From: Hallvard Furuseth Date: Thu, 5 Nov 1998 06:49:49 +0000 (+0000) Subject: Some gcc -W... cleanup X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~1187 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=853a1371d176053fa7f66d3e302d97f1b0ef8067;p=openldap Some gcc -W... cleanup --- diff --git a/servers/slapd/back-ldbm/abandon.c b/servers/slapd/back-ldbm/abandon.c index 8f1ca0e040..11280148a8 100644 --- a/servers/slapd/back-ldbm/abandon.c +++ b/servers/slapd/back-ldbm/abandon.c @@ -2,6 +2,7 @@ #include "portable.h" +int ldbm_back_abandon() { } diff --git a/servers/slapd/back-ldbm/compare.c b/servers/slapd/back-ldbm/compare.c index e98f83dd94..d3a4a4d90b 100644 --- a/servers/slapd/back-ldbm/compare.c +++ b/servers/slapd/back-ldbm/compare.c @@ -26,7 +26,7 @@ ldbm_back_compare( char *matched; Entry *e; Attribute *a; - int i, rc; + int rc; /* get entry with reader lock */ if ( (e = dn2entry_r( be, dn, &matched )) == NULL ) { diff --git a/servers/slapd/back-ldbm/id2children.c b/servers/slapd/back-ldbm/id2children.c index b25a14c54d..b8272b87a1 100644 --- a/servers/slapd/back-ldbm/id2children.c +++ b/servers/slapd/back-ldbm/id2children.c @@ -21,12 +21,13 @@ id2children_add( ) { struct dbcache *db; - Datum key, data; + Datum key; int len, rc; IDList *idl; char buf[20]; #ifdef HAVE_BERKELEY_DB2 + Datum data; memset( &key, 0, sizeof( key ) ); memset( &data, 0, sizeof( data ) ); #endif @@ -42,7 +43,7 @@ id2children_add( return( -1 ); } - sprintf( buf, "%c%d", EQ_PREFIX, p ? p->e_id : 0 ); + sprintf( buf, "%c%ld", EQ_PREFIX, p ? p->e_id : 0 ); key.dptr = buf; key.dsize = strlen( buf ) + 1; @@ -85,7 +86,7 @@ has_children( return( 0 ); } - sprintf( buf, "%c%d", EQ_PREFIX, p->e_id ); + sprintf( buf, "%c%ld", EQ_PREFIX, p->e_id ); key.dptr = buf; key.dsize = strlen( buf ) + 1; diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index 88f089116f..1c426ef944 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -55,13 +55,11 @@ idl_fetch_one( Datum key ) { - Datum data, k2; + Datum data; IDList *idl; - IDList **tmp; - char *kstr; - int i, nids; #ifdef HAVE_BERKELEY_DB2 + datum k2; memset( &k2, 0, sizeof( k2 ) ); memset( &data, 0, sizeof( data ) ); #endif @@ -131,7 +129,7 @@ idl_fetch( kstr = (char *) ch_malloc( key.dsize + 20 ); nids = 0; for ( i = 0; idl->b_ids[i] != NOID; i++ ) { - sprintf( kstr, "%c%s%d", CONT_PREFIX, key.dptr, idl->b_ids[i] ); + sprintf( kstr, "%c%s%ld", CONT_PREFIX, key.dptr, idl->b_ids[i] ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; @@ -212,7 +210,7 @@ idl_split_block( IDList **n2 ) { - int i; + unsigned int i; /* find where to split the block */ for ( i = 0; i < b->b_nids && id > b->b_ids[i]; i++ ) @@ -272,7 +270,7 @@ idl_change_first( } /* write block with new key */ - sprintf( bkey.dptr, "%c%s%d", CONT_PREFIX, hkey.dptr, b->b_ids[0] ); + sprintf( bkey.dptr, "%c%s%ld", CONT_PREFIX, hkey.dptr, b->b_ids[0] ); bkey.dsize = strlen( bkey.dptr ) + 1; if ( (rc = idl_store( be, db, bkey, b )) != 0 ) { Debug( LDAP_DEBUG_ANY, @@ -361,14 +359,14 @@ idl_insert_key( /* store the first id block */ kstr = (char *) ch_malloc( key.dsize + 20 ); - sprintf( kstr, "%c%s%d", CONT_PREFIX, key.dptr, + sprintf( kstr, "%c%s%ld", CONT_PREFIX, key.dptr, tmp->b_ids[0] ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; rc = idl_store( be, db, k2, tmp ); /* store the second id block */ - sprintf( kstr, "%c%s%d", CONT_PREFIX, key.dptr, + sprintf( kstr, "%c%s%ld", CONT_PREFIX, key.dptr, tmp2->b_ids[0] ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; @@ -404,7 +402,7 @@ idl_insert_key( /* get the block */ kstr = (char *) ch_malloc( key.dsize + 20 ); - sprintf( kstr, "%c%s%d", CONT_PREFIX, key.dptr, idl->b_ids[i] ); + sprintf( kstr, "%c%s%ld", CONT_PREFIX, key.dptr, idl->b_ids[i] ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; if ( (tmp = idl_fetch_one( be, db, k2 )) == NULL ) { @@ -446,7 +444,7 @@ idl_insert_key( /* is there a next block? */ if ( !first && idl->b_ids[i + 1] != NOID ) { /* read it in */ - sprintf( kstr, "%c%s%d", CONT_PREFIX, key.dptr, + sprintf( kstr, "%c%s%ld", CONT_PREFIX, key.dptr, idl->b_ids[i + 1] ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; @@ -505,7 +503,7 @@ idl_insert_key( /* delete all indirect blocks */ for ( j = 0; idl->b_ids[j] != NOID; j++ ) { - sprintf( kstr, "%c%s%d", CONT_PREFIX, key.dptr, + sprintf( kstr,"%c%s%ld", CONT_PREFIX, key.dptr, idl->b_ids[j] ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; @@ -544,14 +542,14 @@ idl_insert_key( rc = idl_store( be, db, key, tmp ); /* store the first id block */ - sprintf( kstr, "%c%s%d", CONT_PREFIX, key.dptr, + sprintf( kstr, "%c%s%ld", CONT_PREFIX, key.dptr, tmp2->b_ids[0] ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; rc = idl_store( be, db, k2, tmp2 ); /* store the second id block */ - sprintf( kstr, "%c%s%d", CONT_PREFIX, key.dptr, + sprintf( kstr, "%c%s%ld", CONT_PREFIX, key.dptr, tmp3->b_ids[0] ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; @@ -579,7 +577,7 @@ idl_insert_key( int idl_insert( IDList **idl, ID id, int maxids ) { - int i, j; + unsigned int i, j; if ( ALLIDS( *idl ) ) { return( 2 ); /* already there */ @@ -653,8 +651,8 @@ idl_intersection( IDList *b ) { - int ai, bi, ni; - IDList *n; + unsigned int ai, bi, ni; + IDList *n; if ( a == NULL || b == NULL ) { return( NULL ); @@ -701,8 +699,8 @@ idl_union( IDList *b ) { - int ai, bi, ni; - IDList *n; + unsigned int ai, bi, ni; + IDList *n; if ( a == NULL ) { return( idl_dup( b ) ); @@ -755,8 +753,8 @@ idl_notin( IDList *b ) { - int ni, ai, bi; - IDList *n; + unsigned int ni, ai, bi; + IDList *n; if ( a == NULL ) { return( NULL ); @@ -834,7 +832,7 @@ idl_firstid( IDList *idl ) ID idl_nextid( IDList *idl, ID id ) { - int i; + unsigned int i; if ( ALLIDS( idl ) ) { return( ++id < idl->b_nids ? id : NOID ); diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index 0581fc1a1e..dbe549b924 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -137,7 +137,7 @@ index_read( realval = val; tmpval = NULL; if ( prefix != '\0' ) { - int len = strlen( val ); + unsigned int len = strlen( val ); if ( (len + 2) < sizeof(buf) ) { realval = buf; @@ -193,7 +193,7 @@ add_value( tmpval = NULL; idl = NULL; if ( prefix != '\0' ) { - int len = strlen( val ); + unsigned int len = strlen( val ); if ( (len + 2) < sizeof(buf) ) { realval = buf; diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 666547f1c9..3c16b925d4 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -30,7 +30,7 @@ ldbm_back_modify( struct ldbminfo *li = (struct ldbminfo *) be->be_private; char *matched = NULL; Entry *e; - int i, err, modtype; + int i, err; LDAPMod *mod; Debug(LDAP_DEBUG_ARGS, "ldbm_back_modify:\n", 0, 0, 0); diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 2ec7b0902b..9839a542c1 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -367,7 +367,7 @@ onelevel_candidates( f->f_and = (Filter *) ch_malloc( sizeof(Filter) ); f->f_and->f_choice = LDAP_FILTER_EQUALITY; f->f_and->f_ava.ava_type = strdup( "id2children" ); - sprintf( buf, "%d", e != NULL ? e->e_id : 0 ); + sprintf( buf, "%ld", e != NULL ? e->e_id : 0 ); f->f_and->f_ava.ava_value.bv_val = strdup( buf ); f->f_and->f_ava.ava_value.bv_len = strlen( buf ); f->f_and->f_next = filter; diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 4f48fdaf0e..d71628d6ab 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -8,6 +8,7 @@ #include "slap.h" #include "ldapconfig.h" +#include "lutil.h" /* Get lutil_detach() */ extern void slapd_daemon(); extern int lber_debug; @@ -56,13 +57,14 @@ pthread_mutex_t num_sent_mutex; pthread_mutex_t entry2str_mutex; pthread_mutex_t replog_mutex; -static +static void usage( name ) char *name; { fprintf( stderr, "usage: %s [-d ?|debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name ); } +int main( argc, argv ) int argc; char **argv; @@ -268,7 +270,7 @@ main( argc, argv ) /* log and send error */ Debug( LDAP_DEBUG_ANY, "ber_get_int returns 0x%x\n", tag, 0, 0 ); - return; + return 1; } if ( (tag = ber_peek_tag( &ber, &len )) @@ -279,7 +281,7 @@ main( argc, argv ) ber_free( &ber, 1 ); close( c.c_sb.sb_sd ); c.c_sb.sb_sd = -1; - return; + return 1; } connection_activity( &c ); @@ -287,4 +289,5 @@ main( argc, argv ) ber_free( &ber, 1 ); } } + return 1; }