]> git.sur5r.net Git - openldap/commitdiff
Fix ber_bvchr() vs assert() logic. Declare missing variable for code in #if 0.
authorHallvard Furuseth <hallvard@openldap.org>
Mon, 14 Nov 2005 16:23:55 +0000 (16:23 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Mon, 14 Nov 2005 16:23:55 +0000 (16:23 +0000)
servers/slapd/value.c

index 293a4e7a35780c1cb502d4a6eb8a0fd5eb9bfd77..cf2d73075e8b16c4cc4039f46a1252502d938d67 100644 (file)
@@ -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);
                        }