From: Matthew Howkins Date: Tue, 23 Dec 2014 21:13:17 +0000 (+0000) Subject: libtt: Fix 'Missing return statement' errors detected by static analysis X-Git-Tag: 2.2.3~98 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=caf4929c414b2ec43a12ee28439da75379f2758d;p=oweals%2Fcde.git libtt: Fix 'Missing return statement' errors detected by static analysis --- diff --git a/cde/lib/tt/lib/util/tt_entry_pt.C b/cde/lib/tt/lib/util/tt_entry_pt.C index c084ad7c..81d14142 100644 --- a/cde/lib/tt/lib/util/tt_entry_pt.C +++ b/cde/lib/tt/lib/util/tt_entry_pt.C @@ -457,4 +457,5 @@ _Tt_string _tt_entrypt_to_string(_Tt_entry_pt fun) case TT_API_CALL_LAST: return NULL; #endif } + return (const char *) NULL; } diff --git a/cde/lib/tt/mini_isam/isamaddindex.c b/cde/lib/tt/mini_isam/isamaddindex.c index 781d0532..31610b6f 100644 --- a/cde/lib/tt/mini_isam/isamaddindex.c +++ b/cde/lib/tt/mini_isam/isamaddindex.c @@ -50,7 +50,7 @@ extern int _iskeycmp(); static void _readallrecords(), _attach_dups_serial(); static Blkno _buildbtree(); static int _duplicate_exist(); -static checkavailfd(); +static void checkavailfd(void); /* * _amaddindex(isfhandle, keydesc, errcode) @@ -649,8 +649,8 @@ Static int _duplicate_exist(srt, keylength) -Static -checkavailfd() +static void +checkavailfd(void) { Fcb *fcb; Bytearray *isfhandle2; diff --git a/cde/lib/tt/mini_isam/isbtree2.c b/cde/lib/tt/mini_isam/isbtree2.c index 6b4269cf..d417b2d2 100644 --- a/cde/lib/tt/mini_isam/isbtree2.c +++ b/cde/lib/tt/mini_isam/isbtree2.c @@ -44,15 +44,17 @@ #include "isam_impl.h" extern int _iskeycmp(); -Static insert_key(); + +void leftkey_up(Btree *, int); + +static void insert_key(Btree *, char *, int, char *, Blkno); +static void splitblock(Btree *, char *, char *, int); /* _isbtree_insert() - Insert entry into B-tree ----------------------------*/ void -_isbtree_insert(btree, key) - register Btree *btree; - char *key; +_isbtree_insert(Btree *btree, char *key) { Keydesc2 *pkeydesc2 = btree->keydesc2; int keylength = pkeydesc2->k2_len; @@ -185,9 +187,8 @@ _isbtree_insert(btree, key) /*--------- insert supporting local functions -------------------------------*/ /* leftkey_up() - Update upper levels with new leftmost entry -----------*/ -leftkey_up(btree, level) - register Btree *btree; - int level; +void +leftkey_up(Btree *btree, int level) { int keylength = btree->keydesc2->k2_len; char *pkp; @@ -210,12 +211,8 @@ leftkey_up(btree, level) } /* insert_key - Insert key into block ------------------------*/ -Static insert_key(btree, pkp, pos, key, blkno) - register Btree *btree; - char *pkp; - int pos; - char *key; - Blkno blkno; +static void +insert_key(Btree *btree, char *pkp, int pos, char *key, Blkno blkno) { int keylength = btree->keydesc2->k2_len; int nkeys = ldshort(pkp + BT_NKEYS_OFF); @@ -248,10 +245,8 @@ Static insert_key(btree, pkp, pos, key, blkno) } /* splitblock() - Split block into two -----------------------------*/ -splitblock(btree, fullpage, newpage, pos) - register Btree *btree; - register char *fullpage, *newpage; - int pos; +static void +splitblock(Btree *btree, char *fullpage, char *newpage, int pos) { int keylength = btree->keydesc2->k2_len; int nkeys, capac, level; diff --git a/cde/lib/tt/mini_isam/isbtree3.c b/cde/lib/tt/mini_isam/isbtree3.c index 624e0c72..02f0b6e4 100644 --- a/cde/lib/tt/mini_isam/isbtree3.c +++ b/cde/lib/tt/mini_isam/isbtree3.c @@ -44,13 +44,15 @@ #include "isam_impl.h" extern int _iskeycmp(); -static remove_entry(); + +static void remove_entry(Btree *, char *, int); +static void move_from_right(Btree *, char *, char *, int); +static void move_from_left(Btree *, char *, char *, int); /* _isbtree_remove() - Remove entry from B-tree ----------------------------*/ void -_isbtree_remove(btree) - register Btree *btree; +_isbtree_remove(Btree *btree) { struct keydesc2 *pkeydesc2 = btree->keydesc2; int nkeys; /* Number of keys in the page */ @@ -244,10 +246,8 @@ _isbtree_remove(btree) /*--------- remove supporting local functions -------------------------------*/ -static remove_entry(btree, pkp, pos) - register Btree *btree; - char *pkp; - int pos; +static void +remove_entry(Btree *btree, char *pkp, int pos) { int keylength = btree->keydesc2->k2_len; int nkeys = ldshort(pkp + BT_NKEYS_OFF); @@ -272,10 +272,8 @@ static remove_entry(btree, pkp, pos) stshort((short) (nkeys - 1), pkp + BT_NKEYS_OFF); } -move_from_right(btree, l, r, move_keys) - Btree *btree; - char *l, *r; - int move_keys; +static void +move_from_right(Btree *btree, char *l, char *r, int move_keys) { int keylength = btree->keydesc2->k2_len; int lnkeys = ldshort(l + BT_NKEYS_OFF); @@ -308,10 +306,8 @@ move_from_right(btree, l, r, move_keys) stshort((short) rnkeys, r + BT_NKEYS_OFF); } -move_from_left(btree, l, r, move_keys) - Btree *btree; - char *l, *r; - int move_keys; +static void +move_from_left(Btree *btree, char *l, char *r, int move_keys) { int keylength = btree->keydesc2->k2_len; int lnkeys = ldshort(l + BT_NKEYS_OFF); diff --git a/cde/lib/tt/mini_isam/isdatconv.c b/cde/lib/tt/mini_isam/isdatconv.c index eacbb6a6..3fe0ddb7 100644 --- a/cde/lib/tt/mini_isam/isdatconv.c +++ b/cde/lib/tt/mini_isam/isdatconv.c @@ -154,6 +154,7 @@ ldchar(src, len, dst) } *++p = '\0'; + return 0; } int @@ -177,6 +178,7 @@ stchar(src, dst, len) /* Pad with blanks. */ if (len > 0) (void) memset((void *) dst, BLANK, len); + return 0; } /* ldchar2() - Load character field (C style, NULL padded) */ @@ -195,6 +197,7 @@ ldchar2(src, len, dst) /* Load the entire string. */ memcpy((void *) dst, (const void *) src, len); *(dst + len) = '\0'; + return 0; } int @@ -218,6 +221,7 @@ stchar2(src, dst, len) /* Pad with NULLs. */ if (len > 0) memset(dst, 0, len); + return 0; } /* ldfloat() - Load a float number from a potentially unaligned address */ @@ -288,6 +292,7 @@ stdbl(val, p) register char *p; { memcpy ( p,(char *)&val, DOUBLESIZE); + return 0; } #else /* 386i -- do it the long way round.... */ diff --git a/cde/lib/tt/mini_isam/iserror.c b/cde/lib/tt/mini_isam/iserror.c index 72d32b9f..956ce1a1 100644 --- a/cde/lib/tt/mini_isam/iserror.c +++ b/cde/lib/tt/mini_isam/iserror.c @@ -56,8 +56,7 @@ static char sccsid[] = "@(#)iserror.c 1.10 89/07/17 Copyr 1988 Sun Micro"; static int (*fatal_error_user_handler)(); /* set by iscntl(..,ISCNTL_FATAL,..) */ void -_isfatal_error(msg) - char *msg; +_isfatal_error(char *msg) { int logerr; @@ -83,8 +82,7 @@ _isfatal_error(msg) } void -_isfatal_error1(msg) - char *msg; +_isfatal_error1(char *msg) { extern int _is_rpcnetisamd; /* is 1 if this is rpc.netisamd */ extern int _is_netisamlockd; /* is 1 if this is netisamlockd */ @@ -110,8 +108,8 @@ _isfatal_error1(msg) } } -_isam_warning(msg) - char *msg; +void +_isam_warning(char *msg) { openlog("NetISAM", LOG_PID, LOG_USER); syslog(LOG_ERR, "%s", msg); @@ -136,9 +134,7 @@ int (*_isfatal_error_set_func(func))() */ void -_setiserrno2(error, is1, is2) - int error; - int is1, is2; +_setiserrno2(int error, int is1, int is2) { iserrno = error; isstat1 = is1; @@ -152,8 +148,7 @@ _setiserrno2(error, is1, is2) */ void -_seterr_errcode(errcode) - register struct errcode *errcode; +_seterr_errcode(struct errcode *errcode) { iserrno = errcode->iserrno; isstat1 = errcode->isstat[0]; diff --git a/cde/lib/tt/mini_isam/iskeyconv.c b/cde/lib/tt/mini_isam/iskeyconv.c index 1408166f..a93a907f 100644 --- a/cde/lib/tt/mini_isam/iskeyconv.c +++ b/cde/lib/tt/mini_isam/iskeyconv.c @@ -47,11 +47,12 @@ static char sccsid[] = "@(#)iskeyconv.c 1.4 89/07/17 Copyr 1988 Sun Micro"; * _iskey_itox(pikdesc,pxkdesc) * * Convert internal key desc. to X/OPEN key descriptor. + * + * @param pikdesc NetISAM internal format + * @param pxkdesc X/OPEN format */ - -_iskey_itox(pikdesc,pxkdesc) - register struct keydesc2 *pikdesc; /* NetISAM internal format */ - register struct keydesc *pxkdesc; /* X/OPEN format */ +void +_iskey_itox(struct keydesc2 *pikdesc, struct keydesc *pxkdesc) { int nparts; register int i; @@ -74,11 +75,11 @@ _iskey_itox(pikdesc,pxkdesc) * * Convert X/OPEN key descriptor to internal key descriptor. * + * @param pikdesc NetISAM internal format + * @param pxkdesc X/OPEN format */ - -_iskey_xtoi(pikdesc,pxkdesc) - register struct keydesc2 *pikdesc; /* NetISAM internal format */ - register struct keydesc *pxkdesc; /* X/OPEN format */ +void +_iskey_xtoi(struct keydesc2 *pikdesc, struct keydesc *pxkdesc) { int nparts; register int i; diff --git a/cde/lib/tt/mini_isam/isrepair.c b/cde/lib/tt/mini_isam/isrepair.c index 124a5052..5c046a00 100644 --- a/cde/lib/tt/mini_isam/isrepair.c +++ b/cde/lib/tt/mini_isam/isrepair.c @@ -63,11 +63,12 @@ */ Static char *rp_readrecord_v(), *rp_readrecord_f(); -Static printkey(); -Static cmd_error(); +Static int printkey(int, struct keydesc *, int (*)(const char *, ...)); +Static void cmd_error(const char *, int (*)(const char *, ...)); Static int typeletter(); Static rp_readcntlpg(); static int isnoprintf(const char *, ...); + isrepair(isfname, verbose) char *isfname; int verbose; @@ -400,11 +401,8 @@ isnoprintf(const char *s, ...) return(0); } -static -printkey(n, pkdesc, print) - int n; - struct keydesc *pkdesc; - int (*print)(); +static int +printkey(int n, struct keydesc *pkdesc, int (*print)(const char *, ...)) { int i; struct keypart *pk; @@ -429,12 +427,11 @@ printkey(n, pkdesc, print) (pk->kp_type & ISDESC)?"D":" "); } print("\n"); + return 1; } -static -cmd_error(str,print) - char *str; - int (*print)(); +static void +cmd_error(const char *str, int (*print)(const char *, ...)) { (void)print("%s: ISAM error %d\n", str, iserrno); } diff --git a/cde/lib/tt/mini_isam/issignals.c b/cde/lib/tt/mini_isam/issignals.c index 14608c33..ecaafc3c 100644 --- a/cde/lib/tt/mini_isam/issignals.c +++ b/cde/lib/tt/mini_isam/issignals.c @@ -76,7 +76,8 @@ _issignals_cntl(opt) return (oldmask); } -_issignals_mask() +void +_issignals_mask(void) { if (do_mask && !already_masked) { (void) sigfillset(&allsignals); @@ -89,7 +90,8 @@ _issignals_mask() } } -_issignals_unmask() +void +_issignals_unmask(void) { if (do_mask) { (void)sigprocmask(SIG_SETMASK, &oldmask, NULL);