From 8bb10add2465eee34e79abeaa62011e3e234effb Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 17 Sep 2012 06:35:03 -0700 Subject: [PATCH] More for ab04c50a32275e216b82edaeeed50208cf49336b Fix typos, error code ranges --- libraries/libmdb/mdb.c | 11 +++++++---- libraries/libmdb/mdb.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 345ebf436c..8252cd63bc 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -1024,24 +1024,27 @@ static char *const mdb_errstr[] = { "MDB_CORRUPTED: Located page was wrong type", "MDB_PANIC: Update of meta page failed", "MDB_VERSION_MISMATCH: Database environment version mismatch", - "MDB_INVALID: File is not an MDB file" + "MDB_INVALID: File is not an MDB file", "MDB_MAP_FULL: Environment mapsize limit reached", "MDB_DBS_FULL: Environment maxdbs limit reached", "MDB_READERS_FULL: Environment maxreaders limit reached", "MDB_TLS_FULL: Thread-local storage keys full - too many environments open", "MDB_TXN_FULL: Nested transaction has too many dirty pages - transaction too big", "MDB_CURSOR_FULL: Internal error - cursor stack limit reached", - "MDB_PAGE_FULL: Internal error - page has no more space", + "MDB_PAGE_FULL: Internal error - page has no more space" }; char * mdb_strerror(int err) { + int i; if (!err) return ("Successful return: 0"); - if (err >= MDB_KEYEXIST && err <= MDB_VERSION_MISMATCH) - return mdb_errstr[err - MDB_KEYEXIST]; + if (err >= MDB_KEYEXIST && err <= MDB_LAST_ERRCODE) { + i = err - MDB_KEYEXIST; + return mdb_errstr[i]; + } return strerror(err); } diff --git a/libraries/libmdb/mdb.h b/libraries/libmdb/mdb.h index 6e9cd2b323..7fc1bf217e 100644 --- a/libraries/libmdb/mdb.h +++ b/libraries/libmdb/mdb.h @@ -286,6 +286,7 @@ typedef enum MDB_cursor_op { #define MDB_CURSOR_FULL (-30787) /** Page has not enough space - internal error */ #define MDB_PAGE_FULL (-30786) +#define MDB_LAST_ERRCODE MDB_PAGE_FULL /** @} */ /** @brief Statistics for a database in the environment */ -- 2.39.5