]> git.sur5r.net Git - openldap/commitdiff
Warnings cleanup
authorQuanah Gibson-Mount <quanah@openldap.org>
Sat, 8 Nov 2008 02:15:17 +0000 (02:15 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Sat, 8 Nov 2008 02:15:17 +0000 (02:15 +0000)
39 files changed:
clients/tools/common.c
clients/tools/ldapsearch.c
libraries/libldap/abandon.c
libraries/libldap/ldap_sync.c
libraries/libldap/request.c
libraries/liblutil/passwd.c
libraries/liblutil/utils.c
servers/slapd/aci.c
servers/slapd/alock.c
servers/slapd/attr.c
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/back-bdb.h
servers/slapd/back-bdb/cache.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/monitor.c
servers/slapd/back-bdb/tools.c
servers/slapd/back-ldif/ldif.c
servers/slapd/back-meta/bind.c
servers/slapd/back-meta/config.c
servers/slapd/component.c
servers/slapd/dn.c
servers/slapd/entry.c
servers/slapd/mods.c
servers/slapd/mr.c
servers/slapd/overlays/accesslog.c
servers/slapd/overlays/dynlist.c
servers/slapd/overlays/pcache.c
servers/slapd/overlays/ppolicy.c
servers/slapd/result.c
servers/slapd/sasl.c
servers/slapd/saslauthz.c
servers/slapd/schema_init.c
servers/slapd/search.c
servers/slapd/slapi/slapi_pblock.c
servers/slapd/slapi/slapi_utils.c
servers/slapd/syncrepl.c
servers/slapd/value.c

index 86434283d8f21c40907cd1047d4140c4845b454e..d468dd9969f743c66d392ec5ccdd0d9eed4bef97 100644 (file)
@@ -625,7 +625,7 @@ tool_args( int argc, char **argv )
                                                (unsigned char *)bv.bv_val,
                                                bv.bv_len );
 
-                                       if ( retcode == -1 || retcode > bv.bv_len ) {
+                                       if ( retcode == -1 || (unsigned) retcode > bv.bv_len ) {
                                                fprintf( stderr, "Unable to parse value of general control %s\n",
                                                        control );
                                                usage();
@@ -1310,7 +1310,7 @@ tool_bind( LDAP *ld )
                sctrlsp = sctrls;
        }
 
-       assert( nsctrls < sizeof(sctrls)/sizeof(sctrls[0]) );
+       assert( nsctrls < (int) (sizeof(sctrls)/sizeof(sctrls[0])) );
 
        if ( authmethod == LDAP_AUTH_SASL ) {
 #ifdef HAVE_CYRUS_SASL
@@ -1523,7 +1523,7 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count )
                
                ber_init2( ber, NULL, LBER_USE_DER );
 
-               if ( ber_printf( ber, "s", proxydn ) == LBER_ERROR ) {
+               if ( ber_printf( ber, "s", proxydn ) == -1 ) {
                        exit( EXIT_FAILURE );
                }
 
index 43d4b5ff0e0adf10ccdb993cafdb281e81314568..04bbc725b04d2c2c609e22459489cc67068f2b77 100644 (file)
@@ -856,13 +856,13 @@ getNextPage:
                                                        &sync_cookie );
                        }
 
