From: Hallvard Furuseth Date: Wed, 11 Nov 1998 23:37:38 +0000 (+0000) Subject: Fix most `wider type truncated to int' bugs on OSF1 due to implicit decls: X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~1132 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=523fd2c891cfdbd318642b20a105adb4b2f9149c;p=openldap Fix most `wider type truncated to int' bugs on OSF1 due to implicit decls: #include to get malloc & co various places, #include to get strlen & co in (liblutil/setproctitle.c), declare ch_malloc & co (slurp.h), avl_find_lin (avl.h), Malloc (ud/edit.c). Also changed ch_malloc & co from char* to void* functions. --- diff --git a/clients/fax500/main.c b/clients/fax500/main.c index 61ff681f07..7288e941a8 100644 --- a/clients/fax500/main.c +++ b/clients/fax500/main.c @@ -13,6 +13,7 @@ #include "portable.h" #include +#include #include #include diff --git a/clients/mail500/main.c b/clients/mail500/main.c index 0a117ce432..ef0e90006a 100644 --- a/clients/mail500/main.c +++ b/clients/mail500/main.c @@ -13,6 +13,7 @@ #include "portable.h" #include +#include #include #include diff --git a/clients/ud/edit.c b/clients/ud/edit.c index f8a094361a..a7e1d92e72 100644 --- a/clients/ud/edit.c +++ b/clients/ud/edit.c @@ -26,6 +26,7 @@ #include #include #include "ud.h" +extern void *Malloc(); extern struct entry Entry; extern int verbose; diff --git a/include/avl.h b/include/avl.h index eb8b8836fc..c9dc9b2a25 100644 --- a/include/avl.h +++ b/include/avl.h @@ -57,6 +57,9 @@ avl_delete LDAP_P((Avlnode **, caddr_t, IFP)); LDAP_F caddr_t avl_find LDAP_P((Avlnode *, caddr_t, IFP)); +LDAP_F caddr_t +avl_find_lin LDAP_P((Avlnode *, caddr_t, IFP)); + LDAP_F caddr_t avl_getfirst LDAP_P((Avlnode *)); diff --git a/libraries/libldif/line64.c b/libraries/libldif/line64.c index 2761ec5e0b..9c91a41530 100644 --- a/libraries/libldif/line64.c +++ b/libraries/libldif/line64.c @@ -3,6 +3,7 @@ #include "portable.h" #include +#include #include #include diff --git a/libraries/liblutil/setproctitle.c b/libraries/liblutil/setproctitle.c index b2a590b612..d0da848040 100644 --- a/libraries/liblutil/setproctitle.c +++ b/libraries/liblutil/setproctitle.c @@ -3,6 +3,7 @@ #ifndef HAVE_SETPROCTITLE #include +#include #if defined( HAVE_STDARG_H ) && __STDC__ #include diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 1aa2392395..e4fa388fa9 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -22,7 +22,6 @@ #include "slap.h" extern char **charray_dup(); -extern char *ch_malloc(); extern int errno; void diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 9839a542c1..6b73e802b7 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -17,7 +17,6 @@ extern pthread_mutex_t currenttime_mutex; extern IDList *idl_alloc(); extern Attribute *attr_find(); extern IDList *filter_candidates(); -extern char *ch_realloc(); extern char *dn_parent(); static IDList *base_candidates(); diff --git a/servers/slapd/ch_malloc.c b/servers/slapd/ch_malloc.c index 9ce0ed80ec..519720e238 100644 --- a/servers/slapd/ch_malloc.c +++ b/servers/slapd/ch_malloc.c @@ -9,14 +9,14 @@ #include "slap.h" -char * +void * ch_malloc( unsigned long size ) { - char *new; + void *new; - if ( (new = (char *) malloc( size )) == NULL ) { + if ( (new = (void *) malloc( size )) == NULL ) { Debug( LDAP_DEBUG_ANY, "malloc of %d bytes failed\n", size, 0, 0 ); exit( 1 ); } @@ -24,19 +24,19 @@ ch_malloc( return( new ); } -char * +void * ch_realloc( - char *block, + void *block, unsigned long size ) { - char *new; + void *new; if ( block == NULL ) { return( ch_malloc( size ) ); } - if ( (new = (char *) realloc( block, size )) == NULL ) { + if ( (new = (void *) realloc( block, size )) == NULL ) { Debug( LDAP_DEBUG_ANY, "realloc of %d bytes failed\n", size, 0, 0 ); exit( 1 ); } @@ -44,15 +44,15 @@ ch_realloc( return( new ); } -char * +void * ch_calloc( unsigned long nelem, unsigned long size ) { - char *new; + void *new; - if ( (new = (char *) calloc( nelem, size )) == NULL ) { + if ( (new = (void *) calloc( nelem, size )) == NULL ) { Debug( LDAP_DEBUG_ANY, "calloc of %d elems of %d bytes failed\n", nelem, size, 0 ); exit( 1 ); diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index f408e68383..4f76fa55b9 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -13,8 +13,6 @@ static int get_filter_list(); static int get_substring_filter(); extern int get_ava(); -extern char *ch_malloc(); -extern char *ch_realloc(); int get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr ) diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index a1f32ac54e..ef402878e0 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -63,9 +63,9 @@ void be_close LDAP_P(()); * ch_malloc.c */ -char * ch_malloc LDAP_P(( unsigned long size )); -char * ch_realloc LDAP_P(( char *block, unsigned long size )); -char * ch_calloc LDAP_P(( unsigned long nelem, unsigned long size )); +void * ch_malloc LDAP_P(( unsigned long size )); +void * ch_realloc LDAP_P(( void *block, unsigned long size )); +void * ch_calloc LDAP_P(( unsigned long nelem, unsigned long size )); /* * charray.c diff --git a/servers/slapd/repl.c b/servers/slapd/repl.c index 4450be5866..d47d754f57 100644 --- a/servers/slapd/repl.c +++ b/servers/slapd/repl.c @@ -18,7 +18,6 @@ extern char *replogfile; extern FILE *lock_fopen(); extern int lock_fclose(); -extern char *ch_malloc(); extern char *entry2str(); void @@ -81,7 +80,7 @@ replog( len = strlen( mods->mod_type ); len = LDIF_SIZE_NEEDED( len, mods->mod_bvalues[i]->bv_len ) + 1; - buf = ch_malloc( len ); + buf = (char *) ch_malloc( len ); bufp = buf; put_type_and_value( &bufp, mods->mod_type, diff --git a/servers/slapd/tools/centipede.c b/servers/slapd/tools/centipede.c index 266b26bad9..487dd70778 100644 --- a/servers/slapd/tools/centipede.c +++ b/servers/slapd/tools/centipede.c @@ -3,6 +3,7 @@ #include "portable.h" #include +#include #include #include diff --git a/servers/slapd/tools/chlog2replog.c b/servers/slapd/tools/chlog2replog.c index 85a9433bab..f76884643b 100644 --- a/servers/slapd/tools/chlog2replog.c +++ b/servers/slapd/tools/chlog2replog.c @@ -34,7 +34,7 @@ static void de_t61(); extern FILE *lock_fopen( char *, char *, FILE ** ); extern int lock_fclose( FILE *, FILE * ); -extern char *ch_realloc( char *, unsigned long ); +extern void *ch_realloc( void *, unsigned long ); short ldap_dn_syntax; PS rps; diff --git a/servers/slapd/tools/ldif.c b/servers/slapd/tools/ldif.c index 6f68b77d72..0668eddbcd 100644 --- a/servers/slapd/tools/ldif.c +++ b/servers/slapd/tools/ldif.c @@ -1,6 +1,7 @@ #include "portable.h" #include +#include #include #include diff --git a/servers/slurpd/ch_malloc.c b/servers/slurpd/ch_malloc.c index d23bfbeb01..cf3b79c0b9 100644 --- a/servers/slurpd/ch_malloc.c +++ b/servers/slurpd/ch_malloc.c @@ -28,14 +28,14 @@ * Just like malloc, except we check the returned value and exit * if anything goes wrong. */ -char * +void * ch_malloc( unsigned long size ) { - char *new; + void *new; - if ( (new = (char *) malloc( size )) == NULL ) { + if ( (new = (void *) malloc( size )) == NULL ) { fprintf( stderr, "malloc of %lu bytes failed\n", size ); exit( 1 ); } @@ -50,19 +50,19 @@ ch_malloc( * Just like realloc, except we check the returned value and exit * if anything goes wrong. */ -char * +void * ch_realloc( - char *block, + void *block, unsigned long size ) { - char *new; + void *new; if ( block == NULL ) { return( ch_malloc( size ) ); } - if ( (new = (char *) realloc( block, size )) == NULL ) { + if ( (new = (void *) realloc( block, size )) == NULL ) { fprintf( stderr, "realloc of %lu bytes failed\n", size ); exit( 1 ); } @@ -77,15 +77,15 @@ ch_realloc( * Just like calloc, except we check the returned value and exit * if anything goes wrong. */ -char * +void * ch_calloc( unsigned long nelem, unsigned long size ) { - char *new; + void *new; - if ( (new = (char *) calloc( nelem, size )) == NULL ) { + if ( (new = (void *) calloc( nelem, size )) == NULL ) { fprintf( stderr, "calloc of %lu elems of %lu bytes failed\n", nelem, size ); exit( 1 ); @@ -100,7 +100,7 @@ ch_calloc( */ void ch_free( - char *p + void *p ) { if ( p != NULL ) { diff --git a/servers/slurpd/globals.c b/servers/slurpd/globals.c index 7e2c7081bf..ba13dd2000 100644 --- a/servers/slurpd/globals.c +++ b/servers/slurpd/globals.c @@ -17,6 +17,7 @@ #include "portable.h" #include +#include #include "slurp.h" #include "globals.h" diff --git a/servers/slurpd/ldap_op.c b/servers/slurpd/ldap_op.c index 29dddb55ba..36ee80be89 100644 --- a/servers/slurpd/ldap_op.c +++ b/servers/slurpd/ldap_op.c @@ -47,9 +47,6 @@ static int do_bind LDAP_P(( Ri *, int * )); static int do_unbind LDAP_P(( Ri * )); -/* External references */ -extern char *ch_malloc LDAP_P(( unsigned long )); - static char *kattrs[] = {"kerberosName", NULL }; static struct timeval kst = {30L, 0L}; diff --git a/servers/slurpd/re.c b/servers/slurpd/re.c index e2250c72a2..f568f07df4 100644 --- a/servers/slurpd/re.c +++ b/servers/slurpd/re.c @@ -33,7 +33,6 @@ /* externs */ extern char *str_getline LDAP_P(( char **next )); -extern void ch_free LDAP_P(( char *p )); /* Forward references */ static Rh *get_repl_hosts LDAP_P(( char *, int *, char ** )); diff --git a/servers/slurpd/replog.c b/servers/slurpd/replog.c index 732f3cf520..b6b6004960 100644 --- a/servers/slurpd/replog.c +++ b/servers/slurpd/replog.c @@ -36,7 +36,6 @@ * Externs */ extern FILE *lock_fopen LDAP_P(( char *, char *, FILE ** )); -extern char *ch_malloc LDAP_P(( unsigned long )); /* * Forward declarations diff --git a/servers/slurpd/ri.c b/servers/slurpd/ri.c index 964410235a..40aa0f9045 100644 --- a/servers/slurpd/ri.c +++ b/servers/slurpd/ri.c @@ -20,6 +20,7 @@ #include "portable.h" #include +#include #include #include "slurp.h" diff --git a/servers/slurpd/rq.c b/servers/slurpd/rq.c index e34572797b..783b15ba2d 100644 --- a/servers/slurpd/rq.c +++ b/servers/slurpd/rq.c @@ -34,6 +34,7 @@ #include "portable.h" #include +#include #include "slurp.h" #include "globals.h" diff --git a/servers/slurpd/slurp.h b/servers/slurpd/slurp.h index f9e4ff567c..971fd485af 100644 --- a/servers/slurpd/slurp.h +++ b/servers/slurpd/slurp.h @@ -333,6 +333,13 @@ typedef struct tsl { } tsl_t; #endif /* HAVE_LWP */ +/* Public functions */ + +/* In ch_malloc.c */ +void * ch_malloc LDAP_P(( unsigned long size )); +void * ch_realloc LDAP_P(( void *block, unsigned long size )); +void * ch_calloc LDAP_P(( unsigned long nelem, unsigned long size )); +void ch_free LDAP_P(( void *p )); /* @@ -345,4 +352,3 @@ extern int Re_init LDAP_P(( Re **re )); LDAP_END_DECL #endif /* _SLURPD_H_ */ - diff --git a/servers/slurpd/st.c b/servers/slurpd/st.c index db5035a1f4..3d50e80ce4 100644 --- a/servers/slurpd/st.c +++ b/servers/slurpd/st.c @@ -19,6 +19,7 @@ #include "portable.h" #include +#include #include #include