indx_t mp_ptrs[1]; /* dynamic size */
} MDB_page;
-#define PAGEHDRSZ offsetof(MDB_page, mp_ptrs)
+#define PAGEHDRSZ ((unsigned) offsetof(MDB_page, mp_ptrs))
#define NUMKEYS(p) (((p)->mp_lower - PAGEHDRSZ) >> 1)
#define SIZELEFT(p) (indx_t)((p)->mp_upper - (p)->mp_lower)
-#define PAGEFILL(env, p) (1000 * ((env)->me_head.mh_psize - PAGEHDRSZ - SIZELEFT(p)) / \
+#define PAGEFILL(env, p) (1000L * ((env)->me_head.mh_psize - PAGEHDRSZ - SIZELEFT(p)) / \
((env)->me_head.mh_psize - PAGEHDRSZ))
#define IS_LEAF(p) F_ISSET((p)->mp_flags, P_LEAF)
#define IS_BRANCH(p) F_ISSET((p)->mp_flags, P_BRANCH)
MDB_node *node;
MDB_val nodekey;
- DPRINTF("searching %lu keys in %s page %lu",
+ DPRINTF("searching %u keys in %s page %lu",
NUMKEYS(mp),
IS_LEAF(mp) ? "leaf" : "branch",
mp->mp_pgno);
unsigned int i = 0;
MDB_node *node;
- DPRINTF("branch page %lu has %lu keys", mp->mp_pgno, NUMKEYS(mp));
+ DPRINTF("branch page %lu has %u keys", mp->mp_pgno, NUMKEYS(mp));
assert(NUMKEYS(mp) > 1);
DPRINTF("found index 0 to page %lu", NODEPGNO(NODEPTR(mp, 0)));
} else
top->mp_ki++;
- DPRINTF("==> cursor points to page %lu with %lu keys, key index %u",
+ DPRINTF("==> cursor points to page %lu with %u keys, key index %u",
mp->mp_pgno, NUMKEYS(mp), top->mp_ki);
assert(IS_LEAF(mp));
}
if (node_size + sizeof(indx_t) > SIZELEFT(mp)) {
- DPRINTF("not enough room in page %lu, got %lu ptrs",
+ DPRINTF("not enough room in page %lu, got %u ptrs",
mp->mp_pgno, NUMKEYS(mp));
DPRINTF("upper - lower = %u - %u = %u", mp->mp_upper, mp->mp_lower,
mp->mp_upper - mp->mp_lower);
return rc;
}
- DPRINTF("dst page %lu now has %lu keys (%.1f%% filled)",
+ DPRINTF("dst page %lu now has %u keys (%.1f%% filled)",
dst->mp_page->mp_pgno, NUMKEYS(dst->mp_page), (float)PAGEFILL(bt->md_env, dst->mp_page) / 10);
/* Unlink the src page from parent.
assert(db->md_env->me_txn != NULL);
assert(mpp != NULL);
- DPRINTF("rebalancing %s page %lu (has %lu keys, %.1f%% full)",
+ DPRINTF("rebalancing %s page %lu (has %u keys, %.1f%% full)",
IS_LEAF(mpp->mp_page) ? "leaf" : "branch",
mpp->mp_page->mp_pgno, NUMKEYS(mpp->mp_page), (float)PAGEFILL(db->md_env, mpp->mp_page) / 10);
}
npp.mp_parent = mpp->mp_parent;
- DPRINTF("found neighbor page %lu (%lu keys, %.1f%% full)",
+ DPRINTF("found neighbor page %lu (%u keys, %.1f%% full)",
npp.mp_page->mp_pgno, NUMKEYS(npp.mp_page), (float)PAGEFILL(db->md_env, npp.mp_page) / 10);
/* If the neighbor page is above threshold and has at least two
goto done;
assert(IS_LEAF(mpp.mp_page));
- DPRINTF("there are %lu keys, should insert new key at index %i",
+ DPRINTF("there are %u keys, should insert new key at index %i",
NUMKEYS(mpp.mp_page), ki);
if (SIZELEFT(mpp.mp_page) < mdb_leaf_size(bt, key, data)) {
rc = mdb_cursor_open(db, NULL, &cursor);
while (rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) {
printf("key: %p %.*s, data: %p %.*s\n",
- key.mv_data, key.mv_size, key.mv_data, data.mv_data, data.mv_size, data.mv_data);
+ key.mv_data, (int) key.mv_size, (char *) key.mv_data,
+ data.mv_data, (int) data.mv_size, (char *) data.mv_data);
}
mdb_cursor_close(cursor);
rc = mdb_cursor_open(db, NULL, &cursor);
while (rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) {
printf("key: %.*s, data: %.*s\n",
- key.mv_size, key.mv_data, data.mv_size, data.mv_data);
+ (int) key.mv_size, (char *) key.mv_data,
+ (int) data.mv_size, (char *) data.mv_data);
}
#if 0
/* write ops aren't coordinated with cursors,
for (i=0; i<50; i++) {
rc = mdb_cursor_get(cur2, &key, &data, MDB_NEXT);
printf("key: %p %.*s, data: %p %.*s\n",
- key.mv_data, key.mv_size, key.mv_data, data.mv_data, data.mv_size, data.mv_data);
+ key.mv_data, (int) key.mv_size, (char *) key.mv_data,
+ data.mv_data, (int) data.mv_size, (char *) data.mv_data);
rc = mdb_del(db, txn, &key, NULL);
}
printf("Restarting cursor in txn\n");
rc = mdb_cursor_get(cur2, &key, &data, MDB_FIRST);
printf("key: %p %.*s, data: %p %.*s\n",
- key.mv_data, key.mv_size, key.mv_data, data.mv_data, data.mv_size, data.mv_data);
+ key.mv_data, (int) key.mv_size, (char *) key.mv_data,
+ data.mv_data, (int) data.mv_size, (char *) data.mv_data);
for (i=0; i<32; i++) {
rc = mdb_cursor_get(cur2, &key, &data, MDB_NEXT);
printf("key: %p %.*s, data: %p %.*s\n",
- key.mv_data, key.mv_size, key.mv_data, data.mv_data, data.mv_size, data.mv_data);
+ key.mv_data, (int) key.mv_size, (char *) key.mv_data,
+ data.mv_data, (int) data.mv_size, (char *) data.mv_data);
}
mdb_cursor_close(cur2);
rc = mdb_txn_commit(txn);
rc = mdb_cursor_open(db, NULL, &cursor);
rc = mdb_cursor_get(cursor, &key, &data, MDB_FIRST);
printf("key: %p %.*s, data: %p %.*s\n",
- key.mv_data, key.mv_size, key.mv_data, data.mv_data, data.mv_size, data.mv_data);
+ key.mv_data, (int) key.mv_size, (char *) key.mv_data,
+ data.mv_data, (int) data.mv_size, (char *) data.mv_data);
for (i=0; i<32; i++) {
rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT);
printf("key: %p %.*s, data: %p %.*s\n",
- key.mv_data, key.mv_size, key.mv_data, data.mv_data, data.mv_size, data.mv_data);
+ key.mv_data, (int) key.mv_size, (char *) key.mv_data,
+ data.mv_data, (int) data.mv_size, (char *) data.mv_data);
}
#endif
mdb_cursor_close(cursor);