-                       if ( err == LBER_ERROR ) {
+                       if ( err == -1 ) {
                                ber_free( syncber, 1 );
                                fprintf( stderr, _("ldap sync control encoding error!\n") );
                                return EXIT_FAILURE;
                        }
 
-                       if ( ber_flatten( syncber, &syncbvalp ) == LBER_ERROR ) {
+                       if ( ber_flatten( syncber, &syncbvalp ) == -1 ) {
                                return EXIT_FAILURE;
                        }
 
@@ -1618,7 +1618,7 @@ static int print_result(
 
                                                tool_write_ldif( LDIF_PUT_TEXT,
                                                        "text", line,
-                                                       next ? next - line : strlen( line ) );
+                                                       next ? (size_t) (next - line) : strlen( line ));
 
                                                line = next ? next + 1 : NULL;
                                        }
index 8f2fb3419499583f22babc83938cba956afc923e..bd9ebb38181a3e0907d90c6d11de6b9bce924725 100644 (file)
@@ -447,8 +447,7 @@ int
 ldap_int_bisect_delete( ber_int_t **vp, ber_len_t *np, int id, int idx )
 {
        ber_int_t       *v;
-       ber_len_t       n;
-       int             i;
+       ber_len_t       i, n;
 
        assert( vp != NULL );
        assert( np != NULL );
index 6e7cd48084d7fde51d4459f1d440d744447c3e93..da699ff3ee99776e02175ad598f7473a5732664e 100644 (file)
@@ -691,7 +691,7 @@ ldap_sync_init( ldap_sync_t *ls, int mode )
                rc ? "!!! " : "",
                rc );
 #endif /* LDAP_SYNC_TRACE */
-       if ( rc == LBER_ERROR ) {
+       if ( rc < 0 ) {
                rc = LDAP_OTHER;
                 goto done;
         }
index 80304118869b0b64cfff412960bf7d2226082b15..e6b695a6442e6260c2cf22632fcf481b310264b5 100644 (file)
@@ -1099,7 +1099,7 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char *
                        /* See if we've already requested this DN with this conn */
                        LDAPRequest *lp;
                        int looped = 0;
-                       int len = srv->lud_dn ? strlen( srv->lud_dn ) : 0;
+                       ber_len_t len = srv->lud_dn ? strlen( srv->lud_dn ) : 0;
                        for ( lp = origreq; lp; ) {
                                if ( lp->lr_conn == lc
                                        && len == lp->lr_dn.bv_len
@@ -1358,7 +1358,7 @@ ldap_chase_referrals( LDAP *ld,
                if (( lc = find_connection( ld, srv, 1 )) != NULL ) {
                        LDAPRequest *lp;
                        int looped = 0;
-                       int len = srv->lud_dn ? strlen( srv->lud_dn ) : 0;
+                       ber_len_t len = srv->lud_dn ? strlen( srv->lud_dn ) : 0;
                        for ( lp = lr; lp; lp = lp->lr_parent ) {
                                if ( lp->lr_conn == lc
                                        && len == lp->lr_dn.bv_len )
index 8dd59f908466858728710699068c8856d14ccb36..9f2559917e50f2cc3e522d9e0ed6206c820c603d 100644 (file)
@@ -716,7 +716,7 @@ static int chk_lanman(
        const struct berval *cred,
        const char **text )
 {
-       int i;
+       ber_len_t i;
        char UcasePassword[15];
        des_cblock key;
        des_key_schedule schedule;
@@ -1003,7 +1003,7 @@ static int hash_lanman(
        const char **text )
 {
 
-       int i;
+       ber_len_t i;
        char UcasePassword[15];
        des_cblock key;
        des_key_schedule schedule;
index ff37d417a05e2b3707fb148ac7e5ec488a73f5ff..afda235d81fcb9225de0b4a6216b9d831e2ed22b 100644 (file)
@@ -940,7 +940,7 @@ lutil_snprintf( char *buf, ber_len_t bufsize, char **next, ber_len_t *len, LDAP_
                *len = ret;
        }
 
-       if ( ret >= bufsize ) {
+       if ( (unsigned) ret >= bufsize ) {
                if ( next ) {
                        *next = &buf[ bufsize - 1 ];
                }
index de0b6c6ac39703bdd39eb0d180877c0572f5ed5e..88232f33e57b2ae8a90e98df1d72bd57e8cc04b1 100644 (file)
@@ -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 ] ) {
index 3d091bf60fcbcb05983c42f1e636f517533b4df7..1a50a399f159cc2176cdf1e433ca1c93528bacd8 100644 (file)
@@ -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--;
        }
index 67c26911c2ef8dc1755fc566568dcf0825319386..4d578d9247de59f2db3e685a51f444716e2c36a7 100644 (file)
@@ -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++ ) {
index d6fba1bdd2e22c5ab52eff976dfec4cf3e5fbfa5..cea8a0be4c9e8230c95794082ff0d736077bfb54 100644 (file)
@@ -34,7 +34,7 @@ bdb_add(Operation *op, SlapReply *rs )
        AttributeDescription *entry = slap_schema.si_ad_entry;
        DB_TXN          *ltid = NULL, *lt2, *rtxn;
        ID eid = NOID;
-       struct bdb_op_info opinfo = {0};
+       struct bdb_op_info opinfo = {{{ 0 }}};
        int subentry;
        DB_LOCK         lock;
 
index 19c30cc5e110f6ce7864c325b84b6861fb5ee4ae..6493a4583c96d75d380fb6cd3cd25fe4a0074035 100644 (file)
@@ -332,7 +332,7 @@ extern int __db_logmsg(const DB_ENV *env, DB_TXN *txn, const char *op, u_int32_t
 
 /* Copy a pointer "src" to a pointer "dst" from big-endian to native order */
 #define BDB_DISK2ID( src, dst ) \
-       do { int i0; ID tmp = 0; unsigned char *_p;     \
+       do { unsigned i0; ID tmp = 0; unsigned char *_p;        \
                _p = (unsigned char *)(src);    \
                for ( i0=0; i0<sizeof(ID); i0++ ) {     \
                        tmp <<= 8; tmp |= *_p++;        \
index 9c7d4f8949433c6067be404511e55c7fdc850d20..e72bf30db64284d43d8c4909d648c99ac58af5ce 100644 (file)
@@ -747,7 +747,7 @@ bdb_cache_lru_purge( struct bdb_info *bdb )
                if ( islocked )
                        bdb_cache_entryinfo_unlock( elru );
 
-               if ( count >= bdb->bi_cache.c_minfree ) {
+               if ( (unsigned) count >= bdb->bi_cache.c_minfree ) {
                        ldap_pvt_thread_mutex_lock( &bdb->bi_cache.c_count_mutex );
                        bdb->bi_cache.c_cursize -= count;
                        ldap_pvt_thread_mutex_unlock( &bdb->bi_cache.c_count_mutex );
index b6a33e234c0980b1255ae8d9e6c5ae15400e4485..5979e7cbcd602e32f0388d9092b47cf1d6fe0fc3 100644 (file)
@@ -35,7 +35,7 @@ bdb_delete( Operation *op, SlapReply *rs )
        AttributeDescription *children = slap_schema.si_ad_children;
        AttributeDescription *entry = slap_schema.si_ad_entry;
        DB_TXN          *ltid = NULL, *lt2;
-       struct bdb_op_info opinfo = {0};
+       struct bdb_op_info opinfo = {{{ 0 }}};
        ID      eid;
 
        DB_LOCK         lock, plock;
index cf44b7d9e501da6b2c977ba8f696b90ac9c0b252..0ae77b443e02c5bcc89b4e61215fa5619a2a96cb 100644 (file)
@@ -330,7 +330,7 @@ bdb_modify( Operation *op, SlapReply *rs )
        char textbuf[SLAP_TEXT_BUFLEN];
        size_t textlen = sizeof textbuf;
        DB_TXN  *ltid = NULL, *lt2;
-       struct bdb_op_info opinfo = {0};
+       struct bdb_op_info opinfo = {{{ 0 }}};
        Entry           dummy = {0};
        int                     fakeroot = 0;
 
index c93897525a528b882676180f5c36d6d3949ead93..42a00f01364ba838d8d84c6c78e16cbdf5bf5080 100644 (file)
@@ -36,7 +36,7 @@ bdb_modrdn( Operation *op, SlapReply *rs )
        char textbuf[SLAP_TEXT_BUFLEN];
        size_t textlen = sizeof textbuf;
        DB_TXN          *ltid = NULL, *lt2;
-       struct bdb_op_info opinfo = {0};
+       struct bdb_op_info opinfo = {{{ 0 }}};
        Entry dummy = {0};
 
        Entry           *np = NULL;                     /* newSuperior Entry */
index 7421cb1cd4b9e34c1537243cfa1d6f726a330197..5f7134043b668b1d909b5b1f8cc75b6da09ed31d 100644 (file)
@@ -551,9 +551,9 @@ bdb_monitor_bitmask2key( slap_mask_t bitmask )
 {
        int     key;
 
-       for ( key = 0; key < 8*sizeof(slap_mask_t) && !( bitmask & 0x1U ); key++ ) {
+       for ( key = 0; key < 8 * (int)sizeof(slap_mask_t) && !( bitmask & 0x1U );
+                       key++ )
                bitmask >>= 1;
-       }
 
        return key;
 }
index eb09962c78d553a3e664238cc8b0429e2765021d..66b2e9a32f389443b95a446a5a96946165fc870f 100644 (file)
@@ -395,13 +395,12 @@ static int bdb_tool_next_id(
                        holes[nholes++].id = e->e_id;
                }
        } else if ( !hole ) {
-               unsigned i;
+               unsigned i, j;
 
                e->e_id = ei->bei_id;
 
                for ( i=0; i<nholes; i++) {
                        if ( holes[i].id == e->e_id ) {
-                               int j;
                                free(holes[i].dn.bv_val);
                                for (j=i;j<nholes;j++) holes[j] = holes[j+1];
                                holes[j].id = 0;
index 05d222e0cef05128d13160a116ea25bca15dba9e..00608e7e0099156a59665224c8f8e52fa30f4915 100644 (file)
@@ -35,8 +35,8 @@ typedef struct enumCookie {
        Operation *op;
        SlapReply *rs;
        Entry **entries;
-       int elen;
-       int eind;
+       ID elen;
+       ID eind;
 } enumCookie;
 
 struct ldif_info {
index bcfd191526dab1b1c5069d27a7de04b14efb798b..439f05dd8176e16aae9a3394d1408ee943d88f3c 100644 (file)
@@ -1575,7 +1575,7 @@ meta_back_controls_add(
 
        LDAPControl             **ctrls = NULL;
        /* set to the maximum number of controls this backend can add */
-       LDAPControl             c[ 2 ] = { 0 };
+       LDAPControl             c[ 2 ] = {{ 0 }};
        int                     n = 0, i, j1 = 0, j2 = 0;
 
        *pctrls = NULL;
@@ -1642,7 +1642,7 @@ meta_back_controls_add(
                goto done;
        }
 
-       assert( j1 + j1 <= sizeof( c )/sizeof(LDAPControl) );
+       assert( j1 + j2 <= (int) (sizeof( c )/sizeof( c[0] )) );
 
        if ( op->o_ctrls ) {
                for ( n = 0; op->o_ctrls[ n ]; n++ )
index 610f607545a6c7a6c2d3288a4fc3ac9ee6f45a1e..5a3b3d82ce3c7d0179cfe3e43ecb758aa06bfc0b 100644 (file)
@@ -1082,7 +1082,9 @@ idassert-authzFrom        "dn:<rootdn>"
                                return 1;
                        }
 
-                       if ( snprintf( binddn, sizeof( binddn ), "binddn=%s", argv[ 1 ] ) >= sizeof( binddn ) ) {
+                       if ( sizeof( binddn ) <= (unsigned) snprintf( binddn,
+                                       sizeof( binddn ), "binddn=%s", argv[ 1 ] ))
+                       {
                                Debug( LDAP_DEBUG_ANY, "%s: line %d: \"pseudorootdn\" too long.\n",
                                        fname, lineno, 0 );
                                return 1;
index d950e2ae8a87a5bf3c32d7fdbc697b7ccee57c75..9bc69405b4a3180e6a13c318317b49bfcec234af 100644 (file)
@@ -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;
index 95520700e381e565fece56be343ed9d2e1398f9f..98eeebc41761f8308d833ce16ac6a08a83cdb23f 100644 (file)
@@ -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;
 }
 
 
index fa30a1ee698cfc0760efed326af8f1163d15d52d..289a0f4d09555597a3fb701f8745d6385dad9469 100644 (file)
@@ -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;
 
index 820ed298f679c8c93f2f7849afdda5a06f889cd5..22b9e33651f2a228152d4fab687cba1a2aa4adce 100644 (file)
@@ -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';
 
        /*
index 91756a2d01cf233b438af118940bc48dbf7955be..355191491c3a7911f30c641e6babdbeb08a8d80d 100644 (file)
@@ -377,7 +377,7 @@ matching_rule_use_init( void )
 
        LDAP_SLIST_FOREACH( mr, &mr_list, smr_next ) {
                AttributeType   *at;
-               MatchingRuleUse mru_storage = { 0 },
+               MatchingRuleUse mru_storage = {{ 0 }},
                                *mru = &mru_storage;
 
                char            **applies_oids = NULL;
index 866afd7937763176ed0d5a3e81b3294c979df05a..0be32e9bfabe48c6680cc08de515d2d71f3a288e 100644 (file)
@@ -534,17 +534,17 @@ log_age_unparse( int age, struct berval *agebv, size_t size )
 
        if ( dd ) {
                len = snprintf( ptr, size, "%d+", dd );
-               assert( len >= 0 && len < size );
+               assert( len >= 0 && (unsigned) len < size );
                size -= len;
                ptr += len;
        }
        len = snprintf( ptr, size, "%02d:%02d", hh, mm );
-       assert( len >= 0 && len < size );
+       assert( len >= 0 && (unsigned) len < size );
        size -= len;
        ptr += len;
        if ( ss ) {
                len = snprintf( ptr, size, ":%02d", ss );
-               assert( len >= 0 && len < size );
+               assert( len >= 0 && (unsigned) len < size );
                size -= len;
                ptr += len;
        }
@@ -580,7 +580,7 @@ log_old_lookup( Operation *op, SlapReply *rs )
        a = attr_find( rs->sr_entry->e_attrs,
                slap_schema.si_ad_entryCSN );
        if ( a ) {
-               int len = a->a_vals[0].bv_len;
+               ber_len_t len = a->a_vals[0].bv_len;
                if ( len > pd->csn.bv_len )
                        len = pd->csn.bv_len;
                if ( memcmp( a->a_vals[0].bv_val, pd->csn.bv_val, len ) > 0 ) {
@@ -933,7 +933,7 @@ logSchemaControlValidate(
        struct berval   *valp )
 {
        struct berval   val, bv;
-       int             i;
+       ber_len_t               i;
        int             rc = LDAP_SUCCESS;
 
        assert( valp != NULL );
@@ -1155,7 +1155,7 @@ accesslog_ctrls(
                }
                
                if ( !BER_BVISNULL( &ctrls[ i ]->ldctl_value ) ) {
-                       int     j;
+                       ber_len_t       j;
 
                        ptr = lutil_strcopy( ptr, " controlValue \"" );
                        for ( j = 0; j < ctrls[ i ]->ldctl_value.bv_len; j++ )
index 5a5eb09f391ff549f2bf6978ef46c34d48ff7a3d..b7f38aa01dd7f058b26d56b69f3638ab5b575d03 100644 (file)
@@ -877,7 +877,7 @@ dynlist_build_def_filter( dynlist_info_t *dli )
        ptr = lutil_strcopy( ptr, dli->dli_oc->soc_cname.bv_val );
        ptr = lutil_strcopy( ptr, "))" );
 
-       assert( dli->dli_default_filter.bv_len == ptr - dli->dli_default_filter.bv_val );
+       assert( ptr == &dli->dli_default_filter.bv_val[dli->dli_default_filter.bv_len] );
 
        return 0;
 }
index 40ac4b99eda15cf777c7af3ff817b039da75a909..ea01254d18a12e29147a498b34d6c3ce17232b8e 100644 (file)
@@ -1697,7 +1697,7 @@ pcache_remove_entries_from_cache(
        Filter          f = { 0 };
        char            filtbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE + STRLENOF( "(entryUUID=)" ) ];
        AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
-       AttributeName   attrs[ 2 ] = { 0 };
+       AttributeName   attrs[ 2 ] = {{{ 0 }}};
        int             s, rc;
 
        if ( op == NULL ) {
@@ -1812,7 +1812,7 @@ pcache_remove_entry_queries_from_cache(
        Filter                  f = { 0 };
        char                    filter_str[ LDAP_LUTIL_UUIDSTR_BUFSIZE + STRLENOF( "(queryId=)" ) ];
        AttributeAssertion      ava = ATTRIBUTEASSERTION_INIT;
-       AttributeName           attrs[ 2 ] = { 0 };
+       AttributeName           attrs[ 2 ] = {{{ 0 }}};
        int                     rc;
 
        BerVarray               vals = NULL;
@@ -3258,7 +3258,7 @@ pcache_db_open2(
                        BerVarray       vals = NULL;
                        Filter          f = { 0 }, f2 = { 0 };
                        AttributeAssertion      ava = ATTRIBUTEASSERTION_INIT;
-                       AttributeName   attrs[ 2 ] = { 0 };
+                       AttributeName   attrs[ 2 ] = {{{ 0 }}};
 
                        connection_fake_init( &conn, &opbuf, thrctx );
                        op = &opbuf.ob_op;
@@ -3424,7 +3424,7 @@ pcache_db_close(
                slap_callback   cb = { 0 };
 
                SlapReply       rs = { REP_RESULT };
-               Modifications   mod = { 0 };
+               Modifications   mod = {{ 0 }};
 
                thrctx = ldap_pvt_thread_pool_context();
 
index 99db2bd5b1326afb26c370541ed08ead84d5c286..ca0cb29b143ef07e0b0f25a765aafd110b84078b 100644 (file)
@@ -395,7 +395,7 @@ create_passcontrol( Operation *op, int exptime, int grace, LDAPPasswordPolicyErr
        }
        ber_printf( ber, /*{*/ "N}" );
 
-       if (ber_flatten2( ber, &(c.ldctl_value), 1 ) == LBER_DEFAULT) {
+       if (ber_flatten2( ber, &(c.ldctl_value), 1 ) == -1) {
                return NULL;
        }
        (void)ber_free_buf(ber);
@@ -679,7 +679,7 @@ parse_pwdhistory( struct berval *bv, char **oid, time_t *oldtime, struct berval
 {
        char *ptr;
        struct berval nv, npw;
-       int i, j;
+       ber_len_t i, j;
        
        assert (bv && (bv->bv_len > 0) && (bv->bv_val) && oldtime && oldpw );
 
index f89b87304c5e8acabcf07077b72ec189b91e81a6..2912143dd465411b638d36985524b67c14c2e5af 100644 (file)
@@ -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;
index b73258e66dc9dc2c59d25fbd0fcc76efec83957d..0a300fa879fe107e78f7a31cb8c98a1af5279348 100644 (file)
@@ -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 : "<empty>");
 
@@ -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 : "<EMPTY>" );
 
        /* 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;
 } 
index 08c7c690f58c426386ef7b5c4386d3db0b189ecf..0d98d86b6a447e3c0b916688c0dfbba5525dc105 100644 (file)
@@ -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;
                        }
 
index 9f5e88e7b5b90938ec74c64e68986d098034f160..27bcb72824e2c079aeea72b3fd921fc90c7d2e1e 100644 (file)
@@ -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( &gt, '#' );
-       if ( ptr == NULL || ptr - gt.bv_val == gt.bv_len ) {
+       if ( ptr == NULL || ptr == &gt.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( &gt, '#' );
-       if ( ptr == NULL || ptr - gt.bv_val == gt.bv_len ) {
+       if ( ptr == NULL || ptr == &gt.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;
        }
 
index 25b88053811a5f2e95bd4f3a6b23fc30ef68ce8e..cf434106ae0364c193703dc6a50d7e4bf5279d80 100644 (file)
@@ -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,
index 1a5d6584ba3ea584fbb2f6a51269f4bf2938ea4f..0bbd91f406d6583ee4caf3166f76f7c7d1d950eb 100644 (file)
@@ -396,7 +396,7 @@ static int
 pblock_set_default( Slapi_PBlock *pb, int param, void *value ) 
 {
        slapi_pblock_class_t pbClass;
-       size_t i;
+       int i;
 
        pbClass = pblock_get_param_class( param );
        if ( pbClass == PBLOCK_CLASS_INVALID ) {
index 8c9910b162e1a6b2c5a1fae49572f3ac49b15239..06768345c396cf824a9ecdbc4836aba582d6425e 100644 (file)
@@ -52,7 +52,7 @@ struct slapi_condvar {
 
 static int checkBVString(const struct berval *bv)
 {
-       int i;
+       ber_len_t i;
 
        for ( i = 0; i < bv->bv_len; i++ ) {
                if ( bv->bv_val[i] == '\0' )
@@ -3231,7 +3231,7 @@ LDAP *slapi_ldap_init( char *ldaphost, int ldapport, int secure, int shared )
                rc = snprintf( url, size, "ldap%s://%s/", ( secure ? "s" : "" ), ldaphost );
        }
 
-       if ( rc > 0 && rc < size ) {
+       if ( rc > 0 && (size_t) rc < size ) {
                rc = ldap_initialize( &ld, url );
        } else {
                ld = NULL;
index 516eb4a710ec9cebf8ddcacbbc3c7a0689ccb49d..9df56882dafb184aaf573a75f2b48ba3f63b0555 100644 (file)
@@ -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,
index 1f9d59cb85d7dea9762b57e919fd208c155332b9..ad7be0f46665e1cdec6756c0770fca1dcfbce9d9 100644 (file)
@@ -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; i<a->a_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 );