Factor -type problems into explicit code annotations.

CVS patchset: 5117
CVS date: 2001/10/16 17:42:18
This commit is contained in:
jbj 2001-10-16 17:42:18 +00:00
parent 9f45bcd3ec
commit 96a3f7a55d
46 changed files with 184 additions and 26 deletions

View File

@ -31,7 +31,6 @@
-numenummembers 1024 # RPMTAG has 138 members
-numstructfields 256 # Java jni.h has 229 fields
-ptrarith # tedious
#-sizeoftype # ~240 occurences, <sys/select.h> tedium, more
-strictops
-strictusereleased
-stringliterallen 4096 # redhat*PubKey's are big
@ -59,4 +58,9 @@
# --- not-yet at standard level
-boolops # 1898 occurences
-predboolint # 1248 occurences
-type # 3019 occurences
#-type # 3019 occurences
+boolint
+charint
+ignorequals
+ignoresigns
+matchanyintegral

View File

@ -333,9 +333,9 @@ fprintf(stderr, "%7u %02x %02x %02x -> %02x %02x %02x %02x\n",
*te = '\0';
}
/*@-mustfree@*/
/*@-mustfree -compdef @*/
return t;
/*@=mustfree@*/
/*@=mustfree =compdef @*/
}
/*@=internalglobs =modfilesys @*/

View File

@ -67,6 +67,7 @@ typedef struct
#include "blowfish.h"
#include "blockmode.h"
/*@-type@*/ /* FIX: cast? */
/*@observer@*/ /*@unchecked@*/
static entropySource entropySourceList[] =
{
@ -92,6 +93,7 @@ static entropySource entropySourceList[] =
# endif
#endif
};
/*@=type@*/
#define ENTROPYSOURCES (sizeof(entropySourceList) / sizeof(entropySource))
@ -156,12 +158,14 @@ int entropyGatherNext(uint32* data, int size)
return -1;
}
/*@-type@*/ /* FIX: cast? */
/*@observer@*/ /*@unchecked@*/
static const randomGenerator* randomGeneratorList[] =
{
&fips186prng,
&mtprng
};
/*@=type@*/
#define RANDOMGENERATORS (sizeof(randomGeneratorList) / sizeof(randomGenerator*))
@ -258,6 +262,7 @@ int randomGeneratorContextNext(randomGeneratorContext* ctxt, uint32* data, int s
return ctxt->rng->next(ctxt->param, data, size);
}
/*@-type@*/ /* FIX: cast? */
/*@observer@*/ /*@unchecked@*/
static const hashFunction* hashFunctionList[] =
{
@ -265,6 +270,7 @@ static const hashFunction* hashFunctionList[] =
&sha1,
&sha256
};
/*@=type@*/
#define HASHFUNCTIONS (sizeof(hashFunctionList) / sizeof(hashFunction*))
@ -472,6 +478,7 @@ int hashFunctionContextDigestMatch(hashFunctionContext* ctxt, const mp32number*
/*@=mustfree@*/
}
/*@-type@*/ /* FIX: cast? */
/*@observer@*/ /*@unchecked@*/
static const keyedHashFunction* keyedHashFunctionList[] =
{
@ -479,6 +486,7 @@ static const keyedHashFunction* keyedHashFunctionList[] =
&hmacsha1,
&hmacsha256
};
/*@=type@*/
#define KEYEDHASHFUNCTIONS (sizeof(keyedHashFunctionList) / sizeof(keyedHashFunction*))
@ -708,11 +716,13 @@ int keyedHashFunctionContextDigestMatch(keyedHashFunctionContext* ctxt, const mp
}
/*@-type@*/ /* FIX: cast? */
/*@observer@*/ /*@unchecked@*/
static const blockCipher* blockCipherList[] =
{
&blowfish
};
/*@=type@*/
#define BLOCKCIPHERS (sizeof(blockCipherList) / sizeof(blockCipher*))

View File

@ -1,4 +1,4 @@
/*@-sizeoftype@*/
/*@-sizeoftype -type@*/
/** \ingroup ES_m
* \file entropy.c
*
@ -1610,4 +1610,4 @@ dev_tty_end:
#endif
#endif
/*@=sizeoftype@*/
/*@=sizeoftype =type@*/

View File

