mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:14:12 +08:00
mdbx: more explicit casting to size_t (paranoia).
Change-Id: I1c65943cdcdd77cc12bc27d9ced19765ea7911bb
This commit is contained in:
parent
bf0cff9a8a
commit
94e58d7acc
@ -328,7 +328,7 @@ node_largedata_pgno(const MDBX_node *const __restrict node) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define PAGEROOM(pagesize) ((pagesize)-PAGEHDRSZ)
|
#define PAGEROOM(pagesize) ((pagesize)-PAGEHDRSZ)
|
||||||
#define EVEN_FLOOR(n) ((n) & ~1ul)
|
#define EVEN_FLOOR(n) ((n) & ~(size_t)1)
|
||||||
#define BRANCH_NODEMAX(pagesize) \
|
#define BRANCH_NODEMAX(pagesize) \
|
||||||
(EVEN_FLOOR(PAGEROOM(pagesize) / (MDBX_MINKEYS * 2 - 1)) - sizeof(indx_t))
|
(EVEN_FLOOR(PAGEROOM(pagesize) / (MDBX_MINKEYS * 2 - 1)) - sizeof(indx_t))
|
||||||
#define LEAF_NODEMAX(pagesize) (PAGEROOM(pagesize) - sizeof(indx_t))
|
#define LEAF_NODEMAX(pagesize) (PAGEROOM(pagesize) - sizeof(indx_t))
|
||||||
@ -12749,7 +12749,7 @@ static void mdbx_node_shrink(MDBX_page *mp, unsigned indx) {
|
|||||||
|
|
||||||
/* Prepare to shift upward, set len = length(subpage part to shift) */
|
/* Prepare to shift upward, set len = length(subpage part to shift) */
|
||||||
if (IS_LEAF2(sp)) {
|
if (IS_LEAF2(sp)) {
|
||||||
delta &= /* do not make the node uneven-sized */ ~1u;
|
delta &= /* do not make the node uneven-sized */ ~(size_t)1;
|
||||||
if (unlikely(delta) == 0)
|
if (unlikely(delta) == 0)
|
||||||
return;
|
return;
|
||||||
nsize = node_ds(node) - delta;
|
nsize = node_ds(node) - delta;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user