mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Fix ber_bvchr() vs assert() logic. Declare missing variable for code in #if 0.
This commit is contained in:
parent
4b9d08fd9b
commit
dbb2ceac90
@ -271,8 +271,9 @@ ordered_value_renumber( Attribute *a, int vals )
|
||||
ibv.bv_len = sprintf(ibv.bv_val, "{%d}", i);
|
||||
vtmp = a->a_vals[i];
|
||||
if ( vtmp.bv_val[0] == '{' ) {
|
||||
ptr = ber_bvchr(&vtmp, '}') + 1;
|
||||
ptr = ber_bvchr(&vtmp, '}');
|
||||
assert( ptr != NULL );
|
||||
++ptr;
|
||||
vtmp.bv_len -= ptr - vtmp.bv_val;
|
||||
vtmp.bv_val = ptr;
|
||||
}
|
||||
@ -287,8 +288,9 @@ ordered_value_renumber( Attribute *a, int vals )
|
||||
if ( a->a_nvals && a->a_nvals != a->a_vals ) {
|
||||
vtmp = a->a_nvals[i];
|
||||
if ( vtmp.bv_val[0] == '{' ) {
|
||||
ptr = ber_bvchr(&vtmp, '}') + 1;
|
||||
ptr = ber_bvchr(&vtmp, '}');
|
||||
assert( ptr != NULL );
|
||||
++ptr;
|
||||
vtmp.bv_len -= ptr - vtmp.bv_val;
|
||||
vtmp.bv_val = ptr;
|
||||
}
|
||||
@ -347,7 +349,7 @@ ordered_value_sort( Attribute *a, int do_renumber )
|
||||
a->a_nvals = ch_malloc( (vals+1)*sizeof(struct berval));
|
||||
BER_BVZERO(a->a_nvals+vals);
|
||||
for ( i=0; i<vals; i++ ) {
|
||||
ptr = ber_bvchr(&a->a_vals[i], '}') + 1;
|
||||
char *ptr = ber_bvchr(&a->a_vals[i], '}') + 1;
|
||||
a->a_nvals[i].bv_len = a->a_vals[i].bv_len -
|
||||
(ptr - a->a_vals[i].bv_val);
|
||||
a->a_nvals[i].bv_val = ch_malloc( a->a_nvals[i].bv_len + 1);
|
||||
@ -355,7 +357,7 @@ ordered_value_sort( Attribute *a, int do_renumber )
|
||||
}
|
||||
} else {
|
||||
for ( i=0; i<vals; i++ ) {
|
||||
ptr = ber_bvchr(&a->a_nvals[i], '}') + 1;
|
||||
char *ptr = ber_bvchr(&a->a_nvals[i], '}') + 1;
|
||||
a->a_nvals[i].bv_len -= ptr - a->a_nvals[i].bv_val;
|
||||
strcpy(a->a_nvals[i].bv_val, ptr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user