lmdb: fix size_t size issues on 32 bit
This commit is contained in:
parent
e4b049da05
commit
5e1a3e48ba
|
@ -46,7 +46,7 @@ namespace lmdb
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
constexpr const std::size_t max_resize = 1 * 1024 * 1024 * 1024; // 1 GB
|
constexpr const mdb_size_t max_resize = 1 * 1024 * 1024 * 1024; // 1 GB
|
||||||
void acquire_context(context& ctx) noexcept
|
void acquire_context(context& ctx) noexcept
|
||||||
{
|
{
|
||||||
while (ctx.lock.test_and_set());
|
while (ctx.lock.test_and_set());
|
||||||
|
@ -136,7 +136,7 @@ namespace lmdb
|
||||||
MDB_envinfo info{};
|
MDB_envinfo info{};
|
||||||
MONERO_LMDB_CHECK(mdb_env_info(handle(), &info));
|
MONERO_LMDB_CHECK(mdb_env_info(handle(), &info));
|
||||||
|
|
||||||
const std::size_t resize = std::min(info.me_mapsize, max_resize);
|
const mdb_size_t resize = std::min(info.me_mapsize, max_resize);
|
||||||
const int err = mdb_env_set_mapsize(handle(), info.me_mapsize + resize);
|
const int err = mdb_env_set_mapsize(handle(), info.me_mapsize + resize);
|
||||||
ctx.lock.clear();
|
ctx.lock.clear();
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -36,9 +36,9 @@ namespace lmdb
|
||||||
{
|
{
|
||||||
namespace stream
|
namespace stream
|
||||||
{
|
{
|
||||||
std::size_t count(MDB_cursor* cur)
|
mdb_size_t count(MDB_cursor* cur)
|
||||||
{
|
{
|
||||||
std::size_t out = 0;
|
mdb_size_t out = 0;
|
||||||
if (cur)
|
if (cur)
|
||||||
{
|
{
|
||||||
const int rc = mdb_cursor_count(cur, &out);
|
const int rc = mdb_cursor_count(cur, &out);
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace lmdb
|
||||||
\throw std::system_error if unexpected LMDB error.
|
\throw std::system_error if unexpected LMDB error.
|
||||||
\return 0 if `cur == nullptr`, otherwise count of values at current key.
|
\return 0 if `cur == nullptr`, otherwise count of values at current key.
|
||||||
*/
|
*/
|
||||||
std::size_t count(MDB_cursor* cur);
|
mdb_size_t count(MDB_cursor* cur);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Calls `mdb_cursor_get` and does some error checking.
|
Calls `mdb_cursor_get` and does some error checking.
|
||||||
|
|
Loading…
Reference in New Issue