@ -33,6 +33,7 @@
const keyedHashFunction hmacmd5 = { "HMAC-MD5", sizeof(hmacmd5Param), 64, 4 * sizeof(uint32), 64, 512, 32, (const keyedHashFunctionSetup) hmacmd5Setup, (const keyedHashFunctionReset) hmacmd5Reset, (const keyedHashFunctionUpdate) hmacmd5Update, (const keyedHashFunctionDigest) hmacmd5Digest };
/*@=sizeoftype@*/
/*@-type@*/
int hmacmd5Setup (hmacmd5Param* sp, const uint32* key, int keybits)
{
return hmacSetup((hmacParam*) sp, &md5, &sp->param, key, keybits);
@ -52,3 +53,4 @@ int hmacmd5Digest(hmacmd5Param* sp, uint32* data)
{
return hmacDigest((hmacParam*) sp, &md5, &sp->param, data);
}
/*@=type@*/

View File

@ -33,6 +33,7 @@
const keyedHashFunction hmacsha1 = { "HMAC-SHA-1", sizeof(hmacsha1Param), 64, 5 * sizeof(uint32), 64, 512, 32, (keyedHashFunctionSetup) hmacsha1Setup, (keyedHashFunctionReset) hmacsha1Reset, (keyedHashFunctionUpdate) hmacsha1Update, (keyedHashFunctionDigest) hmacsha1Digest };
/*@=sizeoftype@*/
/*@-type@*/
int hmacsha1Setup (hmacsha1Param* sp, const uint32* key, int keybits)
{
return hmacSetup((hmacParam*) sp, &sha1, &sp->param, key, keybits);
@ -52,3 +53,4 @@ int hmacsha1Digest(hmacsha1Param* sp, uint32* data)
{
return hmacDigest((hmacParam*) sp, &sha1, &sp->param, data);
}
/*@=type@*/

View File

@ -33,6 +33,7 @@
const keyedHashFunction hmacsha256 = { "HMAC-SHA-256", sizeof(hmacsha256Param), 64, 8 * sizeof(uint32), 64, 512, 32, (keyedHashFunctionSetup) hmacsha256Setup, (keyedHashFunctionReset) hmacsha256Reset, (keyedHashFunctionUpdate) hmacsha256Update, (keyedHashFunctionDigest) hmacsha256Digest };
/*@=sizeoftype@*/
/*@-type@*/
int hmacsha256Setup (hmacsha256Param* sp, const uint32* key, int keybits)
{
return hmacSetup((hmacParam*) sp, &sha256, &sp->param, key, keybits);
@ -52,3 +53,4 @@ int hmacsha256Digest(hmacsha256Param* sp, uint32* data)
{
return hmacDigest((hmacParam*) sp, &sha256, &sp->param, data);
}
/*@=type@*/

View File

@ -1,4 +1,4 @@
/*@-sizeoftype@*/
/*@-sizeoftype -type@*/
/** \ingroup MP_m
* \file mp32barrett.c
*
@ -460,7 +460,9 @@ void mp32bmulmod_w(const mp32barrett* b, uint32 xsize, const uint32* xdata, uint
mp32zero(fill, temp);
mp32mul(temp+fill, xsize, xdata, ysize, ydata);
/*@-compdef@*/ /* *temp undefined */
mp32bmod_w(b, temp, result, wksp);
/*@=compdef@*/
}
/**
@ -478,7 +480,9 @@ void mp32bsqrmod_w(const mp32barrett* b, uint32 xsize, const uint32* xdata, uint
mp32zero(fill, temp);
mp32sqr(temp+fill, xsize, xdata);
/*@-compdef@*/ /* *temp undefined */
mp32bmod_w(b, temp, result, wksp);
/*@=compdef@*/
}
/**
@ -980,7 +984,9 @@ void mp32bnmulmod(const mp32barrett* b, const mp32number* x, const mp32number* y
/* xsize and ysize must be <= b->size */
register uint32 fill = 2*size-x->size-y->size;
/*@-nullptrarith@*/ /* temp may be NULL */
register uint32* opnd = temp+size*2+2;
/*@=nullptrarith@*/
mp32nfree(result);
mp32nsize(result, size);
@ -990,9 +996,9 @@ void mp32bnmulmod(const mp32barrett* b, const mp32number* x, const mp32number* y
mp32mul(opnd+fill, x->size, x->data, y->size, y->data);
/*@-nullpass@*/ /* temp may be NULL */
/*@-usedef@*/ /* result->data unallocated? */
/*@-usedef -compdef @*/ /* result->data unallocated? */
mp32bmod_w(b, opnd, result->data, temp);
/*@=usedef@*/
/*@=usedef =compdef @*/
free(temp);
/*@=nullpass@*/
@ -1005,7 +1011,9 @@ void mp32bnsqrmod(const mp32barrett* b, const mp32number* x, mp32number* result)
/* xsize must be <= b->size */
register uint32 fill = 2*(size-x->size);
/*@-nullptrarith@*/ /* temp may be NULL */
register uint32* opnd = temp + size*2+2;
/*@=nullptrarith@*/
mp32nfree(result);
mp32nsize(result, size);
@ -1015,9 +1023,9 @@ void mp32bnsqrmod(const mp32barrett* b, const mp32number* x, mp32number* result)
mp32sqr(opnd+fill, x->size, x->data);
/*@-nullpass@*/ /* temp may be NULL */
/*@-usedef@*/ /* result->data unallocated? */
/*@-usedef -compdef @*/ /* result->data unallocated? */
mp32bmod_w(b, opnd, result->data, temp);
/*@=usedef@*/
/*@=usedef =compdef @*/
free(temp);
/*@=nullpass@*/
@ -1054,4 +1062,4 @@ void mp32bnpowmodsld(const mp32barrett* b, const uint32* slide, const mp32number
free(temp);
/*@=nullpass@*/
}
/*@=sizeoftype@*/
/*@=sizeoftype =type@*/

View File

@ -145,10 +145,12 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
xfd = fd;
/*@=branchstate@*/
/*@-type@*/ /* FIX: cast? */
if ((fp = fdGetFp(xfd)) == NULL) {
rc = RPMERR_SCRIPT;
goto exit;
}
/*@=type@*/
(void) urlPath(rootURL, &rootDir);
/*@-branchstate@*/

View File

@ -2200,7 +2200,9 @@ static StringBuf getOutputFrom(char * dir, char * argv[],
StringBuf readBuff;
int done;
/*@-type@*/ /* FIX: cast? */
oldhandler = signal(SIGPIPE, SIG_IGN);
/*@=type@*/
toProg[0] = toProg[1] = 0;
(void) pipe(toProg);
@ -2305,7 +2307,9 @@ top:
(void) close(toProg[1]);
if (fromProg[0] >= 0)
(void) close(fromProg[0]);
/*@-type@*/ /* FIX: cast? */
(void) signal(SIGPIPE, oldhandler);
/*@=type@*/
/* Collect status from prog */
(void)waitpid(progPID, &status, 0);

View File

@ -141,7 +141,9 @@ static /*@only@*/ /*@null@*/ StringBuf addFileToTagAux(Spec spec,
sb = freeStringBuf(sb);
return NULL;
}
/*@-type@*/ /* FIX: cast? */
if ((f = fdGetFp(fd)) != NULL)
/*@=type@*/
while (fgets(buf, sizeof(buf), f)) {
/* XXX display fn in error msg */
if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
@ -766,12 +768,14 @@ int packageBinaries(Spec spec)
memset(csa, 0, sizeof(*csa));
csa->cpioArchiveSize = 0;
/*@-type@*/ /* LCL: function typedefs */
csa->cpioFdIn = fdNew("init (packageBinaries)");
csa->cpioList = pkg->cpioList;
rc = writeRPM(&pkg->header, fn, RPMLEAD_BINARY,
csa, spec->passPhrase, NULL);
csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageBinaries)");
/*@=type@*/
fn = _free(fn);
if (rc)
return rc;
@ -803,12 +807,14 @@ int packageSources(Spec spec)
memset(csa, 0, sizeof(*csa));
csa->cpioArchiveSize = 0;
/*@-type@*/ /* LCL: function typedefs */
csa->cpioFdIn = fdNew("init (packageSources)");
csa->cpioList = spec->sourceCpioList;
rc = writeRPM(&spec->sourceHeader, fn, RPMLEAD_SOURCE,
csa, spec->passPhrase, &(spec->cookie));
csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageSources)");
/*@=type@*/
fn = _free(fn);
}
return rc;

View File

@ -203,7 +203,9 @@ retry:
/* Make sure we have something in the read buffer */
if (!(ofi->readPtr && *(ofi->readPtr))) {
/*@-type@*/ /* FIX: cast? */
FILE * f = fdGetFp(ofi->fd);
/*@=type@*/
if (f == NULL || !fgets(ofi->readBuf, BUFSIZ, f)) {
/* EOF */
if (spec->readStack->next) {

View File

@ -159,9 +159,9 @@ Package freePackage(Package pkg)
pkg->fileList = freeStringBuf(pkg->fileList);
pkg->fileFile = _free(pkg->fileFile);
if (pkg->cpioList) {
TFI_t fi = pkg->cpioList;
void * fi = pkg->cpioList;
pkg->cpioList = NULL;
freeFi(fi);
/*@i@*/ freeFi((TFI_t)fi);
fi = _free(fi);
}
@ -505,9 +505,9 @@ Spec freeSpec(Spec spec)
spec->sourceHeader = headerFree(spec->sourceHeader);
if (spec->sourceCpioList) {
TFI_t fi = spec->sourceCpioList;
void * fi = spec->sourceCpioList;
spec->sourceCpioList = NULL;
freeFi(fi);
/*@i@*/ freeFi(fi);
fi = _free(fi);
}

View File

@ -193,8 +193,10 @@ static void alFree(availableList al)
}
p->relocs = _free(p->relocs);
}
/*@-type@*/ /* FIX: cast? */
if (p->fd != NULL)
p->fd = fdFree(p->fd, "alAddPackage (alFree)");
/*@=type@*/
}
if (al->dirs != NULL)
@ -398,7 +400,9 @@ alAddPackage(availableList al,
}
p->key = key;
/*@-type@*/ /* FIX: cast? */
p->fd = (fd != NULL ? fdLink(fd, "alAddPackage") : NULL);
/*@=type@*/
if (relocs) {
for (i = 0, r = relocs; r->oldPath || r->newPath; i++, r++)
@ -933,9 +937,11 @@ rpmTransactionSet rpmtransFree(rpmTransactionSet ts)
ts->di = _free(ts->di);
ts->removedPackages = _free(ts->removedPackages);
ts->order = _free(ts->order);
/*@-type@*/ /* FIX: cast? */
if (ts->scriptFd != NULL)
ts->scriptFd =
fdFree(ts->scriptFd, "rpmtransSetScriptFd (rpmtransFree");
/*@=type@*/
ts->rootDir = _free(ts->rootDir);
ts->currDir = _free(ts->currDir);

View File

@ -591,6 +591,7 @@ static int groupTag(Header h, /*@out@*/ rpmTagType * type,
return i18nTag(h, RPMTAG_GROUP, type, data, count, freeData);
}
/*@-type@*/ /* FIX: cast? */
const struct headerSprintfExtension_s rpmHeaderFormats[] = {
{ HEADER_EXT_TAG, "RPMTAG_GROUP", { groupTag } },
{ HEADER_EXT_TAG, "RPMTAG_DESCRIPTION", { descriptionTag } },
@ -611,3 +612,4 @@ const struct headerSprintfExtension_s rpmHeaderFormats[] = {
{ HEADER_EXT_FORMAT, "triggertype", { triggertypeFormat } },
{ HEADER_EXT_MORE, NULL, { (void *) headerDefaultFormats } }
} ;
/*@=type@*/

View File

@ -478,7 +478,9 @@ int fsmSetup(FSM_t fsm, fileStage goal,
fsm->goal = goal;
if (cfd) {
/*@-type@*/ /* FIX: cast? */
fsm->cfd = fdLink(cfd, "persist (fsm)");
/*@=type@*/
pos = fdGetCpioPos(fsm->cfd);
fdSetCpioPos(fsm->cfd, 0);
}
@ -486,10 +488,12 @@ int fsmSetup(FSM_t fsm, fileStage goal,
if (fsm->goal == FSM_PKGINSTALL) {
if (ts && ts->notify) {
/*@-type@*/ /* FIX: cast? */
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_START, 0, fi->archiveSize,
(fi->ap ? fi->ap->key : NULL), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
}
@ -529,7 +533,9 @@ int fsmTeardown(FSM_t fsm) {
fsm->iter = mapFreeIterator(fsm->iter);
if (fsm->cfd) {
/*@-type@*/ /* FIX: cast? */
fsm->cfd = fdFree(fsm->cfd, "persist (fsm)");
/*@=type@*/
fsm->cfd = NULL;
}
fsm->failedFile = NULL;
@ -857,10 +863,12 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
TFI_t fi = fsmGetFi(fsm);
if (ts && ts->notify && fi) {
size_t size = (fdGetCpioPos(fsm->cfd) - pos);
/*@-type@*/ /* FIX: cast? */
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS, size, size,
(fi->ap ? fi->ap->key : NULL), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
}
@ -1633,11 +1641,13 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
rpmTransactionSet ts = fsmGetTs(fsm);
TFI_t fi = fsmGetFi(fsm);
if (ts && ts->notify && fi) {
/*@-type@*/ /* FIX: cast? */
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS,
fdGetCpioPos(fsm->cfd), fi->archiveSize,
(fi->ap ? fi->ap->key : NULL), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
}
break;

View File

@ -1,3 +1,4 @@
/*@-type@*/ /* FIX: cast to HV_t bogus */
#ifndef H_HDRINLINE
#define H_HDRINLINE
@ -492,3 +493,4 @@ int headerNextIterator(HeaderIterator hi,
#endif
#endif /* H_HDRINLINE */
/*@=type@*/

View File

@ -1117,8 +1117,10 @@ Header headerRead(FD_t fd, enum hMagic magicp)
if (magicp == HEADER_MAGIC_YES)
i += 2;
/*@-type@*/ /* FIX: cast? */
if (timedRead(fd, (char *)block, i*sizeof(*block)) != (i * sizeof(*block)))
goto exit;
/*@=type@*/
i = 0;
@ -1143,8 +1145,10 @@ Header headerRead(FD_t fd, enum hMagic magicp)
ei[1] = htonl(dl);
len -= sizeof(il) + sizeof(dl);
/*@-type@*/ /* FIX: cast? */
if (timedRead(fd, (char *)&ei[2], len) != len)
goto exit;
/*@=type@*/
h = headerLoad(ei);
@ -2986,6 +2990,7 @@ static char * shescapeFormat(int_32 type, hPTR_t data,
return result;
}
/*@-type@*/ /* FIX: cast? */
const struct headerSprintfExtension_s headerDefaultFormats[] = {
{ HEADER_EXT_FORMAT, "octal", { octalFormat } },
{ HEADER_EXT_FORMAT, "hex", { hexFormat } },
@ -2994,6 +2999,7 @@ const struct headerSprintfExtension_s headerDefaultFormats[] = {
{ HEADER_EXT_FORMAT, "shescape", { shescapeFormat } },
{ HEADER_EXT_LAST, NULL, { NULL } }
};
/*@=type@*/
/** \ingroup header
* Duplicate tag values from one header into another.

View File

@ -28,6 +28,7 @@ char ** headerGetLangs(Header h)
/*@-nullret@*/ return table; /*@=nullret@*/ /* LCL: double indirection? */
}
/*@-type@*/ /* FIX: shrug */
void headerDump(Header h, FILE *f, int flags,
const struct headerTagTableEntry_s * tags)
{
@ -165,4 +166,5 @@ void headerDump(Header h, FILE *f, int flags,
p++;
}
}
/*@=type@*/
/*@=sizeoftype@*/

View File

@ -161,9 +161,11 @@ int headerGetRawEntry(Header h, int_32 tag,
* @param h header
* @return no. of references
*/
/*@-type@*/ /* FIX: cast? */
/*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
return h->nrefs;
}
/*@=type@*/
/** \ingroup header
* Dump a header in human readable format (for debugging).

View File

@ -67,7 +67,9 @@ int rpmReadPackageManifest(FD_t fd, int * argcPtr, const char *** argvPtr)
const char ** av = NULL;
int argc = (argcPtr ? *argcPtr : 0);
const char ** argv = (argvPtr ? *argvPtr : NULL);
/*@-type@*/ /* FIX: cast? */
FILE * f = fdGetFp(fd);
/*@=type@*/
int rc = 0;
int i;

View File

@ -461,11 +461,13 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
fileNames = xmalloc(size);
data = ((char *) fileNames) + (sizeof(*fileNames) * count);
/*@-branchstate@*/
for (i = 0; i < count; i++) {
fileNames[i] = data;
data = stpcpy( stpcpy(data, dirNames[dirIndexes[i]]), baseNames[i]);
*data++ = '\0';
}
/*@=branchstate@*/
baseNames = hfd(baseNames, bnt);
dirNames = hfd(dirNames, dnt);

View File

@ -127,11 +127,13 @@ static void buildArgCallback( /*@unused@*/ poptContext con,
/**
*/
/*@-bitwisesigned -compmempass@*/
/*@-bitwisesigned -compmempass @*/
/*@unchecked@*/
struct poptOption rpmBuildPoptTable[] = {
/*@-type@*/ /* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
buildArgCallback, 0, NULL, NULL },
/*@=type@*/
{ "bp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BP,
N_("build through %prep (unpack sources and apply patches) from <specfile>"),
@ -218,4 +220,4 @@ struct poptOption rpmBuildPoptTable[] = {
POPT_TABLEEND
};
/*@=bitwisesigned =compmempass@*/
/*@=bitwisesigned =compmempass @*/

View File

@ -87,11 +87,13 @@ static void installArgCallback( /*@unused@*/ poptContext con,
/**
*/
/*@-bitwisesigned -compmempass@*/
/*@-bitwisesigned -compmempass @*/
/*@unchecked@*/
struct poptOption rpmInstallPoptTable[] = {
/*@-type@*/ /* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
installArgCallback, 0, NULL, NULL },
/*@=type@*/
{ "allfiles", '\0', POPT_BIT_SET,
&rpmIArgs.transFlags, RPMTRANS_FLAG_ALLFILES,
@ -220,4 +222,4 @@ struct poptOption rpmInstallPoptTable[] = {
POPT_TABLEEND
};
/*@=bitwisesigned =compmempass@*/
/*@=bitwisesigned =compmempass @*/

View File

@ -48,8 +48,10 @@ static void signArgCallback( /*@unused@*/ poptContext con,
*/
/*@unchecked@*/
struct poptOption rpmSignPoptTable[] = {
/*@-type@*/ /* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
signArgCallback, 0, NULL, NULL },
/*@=type@*/
{ "addsign", '\0', 0, 0, POPT_ADDSIGN,
N_("add a signature to a package"), NULL },
{ "resign", '\0', 0, 0, POPT_RESIGN,

View File

@ -70,8 +70,10 @@ static void rpmQVSourceArgCallback( /*@unused@*/ poptContext con,
*/
/*@unchecked@*/
struct poptOption rpmQVSourcePoptTable[] = {
/*@-type@*/ /* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
rpmQVSourceArgCallback, 0, NULL, NULL },
/*@=type@*/
{ "all", 'a', 0, 0, 'a',
N_("query/verify all packages"), NULL },
{ "file", 'f', 0, 0, 'f',
@ -150,8 +152,10 @@ static void queryArgCallback(/*@unused@*/poptContext con,
*/
/*@unchecked@*/
struct poptOption rpmQueryPoptTable[] = {
/*@-type@*/ /* FIX: cast? */
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
queryArgCallback, 0, NULL, NULL },
/*@=type@*/
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQVSourcePoptTable, 0,
NULL, NULL },
{ "configfiles", 'c', 0, 0, 'c',

View File

@ -58,8 +58,10 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags,
}
if (fnp)
*fnp = fn;
/*@-type@*/ /* FIX: cast? */
*fdp = fdLink(fd, "manageFile return");
fdFree(fd, "manageFile return");
/*@=type@*/
return 0;
}
@ -86,14 +88,18 @@ static int copyFile(FD_t *sfdp, const char **sfnp,
if (manageFile(tfdp, tfnp, O_WRONLY|O_CREAT|O_TRUNC, 0))
goto exit;
/*@-type@*/ /* FIX: cast? */
if (dig != NULL) {
dig->md5ctx = rpmDigestInit(RPMDIGEST_MD5);
(void) fdInitSHA1(*sfdp, 0);
}
/*@=type@*/
while ((count = Fread(buffer, sizeof(buffer[0]), sizeof(buffer), *sfdp)) > 0) {
/*@-type@*/ /* FIX: cast? */
if (dig)
rpmDigestUpdate(dig->md5ctx, buffer, count);
/*@=type@*/
if (Fwrite(buffer, sizeof(buffer[0]), count, *tfdp) != count) {
rpmError(RPMERR_FWRITE, _("%s: Fwrite failed: %s\n"), *tfnp,
@ -106,11 +112,13 @@ static int copyFile(FD_t *sfdp, const char **sfnp,
goto exit;
}
/*@-type@*/ /* FIX: cast? */
if (dig != NULL) {
dig->sha1ctx = _free(dig->sha1ctx);
dig->sha1ctx = (*sfdp)->digest;
(*sfdp)->digest = NULL;
}
/*@=type@*/
rc = 0;
@ -345,6 +353,7 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char ** argv)
if (rpmIsVerbose())
fprintf(stderr, "========================= Package RSA Signature\n");
(void) pgpPrtPkts(ptr, count, dig, rpmIsVerbose());
/*@-type@*/ /* FIX: cast? */
{ DIGEST_CTX ctx = rpmDigestDup(dig->md5ctx);
rpmDigestUpdate(ctx, &dig->sig.v3.sigtype, dig->sig.v3.hashlen);
@ -352,6 +361,7 @@ fprintf(stderr, "========================= Package RSA Signature\n");
/* XXX compare leading 16 bits of digest for quick check. */
}
/*@=type@*/
/* XXX retrieve by keyid from signature. */
if (pgppk == NULL) {
(void) b64decode(redhatPubKeyRSA, (void **)&pgppk, &pgppklen);
@ -388,11 +398,13 @@ fprintf(stderr, "========================= Red Hat RSA Public Key\n");
if (rpmIsVerbose())
fprintf(stderr, "========================= Package DSA Signature\n");
(void) pgpPrtPkts(ptr, count, dig, rpmIsVerbose());
/*@-type@*/ /* FIX: cast? */
{ DIGEST_CTX ctx = rpmDigestDup(dig->sha1ctx);
rpmDigestUpdate(ctx, &dig->sig.v3.sigtype, dig->sig.v3.hashlen);
rpmDigestFinal(ctx, (void **)&dig->sha1, &dig->sha1len, 1);
mp32nzero(&dig->hm); mp32nsethex(&dig->hm, dig->sha1);
}
/*@=type@*/
/* XXX retrieve by keyid from signature. */
if (gpgpk == NULL) {
(void) b64decode(redhatPubKeyDSA, (void **)&gpgpk, &gpgpklen);

View File

@ -92,13 +92,17 @@ void * rpmShowProgress(/*@null@*/ const void * arg,
if (filename == NULL || filename[0] == '\0')
return NULL;
fd = Fopen(filename, "r.ufdio");
/*@-type@*/ /* FIX: still necessary? */
if (fd)
fd = fdLink(fd, "persist (showProgress)");
/*@=type@*/
return fd;
/*@notreached@*/ break;
case RPMCALLBACK_INST_CLOSE_FILE:
/*@-type@*/ /* FIX: still necessary? */
fd = fdFree(fd, "persist (showProgress)");
/*@=type@*/
if (fd) {
(void) Fclose(fd);
fd = NULL;

View File

@ -45,11 +45,13 @@ int writeLead(FD_t fd, const struct rpmlead *lead)
int readLead(FD_t fd, struct rpmlead *lead)
{
memset(lead, 0, sizeof(*lead));
/*@-type@*/ /* FIX: remove timed read */
if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) {
rpmError(RPMERR_READ, _("read failed: %s (%d)\n"), Fstrerror(fd),
errno);
return 1;
}
/*@=type@*/
lead->type = ntohs(lead->type);
lead->archnum = ntohs(lead->archnum);

View File

@ -161,8 +161,10 @@ rpmRC rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
case RPMSIGTYPE_PGP262_1024:
rpmMessage(RPMMESS_DEBUG, _("Old PGP signature\n"));
/* These are always 256 bytes */
/*@-type@*/ /* FIX: eliminate timedRead @*/
if (timedRead(fd, buf, 256) != 256)
break;
/*@=type@*/
h = headerNew();
(void) headerAddEntry(h, RPMSIGTAG_PGP, RPM_BIN_TYPE, buf, 152);
rc = RPMRC_OK;
@ -193,8 +195,10 @@ rpmRC rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
break;
rc = checkSize(fd, sigSize, pad, *archSize);
}
/*@-type@*/ /* FIX: eliminate timedRead @*/
if (pad && timedRead(fd, buf, pad) != pad)
rc = RPMRC_SHORTREAD;
/*@=type@*/
break;
default:
break;
@ -318,7 +322,9 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
int rc = 0;
fd = Fopen(sigfile, "r.fdio");
if (fd != NULL && !Ferror(fd)) {
/*@-type@*/ /* FIX: eliminate timedRead @*/
rc = timedRead(fd, *sig, *size);
/*@=type@*/
if (sigfile) (void) unlink(sigfile);
(void) Fclose(fd);
}
@ -402,7 +408,9 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
int rc = 0;
fd = Fopen(sigfile, "r.fdio");
if (fd != NULL && !Ferror(fd)) {
/*@-type@*/ /* FIX: eliminate timedRead @*/
rc = timedRead(fd, *sig, *size);
/*@=type@*/
if (sigfile) (void) unlink(sigfile);
(void) Fclose(fd);
}
@ -537,6 +545,7 @@ verifyPGPSignature(const char * datafile, const byte * sig, int count,
pgpVersion pgpVer;
int rc;
/*@-type@*/
rc = rsavrfy(&dig->rsa_pk, &dig->rsahm, &dig->c);
if (rc == 0 || rpmIsVerbose()) {
@ -549,6 +558,7 @@ fprintf(stderr, "=============================== RSA verify %s: rc %d\n",
printf("\t c = "); (void)fflush(stdout); mp32println(dig->c.size, dig->c.data);
printf("\t m = "); (void)fflush(stdout); mp32println(dig->rsahm.size, dig->rsahm.data);
}
/*@=type@*/
/* What version do we have? */
if ((path = rpmDetectPGPVersion(&pgpVer)) == NULL) {
@ -680,6 +690,7 @@ verifyGPGSignature(const char * datafile, const byte * sig, int count,
int res = RPMSIG_OK;
int rc;
/*@-type@*/
rc = dsavrfy(&dig->p, &dig->q, &dig->g, &dig->hm,
&dig->y, &dig->r, &dig->s);
@ -696,6 +707,7 @@ fprintf(stderr, "=============================== DSA verify %s: rc %d\n",
printf("\t s = "); (void)fflush(stdout); mp32println(dig->s.size, dig->s.data);
printf("\thm = "); (void)fflush(stdout); mp32println(dig->hm.size, dig->hm.data);
}
/*@=type@*/
/* Write out the signature */
#ifdef DYING

View File

@ -99,7 +99,9 @@ static /*@null@*/ void * freeFl(rpmTransactionSet ts,
void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd)
{
/*@-type@*/ /* FIX: cast? */
ts->scriptFd = (fd ? fdLink(fd, "rpmtransSetScriptFd") : NULL);
/*@=type@*/
}
int rpmtransGetKeys(const rpmTransactionSet ts, const void *** ep, int * nep)
@ -1409,7 +1411,7 @@ static void skipFiles(const rpmTransactionSet ts, TFI_t fi)
*/
if (fi->flangs && languages && *fi->flangs[i]) {
const char **lang, *l, *le;
for (lang = languages; *lang != '\0'; lang++) {
for (lang = languages; *lang != NULL; lang++) {
if (!strcmp(*lang, "all"))
/*@innerbreak@*/ break;
for (l = fi->flangs[i]; *l != '\0'; l = le) {

View File

@ -284,8 +284,10 @@ int rpmVerifyScript(const char * rootDir, Header h, /*@null@*/ FD_t scriptFd)
PSM_t psm = &psmbuf;
int rc;
/*@-type@*/ /* FIX: cast? */
if (scriptFd != NULL)
ts->scriptFd = fdLink(scriptFd, "rpmVerifyScript");
/*@=type@*/
fi->magic = TFIMAGIC;
loadFi(h, fi);
memset(psm, 0, sizeof(*psm));
@ -369,7 +371,9 @@ static int verifyHeader(QVA_t qva, Header h)
int count;
int_32 * fileFlags = NULL;
rpmVerifyAttrs verifyResult = 0;
/*@-type@*/ /* FIX: union? */
rpmVerifyAttrs omitMask = ((qva->qva_flags & VERIFY_ATTRS) ^ VERIFY_ATTRS);
/*@=type@*/
int ec = 0; /* assume no problems */
int i;
@ -488,6 +492,7 @@ static int verifyDependencies(rpmdb db, Header h)
int nb = 512;
(void) headerNVR(h, &n, &v, &r);
/*@-type@*/ /* FIX: rpmDependencyConflict usage */
for (i = 0; i < numConflicts; i++) {
nb += strlen(conflicts[i].needsName) + sizeof(", ") - 1;
if (conflicts[i].needsFlags)
@ -511,6 +516,8 @@ static int verifyDependencies(rpmdb db, Header h)
}
}
conflicts = rpmdepFreeConflicts(conflicts, numConflicts);
/*@=type@*/
if (te > t) {
*te++ = '\n';
*te = '\0';

View File

@ -9,10 +9,6 @@
#ifndef H_POPT
#define H_POPT
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h> /* for FILE * */
#define POPT_OPTION_DEPTH 10
@ -184,6 +180,11 @@ enum poptCallbackReason { POPT_CALLBACK_REASON_PRE,
POPT_CALLBACK_REASON_POST,
POPT_CALLBACK_REASON_OPTION };
#ifdef __cplusplus
extern "C" {
#endif
/*@-type@*/
/** \ingroup popt
* Table callback prototype.
* @param con context
@ -437,6 +438,7 @@ int poptStrippedArgv(poptContext con, int argc, char ** argv)
/*@modifies *argv @*/;
/*@=fcnuse@*/
/*@=type@*/
#ifdef __cplusplus
}
#endif

View File

@ -13,7 +13,9 @@
static void configLine(poptContext con, char * line)
/*@modifies con @*/
{
/*@-type@*/
int nameLength = strlen(con->appName);
/*@=type@*/
const char * entryType;
const char * opt;
poptItem item = alloca(sizeof(*item));
@ -21,7 +23,10 @@ static void configLine(poptContext con, char * line)
memset(item, 0, sizeof(*item));
/*@-type@*/
if (strncmp(line, con->appName, nameLength)) return;
/*@=type@*/
line += nameLength;
if (*line == '\0' || !isspace(*line)) return;
@ -151,7 +156,9 @@ int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv) {
char * fn, * home;
int rc;
/*@-type@*/
if (!con->appName) return 0;
/*@=type@*/
rc = poptReadConfigFile(con, "/etc/popt");
if (rc) return rc;

View File

@ -1,5 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*@-type@*/
/** \ingroup popt
* \file popt/popthelp.c
*/
@ -650,3 +651,4 @@ void poptSetOtherOptionHelp(poptContext con, const char * text)
con->otherHelp = _free(con->otherHelp);
con->otherHelp = xstrdup(text);
}
/*@=type@*/

View File

@ -1,3 +1,4 @@
/*@-type@*/ /* FIX: shrug */
/** \ingroup db1
* \file rpmdb/db1.c
*/
@ -620,3 +621,4 @@ struct _dbiVec db1vec = {
db1ccount, db1byteswapped, db1stat
};
/*@=exportheadervar@*/
/*@=type@*/

View File

@ -1,3 +1,4 @@
/*@-type@*/ /* FIX: annotate db3 methods */
/** \ingroup db3
* \file rpmdb/db3.c
*/
@ -1229,3 +1230,4 @@ struct _dbiVec db3vec = {
db3ccount, db3byteswapped, db3stat
};
/*@=exportheadervar@*/
/*@=type@*/

View File

@ -60,7 +60,9 @@ FD_t fadOpen(const char * path, int flags, mode_t perms)
if (flags & O_WRONLY)
return NULL;
/*@-type@*/ /* FIX: cast? */
fd = ufdio->_open(path, flags, perms);
/*@=type@*/
if (Ferror(fd))
/* XXX Fstrerror */
return NULL;

View File

@ -1796,7 +1796,9 @@ int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
case RPMMIRE_STRCMP:
break;
case RPMMIRE_REGEX:
/*@-type@*/
preg = xcalloc(1, sizeof(*preg));
/*@=type@*/
cflags = (REG_EXTENDED | REG_NOSUB);
rc = regcomp(preg, allpat, cflags);
if (rc) {

View File

@ -55,9 +55,11 @@ rpmDigestInit(rpmDigestFlags flags)
/*@-sizeoftype@*/ /* FIX: union, not void pointer */
ctx->param = xcalloc(1, sizeof(md5Param));
/*@=sizeoftype@*/
/*@-type@*/ /* FIX: cast? */
ctx->Reset = (void *) md5Reset;
ctx->Update = (void *) md5Update;
ctx->Digest = (void *) md5Digest;
/*@=type@*/
}
if (flags & RPMDIGEST_SHA1) {
@ -66,9 +68,11 @@ rpmDigestInit(rpmDigestFlags flags)
/*@-sizeoftype@*/ /* FIX: union, not void pointer */
ctx->param = xcalloc(1, sizeof(sha1Param));
/*@=sizeoftype@*/
/*@-type@*/ /* FIX: cast? */
ctx->Reset = (void *) sha1Reset;
ctx->Update = (void *) sha1Update;
ctx->Digest = (void *) sha1Digest;
/*@=type@*/
}
/*@-noeffectuncon@*/ /* FIX: check rc */

View File

@ -1,3 +1,4 @@
/*@-type@*/ /* LCL: function typedefs */
/** \ingroup rpmio
* \file rpmio/rpmio.c
*/
@ -3063,3 +3064,4 @@ static struct FDIO_s fpio_s = {
ufdOpen, NULL, fdGetFp, NULL, Mkdir, Chdir, Rmdir, Rename, Unlink
};
FDIO_t fpio = /*@-compmempass@*/ &fpio_s /*@=compmempass@*/ ;
/*@=type@*/

View File

@ -808,7 +808,9 @@ printf("\t y = "), mp32println(_dig->y.size, _dig->y.data);
/*@innerbreak@*/ break;
case 0x03:
pgpPrtVal(" iterated/salted ", pgpHashTbl, p[2]);
/*@-shiftsigned@*/ /* FIX: unsigned cast */
i = (16 + (p[11] & 0xf)) << ((p[11] >> 4) + 6);
/*@=shiftsigned@*/
pgpPrtHex("", p+3, 8);
pgpPrtInt(" iter", i);
p += 11;

View File

@ -914,7 +914,7 @@ int pgpLen(const byte *s, /*@out@*/ unsigned int *lenp)
(*lenp) = *s++;
return 1;
} else if (*s < 255) {
(*lenp) = ((s[0] - 192) << 8) + s[1] + 192;
(*lenp) = ((((unsigned)s[0]) - 192) << 8) + s[1] + 192;
return 2;
} else {
(*lenp) = pgpGrab(s+1, 4);

View File

@ -1,3 +1,4 @@
/*@-type@*/ /* LCL: function typedefs */
/** \ingroup rpmio
* \file rpmio/rpmrpc.c
*/
@ -1230,3 +1231,4 @@ fprintf(stderr, "*** Closedir(%p)\n", (void *)dir);
return closedir(dir);
}
/*@=voidabstract@*/
/*@=type@*/

View File

@ -1,3 +1,4 @@
/*@-type@*/ /* LCL: function typedefs */
/** \ingroup rpmio
* \file rpmio/url.c
*/
@ -547,3 +548,4 @@ exit:
return rc;
}
/*@=type@*/

View File

@ -384,8 +384,10 @@ int main(int argc, const char ** argv)
/* XXX Eliminate query linkage loop */
specedit = 0;
/*@-type@*/ /* FIX: casts? */
parseSpecVec = parseSpec;
freeSpecVec = freeSpec;
/*@=type@*/
/* set up the correct locale */
(void) setlocale(LC_ALL, "" );