Commit a4e3706e authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

Warnings cleanup

parent 698c43b5
......@@ -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 );
}
......
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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;
}
......
......@@ -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 )
......
......@@ -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;
......
......@@ -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 ];
}
......
......@@ -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 ] ) {
......
......@@ -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--;
}
......
......@@ -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++ ) {
......
......@@ -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;
......
......@@ -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++; \
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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 {
......
......@@ -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++ )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment