mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 02:44:13 +08:00
mdbx: fix and check width of off_t
for Android.
This commit is contained in:
parent
682ff99f1c
commit
eb8bc865d1
@ -47,7 +47,8 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/* Should be defined before any includes */
|
||||
#ifndef _FILE_OFFSET_BITS
|
||||
#if !defined(_FILE_OFFSET_BITS) && !defined(__ANDROID_API__) && \
|
||||
!defined(ANDROID)
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#endif
|
||||
|
||||
|
@ -180,6 +180,13 @@ __cold static void choice_fcntl() {
|
||||
|
||||
static int lck_op(const mdbx_filehandle_t fd, int cmd, const int lck,
|
||||
const off_t offset, off_t len) {
|
||||
STATIC_ASSERT(sizeof(off_t) >= sizeof(void *) &&
|
||||
sizeof(off_t) >= sizeof(size_t));
|
||||
#ifdef __ANDROID_API__
|
||||
STATIC_ASSERT_MSG((sizeof(off_t) * 8 == MDBX_WORDBITS),
|
||||
"The bitness of system `off_t` type is mismatch. Please "
|
||||
"fix build and/or NDK configuration.");
|
||||
#endif /* Android */
|
||||
mdbx_jitter4testing(true);
|
||||
assert(offset >= 0 && len > 0);
|
||||
assert((uint64_t)offset < (uint64_t)INT64_MAX &&
|
||||
|
@ -332,6 +332,14 @@ typedef pthread_mutex_t mdbx_fastmutex_t;
|
||||
#define MDBX_WORDBITS 32
|
||||
#endif /* MDBX_WORDBITS */
|
||||
|
||||
#if defined(__ANDROID_API__) || defined(ANDROID)
|
||||
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS != MDBX_WORDBITS
|
||||
#error "_FILE_OFFSET_BITS != MDBX_WORDBITS" (_FILE_OFFSET_BITS != MDBX_WORDBITS)
|
||||
#elif defined(__FILE_OFFSET_BITS) && __FILE_OFFSET_BITS != MDBX_WORDBITS
|
||||
#error "__FILE_OFFSET_BITS != MDBX_WORDBITS" (__FILE_OFFSET_BITS != MDBX_WORDBITS)
|
||||
#endif
|
||||
#endif /* Android */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Compiler's includes for builtins/intrinsics */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user