diff --git a/src/mdbx.c b/src/mdbx.c index 1b82fcfc..1d11303d 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -4160,7 +4160,7 @@ static int __cold mdbx_read_header(MDBX_env *env, MDBX_meta *meta) { STATIC_ASSERT(MIN_MAPSIZE < MAX_MAPSIZE); if (mapsize_max > MAX_MAPSIZE || MAX_PAGENO < mdbx_roundup2((size_t)mapsize_max, env->me_os_psize) / - (uint64_t)page.mp_meta.mm_psize) { + (size_t)page.mp_meta.mm_psize) { const uint64_t used_bytes = page.mp_meta.mm_geo.next * (uint64_t)page.mp_meta.mm_psize; if (page.mp_meta.mm_geo.next - 1 > MAX_PAGENO || @@ -4762,13 +4762,13 @@ LIBMDBX_API int mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, if (pagesize < 0) { pagesize = env->me_os_psize; - if (pagesize > MAX_PAGESIZE) + if ((uintptr_t)pagesize > MAX_PAGESIZE) pagesize = MAX_PAGESIZE; - mdbx_assert(env, pagesize >= MIN_PAGESIZE); + mdbx_assert(env, (uintptr_t)pagesize >= MIN_PAGESIZE); } } - if (pagesize < MIN_PAGESIZE || pagesize > MAX_PAGESIZE || + if (pagesize < (intptr_t)MIN_PAGESIZE || pagesize > (intptr_t)MAX_PAGESIZE || !mdbx_is_power2(pagesize)) { rc = MDBX_EINVAL; goto bailout; @@ -4802,7 +4802,7 @@ LIBMDBX_API int mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, size_upper = pagesize * MAX_PAGENO; } - if (unlikely(size_lower < MIN_MAPSIZE || size_lower > size_upper)) { + if (unlikely(size_lower < (intptr_t)MIN_MAPSIZE || size_lower > size_upper)) { rc = MDBX_EINVAL; goto bailout; } @@ -5109,7 +5109,7 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, int lck_rc) { filesize_before_mmap, bytes2pgno(env, (size_t)filesize_before_mmap)); } else { - mdbx_notice("filesize mismatch (expect %" PRIuPTR "/%" PRIaPGNO + mdbx_notice("filesize mismatch (expect %" PRIuSIZE "/%" PRIaPGNO ", have %" PRIu64 "/%" PRIaPGNO ")", expected_bytes, bytes2pgno(env, expected_bytes), filesize_before_mmap, @@ -5125,11 +5125,11 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, int lck_rc) { if (env->me_flags & MDBX_RDONLY) { mdbx_notice("ignore filesize mismatch in readonly-mode"); } else { - mdbx_info("resize datafile to %" PRIu64 " bytes, %" PRIaPGNO " pages", + mdbx_info("resize datafile to %" PRIuSIZE " bytes, %" PRIaPGNO " pages", expected_bytes, bytes2pgno(env, expected_bytes)); err = mdbx_ftruncate(env->me_fd, expected_bytes); if (unlikely(err != MDBX_SUCCESS)) { - mdbx_error("error %d, while resize datafile to %" PRIu64 + mdbx_error("error %d, while resize datafile to %" PRIuSIZE " bytes, %" PRIaPGNO " pages", rc, expected_bytes, bytes2pgno(env, expected_bytes)); return err;