mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-27 18:19:52 -05:00
Fix idl_firstid to return NOID when !(nids > 1) instead of when (nids == 1)
Fix idl_nextid not to skip an ID if ID not in list. Both of these should not occur if used correctly, but cheap insurance against incorrect usage is welcomed.
This commit is contained in:
parent
4160c2029b
commit
3e48937ac8
1 changed files with 2 additions and 3 deletions
|
|
@ -932,7 +932,7 @@ idl_firstid( ID_BLOCK *idl )
|
|||
}
|
||||
|
||||
if ( ID_BLOCK_ALLIDS( idl ) ) {
|
||||
return( ID_BLOCK_NIDS(idl) == 1 ? NOID : 1 );
|
||||
return( ID_BLOCK_NIDS(idl) > 1 ? 1 : NOID );
|
||||
}
|
||||
|
||||
return( ID_BLOCK_ID(idl, 0) );
|
||||
|
|
@ -947,10 +947,9 @@ idl_nextid( ID_BLOCK *idl, ID id )
|
|||
return( ++id < ID_BLOCK_NIDS(idl) ? id : NOID );
|
||||
}
|
||||
|
||||
for ( i = 0; i < ID_BLOCK_NIDS(idl) && ID_BLOCK_ID(idl, i) < id; i++ ) {
|
||||
for ( i = 0; i < ID_BLOCK_NIDS(idl) && ID_BLOCK_ID(idl, i) <= id; i++ ) {
|
||||
; /* NULL */
|
||||
}
|
||||
i++;
|
||||
|
||||
if ( i >= ID_BLOCK_NIDS(idl) ) {
|
||||
return( NOID );
|
||||
|
|
|
|||
Loading…
Reference in a new issue