mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-09 08:23:35 -05:00
ITS#9017 LMDB: fix off_t usage on Windows
This commit is contained in:
parent
147582b5dc
commit
b77c2ba72a
1 changed files with 9 additions and 7 deletions
|
|
@ -96,6 +96,7 @@ static NtCloseFunc *NtClose;
|
|||
# define SSIZE_MAX INT_MAX
|
||||
# endif
|
||||
#endif
|
||||
#define MDB_OFF_T LARGE_INTEGER
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
@ -108,6 +109,7 @@ static NtCloseFunc *NtClose;
|
|||
#include <sys/file.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#define MDB_OFF_T off_t
|
||||
#endif
|
||||
|
||||
#if defined(__mips) && defined(__linux)
|
||||
|
|
@ -1493,7 +1495,7 @@ struct MDB_env {
|
|||
MDB_txn *me_txn; /**< current write transaction */
|
||||
MDB_txn *me_txn0; /**< prealloc'd write transaction */
|
||||
mdb_size_t me_mapsize; /**< size of the data memory map */
|
||||
off_t me_size; /**< current file size */
|
||||
MDB_OFF_T me_size; /**< current file size */
|
||||
pgno_t me_maxpg; /**< me_mapsize / me_psize */
|
||||
MDB_dbx *me_dbxs; /**< array of static DB info */
|
||||
uint16_t *me_dbflags; /**< array of flags from MDB_db.md_flags */
|
||||
|
|
@ -3662,7 +3664,7 @@ mdb_page_flush(MDB_txn *txn, int keep)
|
|||
unsigned psize = env->me_psize, j;
|
||||
int i, pagecount = dl[0].mid, rc;
|
||||
size_t size = 0;
|
||||
off_t pos = 0;
|
||||
MDB_OFF_T pos = 0;
|
||||
pgno_t pgno = 0;
|
||||
MDB_page *dp = NULL;
|
||||
#ifdef _WIN32
|
||||
|
|
@ -3675,7 +3677,7 @@ mdb_page_flush(MDB_txn *txn, int keep)
|
|||
HANDLE fd = env->me_fd;
|
||||
#endif
|
||||
ssize_t wsize = 0, wres;
|
||||
off_t wpos = 0, next_pos = 1; /* impossible pos, so pos != next_pos */
|
||||
MDB_OFF_T wpos = 0, next_pos = 1; /* impossible pos, so pos != next_pos */
|
||||
int n = 0;
|
||||
|
||||
j = i = keep;
|
||||
|
|
@ -4269,7 +4271,7 @@ mdb_env_write_meta(MDB_txn *txn)
|
|||
MDB_meta meta, metab, *mp;
|
||||
unsigned flags;
|
||||
mdb_size_t mapsize;
|
||||
off_t off;
|
||||
MDB_OFF_T off;
|
||||
int rc, len, toggle;
|
||||
char *ptr;
|
||||
HANDLE mfd;
|
||||
|
|
@ -5277,7 +5279,7 @@ mdb_env_setup_locks(MDB_env *env, MDB_name *fname, int mode, int *excl)
|
|||
union semun semu;
|
||||
#endif
|
||||
int rc;
|
||||
off_t size, rsize;
|
||||
MDB_OFF_T size, rsize;
|
||||
|
||||
rc = mdb_fopen(env, fname, MDB_O_LOCKS, mode, &env->me_lfd);
|
||||
if (rc) {
|
||||
|
|
@ -6139,7 +6141,7 @@ mdb_rpage_get(MDB_txn *txn, pgno_t pg0, MDB_page **ret)
|
|||
pgno_t pgno;
|
||||
int rc, retries = 1;
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER off;
|
||||
MDB_OFF_T off;
|
||||
SIZE_T len;
|
||||
#define SET_OFF(off,val) off.QuadPart = val
|
||||
#define MAP(rc,env,addr,len,off) \
|
||||
|
|
@ -6148,7 +6150,7 @@ mdb_rpage_get(MDB_txn *txn, pgno_t pg0, MDB_page **ret)
|
|||
len, &off, &len, ViewUnmap, (env->me_flags & MDB_RDONLY) ? 0 : MEM_RESERVE, PAGE_READONLY); \
|
||||
if (rc) rc = mdb_nt2win32(rc)
|
||||
#else
|
||||
off_t off;
|
||||
MDB_OFF_T off;
|
||||
size_t len;
|
||||
#define SET_OFF(off,val) off = val
|
||||
#define MAP(rc,env,addr,len,off) \
|
||||
|
|
|
|||
Loading…
Reference in a new issue