mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 22:54:13 +08:00
mdbx-winfdows: fix returning negative value on failure.
Change-Id: Iaf5fb1f0cbcc3c14e2d3edf1f57538ecc0dfdf00
This commit is contained in:
parent
624968b74c
commit
4708e0cf79
16
src/mdbx.c
16
src/mdbx.c
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2015-2018 Leonid Yuriev <leo@yuriev.ru>
|
* Copyright 2015-2018 Leonid Yuriev <leo@yuriev.ru>
|
||||||
* and other libmdbx authors: please see AUTHORS file.
|
* and other libmdbx authors: please see AUTHORS file.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -5496,7 +5496,7 @@ fail:
|
|||||||
|
|
||||||
int __cold mdbx_env_get_maxkeysize(MDBX_env *env) {
|
int __cold mdbx_env_get_maxkeysize(MDBX_env *env) {
|
||||||
if (!env || env->me_signature != MDBX_ME_SIGNATURE || !env->me_maxkey_limit)
|
if (!env || env->me_signature != MDBX_ME_SIGNATURE || !env->me_maxkey_limit)
|
||||||
return -MDBX_EINVAL;
|
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
|
||||||
return env->me_maxkey_limit;
|
return env->me_maxkey_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12466,7 +12466,7 @@ int __cold mdbx_reader_list(MDBX_env *env, MDBX_msg_func *func, void *ctx) {
|
|||||||
int rc = 0, first = 1;
|
int rc = 0, first = 1;
|
||||||
|
|
||||||
if (unlikely(!env || !func))
|
if (unlikely(!env || !func))
|
||||||
return -MDBX_EINVAL;
|
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
|
||||||
|
|
||||||
if (unlikely(env->me_signature != MDBX_ME_SIGNATURE))
|
if (unlikely(env->me_signature != MDBX_ME_SIGNATURE))
|
||||||
return MDBX_EBADSIGN;
|
return MDBX_EBADSIGN;
|
||||||
@ -12796,7 +12796,7 @@ __attribute__((no_sanitize_thread, noinline))
|
|||||||
int mdbx_txn_straggler(MDBX_txn *txn, int *percent)
|
int mdbx_txn_straggler(MDBX_txn *txn, int *percent)
|
||||||
{
|
{
|
||||||
if (unlikely(!txn))
|
if (unlikely(!txn))
|
||||||
return -MDBX_EINVAL;
|
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
|
||||||
|
|
||||||
if (unlikely(txn->mt_signature != MDBX_MT_SIGNATURE))
|
if (unlikely(txn->mt_signature != MDBX_MT_SIGNATURE))
|
||||||
return MDBX_EBADSIGN;
|
return MDBX_EBADSIGN;
|
||||||
@ -13515,7 +13515,7 @@ __cold intptr_t mdbx_limits_keysize_max(intptr_t pagesize) {
|
|||||||
else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE ||
|
else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE ||
|
||||||
pagesize > (intptr_t)MAX_PAGESIZE ||
|
pagesize > (intptr_t)MAX_PAGESIZE ||
|
||||||
!mdbx_is_power2((size_t)pagesize)))
|
!mdbx_is_power2((size_t)pagesize)))
|
||||||
return -MDBX_EINVAL;
|
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
|
||||||
|
|
||||||
return mdbx_maxkey(mdbx_nodemax(pagesize));
|
return mdbx_maxkey(mdbx_nodemax(pagesize));
|
||||||
}
|
}
|
||||||
@ -13530,7 +13530,7 @@ __cold intptr_t mdbx_limits_dbsize_min(intptr_t pagesize) {
|
|||||||
else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE ||
|
else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE ||
|
||||||
pagesize > (intptr_t)MAX_PAGESIZE ||
|
pagesize > (intptr_t)MAX_PAGESIZE ||
|
||||||
!mdbx_is_power2((size_t)pagesize)))
|
!mdbx_is_power2((size_t)pagesize)))
|
||||||
return -MDBX_EINVAL;
|
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
|
||||||
|
|
||||||
return MIN_PAGENO * pagesize;
|
return MIN_PAGENO * pagesize;
|
||||||
}
|
}
|
||||||
@ -13541,7 +13541,7 @@ __cold intptr_t mdbx_limits_dbsize_max(intptr_t pagesize) {
|
|||||||
else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE ||
|
else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE ||
|
||||||
pagesize > (intptr_t)MAX_PAGESIZE ||
|
pagesize > (intptr_t)MAX_PAGESIZE ||
|
||||||
!mdbx_is_power2((size_t)pagesize)))
|
!mdbx_is_power2((size_t)pagesize)))
|
||||||
return -MDBX_EINVAL;
|
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
|
||||||
|
|
||||||
const uint64_t limit = MAX_PAGENO * (uint64_t)pagesize;
|
const uint64_t limit = MAX_PAGENO * (uint64_t)pagesize;
|
||||||
return (limit < (intptr_t)MAX_MAPSIZE) ? (intptr_t)limit
|
return (limit < (intptr_t)MAX_MAPSIZE) ? (intptr_t)limit
|
||||||
@ -13554,7 +13554,7 @@ __cold intptr_t mdbx_limits_txnsize_max(intptr_t pagesize) {
|
|||||||
else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE ||
|
else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE ||
|
||||||
pagesize > (intptr_t)MAX_PAGESIZE ||
|
pagesize > (intptr_t)MAX_PAGESIZE ||
|
||||||
!mdbx_is_power2((size_t)pagesize)))
|
!mdbx_is_power2((size_t)pagesize)))
|
||||||
return -MDBX_EINVAL;
|
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
|
||||||
|
|
||||||
return pagesize * (MDBX_DPL_TXNFULL - 1);
|
return pagesize * (MDBX_DPL_TXNFULL - 1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user