diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index b73541b..1a539ba 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -436,7 +436,7 @@ typedef struct MDB_txbody { * This always records the maximum count, it is not decremented * when readers release their slots. */ - uint32_t mtb_numreaders; + unsigned mtb_numreaders; /** The ID of the most recent meta page in the database. * This is recorded here only for convenience; the value can always * be determined by reading the main database meta pages. @@ -1819,16 +1819,16 @@ mdb_env_set_maxdbs(MDB_env *env, int dbs) } int -mdb_env_set_maxreaders(MDB_env *env, int readers) +mdb_env_set_maxreaders(MDB_env *env, unsigned int readers) { - if (env->me_map) + if (env->me_map || readers < 1) return EINVAL; env->me_maxreaders = readers; return MDB_SUCCESS; } int -mdb_env_get_maxreaders(MDB_env *env, int *readers) +mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers) { if (!env || !readers) return EINVAL; diff --git a/libraries/libmdb/mdb.h b/libraries/libmdb/mdb.h index c0d4edc..f718c35 100644 --- a/libraries/libmdb/mdb.h +++ b/libraries/libmdb/mdb.h @@ -414,7 +414,7 @@ int mdb_env_set_mapsize(MDB_env *env, size_t size); *
  • EINVAL - an invalid parameter was specified, or the environment is already open. * */ -int mdb_env_set_maxreaders(MDB_env *env, int readers); +int mdb_env_set_maxreaders(MDB_env *env, unsigned int readers); /** Get the maximum number of threads for the environment. * @param[in] env An environment handle returned by #mdb_env_create() @@ -425,7 +425,7 @@ int mdb_env_set_maxreaders(MDB_env *env, int readers); *
  • EINVAL - an invalid parameter was specified. * */ -int mdb_env_get_maxreaders(MDB_env *env, int *readers); +int mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers); /** Set the maximum number of databases for the environment. * This function is only needed if multiple databases will be used in the