Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joe Martin
OpenLDAP
Commits
f8ce8a82
Commit
f8ce8a82
authored
Jan 11, 2017
by
Howard Chu
Browse files
More C_EOF tweaks
parent
c44b29ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/liblmdb/mdb.c
View file @
f8ce8a82
...
...
@@ -6604,8 +6604,11 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
mp
=
mc
->
mc_pg
[
mc
->
mc_top
];
if
((
mc
->
mc_flags
&
C_EOF
)
&&
mc
->
mc_ki
[
mc
->
mc_top
]
>=
NUMKEYS
(
mp
)
-
1
)
return
MDB_NOTFOUND
;
if
(
mc
->
mc_flags
&
C_EOF
)
{
if
(
mc
->
mc_ki
[
mc
->
mc_top
]
>=
NUMKEYS
(
mp
)
-
1
)
return
MDB_NOTFOUND
;
mc
->
mc_flags
^=
C_EOF
;
}
if
(
mc
->
mc_db
->
md_flags
&
MDB_DUPSORT
)
{
leaf
=
NODEPTR
(
mp
,
mc
->
mc_ki
[
mc
->
mc_top
]);
...
...
@@ -7127,10 +7130,19 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data,
rc
=
MDB_INCOMPATIBLE
;
break
;
}
rc
=
MDB_SUCCESS
;
if
(
!
(
mc
->
mc_xcursor
->
mx_cursor
.
mc_flags
&
C_INITIALIZED
)
||
(
mc
->
mc_xcursor
->
mx_cursor
.
mc_flags
&
C_EOF
))
if
(
!
(
mc
->
mc_xcursor
->
mx_cursor
.
mc_flags
&
C_INITIALIZED
))
{
rc
=
EINVAL
;
break
;
}
if
(
mc
->
mc_xcursor
->
mx_cursor
.
mc_flags
&
C_EOF
)
{
MDB_cursor
*
mx
=
&
mc
->
mc_xcursor
->
mx_cursor
;
if
(
mx
->
mc_ki
[
mx
->
mc_top
]
>=
NUMKEYS
(
mx
->
mc_pg
[
mx
->
mc_top
])
-
1
)
{
rc
=
MDB_NOTFOUND
;
break
;
}
mx
->
mc_flags
^=
C_EOF
;
}
rc
=
MDB_SUCCESS
;
goto
fetchm
;
case
MDB_NEXT_MULTIPLE
:
if
(
data
==
NULL
)
{
...
...
@@ -8436,9 +8448,15 @@ mdb_cursor_count(MDB_cursor *mc, mdb_size_t *countp)
if
(
!
(
mc
->
mc_flags
&
C_INITIALIZED
))
return
EINVAL
;
if
(
!
mc
->
mc_snum
||
(
mc
->
mc_flags
&
C_EOF
)
)
if
(
!
mc
->
mc_snum
)
return
MDB_NOTFOUND
;
if
(
mc
->
mc_flags
&
C_EOF
)
{
if
(
mc
->
mc_ki
[
mc
->
mc_top
]
>=
NUMKEYS
(
mc
->
mc_pg
[
mc
->
mc_top
]))
return
MDB_NOTFOUND
;
mc
->
mc_flags
^=
C_EOF
;
}
leaf
=
NODEPTR
(
mc
->
mc_pg
[
mc
->
mc_top
],
mc
->
mc_ki
[
mc
->
mc_top
]);
if
(
!
F_ISSET
(
leaf
->
mn_flags
,
F_DUPDATA
))
{
*
countp
=
1
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment