ITS#8069 char* strings on Windows are ASCII

mdb.RE/0.9
Pavel Medvedev 9 years ago committed by Hallvard Furuseth
parent 22958b0f9e
commit 56adc467a6
  1. 18
      libraries/liblmdb/mdb.c

@ -1417,7 +1417,7 @@ mdb_strerror(int err)
; ;
} }
buf[0] = 0; buf[0] = 0;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, 0, ptr, sizeof(buf), (va_list *)pad); NULL, err, 0, ptr, sizeof(buf), (va_list *)pad);
return ptr; return ptr;
@ -4410,7 +4410,7 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
off_t size, rsize; off_t size, rsize;
#ifdef _WIN32 #ifdef _WIN32
env->me_lfd = CreateFile(lpath, GENERIC_READ|GENERIC_WRITE, env->me_lfd = CreateFileA(lpath, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL); FILE_ATTRIBUTE_NORMAL, NULL);
#else #else
@ -4514,9 +4514,9 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
mdb_hash_enc(&val, encbuf); mdb_hash_enc(&val, encbuf);
sprintf(env->me_txns->mti_rmname, "Global\\MDBr%s", encbuf); sprintf(env->me_txns->mti_rmname, "Global\\MDBr%s", encbuf);
sprintf(env->me_txns->mti_wmname, "Global\\MDBw%s", encbuf); sprintf(env->me_txns->mti_wmname, "Global\\MDBw%s", encbuf);
env->me_rmutex = CreateMutex(&mdb_all_sa, FALSE, env->me_txns->mti_rmname); env->me_rmutex = CreateMutexA(&mdb_all_sa, FALSE, env->me_txns->mti_rmname);
if (!env->me_rmutex) goto fail_errno; if (!env->me_rmutex) goto fail_errno;
env->me_wmutex = CreateMutex(&mdb_all_sa, FALSE, env->me_txns->mti_wmname); env->me_wmutex = CreateMutexA(&mdb_all_sa, FALSE, env->me_txns->mti_wmname);
if (!env->me_wmutex) goto fail_errno; if (!env->me_wmutex) goto fail_errno;
#elif defined(MDB_USE_POSIX_SEM) #elif defined(MDB_USE_POSIX_SEM)
struct stat stbuf; struct stat stbuf;
@ -4588,9 +4588,9 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
goto fail; goto fail;
} }
#ifdef _WIN32 #ifdef _WIN32
env->me_rmutex = OpenMutex(SYNCHRONIZE, FALSE, env->me_txns->mti_rmname); env->me_rmutex = OpenMutexA(SYNCHRONIZE, FALSE, env->me_txns->mti_rmname);
if (!env->me_rmutex) goto fail_errno; if (!env->me_rmutex) goto fail_errno;
env->me_wmutex = OpenMutex(SYNCHRONIZE, FALSE, env->me_txns->mti_wmname); env->me_wmutex = OpenMutexA(SYNCHRONIZE, FALSE, env->me_txns->mti_wmname);
if (!env->me_wmutex) goto fail_errno; if (!env->me_wmutex) goto fail_errno;
#elif defined(MDB_USE_POSIX_SEM) #elif defined(MDB_USE_POSIX_SEM)
env->me_rmutex = sem_open(env->me_txns->mti_rmname, 0); env->me_rmutex = sem_open(env->me_txns->mti_rmname, 0);
@ -4693,7 +4693,7 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode
len = OPEN_ALWAYS; len = OPEN_ALWAYS;
} }
mode = FILE_ATTRIBUTE_NORMAL; mode = FILE_ATTRIBUTE_NORMAL;
env->me_fd = CreateFile(dpath, oflags, FILE_SHARE_READ|FILE_SHARE_WRITE, env->me_fd = CreateFileA(dpath, oflags, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, len, mode, NULL); NULL, len, mode, NULL);
#else #else
if (F_ISSET(flags, MDB_RDONLY)) if (F_ISSET(flags, MDB_RDONLY))
@ -4723,7 +4723,7 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode
*/ */
#ifdef _WIN32 #ifdef _WIN32
len = OPEN_EXISTING; len = OPEN_EXISTING;
env->me_mfd = CreateFile(dpath, oflags, env->me_mfd = CreateFileA(dpath, oflags,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, len, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, len,
mode | FILE_FLAG_WRITE_THROUGH, NULL); mode | FILE_FLAG_WRITE_THROUGH, NULL);
#else #else
@ -9094,7 +9094,7 @@ mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags)
* already in the OS cache. * already in the OS cache.
*/ */
#ifdef _WIN32 #ifdef _WIN32
newfd = CreateFile(lpath, GENERIC_WRITE, 0, NULL, CREATE_NEW, newfd = CreateFileA(lpath, GENERIC_WRITE, 0, NULL, CREATE_NEW,
FILE_FLAG_NO_BUFFERING|FILE_FLAG_WRITE_THROUGH, NULL); FILE_FLAG_NO_BUFFERING|FILE_FLAG_WRITE_THROUGH, NULL);
#else #else
newfd = open(lpath, O_WRONLY|O_CREAT|O_EXCL, 0666); newfd = open(lpath, O_WRONLY|O_CREAT|O_EXCL, 0666);

Loading…
Cancel
Save