From: Hallvard Furuseth Date: Mon, 13 Oct 2008 10:18:15 +0000 (+0000) Subject: Warning cleanup: signed meets unsigned. ber_flatten2() returns -1 on X-Git-Tag: ACLCHECK_0~1256 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7b3bdf218527e35b5d6947109129012ea6611f63;p=openldap Warning cleanup: signed meets unsigned. ber_flatten2() returns -1 on error, not LBER_ERROR. --- diff --git a/servers/slapd/aci.c b/servers/slapd/aci.c index de0b6c6ac3..88232f33e5 100644 --- a/servers/slapd/aci.c +++ b/servers/slapd/aci.c @@ -1043,7 +1043,7 @@ static int OpenLDAPaciValidatePerms( struct berval *perms ) { - int i; + ber_len_t i; for ( i = 0; i < perms->bv_len; ) { switch ( perms->bv_val[ i ] ) { diff --git a/servers/slapd/alock.c b/servers/slapd/alock.c index 3d091bf60f..1a50a399f1 100644 --- a/servers/slapd/alock.c +++ b/servers/slapd/alock.c @@ -178,7 +178,7 @@ alock_read_iattr ( unsigned char * bufptr ) assert (bufptr != NULL); bufptr += sizeof (unsigned long int); - for (count=0; count <= sizeof (unsigned long int); ++count) { + for (count=0; count <= (int) sizeof (unsigned long int); ++count) { val <<= 8; val += (unsigned long int) *bufptr--; } diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 67c26911c2..4d578d9247 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -213,7 +213,7 @@ attr_dup2( Attribute *tmp, Attribute *a ) { tmp->a_flags = a->a_flags & SLAP_ATTR_PERSISTENT_FLAGS; if ( a->a_vals != NULL ) { - int i; + unsigned i, j; tmp->a_numvals = a->a_numvals; tmp->a_vals = ch_malloc( (tmp->a_numvals + 1) * sizeof(struct berval) ); @@ -228,7 +228,6 @@ attr_dup2( Attribute *tmp, Attribute *a ) assert( a->a_nvals != NULL ); if ( a->a_nvals != a->a_vals ) { - int j; tmp->a_nvals = ch_malloc( (tmp->a_numvals + 1) * sizeof(struct berval) ); for ( j = 0; !BER_BVISNULL( &a->a_nvals[j] ); j++ ) { diff --git a/servers/slapd/component.c b/servers/slapd/component.c index d950e2ae8a..9bc69405b4 100644 --- a/servers/slapd/component.c +++ b/servers/slapd/component.c @@ -212,7 +212,7 @@ dup_comp_filter_list ( int get_len_of_next_assert_value ( struct berval* bv, char separator ) { - int i = 0; + ber_len_t i = 0; while (1) { if ( (bv->bv_val[ i ] == separator) || ( i >= bv->bv_len) ) break; diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 95520700e3..98eeebc417 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -1077,7 +1077,7 @@ dn_rdnlen( p = ber_bvchr( dn_in, ',' ); - return p ? p - dn_in->bv_val : dn_in->bv_len; + return p ? (ber_len_t) (p - dn_in->bv_val) : dn_in->bv_len; } diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index fa30a1ee69..289a0f4d09 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -725,8 +725,8 @@ ber_len_t entry_flatsize(Entry *e, int norm) */ int entry_encode(Entry *e, struct berval *bv) { - ber_len_t len, dnlen, ndnlen; - int i, nattrs, nvals; + ber_len_t len, dnlen, ndnlen, i; + int nattrs, nvals; Attribute *a; unsigned char *ptr; diff --git a/servers/slapd/mods.c b/servers/slapd/mods.c index 820ed298f6..22b9e33651 100644 --- a/servers/slapd/mods.c +++ b/servers/slapd/mods.c @@ -59,7 +59,7 @@ modify_add_values( /* FIXME: Catch old code that doesn't set sm_numvals. */ if ( !BER_BVISNULL( &mod->sm_values[mod->sm_numvals] )) { - int i; + unsigned i; for ( i = 0; !BER_BVISNULL( &mod->sm_values[i] ); i++ ); assert( mod->sm_numvals == i ); } @@ -69,8 +69,8 @@ modify_add_values( if ( a != NULL ) { MatchingRule *mr; struct berval *cvals; - int rc, i, p; - unsigned flags; + int rc; + unsigned i, p, flags; mr = mod->sm_desc->ad_type->sat_equality; if( mr == NULL || !mr->smr_match ) { @@ -116,7 +116,7 @@ modify_add_values( /* value already exists */ *text = textbuf; snprintf( textbuf, textlen, - "modify/%s: %s: value #%d already exists", + "modify/%s: %s: value #%u already exists", op, mod->sm_desc->ad_cname.bv_val, i ); return LDAP_TYPE_OR_VALUE_EXISTS; } @@ -196,8 +196,8 @@ modify_delete_vindex( MatchingRule *mr = mod->sm_desc->ad_type->sat_equality; struct berval *cvals; int *id2 = NULL; - int i, j, rc = 0; - unsigned flags; + int rc = 0; + unsigned i, j, flags; char dummy = '\0'; /* diff --git a/servers/slapd/result.c b/servers/slapd/result.c index f89b87304c..2912143dd4 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -1546,7 +1546,7 @@ int slap_read_controls( rc = ber_flatten2( ber, &c.ldctl_value, 0 ); - if( rc == LBER_ERROR ) return LDAP_OTHER; + if( rc == -1 ) return LDAP_OTHER; c.ldctl_oid = oid->bv_val; c.ldctl_iscritical = 0; diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index b73258e66d..0a300fa879 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -117,7 +117,7 @@ slap_sasl_log( } Debug( level, "SASL [conn=%ld] %s: %s\n", - conn ? conn->c_connid: -1, + conn ? (long) conn->c_connid: -1L, label, message ); @@ -554,7 +554,7 @@ slap_sasl_canonicalize( *out_len = 0; Debug( LDAP_DEBUG_ARGS, "SASL Canonicalize [conn=%ld]: %s=\"%s\"\n", - conn ? conn->c_connid : -1, + conn ? (long) conn->c_connid : -1L, (flags & SASL_CU_AUTHID) ? "authcid" : "authzid", in ? in : ""); @@ -636,7 +636,7 @@ slap_sasl_canonicalize( prop_set( props, names[0], dn.bv_val, dn.bv_len ); Debug( LDAP_DEBUG_ARGS, "SASL Canonicalize [conn=%ld]: %s=\"%s\"\n", - conn ? conn->c_connid : -1, names[0]+1, + conn ? (long) conn->c_connid : -1L, names[0]+1, dn.bv_val ? dn.bv_val : "" ); /* Not needed any more, SASL has copied it */ @@ -679,7 +679,7 @@ slap_sasl_authorize( Debug( LDAP_DEBUG_ARGS, "SASL proxy authorize [conn=%ld]: " "authcid=\"%s\" authzid=\"%s\"\n", - conn ? conn->c_connid : -1, auth_identity, requested_user ); + conn ? (long) conn->c_connid : -1L, auth_identity, requested_user ); if ( conn->c_sasl_dn.bv_val ) { BER_BVZERO( &conn->c_sasl_dn ); } @@ -709,7 +709,7 @@ slap_sasl_authorize( if ( rc != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "SASL Proxy Authorize [conn=%ld]: " "proxy authorization disallowed (%d)\n", - (long) (conn ? conn->c_connid : -1), rc, 0 ); + conn ? (long) conn->c_connid : -1L, rc, 0 ); sasl_seterror( sconn, 0, "not authorized" ); return SASL_NOAUTHZ; @@ -729,7 +729,7 @@ ok: Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: " " proxy authorization allowed authzDN=\"%s\"\n", - (long) (conn ? conn->c_connid : -1), + conn ? (long) conn->c_connid : -1L, authzDN.bv_val ? authzDN.bv_val : "", 0 ); return SASL_OK; } diff --git a/servers/slapd/saslauthz.c b/servers/slapd/saslauthz.c index 08c7c690f5..0d98d86b6a 100644 --- a/servers/slapd/saslauthz.c +++ b/servers/slapd/saslauthz.c @@ -1699,7 +1699,7 @@ exact_match: /* leave room for at least one char of attributeType, * one for '=' and one for ',' */ - if ( d < STRLENOF( "x=,") ) { + if ( d < (int) STRLENOF( "x=,") ) { goto CONCLUDED; } diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 9f5e88e7b5..27bcb72824 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -1543,8 +1543,8 @@ UTF8StringNormalize( void *ctx ) { struct berval tmp, nvalue; - int flags; - int i, wasspace; + int flags, wasspace; + ber_len_t i; assert( SLAP_MR_IS_VALUE_OF_SYNTAX( use ) != 0 ); @@ -1619,7 +1619,7 @@ directoryStringSubstringsMatch( int match = 0; SubstringsAssertion *sub = assertedValue; struct berval left = *value; - int i; + ber_len_t i; int priorspace=0; if ( !BER_BVISNULL( &sub->sa_initial ) ) { @@ -2008,7 +2008,7 @@ postalAddressValidate( struct berval *in ) { struct berval bv = *in; - int c; + ber_len_t c; for ( c = 0; c < in->bv_len; c++ ) { if ( in->bv_val[c] == '\\' ) { @@ -2044,7 +2044,7 @@ postalAddressNormalize( void *ctx ) { BerVarray lines = NULL, nlines = NULL; - int l, c; + ber_len_t l, c; int rc = LDAP_SUCCESS; MatchingRule *xmr = NULL; char *p; @@ -2101,7 +2101,7 @@ postalAddressNormalize( } *--p = '\0'; - assert( p - normalized->bv_val == normalized->bv_len ); + assert( p == &normalized->bv_val[normalized->bv_len] ); done:; if ( nlines != NULL ) { @@ -2851,9 +2851,8 @@ static int checkNum( struct berval *in, struct berval *out ) { /* parse serialNumber */ - int neg = 0; + ber_len_t neg = 0, extra = 0; char first = '\0'; - int extra = 0; out->bv_val = in->bv_val; out->bv_len = 0; @@ -2911,7 +2910,7 @@ serialNumberAndIssuerCheck( struct berval *is, void *ctx ) { - int n; + ber_len_t n; if( in->bv_len < 3 ) return LDAP_INVALID_SYNTAX; @@ -3059,7 +3058,7 @@ serialNumberAndIssuerCheck( ber_dupbv_x( &ni, is, ctx ); } else { - ber_int_t src, dst; + ber_len_t src, dst; ni.bv_len = is->bv_len - numdquotes; ni.bv_val = ber_memalloc_x( ni.bv_len + 1, ctx ); @@ -3164,7 +3163,7 @@ serialNumberAndIssuerPretty( p = lutil_strncopy( p, ni.bv_val, ni.bv_len ); p = lutil_strcopy( p, /*{*/ "\" }" ); - assert( p - out->bv_val == out->bv_len ); + assert( p == &out->bv_val[out->bv_len] ); done:; Debug( LDAP_DEBUG_TRACE, "<<< serialNumberAndIssuerPretty: <%s> => <%s>\n", @@ -3186,8 +3185,7 @@ slap_bin2hex( unsigned char *ptr, zero = '\0'; char *sptr; int first; - int i; - ber_len_t len, nlen; + ber_len_t i, len, nlen; assert( in != NULL ); assert( !BER_BVISNULL( in ) ); @@ -3240,7 +3238,7 @@ slap_bin2hex( *sptr++ = 'H'; *sptr = '\0'; - assert( sptr - out->bv_val == nlen ); + assert( sptr == &out->bv_val[nlen] ); out->bv_len = nlen; @@ -3327,7 +3325,7 @@ serialNumberAndIssuerNormalize( p = lutil_strncopy( p, ni.bv_val, ni.bv_len ); p = lutil_strcopy( p, /*{*/ "\" }" ); - assert( p - out->bv_val == out->bv_len ); + assert( p == &out->bv_val[out->bv_len] ); func_leave: Debug( LDAP_DEBUG_TRACE, "<<< serialNumberAndIssuerNormalize: <%s> => <%s>\n", @@ -3440,7 +3438,8 @@ done: static int checkTime( struct berval *in, struct berval *out ) { - int i; + int rc; + ber_len_t i; char buf[STRLENOF("YYYYmmddHHMMSSZ") + 1]; struct berval bv; @@ -3493,12 +3492,12 @@ checkTime( struct berval *in, struct berval *out ) return -1; } - i = generalizedTimeValidate( NULL, &bv ); - if ( i == LDAP_SUCCESS && out != NULL ) { + rc = generalizedTimeValidate( NULL, &bv ); + if ( rc == LDAP_SUCCESS && out != NULL ) { out->bv_len = bv.bv_len; } - return i != LDAP_SUCCESS; + return rc != LDAP_SUCCESS; } static int @@ -3645,7 +3644,7 @@ issuerAndThisUpdateCheck( ber_dupbv_x( &ni, is, ctx ); } else { - ber_int_t src, dst; + ber_len_t src, dst; ni.bv_len = is->bv_len - numdquotes; ni.bv_val = ber_memalloc_x( ni.bv_len + 1, ctx ); @@ -3752,7 +3751,7 @@ issuerAndThisUpdatePretty( p = lutil_strncopy( p, tu.bv_val, tu.bv_len ); p = lutil_strcopy( p, /*{*/ "\" }" ); - assert( p - out->bv_val == out->bv_len ); + assert( p == &out->bv_val[out->bv_len] ); done:; Debug( LDAP_DEBUG_TRACE, "<<< issuerAndThisUpdatePretty: <%s> => <%s>\n", @@ -3818,7 +3817,7 @@ issuerAndThisUpdateNormalize( p = lutil_strncopy( p, tu2.bv_val, tu2.bv_len ); p = lutil_strcopy( p, /*{*/ "\" }" ); - assert( p - out->bv_val == out->bv_len ); + assert( p == & out->bv_val[out->bv_len] ); func_leave: Debug( LDAP_DEBUG_TRACE, "<<< issuerAndThisUpdateNormalize: <%s> => <%s>\n", @@ -3929,7 +3928,7 @@ hexValidate( Syntax *syntax, struct berval *in ) { - int i; + ber_len_t i; assert( in != NULL ); assert( !BER_BVISNULL( in ) ); @@ -3954,7 +3953,7 @@ hexNormalize( struct berval *normalized, void *ctx ) { - int i; + ber_len_t i; assert( val != NULL ); assert( normalized != NULL ); @@ -4045,7 +4044,7 @@ csnSidNormalize( assert( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX(usage) != 0 ); ptr = ber_bvchr( val, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4053,7 +4052,7 @@ csnSidNormalize( bv.bv_len = val->bv_len - ( ptr + 1 - val->bv_val ); ptr = ber_bvchr( &bv, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4061,7 +4060,7 @@ csnSidNormalize( bv.bv_len = val->bv_len - ( ptr + 1 - val->bv_val ); ptr = ber_bvchr( &bv, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4100,7 +4099,7 @@ csnValidate( bv = *in; ptr = ber_bvchr( &bv, '#' ); - if ( ptr == NULL || ptr - bv.bv_val == bv.bv_len ) { + if ( ptr == NULL || ptr == &bv.bv_val[bv.bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4120,7 +4119,7 @@ csnValidate( bv.bv_len = in->bv_len - ( bv.bv_val - in->bv_val ); ptr = ber_bvchr( &bv, '#' ); - if ( ptr == NULL || ptr - in->bv_val == in->bv_len ) { + if ( ptr == NULL || ptr == &in->bv_val[in->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4138,7 +4137,7 @@ csnValidate( bv.bv_len = in->bv_len - ( bv.bv_val - in->bv_val ); ptr = ber_bvchr( &bv, '#' ); - if ( ptr == NULL || ptr - in->bv_val == in->bv_len ) { + if ( ptr == NULL || ptr == &in->bv_val[in->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4178,7 +4177,7 @@ csnNormalize21( struct berval bv; char buf[ STRLENOF( "YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#SID#ssssss" ) + 1 ]; char *ptr; - int i; + ber_len_t i; assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) != 0 ); assert( !BER_BVISEMPTY( val ) ); @@ -4186,7 +4185,7 @@ csnNormalize21( gt = *val; ptr = ber_bvchr( >, '#' ); - if ( ptr == NULL || ptr - gt.bv_val == gt.bv_len ) { + if ( ptr == NULL || ptr == >.bv_val[gt.bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4203,7 +4202,7 @@ csnNormalize21( cnt.bv_len = val->bv_len - ( cnt.bv_val - val->bv_val ); ptr = ber_bvchr( &cnt, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4223,7 +4222,7 @@ csnNormalize21( sid.bv_len = val->bv_len - ( sid.bv_val - val->bv_val ); ptr = ber_bvchr( &sid, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4261,7 +4260,7 @@ csnNormalize21( } *ptr = '\0'; - assert( ptr - bv.bv_val == bv.bv_len ); + assert( ptr == &bv.bv_val[bv.bv_len] ); if ( csnValidate( syntax, &bv ) != LDAP_SUCCESS ) { return LDAP_INVALID_SYNTAX; @@ -4286,7 +4285,7 @@ csnNormalize23( struct berval bv; char buf[ STRLENOF( "YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#SID#ssssss" ) + 1 ]; char *ptr; - int i; + ber_len_t i; assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) != 0 ); assert( !BER_BVISEMPTY( val ) ); @@ -4294,7 +4293,7 @@ csnNormalize23( gt = *val; ptr = ber_bvchr( >, '#' ); - if ( ptr == NULL || ptr - gt.bv_val == gt.bv_len ) { + if ( ptr == NULL || ptr == >.bv_val[gt.bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4307,7 +4306,7 @@ csnNormalize23( cnt.bv_len = val->bv_len - ( cnt.bv_val - val->bv_val ); ptr = ber_bvchr( &cnt, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4320,7 +4319,7 @@ csnNormalize23( sid.bv_len = val->bv_len - ( sid.bv_val - val->bv_val ); ptr = ber_bvchr( &sid, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4353,7 +4352,7 @@ csnNormalize23( } *ptr = '\0'; - assert( ptr - bv.bv_val == bv.bv_len ); + assert( ptr == &bv.bv_val[bv.bv_len] ); if ( csnValidate( syntax, &bv ) != LDAP_SUCCESS ) { return LDAP_INVALID_SYNTAX; } @@ -4375,7 +4374,7 @@ csnNormalize( { struct berval cnt, sid, mod; char *ptr; - int i; + ber_len_t i; assert( val != NULL ); assert( normalized != NULL ); @@ -4403,7 +4402,7 @@ csnNormalize( } ptr = ber_bvchr( val, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4415,7 +4414,7 @@ csnNormalize( cnt.bv_len = val->bv_len - ( cnt.bv_val - val->bv_val ); ptr = ber_bvchr( &cnt, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } @@ -4427,7 +4426,7 @@ csnNormalize( sid.bv_len = val->bv_len - ( sid.bv_val - val->bv_val ); ptr = ber_bvchr( &sid, '#' ); - if ( ptr == NULL || ptr - val->bv_val == val->bv_len ) { + if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } diff --git a/servers/slapd/search.c b/servers/slapd/search.c index 25b8805381..cf434106ae 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -180,7 +180,7 @@ do_search( if ( StatslogTest( LDAP_DEBUG_STATS ) ) { char abuf[BUFSIZ/2], *ptr = abuf; - int len = 0, alen; + unsigned len = 0, alen; sprintf(abuf, "scope=%d deref=%d", op->ors_scope, op->ors_deref); Statslog( LDAP_DEBUG_STATS, diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 516eb4a710..9df56882da 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -407,7 +407,7 @@ ldap_sync_search( abs(si->si_type), rhint ); } - if ( (rc = ber_flatten2( ber, &c[0].ldctl_value, 0 ) ) == LBER_ERROR ) { + if ( (rc = ber_flatten2( ber, &c[0].ldctl_value, 0 ) ) == -1 ) { ber_free_buf( ber ); return rc; } @@ -2733,7 +2733,8 @@ syncrepl_updateCookie( Modifications mod; struct berval first = BER_BVNULL; - int rc, i, j, len; + int rc, i, j; + ber_len_t len; slap_callback cb = { NULL }; SlapReply rs_modify = {REP_RESULT}; @@ -3056,7 +3057,8 @@ dn_callback( new = attr_find( dni->new_entry->e_attrs, slap_schema.si_ad_entryCSN ); if ( new && old ) { - int rc, len = old->a_vals[0].bv_len; + int rc; + ber_len_t len = old->a_vals[0].bv_len; if ( len > new->a_vals[0].bv_len ) len = new->a_vals[0].bv_len; rc = memcmp( old->a_vals[0].bv_val, diff --git a/servers/slapd/value.c b/servers/slapd/value.c index 1f9d59cb85..ad7be0f466 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -267,12 +267,12 @@ ordered_value_renumber( Attribute *a ) { char *ptr, ibuf[64]; /* many digits */ struct berval ibv, tmp, vtmp; - int i; + unsigned i; ibv.bv_val = ibuf; for (i=0; ia_numvals; i++) { - ibv.bv_len = sprintf(ibv.bv_val, "{%d}", i); + ibv.bv_len = sprintf(ibv.bv_val, "{%u}", i); vtmp = a->a_vals[i]; if ( vtmp.bv_val[0] == '{' ) { ptr = ber_bvchr(&vtmp, '}'); @@ -750,7 +750,7 @@ ordered_value_add( k = strtol( vals[i].bv_val + 1, &next, 0 ); if ( next == vals[i].bv_val + 1 || next[ 0 ] != '}' || - next - vals[i].bv_val > vals[i].bv_len ) + (ber_len_t) (next - vals[i].bv_val) > vals[i].bv_len ) { ch_free( nnew ); ch_free( new );