mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 18:24:12 +08:00
mdbx: fix PVS-Studio warnings.
This commit is contained in:
parent
928014c88a
commit
e6e92134a6
14
src/mdbx.c
14
src/mdbx.c
@ -4188,8 +4188,9 @@ static int mdbx_sync_locked(MDBX_env *env, unsigned flags,
|
|||||||
if ((flags & (MDBX_NOSYNC | MDBX_NOMETASYNC)) == 0) {
|
if ((flags & (MDBX_NOSYNC | MDBX_NOMETASYNC)) == 0) {
|
||||||
mdbx_assert(env, ((flags ^ env->me_flags) & MDBX_WRITEMAP) == 0);
|
mdbx_assert(env, ((flags ^ env->me_flags) & MDBX_WRITEMAP) == 0);
|
||||||
if (flags & MDBX_WRITEMAP) {
|
if (flags & MDBX_WRITEMAP) {
|
||||||
const size_t offset = (uint8_t *)container_of(head, MDBX_page, mp_meta) -
|
const size_t offset =
|
||||||
env->me_dxb_mmap.dxb;
|
((uint8_t *)container_of(head, MDBX_page, mp_meta)) -
|
||||||
|
env->me_dxb_mmap.dxb;
|
||||||
const size_t paged_offset = offset & ~(env->me_os_psize - 1);
|
const size_t paged_offset = offset & ~(env->me_os_psize - 1);
|
||||||
const size_t paged_length = mdbx_roundup2(
|
const size_t paged_length = mdbx_roundup2(
|
||||||
env->me_psize + offset - paged_offset, env->me_os_psize);
|
env->me_psize + offset - paged_offset, env->me_os_psize);
|
||||||
@ -4852,7 +4853,7 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, int lck_rc) {
|
|||||||
head->mm_datasync_sign = MDBX_DATASIGN_WEAK;
|
head->mm_datasync_sign = MDBX_DATASIGN_WEAK;
|
||||||
head->mm_txnid_b = 0;
|
head->mm_txnid_b = 0;
|
||||||
const size_t offset =
|
const size_t offset =
|
||||||
(uint8_t *)container_of(head, MDBX_page, mp_meta) -
|
((uint8_t *)container_of(head, MDBX_page, mp_meta)) -
|
||||||
env->me_dxb_mmap.dxb;
|
env->me_dxb_mmap.dxb;
|
||||||
const size_t paged_offset = offset & ~(env->me_os_psize - 1);
|
const size_t paged_offset = offset & ~(env->me_os_psize - 1);
|
||||||
const size_t paged_length = mdbx_roundup2(
|
const size_t paged_length = mdbx_roundup2(
|
||||||
@ -10750,9 +10751,10 @@ int mdbx_txn_straggler(MDBX_txn *txn, int *percent)
|
|||||||
|
|
||||||
MDBX_env *env = txn->mt_env;
|
MDBX_env *env = txn->mt_env;
|
||||||
if (unlikely((txn->mt_flags & MDBX_RDONLY) == 0)) {
|
if (unlikely((txn->mt_flags & MDBX_RDONLY) == 0)) {
|
||||||
*percent =
|
if (percent)
|
||||||
(int)((txn->mt_next_pgno * UINT64_C(100) + txn->mt_end_pgno / 2) /
|
*percent =
|
||||||
txn->mt_end_pgno);
|
(int)((txn->mt_next_pgno * UINT64_C(100) + txn->mt_end_pgno / 2) /
|
||||||
|
txn->mt_end_pgno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user