diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c
index 1cebe171d4..03c5143794 100644
--- a/clients/tools/ldapdelete.c
+++ b/clients/tools/ldapdelete.c
@@ -33,6 +33,7 @@ static int dodelete LDAP_P((
LDAP *ld,
char *dn));
+int
main( argc, argv )
int argc;
char **argv;
diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c
index 9e8546248d..074c5259e7 100644
--- a/clients/tools/ldapmodify.c
+++ b/clients/tools/ldapmodify.c
@@ -69,6 +69,7 @@ static int fromfile LDAP_P(( char *path, struct berval *bv ));
static char *read_one_record LDAP_P(( FILE *fp ));
+int
main( int argc, char **argv )
{
char *infile, *rbuf, *start, *p, *q;
diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c
index bbfead056c..e8e71473e0 100644
--- a/clients/tools/ldapmodrdn.c
+++ b/clients/tools/ldapmodrdn.c
@@ -35,6 +35,7 @@ static int domodrdn LDAP_P((
char *rdn,
int remove)); /* flag: remove old RDN */
+int
main( argc, argv )
int argc;
char **argv;
diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c
index cc9d7f1567..d7411e86bb 100644
--- a/clients/tools/ldapsearch.c
+++ b/clients/tools/ldapsearch.c
@@ -86,6 +86,7 @@ static char *sortattr = NULL;
static int skipsortattr = 0;
static int verbose, not, includeufn, allow_binary, vals2tmp, ldif;
+int
main( argc, argv )
int argc;
char **argv;
diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c
index 0b49037b71..b7606e3d4f 100644
--- a/libraries/liblber/decode.c
+++ b/libraries/liblber/decode.c
@@ -43,7 +43,7 @@ ber_get_tag( BerElement *ber )
unsigned char xbyte;
unsigned long tag;
char *tagp;
- int i;
+ unsigned int i;
if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 )
return( LBER_DEFAULT );
@@ -386,8 +386,8 @@ va_dcl
char *s, **ss, ***sss;
struct berval ***bv, **bvp, *bval;
int *i, j;
- long *l, rc, tag;
- unsigned long len;
+ long *l;
+ unsigned long rc, tag, len;
#if defined( HAVE_STDARG_H ) && __STDC__
va_start( ap, fmt );
diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c
index 4f41a8a2cd..884c63ebd2 100644
--- a/libraries/liblber/io.c
+++ b/libraries/liblber/io.c
@@ -439,7 +439,7 @@ get_tag( Sockbuf *sb )
unsigned char xbyte;
unsigned long tag;
char *tagp;
- int i;
+ unsigned int i;
if ( BerRead( sb, (char *) &xbyte, 1 ) != 1 )
return( LBER_DEFAULT );
diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c
index 04d9f255a7..c8b0d3e8a0 100644
--- a/libraries/libldap/error.c
+++ b/libraries/libldap/error.c
@@ -127,7 +127,7 @@ ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit )
LDAPMessage *lm;
BerElement ber;
long along;
- int rc;
+ unsigned long rc;
Debug( LDAP_DEBUG_TRACE, "ldap_result2error\n", 0, 0, 0 );
diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c
index 2e48818fb1..2ac502bd84 100644
--- a/libraries/libldap/options.c
+++ b/libraries/libldap/options.c
@@ -28,7 +28,7 @@ ldap_get_option(
if(ldp == NULL) {
ld = &openldap_ld_globals;
} else {
- ld = ld;
+ ld = ldp;
}
switch(option) {
@@ -136,7 +136,7 @@ ldap_set_option(
if(ldp == NULL) {
ld = &openldap_ld_globals;
} else {
- ld = ld;
+ ld = ldp;
}
switch(option) {
diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c
index 21adc27287..6714209e2b 100644
--- a/libraries/libldap/result.c
+++ b/libraries/libldap/result.c
@@ -30,7 +30,7 @@ static int wait4msg LDAP_P(( LDAP *ld, int msgid, int all, struct timeval *timeo
#ifdef LDAP_REFERRALS
static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc,
LDAPMessage **result ));
-static int build_result_ber LDAP_P(( LDAP *ld, BerElement *ber, LDAPRequest *lr ));
+static unsigned long build_result_ber LDAP_P(( LDAP *ld, BerElement *ber, LDAPRequest *lr ));
static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));
#else /* LDAP_REFERRALS */
static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb,
@@ -512,7 +512,7 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
#ifdef LDAP_REFERRALS
-static int
+static unsigned long
build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr )
{
unsigned long len;
@@ -523,7 +523,7 @@ build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr )
if ( ber_printf( ber, "{it{ess}}", lr->lr_msgid,
(long)lr->lr_res_msgtype, lr->lr_res_errno,
lr->lr_res_matched ? lr->lr_res_matched : "",
- lr->lr_res_error ? lr->lr_res_error : "" ) == LBER_ERROR ) {
+ lr->lr_res_error ? lr->lr_res_error : "" ) == -1 ) {
return( LBER_ERROR );
}
diff --git a/libraries/libldap/sort.c b/libraries/libldap/sort.c
index a0137b0605..7e7eb17447 100644
--- a/libraries/libldap/sort.c
+++ b/libraries/libldap/sort.c
@@ -30,7 +30,7 @@ struct entrything {
};
static int (*et_cmp_fn) LDAP_P(( char *a, char *b ));
-static int et_cmp LDAP_P(( void *aa, void *bb));
+static int et_cmp LDAP_P(( const void *aa, const void *bb));
int
@@ -44,13 +44,13 @@ ldap_sort_strcasecmp(
static int
et_cmp(
- void *aa,
- void *bb
+ const void *aa,
+ const void *bb
)
{
int i, rc;
- struct entrything *a = (struct entrything *)aa;
- struct entrything *b = (struct entrything *)bb;
+ const struct entrything *a = (const struct entrything *)aa;
+ const struct entrything *b = (const struct entrything *)bb;
if ( a->et_vals == NULL && b->et_vals == NULL )
return( 0 );
diff --git a/libraries/libldap/tmplout.c b/libraries/libldap/tmplout.c
index 4eac35344f..bd5aaca124 100644
--- a/libraries/libldap/tmplout.c
+++ b/libraries/libldap/tmplout.c
@@ -195,7 +195,7 @@ do_entry2text(
sprintf( buf + strlen( buf ),
"%s\">Move Up To %s%s
",
( vals[ 1 ] == NULL ) ? "??one" : "",
- ( untagged != NULL ) ? untagged + 1 : vals[ 1 ], eol, eol );
+ ( untagged != NULL ) ? untagged + 1 : vals[ 1 ], eol );
(*writeproc)( writeparm, buf, strlen( buf ));
/*
diff --git a/libraries/libldbm/ldbm.c b/libraries/libldbm/ldbm.c
index df3bb6d57c..23e6f842f9 100644
--- a/libraries/libldbm/ldbm.c
+++ b/libraries/libldbm/ldbm.c
@@ -414,7 +414,8 @@ ldbm_datum_dup( LDBM ldbm, Datum data )
return( dup );
}
dup.dsize = data.dsize;
- if ( dup.dptr = (char *) malloc( data.dsize ) )
+ dup.dptr = (char *) malloc( data.dsize );
+ if ( dup.dptr )
memcpy( dup.dptr, data.dptr, data.dsize );
return( dup );
diff --git a/libraries/libldif/line64.c b/libraries/libldif/line64.c
index ba72e01532..2761ec5e0b 100644
--- a/libraries/libldif/line64.c
+++ b/libraries/libldif/line64.c
@@ -187,7 +187,7 @@ str_getline( char **next )
*(*next)++ = '\0';
break;
}
- *(*next)++;
+ (*next)++;
}
return( l );
@@ -215,7 +215,7 @@ put_type_and_value( char **out, char *t, char *val, int vlen )
b64 = 0;
stop = (unsigned char *) (val + vlen);
- if ( isascii( val[0] ) && isspace( val[0] ) || val[0] == ':' ) {
+ if ( isascii( val[0] ) && (isspace( val[0] ) || val[0] == ':') ) {
b64 = 1;
} else {
for ( byte = (unsigned char *) val; byte < stop;
diff --git a/libraries/liblutil/base64.c b/libraries/liblutil/base64.c
index 6f4b88fe8d..a2c27a1ff9 100644
--- a/libraries/liblutil/base64.c
+++ b/libraries/liblutil/base64.c
@@ -48,6 +48,7 @@
#include
#include
+#include
#include
@@ -209,7 +210,7 @@ b64_pton(
tarindex = 0;
while ((ch = *src++) != '\0') {
- if (isspace(ch)) /* Skip whitespace anywhere. */
+ if (isascii(ch) && isspace(ch)) /* Skip whitespace anywhere. */
continue;
if (ch == Pad64)
@@ -279,7 +280,7 @@ b64_pton(
case 2: /* Valid, means one byte of info */
/* Skip any number of spaces. */
for ((void)NULL; ch != '\0'; ch = *src++)
- if (!isspace(ch))
+ if (! (isascii(ch) && isspace(ch)))
break;
/* Make sure there is another trailing = sign. */
if (ch != Pad64)
@@ -294,7 +295,7 @@ b64_pton(
* whitespace after it?
*/
for ((void)NULL; ch != '\0'; ch = *src++)
- if (!isspace(ch))
+ if (! (isascii(ch) && isspace(ch)))
return (-1);
/*