mdbx: slightly more cases to return MDBX_ENODATA.

This commit is contained in:
Leonid Yuriev 2021-11-22 13:48:08 +03:00
parent 9d55d06a20
commit a2141ceaac

View File

@ -13741,7 +13741,7 @@ static int mdbx_cursor_next(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data,
mp = mc->mc_pg[mc->mc_top];
if (mc->mc_flags & C_EOF) {
if (mc->mc_ki[mc->mc_top] + 1u >= page_numkeys(mp))
return MDBX_NOTFOUND;
return MDBX_ENODATA;
mc->mc_flags ^= C_EOF;
}
@ -14324,7 +14324,7 @@ int mdbx_cursor_get(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data,
int (*mfunc)(MDBX_cursor * mc, MDBX_val * key, MDBX_val * data);
switch (op) {
case MDBX_GET_CURRENT: {
if (unlikely(!(mc->mc_flags & C_INITIALIZED)))
if (unlikely((mc->mc_flags & (C_INITIALIZED | C_EOF)) != C_INITIALIZED))
return MDBX_ENODATA;
MDBX_page *mp = mc->mc_pg[mc->mc_top];
const unsigned nkeys = page_numkeys(mp);