Fix size_t/formats -> mdb_size_t for MDB_VL32

ntdll
Hallvard Furuseth 8 years ago
parent dff8bafb36
commit 12ad38d67f
  1. 8
      libraries/liblmdb/mdb.c
  2. 12
      libraries/liblmdb/mdb_stat.c

@ -228,7 +228,7 @@ union semun {
#if (BYTE_ORDER == LITTLE_ENDIAN) == (BYTE_ORDER == BIG_ENDIAN) #if (BYTE_ORDER == LITTLE_ENDIAN) == (BYTE_ORDER == BIG_ENDIAN)
# error "Unknown or unsupported endianness (BYTE_ORDER)" # error "Unknown or unsupported endianness (BYTE_ORDER)"
#elif (-6 & 5) || CHAR_BIT != 8 || UINT_MAX < 0xffffffff || ULONG_MAX % 0xFFFF #elif (-6 & 5) || CHAR_BIT!=8 || UINT_MAX!=0xffffffff || MDB_SIZE_MAX%UINT_MAX
# error "Two's complement, reasonably sized integer types, please" # error "Two's complement, reasonably sized integer types, please"
#endif #endif
@ -1028,7 +1028,7 @@ typedef struct MDB_node {
#ifdef MISALIGNED_OK #ifdef MISALIGNED_OK
#define COPY_PGNO(dst,src) dst = src #define COPY_PGNO(dst,src) dst = src
#else #else
#if SIZE_MAX > 4294967295UL #if MDB_SIZE_MAX > 0xffffffffU
#define COPY_PGNO(dst,src) do { \ #define COPY_PGNO(dst,src) do { \
unsigned short *s, *d; \ unsigned short *s, *d; \
s = (unsigned short *)&(src); \ s = (unsigned short *)&(src); \
@ -3551,7 +3551,7 @@ mdb_page_flush(MDB_txn *txn, int keep)
* the write offset, to at least save the overhead of a Seek * the write offset, to at least save the overhead of a Seek
* system call. * system call.
*/ */
DPRINTF(("committing page %"Z"u", pgno)); DPRINTF(("committing page %"Y"u", pgno));
memset(&ov, 0, sizeof(ov)); memset(&ov, 0, sizeof(ov));
ov.Offset = pos & 0xffffffff; ov.Offset = pos & 0xffffffff;
ov.OffsetHigh = pos >> 16 >> 16; ov.OffsetHigh = pos >> 16 >> 16;
@ -8165,7 +8165,7 @@ mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int new_dupdata)
mx->mx_cursor.mc_flags |= C_INITIALIZED; mx->mx_cursor.mc_flags |= C_INITIALIZED;
mx->mx_cursor.mc_ki[0] = 0; mx->mx_cursor.mc_ki[0] = 0;
mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DIRTY; /* DB_DIRTY guides mdb_cursor_touch */ mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DIRTY; /* DB_DIRTY guides mdb_cursor_touch */
#if UINT_MAX < SIZE_MAX #if UINT_MAX < MDB_SIZE_MAX /* matches mdb_xcursor_init1:NEED_CMP_CLONG() */
mx->mx_dbx.md_cmp = src_mx->mx_dbx.md_cmp; mx->mx_dbx.md_cmp = src_mx->mx_dbx.md_cmp;
#endif #endif
} else if (!(mx->mx_cursor.mc_flags & C_INITIALIZED)) { } else if (!(mx->mx_cursor.mc_flags & C_INITIALIZED)) {

@ -153,7 +153,7 @@ int main(int argc, char *argv[])
if (freinfo) { if (freinfo) {
MDB_cursor *cursor; MDB_cursor *cursor;
MDB_val key, data; MDB_val key, data;
size_t pages = 0, *iptr; mdb_size_t pages = 0, *iptr;
printf("Freelist Status\n"); printf("Freelist Status\n");
dbi = 0; dbi = 0;
@ -173,7 +173,7 @@ int main(int argc, char *argv[])
pages += *iptr; pages += *iptr;
if (freinfo > 1) { if (freinfo > 1) {
char *bad = ""; char *bad = "";
size_t pg, prev; mdb_size_t pg, prev;
ssize_t i, j, span = 0; ssize_t i, j, span = 0;
j = *iptr++; j = *iptr++;
for (i = j, prev = 1; --i >= 0; ) { for (i = j, prev = 1; --i >= 0; ) {
@ -184,20 +184,20 @@ int main(int argc, char *argv[])
pg += span; pg += span;
for (; i >= span && iptr[i-span] == pg; span++, pg++) ; for (; i >= span && iptr[i-span] == pg; span++, pg++) ;
} }
printf(" Transaction %"Z"u, %"Z"d pages, maxspan %"Z"d%s\n", printf(" Transaction %"Y"u, %"Z"d pages, maxspan %"Z"d%s\n",
*(size_t *)key.mv_data, j, span, bad); *(mdb_size_t *)key.mv_data, j, span, bad);
if (freinfo > 2) { if (freinfo > 2) {
for (--j; j >= 0; ) { for (--j; j >= 0; ) {
pg = iptr[j]; pg = iptr[j];
for (span=1; --j >= 0 && iptr[j] == pg+span; span++) ; for (span=1; --j >= 0 && iptr[j] == pg+span; span++) ;
printf(span>1 ? " %9"Z"u[%"Z"d]\n" : " %9"Z"u\n", printf(span>1 ? " %9"Y"u[%"Z"d]\n" : " %9"Y"u\n",
pg, span); pg, span);
} }
} }
} }
} }
mdb_cursor_close(cursor); mdb_cursor_close(cursor);
printf(" Free pages: %"Z"u\n", pages); printf(" Free pages: %"Y"u\n", pages);
} }
rc = mdb_open(txn, subname, 0, &dbi); rc = mdb_open(txn, subname, 0, &dbi);

Loading…
Cancel
Save