mdbx-winfdows: fix returning negative value on failure.

Change-Id: Iaf5fb1f0cbcc3c14e2d3edf1f57538ecc0dfdf00
This commit is contained in:
Leonid Yuriev 2019-01-17 23:09:40 +03:00
parent 624968b74c
commit 4708e0cf79

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright 2015-2018 Leonid Yuriev <leo@yuriev.ru>
* and other libmdbx authors: please see AUTHORS file.
* All rights reserved.
@ -5496,7 +5496,7 @@ fail:
int __cold mdbx_env_get_maxkeysize(MDBX_env *env) {
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;
}
@ -12466,7 +12466,7 @@ int __cold mdbx_reader_list(MDBX_env *env, MDBX_msg_func *func, void *ctx) {
int rc = 0, first = 1;
if (unlikely(!env || !func))
return -MDBX_EINVAL;
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
if (unlikely(env->me_signature != MDBX_ME_SIGNATURE))
return MDBX_EBADSIGN;
@ -12796,7 +12796,7 @@ __attribute__((no_sanitize_thread, noinline))
int mdbx_txn_straggler(MDBX_txn *txn, int *percent)
{
if (unlikely(!txn))
return -MDBX_EINVAL;
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
if (unlikely(txn->mt_signature != MDBX_MT_SIGNATURE))
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 ||
pagesize > (intptr_t)MAX_PAGESIZE ||
!mdbx_is_power2((size_t)pagesize)))
return -MDBX_EINVAL;
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
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 ||
pagesize > (intptr_t)MAX_PAGESIZE ||
!mdbx_is_power2((size_t)pagesize)))
return -MDBX_EINVAL;
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
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 ||
pagesize > (intptr_t)MAX_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;
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 ||
pagesize > (intptr_t)MAX_PAGESIZE ||
!mdbx_is_power2((size_t)pagesize)))
return -MDBX_EINVAL;
return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL;
return pagesize * (MDBX_DPL_TXNFULL - 1);
}