From 177367bdb14913abb1ce90d44758f0390f626a92 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Thu, 5 Nov 1998 07:31:40 +0000 Subject: [PATCH] Some gcc -W... cleanup --- servers/slurpd/args.c | 2 +- servers/slurpd/ch_malloc.c | 6 +++--- servers/slurpd/config.c | 6 +++--- servers/slurpd/ldap_op.c | 14 ++++++-------- servers/slurpd/lock.c | 1 + servers/slurpd/main.c | 13 +++++++------ servers/slurpd/re.c | 4 ++-- servers/slurpd/replica.c | 3 --- servers/slurpd/ri.c | 1 - 9 files changed, 23 insertions(+), 27 deletions(-) diff --git a/servers/slurpd/args.c b/servers/slurpd/args.c index 678954bf14..d598cce645 100644 --- a/servers/slurpd/args.c +++ b/servers/slurpd/args.c @@ -28,7 +28,7 @@ #include "globals.h" -static int +static void usage( char *name ) { fprintf( stderr, "usage: %s\t[-d debug-level] [-s syslog-level]\n", name ); diff --git a/servers/slurpd/ch_malloc.c b/servers/slurpd/ch_malloc.c index 7b3ddcd840..d23bfbeb01 100644 --- a/servers/slurpd/ch_malloc.c +++ b/servers/slurpd/ch_malloc.c @@ -36,7 +36,7 @@ ch_malloc( char *new; if ( (new = (char *) malloc( size )) == NULL ) { - fprintf( stderr, "malloc of %d bytes failed\n", size ); + fprintf( stderr, "malloc of %lu bytes failed\n", size ); exit( 1 ); } @@ -63,7 +63,7 @@ ch_realloc( } if ( (new = (char *) realloc( block, size )) == NULL ) { - fprintf( stderr, "realloc of %d bytes failed\n", size ); + fprintf( stderr, "realloc of %lu bytes failed\n", size ); exit( 1 ); } @@ -86,7 +86,7 @@ ch_calloc( char *new; if ( (new = (char *) calloc( nelem, size )) == NULL ) { - fprintf( stderr, "calloc of %d elems of %d bytes failed\n", + fprintf( stderr, "calloc of %lu elems of %lu bytes failed\n", nelem, size ); exit( 1 ); } diff --git a/servers/slurpd/config.c b/servers/slurpd/config.c index 7c97aaaac8..ffd25ed029 100644 --- a/servers/slurpd/config.c +++ b/servers/slurpd/config.c @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -53,8 +54,7 @@ slurpd_read_config( ) { FILE *fp; - char buf[BUFSIZ]; - char *line, *p; + char *line; int cargc; char *cargv[MAXARGS]; @@ -227,7 +227,7 @@ getline( *p = '\0'; } lineno++; - if ( ! isspace( buf[0] ) ) { + if ( ! isspace( (unsigned char) buf[0] ) ) { return( line ); } diff --git a/servers/slurpd/ldap_op.c b/servers/slurpd/ldap_op.c index 486360fc0c..9ca81852eb 100644 --- a/servers/slurpd/ldap_op.c +++ b/servers/slurpd/ldap_op.c @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -30,7 +31,6 @@ #include "slurp.h" /* Forward references */ -static int get_changetype LDAP_P(( char * )); static struct berval **make_singlevalued_berval LDAP_P(( char *, int )); static int op_ldap_add LDAP_P(( Ri *, Re *, char ** )); static int op_ldap_modify LDAP_P(( Ri *, Re *, char ** )); @@ -75,7 +75,6 @@ do_ldap( int rc = 0; int lderr = LDAP_SUCCESS; int retry = 2; - char *msg; *errmsg = NULL; @@ -224,7 +223,7 @@ op_ldap_modify( int state; /* This code is a simple-minded state machine */ int nvals; /* Number of values we're modifying */ int nops; /* Number of LDAPMod structs in ldmarr */ - LDAPMod *ldm, *nldm, **ldmarr; + LDAPMod *ldm, **ldmarr; int i, len; char *type, *value; int rc = 0; @@ -583,10 +582,9 @@ do_bind( int *lderr ) { - int rc; int ldrc; - char msgbuf[ 1024]; #ifdef HAVE_KERBEROS + int rc; int retval = 0; int kni, got_tgt; char **krbnames; @@ -769,7 +767,7 @@ LDAPMod **ldmarr ) if ( ldm->mod_bvalues != NULL ) { for ( j = 0; ( b = ldm->mod_bvalues[ j ] ) != NULL; j++ ) { msgbuf = ch_malloc( b->bv_len + 512 ); - sprintf( msgbuf, "***** bv[ %d ] len = %d, val = <%s>", + sprintf( msgbuf, "***** bv[ %d ] len = %ld, val = <%s>", j, b->bv_len, b->bv_val ); Debug( LDAP_DEBUG_TRACE, "Trace (%d):%s\n", getpid(), msgbuf, 0 ); @@ -849,8 +847,8 @@ char *s ) char *p; for ( p = s; ( p != NULL ) && ( *p != '\0' ); p++ ) { - if ( islower( *p )) { - *p = toupper( *p ); + if ( islower( (unsigned char) *p )) { + *p = toupper( (unsigned char) *p ); } } } diff --git a/servers/slurpd/lock.c b/servers/slurpd/lock.c index 048c42529c..17bc995efa 100644 --- a/servers/slurpd/lock.c +++ b/servers/slurpd/lock.c @@ -18,6 +18,7 @@ #include +#include #include #include #include diff --git a/servers/slurpd/main.c b/servers/slurpd/main.c index 061aefa080..632372f2e2 100644 --- a/servers/slurpd/main.c +++ b/servers/slurpd/main.c @@ -34,21 +34,22 @@ extern int sanity(); extern void start_lwp_scheduler(); #endif /* HAVE_LWP */ +int main( int argc, char **argv ) { - pthread_attr_t attr; - int status; - int i; - #ifdef NO_THREADS /* Haven't yet written the non-threaded version */ - fprintf( stderr, "slurpd currently requires threads support\n" ); - exit( 1 ); + fputs( "slurpd currently requires threads support\n", stderr ); + return( 1 ); #else + pthread_attr_t attr; + int status; + int i; + /* * Create and initialize globals. init_globals() also initializes * the main replication queue. diff --git a/servers/slurpd/re.c b/servers/slurpd/re.c index 36a37538fe..e2250c72a2 100644 --- a/servers/slurpd/re.c +++ b/servers/slurpd/re.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "../slapd/slap.h" #include "slurp.h" @@ -177,7 +178,7 @@ Re_parse( *p++ = '\0'; } re->re_timestamp = strdup( value ); - if ( p != NULL && isdigit( *p )) { + if ( p != NULL && isdigit( (unsigned char) *p )) { re->re_seq = atoi( p ); } state |= GOT_TIME; @@ -499,7 +500,6 @@ Re_write( int i; char *s; int rc = 0; - Rh *rh; if ( re == NULL || fp == NULL ) { Debug( LDAP_DEBUG_ANY, "Internal error: Re_write: NULL argument\n", diff --git a/servers/slurpd/replica.c b/servers/slurpd/replica.c index 7ce0c54f2b..7ed7b20d5e 100644 --- a/servers/slurpd/replica.c +++ b/servers/slurpd/replica.c @@ -32,9 +32,6 @@ replicate( Ri *ri ) { - int i; - unsigned long seq; - Debug( LDAP_DEBUG_ARGS, "begin replication thread for %s:%d\n", ri->ri_hostname, ri->ri_port, 0 ); diff --git a/servers/slurpd/ri.c b/servers/slurpd/ri.c index 529438e31b..af7a846e45 100644 --- a/servers/slurpd/ri.c +++ b/servers/slurpd/ri.c @@ -46,7 +46,6 @@ Ri_process( { Rq *rq = sglob->rq; Re *re, *new_re; - int i; int rc ; char *errmsg; -- 2.39.5