More lclint annotations.

CVS patchset: 5116
CVS date: 2001/10/16 14:58:57
This commit is contained in:
jbj 2001-10-16 14:58:57 +00:00
parent cafccc0058
commit 9f45bcd3ec
61 changed files with 705 additions and 553 deletions

View File

@ -1,7 +1,7 @@
-I. -I./build -I./lib -I./rpmdb -I./rpmio -I./beecrypt -I./popt -I/usr/lib/gcc-lib/i386-redhat-linux/2.96/include -DHAVE_CONFIG_H -D_GNU_SOURCE -D_REENTRANT -DHAVE_DEV_DSP -DHAVE_SYS_SOUNDCARD -I. -I./build -I./lib -I./rpmdb -I./rpmio -I./beecrypt -I./popt -I/usr/lib/gcc-lib/i386-redhat-linux/2.96/include -DHAVE_CONFIG_H -D_GNU_SOURCE -D_REENTRANT -DHAVE_DEV_DSP -DHAVE_SYS_SOUNDCARD
#+partial #+partial
+forcehints #+forcehints
-warnunixlib -warnunixlib
-warnposix -warnposix
@ -28,15 +28,14 @@
-matchfields # <bits/ipc.h> heartburn -matchfields # <bits/ipc.h> heartburn
-mods # 281 occurences, errno will be a pita -mods # 281 occurences, errno will be a pita
-namechecks # tedious ANSI compliance checks -namechecks # tedious ANSI compliance checks
-noeffectuncon # 228 occurences, HGE_t needs special annotations
-numenummembers 1024 # RPMTAG has 138 members -numenummembers 1024 # RPMTAG has 138 members
-numstructfields 256 # Java jni.h has 229 fields -numstructfields 256 # Java jni.h has 229 fields
-ptrarith # tedious -ptrarith # tedious
-sizeoftype # ~240 occurences, <sys/select.h> tedium, more #-sizeoftype # ~240 occurences, <sys/select.h> tedium, more
-strictops -strictops
-strictusereleased -strictusereleased
-stringliterallen 4096 # redhat*PubKey's are big -stringliterallen 4096 # redhat*PubKey's are big
-usedef # 303 occurences, HGE_t needs special annotations -usedef # 303 occurences, HGE_t needs work
-whileblock # tedious -whileblock # tedious
# --- random anal-retentive parameters # --- random anal-retentive parameters
@ -45,8 +44,6 @@
#+internalglobnoglobs # ??? #+internalglobnoglobs # ???
#+modglobsunchecked # 73 occurences #+modglobsunchecked # 73 occurences
#+warnmissingglobsnomods # ??? #+warnmissingglobsnomods # ???
#+impcheckedstrictglobs # 358 occurences
#+impcheckedstrictstatics # 1057 occurences
#+strictbranchstate #+strictbranchstate
#+strictdestroy #+strictdestroy
#+ansi-reserved-internal #+ansi-reserved-internal

View File

@ -1,3 +1,4 @@
/*@-sizeoftype@*/
/** /**
* \file beecrypt.c * \file beecrypt.c
* *
@ -846,3 +847,4 @@ BOOL WINAPI DllMain(HINSTANCE hInst, DWORD wDataSeg, LPVOID lpReserved)
return TRUE; return TRUE;
} }
#endif #endif
/*@=sizeoftype@*/

View File

@ -324,7 +324,9 @@ static const blockMode blowfishModes[2] =
{ /* CBC */ (blockModeEncrypt) blowfishCBCEncrypt, (blockModeDecrypt) blowfishCBCDecrypt } { /* CBC */ (blockModeEncrypt) blowfishCBCEncrypt, (blockModeDecrypt) blowfishCBCDecrypt }
}; };
/*@-sizeoftype@*/
const blockCipher blowfish = { "Blowfish", sizeof(blowfishParam), 8, 64, 448, 32, (blockCipherSetup) blowfishSetup, (blockCipherSetIV) blowfishSetIV, (blockCipherEncrypt) blowfishEncrypt, (blockCipherDecrypt) blowfishDecrypt, blowfishModes }; const blockCipher blowfish = { "Blowfish", sizeof(blowfishParam), 8, 64, 448, 32, (blockCipherSetup) blowfishSetup, (blockCipherSetIV) blowfishSetIV, (blockCipherEncrypt) blowfishEncrypt, (blockCipherDecrypt) blowfishDecrypt, blowfishModes };
/*@=sizeoftype@*/
int blowfishSetup(blowfishParam* bp, const uint32* key, int keybits, /*@unused@*/ cipherOperation op) int blowfishSetup(blowfishParam* bp, const uint32* key, int keybits, /*@unused@*/ cipherOperation op)
{ {
@ -336,8 +338,8 @@ int blowfishSetup(blowfishParam* bp, const uint32* key, int keybits, /*@unused@*
uint32 work[2]; uint32 work[2];
memcpy(p, _bf_p, BLOWFISHPSIZE * sizeof(uint32)); memcpy(p, _bf_p, BLOWFISHPSIZE * sizeof(*p));
memcpy(s, _bf_s, 1024 * sizeof(uint32)); memcpy(s, _bf_s, 1024 * sizeof(*s));
if ((keybits & 31) == 0) if ((keybits & 31) == 0)
{ {

View File

@ -327,7 +327,9 @@ memchunk* dhaes_pContextDecrypt(dhaes_pContext* ctxt, const mp32number* ephemera
goto decrypt_end; goto decrypt_end;
/* decrypt the memchunk with CBC mode */ /* decrypt the memchunk with CBC mode */
/*@-sizeoftype@*/
paddedtext = (memchunk*) calloc(1, sizeof(memchunk)); paddedtext = (memchunk*) calloc(1, sizeof(memchunk));
/*@=sizeoftype@*/
if (paddedtext == (memchunk*) 0) if (paddedtext == (memchunk*) 0)
goto decrypt_end; goto decrypt_end;

View File

@ -100,7 +100,7 @@ static int dldp_pValidate(const dldp_p* dp, randomGeneratorContext* rgc)
/*@*/ /*@*/
{ {
register uint32 size = dp->p.size; register uint32 size = dp->p.size;
register uint32* temp = (uint32*) malloc((8*size+2) * sizeof(uint32)); register uint32* temp = (uint32*) malloc((8*size+2) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -185,7 +185,7 @@ int dldp_pgoqMake(dldp_p* dp, randomGeneratorContext* rgc, uint32 psize, uint32
* Generate parameters as described by IEEE P1363, A.16.1 * Generate parameters as described by IEEE P1363, A.16.1
*/ */
register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -221,7 +221,7 @@ int dldp_pgoqMakeSafe(dldp_p* dp, randomGeneratorContext* rgc, uint32 psize)
* *
*/ */
register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -280,7 +280,7 @@ int dldp_pgoqGenerator_w(dldp_p* dp, randomGeneratorContext* rgc, uint32* wksp)
int dldp_pgoqGenerator(dldp_p* dp, randomGeneratorContext* rgc) int dldp_pgoqGenerator(dldp_p* dp, randomGeneratorContext* rgc)
{ {
register uint32 size = dp->p.size; register uint32 size = dp->p.size;
register uint32* temp = (uint32*) malloc((4*size+2)*sizeof(uint32)); register uint32* temp = (uint32*) malloc((4*size+2) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -315,7 +315,7 @@ int dldp_pgonMake(dldp_p* dp, randomGeneratorContext* rgc, uint32 psize, uint32
* Generate parameters with a prime p such that p = qr+1, with q prime, and r = 2s, with s prime * Generate parameters with a prime p such that p = qr+1, with q prime, and r = 2s, with s prime
*/ */
register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -348,7 +348,7 @@ int dldp_pgonMakeSafe(dldp_p* dp, randomGeneratorContext* rgc, uint32 psize)
* Generate parameters with a safe prime; i.e. p = 2q+1, where q is prime * Generate parameters with a safe prime; i.e. p = 2q+1, where q is prime
*/ */
register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -446,7 +446,7 @@ int dldp_pgonGenerator_w(dldp_p* dp, randomGeneratorContext* rgc, uint32* wksp)
int dldp_pgonGenerator(dldp_p* dp, randomGeneratorContext* rgc) int dldp_pgonGenerator(dldp_p* dp, randomGeneratorContext* rgc)
{ {
register uint32 psize = dp->p.size; register uint32 psize = dp->p.size;
register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp));
if (temp) if (temp)
{ {

View File

@ -65,10 +65,10 @@ int dsasign(const mp32barrett* p, const mp32barrett* q, const mp32number* g, ran
register uint32* qtemp; register uint32* qtemp;
register int rc = -1; /* assume failure */ register int rc = -1; /* assume failure */
ptemp = (uint32*) malloc((5*psize+2)*sizeof(uint32)); ptemp = (uint32*) malloc((5*psize+2) * sizeof(*ptemp));
if (ptemp == NULL) if (ptemp == NULL)
return rc; return rc;
qtemp = (uint32*) malloc((9*qsize+6)*sizeof(uint32)); qtemp = (uint32*) malloc((9*qsize+6) * sizeof(*qtemp));
if (qtemp == NULL) { if (qtemp == NULL) {
free(ptemp); free(ptemp);
return rc; return rc;
@ -144,11 +144,11 @@ int dsavrfy(const mp32barrett* p, const mp32barrett* q, const mp32number* g, con
if (mp32gex(s->size, s->data, qsize, q->modl)) if (mp32gex(s->size, s->data, qsize, q->modl))
return rc; return rc;
ptemp = (uint32*) malloc((6*psize+2)*sizeof(uint32)); ptemp = (uint32*) malloc((6*psize+2) * sizeof(*ptemp));
if (ptemp == NULL) if (ptemp == NULL)
return rc; return rc;
qtemp = (uint32*) malloc((8*qsize+6)*sizeof(uint32)); qtemp = (uint32*) malloc((8*qsize+6) * sizeof(*qtemp));
if (qtemp == NULL) { if (qtemp == NULL) {
free(ptemp); free(ptemp);
return rc; return rc;

View File

@ -70,7 +70,7 @@
int elgv1sign(const mp32barrett* p, const mp32barrett* n, const mp32number* g, randomGeneratorContext* rgc, const mp32number* hm, const mp32number* x, mp32number* r, mp32number* s) int elgv1sign(const mp32barrett* p, const mp32barrett* n, const mp32number* g, randomGeneratorContext* rgc, const mp32number* hm, const mp32number* x, mp32number* r, mp32number* s)
{ {
register uint32 size = p->size; register uint32 size = p->size;
register uint32* temp = (uint32*) malloc((8*size+6)*sizeof(uint32)); register uint32* temp = (uint32*) malloc((8*size+6) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -121,7 +121,7 @@ int elgv1vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number* g, c
if (mp32gex(s->size, s->data, n->size, n->modl)) if (mp32gex(s->size, s->data, n->size, n->modl))
return 0; return 0;
temp = (uint32*) malloc((6*size+2)*sizeof(uint32)); temp = (uint32*) malloc((6*size+2) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -151,7 +151,7 @@ int elgv1vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number* g, c
int elgv3sign(const mp32barrett* p, const mp32barrett* n, const mp32number* g, randomGeneratorContext* rgc, const mp32number* hm, const mp32number* x, mp32number* r, mp32number* s) int elgv3sign(const mp32barrett* p, const mp32barrett* n, const mp32number* g, randomGeneratorContext* rgc, const mp32number* hm, const mp32number* x, mp32number* r, mp32number* s)
{ {
register uint32 size = p->size; register uint32 size = p->size;
register uint32* temp = (uint32*) malloc((6*size+2)*sizeof(uint32)); register uint32* temp = (uint32*) malloc((6*size+2) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -198,7 +198,7 @@ int elgv3vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number* g, c
if (mp32gex(s->size, s->data, n->size, n->modl)) if (mp32gex(s->size, s->data, n->size, n->modl))
return 0; return 0;
temp = (uint32*) malloc((6*size+2)*sizeof(uint32)); temp = (uint32*) malloc((6*size+2) * sizeof(*temp));
if (temp) if (temp)
{ {

View File

@ -1,3 +1,4 @@
/*@-sizeoftype@*/
/** \ingroup ES_m /** \ingroup ES_m
* \file entropy.c * \file entropy.c
* *
@ -1345,10 +1346,10 @@ int entropy_dev_dsp(uint32 *data, int size)
if (mutex_lock(&dev_dsp_lock)) if (mutex_lock(&dev_dsp_lock))
return -1; return -1;
# elif HAVE_PTHREAD_H # elif HAVE_PTHREAD_H
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */
if (pthread_mutex_lock(&dev_dsp_lock)) if (pthread_mutex_lock(&dev_dsp_lock))
return -1; return -1;
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
# endif # endif
#endif #endif
@ -1456,9 +1457,9 @@ dev_dsp_end:
# if HAVE_SYNCH_H # if HAVE_SYNCH_H
mutex_unlock(&dev_dsp_lock); mutex_unlock(&dev_dsp_lock);
# elif HAVE_PTHREAD_H # elif HAVE_PTHREAD_H
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */
(void) pthread_mutex_unlock(&dev_dsp_lock); (void) pthread_mutex_unlock(&dev_dsp_lock);
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
# endif # endif
#endif #endif
@ -1480,10 +1481,10 @@ int entropy_dev_random(uint32* data, int size)
if (mutex_lock(&dev_random_lock)) if (mutex_lock(&dev_random_lock))
return -1; return -1;
# elif HAVE_PTHREAD_H # elif HAVE_PTHREAD_H
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */
if (pthread_mutex_lock(&dev_random_lock)) if (pthread_mutex_lock(&dev_random_lock))
return -1; return -1;
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
# endif # endif
#endif #endif
@ -1505,9 +1506,9 @@ dev_random_end:
# if HAVE_SYNCH_H # if HAVE_SYNCH_H
mutex_unlock(&dev_random_lock); mutex_unlock(&dev_random_lock);
# elif HAVE_PTHREAD_H # elif HAVE_PTHREAD_H
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */
(void) pthread_mutex_unlock(&dev_random_lock); (void) pthread_mutex_unlock(&dev_random_lock);
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
# endif # endif
#endif #endif
return rc; return rc;
@ -1528,10 +1529,10 @@ int entropy_dev_urandom(uint32* data, int size)
if (mutex_lock(&dev_urandom_lock)) if (mutex_lock(&dev_urandom_lock))
return -1; return -1;
# elif HAVE_PTHREAD_H # elif HAVE_PTHREAD_H
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */
if (pthread_mutex_lock(&dev_urandom_lock)) if (pthread_mutex_lock(&dev_urandom_lock))
return -1; return -1;
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
# endif # endif
#endif #endif
@ -1553,9 +1554,9 @@ dev_urandom_end:
# if HAVE_SYNCH_H # if HAVE_SYNCH_H
mutex_unlock(&dev_urandom_lock); mutex_unlock(&dev_urandom_lock);
# elif HAVE_PTHREAD_H # elif HAVE_PTHREAD_H
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */
(void) pthread_mutex_unlock(&dev_urandom_lock); (void) pthread_mutex_unlock(&dev_urandom_lock);
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
# endif # endif
#endif #endif
return rc; return rc;
@ -1574,10 +1575,10 @@ int entropy_dev_tty(uint32* data, int size)
if (mutex_lock(&dev_tty_lock)) if (mutex_lock(&dev_tty_lock))
return -1; return -1;
# elif HAVE_PTHREAD_H # elif HAVE_PTHREAD_H
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */
if (pthread_mutex_lock(&dev_tty_lock)) if (pthread_mutex_lock(&dev_tty_lock))
return -1; return -1;
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
# endif # endif
#endif #endif
@ -1598,9 +1599,9 @@ dev_tty_end:
# if HAVE_SYNCH_H # if HAVE_SYNCH_H
mutex_unlock(&dev_tty_lock); mutex_unlock(&dev_tty_lock);
# elif HAVE_PTHREAD_H # elif HAVE_PTHREAD_H
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */
(void) pthread_mutex_unlock(&dev_tty_lock); (void) pthread_mutex_unlock(&dev_tty_lock);
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
# endif # endif
#endif #endif
@ -1609,3 +1610,4 @@ dev_tty_end:
#endif #endif
#endif #endif
/*@=sizeoftype@*/

View File

@ -44,7 +44,9 @@ static const uint32 k[4] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 };
/*@observer@*/ /*@unchecked@*/ /*@observer@*/ /*@unchecked@*/
static const uint32 hinit[5] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 }; static const uint32 hinit[5] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 };
/*@-sizeoftype@*/
const hashFunction sha1 = { "SHA-1", sizeof(sha1Param), 64, 5 * sizeof(uint32), (hashFunctionReset) sha1Reset, (hashFunctionUpdate) sha1Update, (hashFunctionDigest) sha1Digest }; const hashFunction sha1 = { "SHA-1", sizeof(sha1Param), 64, 5 * sizeof(uint32), (hashFunctionReset) sha1Reset, (hashFunctionUpdate) sha1Update, (hashFunctionDigest) sha1Digest };
/*@=sizeoftype@*/
int sha1Reset(register sha1Param *p) int sha1Reset(register sha1Param *p)
{ {

View File

@ -43,7 +43,9 @@
/*@observer@*/ /*@unchecked@*/ /*@observer@*/ /*@unchecked@*/
static uint32 fips186hinit[5] = { 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0, 0x67452301 }; static uint32 fips186hinit[5] = { 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0, 0x67452301 };
/*@-sizeoftype@*/
const randomGenerator fips186prng = { "FIPS 186", sizeof(fips186Param), (const randomGeneratorSetup) fips186Setup, (const randomGeneratorSeed) fips186Seed, (const randomGeneratorNext) fips186Next, (const randomGeneratorCleanup) fips186Cleanup }; const randomGenerator fips186prng = { "FIPS 186", sizeof(fips186Param), (const randomGeneratorSetup) fips186Setup, (const randomGeneratorSeed) fips186Seed, (const randomGeneratorNext) fips186Next, (const randomGeneratorCleanup) fips186Cleanup };
/*@=sizeoftype@*/
/** /**
*/ */

View File

@ -29,7 +29,9 @@
#include "hmacmd5.h" #include "hmacmd5.h"
/*@-sizeoftype@*/
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 }; 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@*/
int hmacmd5Setup (hmacmd5Param* sp, const uint32* key, int keybits) int hmacmd5Setup (hmacmd5Param* sp, const uint32* key, int keybits)
{ {

View File

@ -29,7 +29,9 @@
#include "hmacsha1.h" #include "hmacsha1.h"
/*@-sizeoftype@*/
const keyedHashFunction hmacsha1 = { "HMAC-SHA-1", sizeof(hmacsha1Param), 64, 5 * sizeof(uint32), 64, 512, 32, (keyedHashFunctionSetup) hmacsha1Setup, (keyedHashFunctionReset) hmacsha1Reset, (keyedHashFunctionUpdate) hmacsha1Update, (keyedHashFunctionDigest) hmacsha1Digest }; const keyedHashFunction hmacsha1 = { "HMAC-SHA-1", sizeof(hmacsha1Param), 64, 5 * sizeof(uint32), 64, 512, 32, (keyedHashFunctionSetup) hmacsha1Setup, (keyedHashFunctionReset) hmacsha1Reset, (keyedHashFunctionUpdate) hmacsha1Update, (keyedHashFunctionDigest) hmacsha1Digest };
/*@=sizeoftype@*/
int hmacsha1Setup (hmacsha1Param* sp, const uint32* key, int keybits) int hmacsha1Setup (hmacsha1Param* sp, const uint32* key, int keybits)
{ {

View File

@ -29,7 +29,9 @@
#include "hmacsha256.h" #include "hmacsha256.h"
/*@-sizeoftype@*/
const keyedHashFunction hmacsha256 = { "HMAC-SHA-256", sizeof(hmacsha256Param), 64, 8 * sizeof(uint32), 64, 512, 32, (keyedHashFunctionSetup) hmacsha256Setup, (keyedHashFunctionReset) hmacsha256Reset, (keyedHashFunctionUpdate) hmacsha256Update, (keyedHashFunctionDigest) hmacsha256Digest }; const keyedHashFunction hmacsha256 = { "HMAC-SHA-256", sizeof(hmacsha256Param), 64, 8 * sizeof(uint32), 64, 512, 32, (keyedHashFunctionSetup) hmacsha256Setup, (keyedHashFunctionReset) hmacsha256Reset, (keyedHashFunctionUpdate) hmacsha256Update, (keyedHashFunctionDigest) hmacsha256Digest };
/*@=sizeoftype@*/
int hmacsha256Setup (hmacsha256Param* sp, const uint32* key, int keybits) int hmacsha256Setup (hmacsha256Param* sp, const uint32* key, int keybits)
{ {

View File

@ -36,7 +36,9 @@
/*@observer@*/ /*@unchecked@*/ /*@observer@*/ /*@unchecked@*/
static uint32 md5hinit[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }; static uint32 md5hinit[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 };
/*@-sizeoftype@*/
const hashFunction md5 = { "MD5", sizeof(md5Param), 64, 4 * sizeof(uint32), (hashFunctionReset) md5Reset, (hashFunctionUpdate) md5Update, (hashFunctionDigest) md5Digest }; const hashFunction md5 = { "MD5", sizeof(md5Param), 64, 4 * sizeof(uint32), (hashFunctionReset) md5Reset, (hashFunctionUpdate) md5Update, (hashFunctionDigest) md5Digest };
/*@=sizeoftype@*/
int md5Reset(register md5Param* p) int md5Reset(register md5Param* p)
{ {

View File

@ -37,7 +37,7 @@
/*@-compdef@*/ /* tmp->data is undefined */ /*@-compdef@*/ /* tmp->data is undefined */
memchunk* memchunkAlloc(int size) memchunk* memchunkAlloc(int size)
{ {
memchunk* tmp = (memchunk*) calloc(1, sizeof(memchunk)); memchunk* tmp = (memchunk*) calloc(1, sizeof(*tmp));
if (tmp) if (tmp)
{ {

View File

@ -1,3 +1,4 @@
/*@-sizeoftype@*/
/** \ingroup MP_m /** \ingroup MP_m
* \file mp32barrett.c * \file mp32barrett.c
* *
@ -1053,3 +1054,4 @@ void mp32bnpowmodsld(const mp32barrett* b, const uint32* slide, const mp32number
free(temp); free(temp);
/*@=nullpass@*/ /*@=nullpass@*/
} }
/*@=sizeoftype@*/

View File

@ -1,3 +1,4 @@
/*@-sizeoftype@*/
/** \ingroup MP_m /** \ingroup MP_m
* \file mp32number.c * \file mp32number.c
* *
@ -229,3 +230,4 @@ void mp32nsethex(mp32number* n, const char* hex)
} }
} }
/*@=nullstate =compdef @*/ /*@=nullstate =compdef @*/
/*@=sizeoftype@*/

View File

@ -53,7 +53,9 @@
#define loBits(a) ((a) & 0x7FFFFFFF) #define loBits(a) ((a) & 0x7FFFFFFF)
#define mixBits(a, b) (hiBit(a) | loBits(b)) #define mixBits(a, b) (hiBit(a) | loBits(b))
/*@-sizeoftype@*/
const randomGenerator mtprng = { "Mersenne Twister", sizeof(mtprngParam), (randomGeneratorSetup) mtprngSetup, (randomGeneratorSeed) mtprngSeed, (randomGeneratorNext) mtprngNext, (randomGeneratorCleanup) mtprngCleanup }; const randomGenerator mtprng = { "Mersenne Twister", sizeof(mtprngParam), (randomGeneratorSetup) mtprngSetup, (randomGeneratorSeed) mtprngSeed, (randomGeneratorNext) mtprngNext, (randomGeneratorCleanup) mtprngCleanup };
/*@=sizeoftype@*/
/** /**
*/ */

View File

@ -40,7 +40,7 @@
int rsapri(const rsakp* kp, const mp32number* m, mp32number* c) int rsapri(const rsakp* kp, const mp32number* m, mp32number* c)
{ {
register uint32 size = kp->n.size; register uint32 size = kp->n.size;
register uint32* temp = (uint32*) malloc((4*size+2)*sizeof(uint32)); register uint32* temp = (uint32*) malloc((4*size+2) * sizeof(*temp));
if (temp) if (temp)
{ {
@ -61,7 +61,7 @@ int rsapricrt(const rsakp* kp, const mp32number* m, mp32number* c)
register uint32 nsize = kp->n.size; register uint32 nsize = kp->n.size;
register uint32 psize = kp->p.size; register uint32 psize = kp->p.size;
register uint32 qsize = kp->q.size; register uint32 qsize = kp->q.size;
register uint32* temp = (uint32*) malloc((psize+qsize+(5*nsize+6))*sizeof(uint32)); register uint32* temp = (uint32*) malloc((psize+qsize+(5*nsize+6))*sizeof(*temp));
register uint32* wksp = temp+psize+qsize+nsize; register uint32* wksp = temp+psize+qsize+nsize;
/* compute j1 = m^d1 mod p */ /* compute j1 = m^d1 mod p */
@ -116,7 +116,7 @@ int rsavrfy(const rsapk* pk, const mp32number* m, const mp32number* c)
{ {
int rc; int rc;
register uint32 size = pk->n.size; register uint32 size = pk->n.size;
register uint32* temp = (uint32*) malloc((5*size+2)*sizeof(uint32)); register uint32* temp = (uint32*) malloc((5*size+2) * sizeof(*temp));
if (temp) if (temp)
{ {

View File

@ -50,7 +50,7 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, int nsize)
*/ */
register uint32 pqsize = ((uint32)(nsize+1)) >> 1; register uint32 pqsize = ((uint32)(nsize+1)) >> 1;
register uint32* temp = (uint32*) malloc((16*pqsize+6)*sizeof(uint32)); register uint32* temp = (uint32*) malloc((16*pqsize+6) * sizeof(*temp));
register uint32 newn = 1; register uint32 newn = 1;
if (temp) if (temp)
@ -71,9 +71,11 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, int nsize)
/* if p <= q, perform a swap to make p larger than q */ /* if p <= q, perform a swap to make p larger than q */
if (mp32le(pqsize, kp->p.modl, kp->q.modl)) if (mp32le(pqsize, kp->p.modl, kp->q.modl))
{ {
/*@-sizeoftype@*/
memcpy(&r, &kp->q, sizeof(mp32barrett)); memcpy(&r, &kp->q, sizeof(mp32barrett));
memcpy(&kp->q, &kp->p, sizeof(mp32barrett)); memcpy(&kp->q, &kp->p, sizeof(mp32barrett));
memcpy(&kp->p, &r, sizeof(mp32barrett)); memcpy(&kp->p, &r, sizeof(mp32barrett));
/*@=sizeoftype@*/
} }
mp32bzero(&r); mp32bzero(&r);
@ -98,15 +100,19 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, int nsize)
if (mp32le(pqsize, kp->p.modl, r.modl)) if (mp32le(pqsize, kp->p.modl, r.modl))
{ {
mp32bfree(&kp->q); mp32bfree(&kp->q);
/*@-sizeoftype@*/
memcpy(&kp->q, &kp->p, sizeof(mp32barrett)); memcpy(&kp->q, &kp->p, sizeof(mp32barrett));
memcpy(&kp->p, &r, sizeof(mp32barrett)); memcpy(&kp->p, &r, sizeof(mp32barrett));
/*@=sizeoftype@*/
mp32bzero(&r); mp32bzero(&r);
newn = 1; newn = 1;
} }
else if (mp32le(pqsize, kp->q.modl, r.modl)) else if (mp32le(pqsize, kp->q.modl, r.modl))
{ {
mp32bfree(&kp->q); mp32bfree(&kp->q);
/*@-sizeoftype@*/
memcpy(&kp->q, &r, sizeof(mp32barrett)); memcpy(&kp->q, &r, sizeof(mp32barrett));
/*@=sizeoftype@*/
mp32bzero(&r); mp32bzero(&r);
newn = 1; newn = 1;
} }
@ -159,7 +165,7 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, int nsize)
int rsakpInit(rsakp* kp) int rsakpInit(rsakp* kp)
{ {
memset(kp, 0, sizeof(rsakp)); memset(kp, 0, sizeof(*kp));
/* or /* or
mp32bzero(&kp->n); mp32bzero(&kp->n);
mp32nzero(&kp->e); mp32nzero(&kp->e);

View File

@ -37,7 +37,7 @@
int rsapkInit(rsapk* pk) int rsapkInit(rsapk* pk)
{ {
memset(pk, 0, sizeof(rsapk)); memset(pk, 0, sizeof(*pk));
/* or /* or
mp32bzero(&pk->n); mp32bzero(&pk->n);
mp32nzero(&pk->e); mp32nzero(&pk->e);

View File

@ -52,7 +52,9 @@ static const uint32 hinit[8] = {
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
}; };
/*@-sizeoftype@*/
const hashFunction sha256 = { "SHA-256", sizeof(sha256Param), 64, 8 * sizeof(uint32), (hashFunctionReset) sha256Reset, (hashFunctionUpdate) sha256Update, (hashFunctionDigest) sha256Digest }; const hashFunction sha256 = { "SHA-256", sizeof(sha256Param), 64, 8 * sizeof(uint32), (hashFunctionReset) sha256Reset, (hashFunctionUpdate) sha256Update, (hashFunctionDigest) sha256Digest };
/*@=sizeoftype@*/
int sha256Reset(register sha256Param *p) int sha256Reset(register sha256Param *p)
{ {

View File

@ -45,7 +45,7 @@ static Value valueMakeInteger(int i)
{ {
Value v; Value v;
v = (Value) xmalloc(sizeof(struct _value)); v = (Value) xmalloc(sizeof(*v));
v->type = VALUE_TYPE_INTEGER; v->type = VALUE_TYPE_INTEGER;
v->data.i = i; v->data.i = i;
return v; return v;
@ -58,7 +58,7 @@ static Value valueMakeString(/*@only@*/ const char *s)
{ {
Value v; Value v;
v = (Value) xmalloc(sizeof(struct _value)); v = (Value) xmalloc(sizeof(*v));
v->type = VALUE_TYPE_STRING; v->type = VALUE_TYPE_STRING;
v->data.s = s; v->data.s = s;
return v; return v;

View File

@ -266,8 +266,8 @@ static void timeCheck(int tc, Header h)
int count, x; int count, x;
time_t currentTime = time(NULL); time_t currentTime = time(NULL);
(void) hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &files, &count); x = hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &files, &count);
(void) hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtime, NULL); x = hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtime, NULL);
for (x = 0; x < count; x++) { for (x = 0; x < count; x++) {
if ((currentTime - mtime[x]) > tc) if ((currentTime - mtime[x]) > tc)
@ -1209,6 +1209,7 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
(void) headerAddOrAppendEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE, (void) headerAddOrAppendEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
&(flp->fileURL), 1); &(flp->fileURL), 1);
/*@-sizeoftype@*/
if (sizeof(flp->fl_size) != sizeof(uint_32)) { if (sizeof(flp->fl_size) != sizeof(uint_32)) {
uint_32 psize = (uint_32)flp->fl_size; uint_32 psize = (uint_32)flp->fl_size;
(void) headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE, (void) headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
@ -1247,6 +1248,7 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE, (void) headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE,
&(flp->fl_dev), 1); &(flp->fl_dev), 1);
} }
/*@=sizeoftype@*/
(void) headerAddOrAppendEntry(h, RPMTAG_FILEINODES, RPM_INT32_TYPE, (void) headerAddOrAppendEntry(h, RPMTAG_FILEINODES, RPM_INT32_TYPE,
&(flp->fl_ino), 1); &(flp->fl_ino), 1);
@ -2551,7 +2553,7 @@ static void printDeps(Header h)
rpmTagType dvt = -1; rpmTagType dvt = -1;
int * flags = NULL; int * flags = NULL;
DepMsg_t * dm; DepMsg_t * dm;
int count; int count, xx;
for (dm = depMsgs; dm->msg != NULL; dm++) { for (dm = depMsgs; dm->msg != NULL; dm++) {
switch (dm->ntag) { switch (dm->ntag) {
@ -2574,7 +2576,7 @@ static void printDeps(Header h)
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
default: default:
versions = hfd(versions, dvt); versions = hfd(versions, dvt);
(void) hge(h, dm->vtag, &dvt, (void **) &versions, NULL); xx = hge(h, dm->vtag, &dvt, (void **) &versions, NULL);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
} }
switch (dm->ftag) { switch (dm->ftag) {
@ -2584,7 +2586,7 @@ static void printDeps(Header h)
case -1: case -1:
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
default: default:
(void) hge(h, dm->ftag, NULL, (void **) &flags, NULL); xx = hge(h, dm->ftag, NULL, (void **) &flags, NULL);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
} }
/*@-noeffect@*/ /*@-noeffect@*/

View File

@ -192,7 +192,7 @@ int myftw (const char *dir,
descriptors = 1; descriptors = 1;
/*@access DIR@*/ /*@access DIR@*/
dirs = (DIR **) alloca (descriptors * sizeof (DIR *)); dirs = (DIR **) alloca (descriptors * sizeof (*dirs));
i = descriptors; i = descriptors;
while (i-- > 0) while (i-- > 0)
dirs[i] = NULL; dirs[i] = NULL;

View File

@ -293,12 +293,14 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead,
} }
/* Get copy of lead */ /* Get copy of lead */
/*@-sizeoftype@*/
if ((rc = Fread(lead, sizeof(char), sizeof(*lead), fdi)) != sizeof(*lead)) { if ((rc = Fread(lead, sizeof(char), sizeof(*lead), fdi)) != sizeof(*lead)) {
rpmError(RPMERR_BADMAGIC, _("readRPM: read %s: %s\n"), rpmError(RPMERR_BADMAGIC, _("readRPM: read %s: %s\n"),
(fileName ? fileName : "<stdin>"), (fileName ? fileName : "<stdin>"),
Fstrerror(fdi)); Fstrerror(fdi));
return RPMERR_BADMAGIC; return RPMERR_BADMAGIC;
} }
/*@=sizeoftype@*/
/* XXX FIXME: EPIPE on <stdin> */ /* XXX FIXME: EPIPE on <stdin> */
if (Fseek(fdi, 0, SEEK_SET) == -1) { if (Fseek(fdi, 0, SEEK_SET) == -1) {

View File

@ -50,12 +50,13 @@ static rpmTag requiredTags[] = {
static void addOrAppendListEntry(Header h, int_32 tag, char * line) static void addOrAppendListEntry(Header h, int_32 tag, char * line)
/*@modifies h @*/ /*@modifies h @*/
{ {
int xx;
int argc; int argc;
const char **argv; const char **argv;
(void) poptParseArgvString(line, &argc, &argv); xx = poptParseArgvString(line, &argc, &argv);
if (argc) if (argc)
(void) headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, argv, argc); xx = headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, argv, argc);
argv = _free(argv); argv = _free(argv);
} }
@ -370,7 +371,7 @@ static int readIcon(Header h, const char * file)
icon = xmalloc(iconsize + 1); icon = xmalloc(iconsize + 1);
*icon = '\0'; *icon = '\0';
nb = Fread(icon, sizeof(char), iconsize, fd); nb = Fread(icon, sizeof(icon[0]), iconsize, fd);
if (Ferror(fd) || (size >= 0 && nb != size)) { if (Ferror(fd) || (size >= 0 && nb != size)) {
rpmError(RPMERR_BADSPEC, _("Unable to read icon %s: %s\n"), rpmError(RPMERR_BADSPEC, _("Unable to read icon %s: %s\n"),
fn, Fstrerror(fd)); fn, Fstrerror(fd));
@ -462,6 +463,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
int len; int len;
int num; int num;
int rc; int rc;
int xx;
if (field == NULL) return RPMERR_BADSPEC; /* XXX can't happen */ if (field == NULL) return RPMERR_BADSPEC; /* XXX can't happen */
/* Find the start of the "field" and strip trailing space */ /* Find the start of the "field" and strip trailing space */
@ -574,7 +576,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
} break; } break;
case RPMTAG_PREFIXES: case RPMTAG_PREFIXES:
addOrAppendListEntry(pkg->header, tag, field); addOrAppendListEntry(pkg->header, tag, field);
(void) hge(pkg->header, tag, &type, (void **)&array, &num); xx = hge(pkg->header, tag, &type, (void **)&array, &num);
while (num--) { while (num--) {
len = strlen(array[num]); len = strlen(array[num]);
if (array[num][len - 1] == '/' && len > 1) { if (array[num][len - 1] == '/' && len > 1) {
@ -607,7 +609,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
(void) headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1); xx = headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1);
break; break;
case RPMTAG_AUTOREQPROV: case RPMTAG_AUTOREQPROV:
pkg->autoReq = parseYesNo(field); pkg->autoReq = parseYesNo(field);
@ -830,7 +832,7 @@ static int findPreambleTag(Spec spec, /*@out@*/int * tag,
int parsePreamble(Spec spec, int initialPackage) int parsePreamble(Spec spec, int initialPackage)
{ {
int nextPart; int nextPart;
int tag, rc; int tag, rc, xx;
char *name, *linep; char *name, *linep;
int flag; int flag;
Package pkg; Package pkg;
@ -858,11 +860,11 @@ int parsePreamble(Spec spec, int initialPackage)
/* Construct the package */ /* Construct the package */
if (flag == PART_SUBNAME) { if (flag == PART_SUBNAME) {
const char * mainName; const char * mainName;
(void) headerNVR(spec->packages->header, &mainName, NULL, NULL); xx = headerNVR(spec->packages->header, &mainName, NULL, NULL);
sprintf(NVR, "%s-%s", mainName, name); sprintf(NVR, "%s-%s", mainName, name);
} else } else
strcpy(NVR, name); strcpy(NVR, name);
(void) headerAddEntry(pkg->header, RPMTAG_NAME, RPM_STRING_TYPE, NVR, 1); xx = headerAddEntry(pkg->header, RPMTAG_NAME, RPM_STRING_TYPE, NVR, 1);
} }
if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) { if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {

View File

@ -335,7 +335,7 @@ retry:
} }
if (match != -1) { if (match != -1) {
rl = xmalloc(sizeof(struct ReadLevelEntry)); rl = xmalloc(sizeof(*rl));
rl->reading = spec->readStack->reading && match; rl->reading = spec->readStack->reading && match;
rl->next = spec->readStack; rl->next = spec->readStack;
spec->readStack = rl; spec->readStack = rl;
@ -482,7 +482,8 @@ fprintf(stderr, "*** PS buildRootURL(%s) %p macro set to %s\n", spec->buildRootU
closeSpec(spec); closeSpec(spec);
spec->BASpecs = xcalloc(spec->BACount, sizeof(Spec)); /* LCL: sizeof(spec->BASpecs[0]) -nullderef whine here */
spec->BASpecs = xcalloc(spec->BACount, sizeof(*spec->BASpecs));
index = 0; index = 0;
if (spec->BANames != NULL) if (spec->BANames != NULL)
for (x = 0; x < spec->BACount; x++) { for (x = 0; x < spec->BACount; x++) {

View File

@ -22,6 +22,7 @@ int addReqProv(/*@unused@*/ Spec spec, Header h,
rpmTag indextag = 0; rpmTag indextag = 0;
int len; int len;
rpmsenseFlags extra = RPMSENSE_ANY; rpmsenseFlags extra = RPMSENSE_ANY;
int xx;
if (depFlags & RPMSENSE_PROVIDES) { if (depFlags & RPMSENSE_PROVIDES) {
nametag = RPMTAG_PROVIDENAME; nametag = RPMTAG_PROVIDENAME;
@ -70,11 +71,11 @@ int addReqProv(/*@unused@*/ Spec spec, Header h,
int duplicate = 0; int duplicate = 0;
if (flagtag) { if (flagtag) {
(void) hge(h, versiontag, &dvt, (void **) &versions, NULL); xx = hge(h, versiontag, &dvt, (void **) &versions, NULL);
(void) hge(h, flagtag, NULL, (void **) &flags, NULL); xx = hge(h, flagtag, NULL, (void **) &flags, NULL);
} }
if (indextag) if (indextag)
(void) hge(h, indextag, NULL, (void **) &indexes, NULL); xx = hge(h, indextag, NULL, (void **) &indexes, NULL);
while (len > 0) { while (len > 0) {
len--; len--;
@ -103,15 +104,15 @@ int addReqProv(/*@unused@*/ Spec spec, Header h,
} }
/* Add this dependency. */ /* Add this dependency. */
(void) headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &depName, 1); xx = headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &depName, 1);
if (flagtag) { if (flagtag) {
(void) headerAddOrAppendEntry(h, versiontag, xx = headerAddOrAppendEntry(h, versiontag,
RPM_STRING_ARRAY_TYPE, &depEVR, 1); RPM_STRING_ARRAY_TYPE, &depEVR, 1);
(void) headerAddOrAppendEntry(h, flagtag, xx = headerAddOrAppendEntry(h, flagtag,
RPM_INT32_TYPE, &depFlags, 1); RPM_INT32_TYPE, &depFlags, 1);
} }
if (indextag) if (indextag)
(void) headerAddOrAppendEntry(h, indextag, RPM_INT32_TYPE, &index, 1); xx = headerAddOrAppendEntry(h, indextag, RPM_INT32_TYPE, &index, 1);
return 0; return 0;
} }

View File

@ -299,7 +299,7 @@ int addSource(Spec spec, Package pkg, const char *field, int tag)
} }
/* Create the entry and link it in */ /* Create the entry and link it in */
p = xmalloc(sizeof(struct Source)); p = xmalloc(sizeof(*p));
p->num = num; p->num = num;
p->fullSource = xstrdup(field); p->fullSource = xstrdup(field);
p->flags = flag; p->flags = flag;
@ -542,7 +542,7 @@ Spec freeSpec(Spec spec)
{ {
struct OpenFileInfo *ofi; struct OpenFileInfo *ofi;
ofi = xmalloc(sizeof(struct OpenFileInfo)); ofi = xmalloc(sizeof(*ofi));
ofi->fd = NULL; ofi->fd = NULL;
ofi->fileName = NULL; ofi->fileName = NULL;
ofi->lineNum = 0; ofi->lineNum = 0;

View File

@ -67,7 +67,7 @@ getdate.c: getdate.y
-@if test -f y.tab.c; then \ -@if test -f y.tab.c; then \
{ echo "/*@-globstate -statictrans -unqualifiedtrans -noparams @*/";\ { echo "/*@-globstate -statictrans -unqualifiedtrans -noparams @*/";\
echo "/*@-retvalint -usedef -varuse -nullderef -nullassign @*/";\ echo "/*@-retvalint -usedef -varuse -nullderef -nullassign @*/";\
echo "/*@-readonlytrans -modunconnomods -compdef @*/";\ echo "/*@-readonlytrans -modunconnomods -compdef -noeffectuncon @*/";\
echo "/*@-globs -evalorderuncon -modobserveruncon -modnomods @*/";\ echo "/*@-globs -evalorderuncon -modobserveruncon -modnomods @*/";\
sed -e 's,y.tab.c,getdate.c,' y.tab.c \ sed -e 's,y.tab.c,getdate.c,' y.tab.c \
-e 's,^YYSTYPE ,static &,' \ -e 's,^YYSTYPE ,static &,' \
@ -76,7 +76,7 @@ getdate.c: getdate.y
-e 's,^int yydebug,/*@unused@*/ static &,' \ -e 's,^int yydebug,/*@unused@*/ static &,' \
-e 's,^int ,static &,' ;\ -e 's,^int ,static &,' ;\
echo "/*@=globs =evalorderuncon =modobserveruncon =modnomods @*/";\ echo "/*@=globs =evalorderuncon =modobserveruncon =modnomods @*/";\
echo "/*@=readonlytrans =modunconnomods =compdef @*/";\ echo "/*@=readonlytrans =modunconnomods =compdef =noeffectuncon @*/";\
echo "/*@=retvalint =usedef =varuse =nullderef =nullassign @*/";\ echo "/*@=retvalint =usedef =varuse =nullderef =nullassign @*/";\
echo "/*@=globstate =statictrans =unqualifiedtrans =noparams @*/";\ echo "/*@=globstate =statictrans =unqualifiedtrans =noparams @*/";\
} > getdate.c ;\ } > getdate.c ;\

View File

@ -249,7 +249,7 @@ alAddPackage(availableList al,
rpmTagType dnt, bnt; rpmTagType dnt, bnt;
struct availablePackage * p; struct availablePackage * p;
rpmRelocation * r; rpmRelocation * r;
int i; int i, xx;
int_32 * dirIndexes; int_32 * dirIndexes;
const char ** dirNames; const char ** dirNames;
int numDirs, dirNum; int numDirs, dirNum;
@ -275,7 +275,7 @@ alAddPackage(availableList al,
memset(&p->tsi, 0, sizeof(p->tsi)); memset(&p->tsi, 0, sizeof(p->tsi));
p->multiLib = 0; /* MULTILIB */ p->multiLib = 0; /* MULTILIB */
(void) headerNVR(p->h, &p->name, &p->version, &p->release); xx = headerNVR(p->h, &p->name, &p->version, &p->release);
/* XXX This should be added always so that packages look alike. /* XXX This should be added always so that packages look alike.
* XXX However, there is logic in files.c/depends.c that checks for * XXX However, there is logic in files.c/depends.c that checks for
@ -333,9 +333,9 @@ alAddPackage(availableList al,
p->filesCount = 0; p->filesCount = 0;
p->baseNames = NULL; p->baseNames = NULL;
} else { } else {
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, &numDirs); xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, &numDirs);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL); xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL);
/* XXX FIXME: We ought to relocate the directory list here */ /* XXX FIXME: We ought to relocate the directory list here */
@ -619,7 +619,7 @@ static int rangeMatchesDepFlags (Header h,
int_32 * provideFlags; int_32 * provideFlags;
int providesCount; int providesCount;
int result; int result;
int i; int i, xx;
if (!(reqFlags & RPMSENSE_SENSEMASK) || !reqEVR || !strlen(reqEVR)) if (!(reqFlags & RPMSENSE_SENSEMASK) || !reqEVR || !strlen(reqEVR))
return 1; return 1;
@ -633,7 +633,7 @@ static int rangeMatchesDepFlags (Header h,
(void **) &providesEVR, &providesCount)) (void **) &providesEVR, &providesCount))
return 1; return 1;
(void) hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL); xx = hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL);
if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, &providesCount)) if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, &providesCount))
{ {
@ -770,19 +770,20 @@ static int removePackage(rpmTransactionSet ts, int dboffset, int depends)
/* Filter out duplicate erasures. */ /* Filter out duplicate erasures. */
if (ts->numRemovedPackages > 0 && ts->removedPackages != NULL) { if (ts->numRemovedPackages > 0 && ts->removedPackages != NULL) {
if (bsearch(&dboffset, ts->removedPackages, ts->numRemovedPackages, if (bsearch(&dboffset, ts->removedPackages, ts->numRemovedPackages,
sizeof(int), intcmp) != NULL) sizeof(*ts->removedPackages), intcmp) != NULL)
return 0; return 0;
} }
if (ts->numRemovedPackages == ts->allocedRemovedPackages) { if (ts->numRemovedPackages == ts->allocedRemovedPackages) {
ts->allocedRemovedPackages += ts->delta; ts->allocedRemovedPackages += ts->delta;
ts->removedPackages = xrealloc(ts->removedPackages, ts->removedPackages = xrealloc(ts->removedPackages,
sizeof(int *) * ts->allocedRemovedPackages); sizeof(ts->removedPackages) * ts->allocedRemovedPackages);
} }
if (ts->removedPackages != NULL) { /* XXX can't happen. */ if (ts->removedPackages != NULL) { /* XXX can't happen. */
ts->removedPackages[ts->numRemovedPackages++] = dboffset; ts->removedPackages[ts->numRemovedPackages++] = dboffset;
qsort(ts->removedPackages, ts->numRemovedPackages, sizeof(int), intcmp); qsort(ts->removedPackages, ts->numRemovedPackages,
sizeof(*ts->removedPackages), intcmp);
} }
if (ts->orderCount == ts->orderAlloced) { if (ts->orderCount == ts->orderAlloced) {
@ -808,6 +809,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
int count; int count;
const char ** obsoletes; const char ** obsoletes;
int alNum; int alNum;
int xx;
/* /*
* FIXME: handling upgrades like this is *almost* okay. It doesn't * FIXME: handling upgrades like this is *almost* okay. It doesn't
@ -836,7 +838,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
if (headerIsEntry(h, RPMTAG_SOURCEPACKAGE)) if (headerIsEntry(h, RPMTAG_SOURCEPACKAGE))
return 0; return 0;
(void) headerNVR(h, &name, NULL, NULL); xx = headerNVR(h, &name, NULL, NULL);
{ rpmdbMatchIterator mi; { rpmdbMatchIterator mi;
Header h2; Header h2;
@ -845,7 +847,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
while((h2 = rpmdbNextIterator(mi)) != NULL) { while((h2 = rpmdbNextIterator(mi)) != NULL) {
/*@-branchstate@*/ /*@-branchstate@*/
if (rpmVersionCompare(h, h2)) if (rpmVersionCompare(h, h2))
(void) removePackage(ts, rpmdbGetIteratorOffset(mi), alNum); xx = removePackage(ts, rpmdbGetIteratorOffset(mi), alNum);
else { else {
uint_32 *p, multiLibMask = 0, oldmultiLibMask = 0; uint_32 *p, multiLibMask = 0, oldmultiLibMask = 0;
@ -868,9 +870,9 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
int_32 * obsoletesFlags; int_32 * obsoletesFlags;
int j; int j;
(void) hge(h, RPMTAG_OBSOLETEVERSION, &ovt, (void **) &obsoletesEVR, xx = hge(h, RPMTAG_OBSOLETEVERSION, &ovt, (void **) &obsoletesEVR,
NULL); NULL);
(void) hge(h, RPMTAG_OBSOLETEFLAGS, NULL, (void **) &obsoletesFlags, xx = hge(h, RPMTAG_OBSOLETEFLAGS, NULL, (void **) &obsoletesFlags,
NULL); NULL);
for (j = 0; j < count; j++) { for (j = 0; j < count; j++) {
@ -884,7 +886,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, obsoletes[j], 0); mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, obsoletes[j], 0);
(void) rpmdbPruneIterator(mi, xx = rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1); ts->removedPackages, ts->numRemovedPackages, 1);
while((h2 = rpmdbNextIterator(mi)) != NULL) { while((h2 = rpmdbNextIterator(mi)) != NULL) {
@ -897,7 +899,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
headerMatchesDepFlags(h2, headerMatchesDepFlags(h2,
obsoletes[j], obsoletesEVR[j], obsoletesFlags[j])) obsoletes[j], obsoletesEVR[j], obsoletesFlags[j]))
{ {
(void) removePackage(ts, rpmdbGetIteratorOffset(mi), alNum); xx = removePackage(ts, rpmdbGetIteratorOffset(mi), alNum);
} }
/*@=branchstate@*/ /*@=branchstate@*/
} }
@ -1402,19 +1404,19 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
int_32 * conflictFlags = NULL; int_32 * conflictFlags = NULL;
int conflictsCount = 0; int conflictsCount = 0;
rpmTagType type; rpmTagType type;
int i, rc; int i, rc, xx;
int ourrc = 0; int ourrc = 0;
struct availablePackage ** suggestion; struct availablePackage ** suggestion;
(void) headerNVR(h, &name, &version, &release); xx = headerNVR(h, &name, &version, &release);
if (!hge(h, RPMTAG_REQUIRENAME, &rnt, (void **) &requires, &requiresCount)) if (!hge(h, RPMTAG_REQUIRENAME, &rnt, (void **) &requires, &requiresCount))
{ {
requiresCount = 0; requiresCount = 0;
rvt = RPM_STRING_ARRAY_TYPE; rvt = RPM_STRING_ARRAY_TYPE;
} else { } else {
(void)hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **) &requireFlags, NULL); xx = hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **) &requireFlags, NULL);
(void)hge(h, RPMTAG_REQUIREVERSION, &rvt, (void **) &requiresEVR, NULL); xx = hge(h, RPMTAG_REQUIREVERSION, &rvt, (void **) &requiresEVR, NULL);
} }
for (i = 0; i < requiresCount && !ourrc; i++) { for (i = 0; i < requiresCount && !ourrc; i++) {
@ -1492,9 +1494,9 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
conflictsCount = 0; conflictsCount = 0;
cvt = RPM_STRING_ARRAY_TYPE; cvt = RPM_STRING_ARRAY_TYPE;
} else { } else {
(void) hge(h, RPMTAG_CONFLICTFLAGS, &type, xx = hge(h, RPMTAG_CONFLICTFLAGS, &type,
(void **) &conflictFlags, &conflictsCount); (void **) &conflictFlags, &conflictsCount);
(void) hge(h, RPMTAG_CONFLICTVERSION, &cvt, xx = hge(h, RPMTAG_CONFLICTVERSION, &cvt,
(void **) &conflictsEVR, &conflictsCount); (void **) &conflictsEVR, &conflictsCount);
} }
@ -2215,7 +2217,7 @@ int rpmdepCheck(rpmTransactionSet ts,
struct availablePackage * p; struct availablePackage * p;
problemsSet ps; problemsSet ps;
int npkgs; int npkgs;
int i, j; int i, j, xx;
int rc; int rc;
npkgs = ts->addedPackages.size; npkgs = ts->addedPackages.size;
@ -2271,12 +2273,12 @@ int rpmdepCheck(rpmTransactionSet ts,
/*@-branchstate@*/ /*@-branchstate@*/
if (ts->numRemovedPackages > 0) { if (ts->numRemovedPackages > 0) {
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0); mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0);
(void) rpmdbAppendIterator(mi, xx = rpmdbAppendIterator(mi,
ts->removedPackages, ts->numRemovedPackages); ts->removedPackages, ts->numRemovedPackages);
while ((h = rpmdbNextIterator(mi)) != NULL) { while ((h = rpmdbNextIterator(mi)) != NULL) {
{ const char * name, * version, * release; { const char * name, * version, * release;
(void) headerNVR(h, &name, &version, &release); xx = headerNVR(h, &name, &version, &release);
rpmMessage(RPMMESS_DEBUG, "========== --- %s-%s-%s\n" , rpmMessage(RPMMESS_DEBUG, "========== --- %s-%s-%s\n" ,
name, version, release); name, version, release);
@ -2317,8 +2319,8 @@ int rpmdepCheck(rpmTransactionSet ts,
if (hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount)) if (hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount))
{ {
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes,
NULL); NULL);
rc = 0; rc = 0;
for (j = 0; j < fileCount; j++) { for (j = 0; j < fileCount; j++) {
@ -2363,7 +2365,7 @@ exit:
ps = _free(ps); ps = _free(ps);
/*@-branchstate@*/ /*@-branchstate@*/
if (_cacheDependsRC) if (_cacheDependsRC)
(void) rpmdbCloseDBI(ts->rpmdb, RPMDBI_DEPENDS); xx = rpmdbCloseDBI(ts->rpmdb, RPMDBI_DEPENDS);
/*@=branchstate@*/ /*@=branchstate@*/
return rc; return rc;
} }

View File

@ -315,7 +315,7 @@ static int triggercondsTag(Header h, /*@out@*/ rpmTagType * type,
char ** conds, ** s; char ** conds, ** s;
char * item, * flagsStr; char * item, * flagsStr;
char * chptr; char * chptr;
int i, j; int i, j, xx;
char buf[5]; char buf[5];
if (!hge(h, RPMTAG_TRIGGERNAME, &tnt, (void **) &names, &numNames)) { if (!hge(h, RPMTAG_TRIGGERNAME, &tnt, (void **) &names, &numNames)) {
@ -323,14 +323,14 @@ static int triggercondsTag(Header h, /*@out@*/ rpmTagType * type,
return 0; return 0;
} }
(void) hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, NULL); xx = hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, NULL);
(void) hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL); xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
(void) hge(h, RPMTAG_TRIGGERVERSION, &tvt, (void **) &versions, NULL); xx = hge(h, RPMTAG_TRIGGERVERSION, &tvt, (void **) &versions, NULL);
(void) hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts); xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
s = hfd(s, tst); s = hfd(s, tst);
*freeData = 1; *freeData = 1;
*data = conds = xmalloc(sizeof(char * ) * numScripts); *data = conds = xmalloc(sizeof(*conds) * numScripts);
*count = numScripts; *count = numScripts;
*type = RPM_STRING_ARRAY_TYPE; *type = RPM_STRING_ARRAY_TYPE;
for (i = 0; i < numScripts; i++) { for (i = 0; i < numScripts; i++) {
@ -384,7 +384,7 @@ static int triggertypeTag(Header h, /*@out@*/ rpmTagType * type,
int_32 * indices, * flags; int_32 * indices, * flags;
const char ** conds; const char ** conds;
const char ** s; const char ** s;
int i, j; int i, j, xx;
int numScripts, numNames; int numScripts, numNames;
if (!hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, &numNames)) { if (!hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, &numNames)) {
@ -392,12 +392,12 @@ static int triggertypeTag(Header h, /*@out@*/ rpmTagType * type,
return 1; return 1;
} }
(void) hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL); xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
(void) hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts); xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
s = hfd(s, tst); s = hfd(s, tst);
*freeData = 1; *freeData = 1;
*data = conds = xmalloc(sizeof(char * ) * numScripts); *data = conds = xmalloc(sizeof(*conds) * numScripts);
*count = numScripts; *count = numScripts;
*type = RPM_STRING_ARRAY_TYPE; *type = RPM_STRING_ARRAY_TYPE;
for (i = 0; i < numScripts; i++) { for (i = 0; i < numScripts; i++) {

View File

@ -486,8 +486,10 @@ int fsmSetup(FSM_t fsm, fileStage goal,
if (fsm->goal == FSM_PKGINSTALL) { if (fsm->goal == FSM_PKGINSTALL) {
if (ts && ts->notify) { if (ts && ts->notify) {
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_START, 0, fi->archiveSize, (void)ts->notify(fi->h, RPMCALLBACK_INST_START, 0, fi->archiveSize,
(fi->ap ? fi->ap->key : NULL), ts->notifyData); (fi->ap ? fi->ap->key : NULL), ts->notifyData);
/*@=noeffectuncon @*/
} }
} }
@ -853,12 +855,12 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
{ const rpmTransactionSet ts = fsmGetTs(fsm); { const rpmTransactionSet ts = fsmGetTs(fsm);
TFI_t fi = fsmGetFi(fsm); TFI_t fi = fsmGetFi(fsm);
if (ts && fi && ts->notify) { if (ts && ts->notify && fi) {
size_t size = (fdGetCpioPos(fsm->cfd) - pos); size_t size = (fdGetCpioPos(fsm->cfd) - pos);
/*@-modunconnomods@*/ /*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS, size, size, (void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS, size, size,
(fi->ap ? fi->ap->key : NULL), ts->notifyData); (fi->ap ? fi->ap->key : NULL), ts->notifyData);
/*@=modunconnomods@*/ /*@=noeffectuncon @*/
} }
} }
@ -1630,10 +1632,13 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) { if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) {
rpmTransactionSet ts = fsmGetTs(fsm); rpmTransactionSet ts = fsmGetTs(fsm);
TFI_t fi = fsmGetFi(fsm); TFI_t fi = fsmGetFi(fsm);
if (ts && ts->notify && fi) if (ts && ts->notify && fi) {
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS, (void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS,
fdGetCpioPos(fsm->cfd), fi->archiveSize, fdGetCpioPos(fsm->cfd), fi->archiveSize,
(fi->ap ? fi->ap->key : NULL), ts->notifyData); (fi->ap ? fi->ap->key : NULL), ts->notifyData);
/*@=noeffectuncon @*/
}
} }
break; break;
case FSM_UNDO: case FSM_UNDO:

View File

@ -1,6 +1,6 @@
/*@-globstate -statictrans -unqualifiedtrans -noparams @*/ /*@-globstate -statictrans -unqualifiedtrans -noparams @*/
/*@-retvalint -usedef -varuse -nullderef -nullassign @*/ /*@-retvalint -usedef -varuse -nullderef -nullassign @*/
/*@-readonlytrans -modunconnomods -compdef @*/ /*@-readonlytrans -modunconnomods -compdef -noeffectuncon @*/
/*@-globs -evalorderuncon -modobserveruncon -modnomods @*/ /*@-globs -evalorderuncon -modobserveruncon -modnomods @*/
#ifndef lint #ifndef lint
static char const static char const
@ -1595,6 +1595,6 @@ yyaccept:
return (0); return (0);
} }
/*@=globs =evalorderuncon =modobserveruncon =modnomods @*/ /*@=globs =evalorderuncon =modobserveruncon =modnomods @*/
/*@=readonlytrans =modunconnomods =compdef @*/ /*@=readonlytrans =modunconnomods =compdef =noeffectuncon @*/
/*@=retvalint =usedef =varuse =nullderef =nullassign @*/ /*@=retvalint =usedef =varuse =nullderef =nullassign @*/
/*@=globstate =statictrans =unqualifiedtrans =noparams @*/ /*@=globstate =statictrans =unqualifiedtrans =noparams @*/

View File

@ -73,7 +73,9 @@ Header headerLink(Header h)
void headerSort(Header h) void headerSort(Header h)
/*@modifies h @*/ /*@modifies h @*/
{ {
/*@-noeffectuncon@*/ /* FIX: add rc */
(h2hv(h)->hdrsort) (h); (h2hv(h)->hdrsort) (h);
/*@=noeffectuncon@*/
return; return;
} }
@ -85,7 +87,9 @@ void headerSort(Header h)
void headerUnsort(Header h) void headerUnsort(Header h)
/*@modifies h @*/ /*@modifies h @*/
{ {
/*@-noeffectuncon@*/ /* FIX: add rc */
(h2hv(h)->hdrunsort) (h); (h2hv(h)->hdrunsort) (h);
/*@=noeffectuncon@*/
return; return;
} }
/*@=exportlocal@*/ /*@=exportlocal@*/
@ -431,7 +435,9 @@ int headerRemoveEntry(Header h, int_32 tag)
void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy) void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
/*@modifies headerFrom, headerTo @*/ /*@modifies headerFrom, headerTo @*/
{ {
/*@-noeffectuncon@*/ /* FIX: add rc */
hdrVec->hdrcopytags(headerFrom, headerTo, tagstocopy); hdrVec->hdrcopytags(headerFrom, headerTo, tagstocopy);
/*@=noeffectuncon@*/
return; return;
} }

View File

@ -1,3 +1,4 @@
/*@-sizeoftype@*/
/** \ingroup header /** \ingroup header
* \file lib/header.c * \file lib/header.c
*/ */
@ -3171,3 +3172,4 @@ static struct HV_s hdrVec1 = {
/*@observer@*/ /*@unchecked@*/ /*@observer@*/ /*@unchecked@*/
HV_t hdrVec = &hdrVec1; HV_t hdrVec = &hdrVec1;
/*@=compmempass =redef@*/ /*@=compmempass =redef@*/
/*@=sizeoftype@*/

View File

@ -1,3 +1,4 @@
/*@-sizeoftype@*/
/** \ingroup header /** \ingroup header
* \file lib/header_internal.c * \file lib/header_internal.c
*/ */
@ -164,3 +165,4 @@ void headerDump(Header h, FILE *f, int flags,
p++; p++;
} }
} }
/*@=sizeoftype@*/

View File

@ -74,7 +74,7 @@ char ** splitString(const char * str, int length, char sep)
*dest = '\0'; *dest = '\0';
list = xmalloc(sizeof(char *) * (fields + 1)); list = xmalloc(sizeof(*list) * (fields + 1));
dest = s; dest = s;
list[0] = dest; list[0] = dest;
@ -348,7 +348,7 @@ void compressFilelist(Header h)
int_32 * dirIndexes; int_32 * dirIndexes;
rpmTagType fnt; rpmTagType fnt;
int count; int count;
int i; int i, xx;
int dirIndex = -1; int dirIndex = -1;
/* /*
@ -358,7 +358,7 @@ void compressFilelist(Header h)
*/ */
if (headerIsEntry(h, RPMTAG_DIRNAMES)) { if (headerIsEntry(h, RPMTAG_DIRNAMES)) {
(void) hre(h, RPMTAG_OLDFILENAMES); xx = hre(h, RPMTAG_OLDFILENAMES);
return; /* Already converted. */ return; /* Already converted. */
} }
@ -413,16 +413,16 @@ void compressFilelist(Header h)
exit: exit:
if (count > 0) { if (count > 0) {
(void) hae(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, dirIndexes, count); xx = hae(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, dirIndexes, count);
(void) hae(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE, xx = hae(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, count); baseNames, count);
(void) hae(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE, xx = hae(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirIndex + 1); dirNames, dirIndex + 1);
} }
fileNames = hfd(fileNames, fnt); fileNames = hfd(fileNames, fnt);
(void) hre(h, RPMTAG_OLDFILENAMES); xx = hre(h, RPMTAG_OLDFILENAMES);
} }
/* /*
@ -444,7 +444,7 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
int size; int size;
rpmTagType bnt, dnt; rpmTagType bnt, dnt;
char * data; char * data;
int i; int i, xx;
if (!hge(h, baseNameTag, &bnt, (void **) &baseNames, &count)) { if (!hge(h, baseNameTag, &bnt, (void **) &baseNames, &count)) {
if (fileListPtr) *fileListPtr = NULL; if (fileListPtr) *fileListPtr = NULL;
@ -452,8 +452,8 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
return; /* no file list */ return; /* no file list */
} }
(void) hge(h, dirNameTag, &dnt, (void **) &dirNames, NULL); xx = hge(h, dirNameTag, &dnt, (void **) &dirNames, NULL);
(void) hge(h, dirIndexesTag, NULL, (void **) &dirIndexes, &count); xx = hge(h, dirIndexesTag, NULL, (void **) &dirIndexes, &count);
size = sizeof(*fileNames) * count; size = sizeof(*fileNames) * count;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -484,6 +484,7 @@ void expandFilelist(Header h)
HRE_t hre = (HRE_t)headerRemoveEntry; HRE_t hre = (HRE_t)headerRemoveEntry;
const char ** fileNames = NULL; const char ** fileNames = NULL;
int count = 0; int count = 0;
int xx;
/*@-branchstate@*/ /*@-branchstate@*/
if (!headerIsEntry(h, RPMTAG_OLDFILENAMES)) { if (!headerIsEntry(h, RPMTAG_OLDFILENAMES)) {
@ -491,15 +492,15 @@ void expandFilelist(Header h)
RPMTAG_DIRNAMES, RPMTAG_DIRINDEXES); RPMTAG_DIRNAMES, RPMTAG_DIRINDEXES);
if (fileNames == NULL || count <= 0) if (fileNames == NULL || count <= 0)
return; return;
(void) hae(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE, xx = hae(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
fileNames, count); fileNames, count);
fileNames = _free(fileNames); fileNames = _free(fileNames);
} }
/*@=branchstate@*/ /*@=branchstate@*/
(void) hre(h, RPMTAG_DIRNAMES); xx = hre(h, RPMTAG_DIRNAMES);
(void) hre(h, RPMTAG_BASENAMES); xx = hre(h, RPMTAG_BASENAMES);
(void) hre(h, RPMTAG_DIRINDEXES); xx = hre(h, RPMTAG_DIRINDEXES);
} }
@ -764,11 +765,11 @@ void providePackageNVR(Header h)
rpmTagType pnt, pvt; rpmTagType pnt, pvt;
int_32 * provideFlags = NULL; int_32 * provideFlags = NULL;
int providesCount; int providesCount;
int i; int i, xx;
int bingo = 1; int bingo = 1;
/* Generate provides for this package name-version-release. */ /* Generate provides for this package name-version-release. */
(void) headerNVR(h, &name, &version, &release); xx = headerNVR(h, &name, &version, &release);
if (!(name && version && release)) if (!(name && version && release))
return; return;
pEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1); pEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1);
@ -794,15 +795,15 @@ void providePackageNVR(Header h)
for (i = 0; i < providesCount; i++) { for (i = 0; i < providesCount; i++) {
char * vdummy = ""; char * vdummy = "";
int_32 fdummy = RPMSENSE_ANY; int_32 fdummy = RPMSENSE_ANY;
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE, xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
&vdummy, 1); &vdummy, 1);
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE, xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
&fdummy, 1); &fdummy, 1);
} }
goto exit; goto exit;
} }
(void) hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL); xx = hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL);
if (provides && providesEVR && provideFlags) if (provides && providesEVR && provideFlags)
for (i = 0; i < providesCount; i++) { for (i = 0; i < providesCount; i++) {
@ -820,11 +821,11 @@ exit:
providesEVR = hfd(providesEVR, pvt); providesEVR = hfd(providesEVR, pvt);
if (bingo) { if (bingo) {
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME, RPM_STRING_ARRAY_TYPE, xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME, RPM_STRING_ARRAY_TYPE,
&name, 1); &name, 1);
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE, xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
&pFlags, 1); &pFlags, 1);
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE, xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
&pEVR, 1); &pEVR, 1);
} }
} }

View File

@ -24,6 +24,7 @@ void headerMergeLegacySigs(Header h, const Header sig)
HeaderIterator hi; HeaderIterator hi;
int_32 tag, type, count; int_32 tag, type, count;
const void * ptr; const void * ptr;
int xx;
/*@-mods@*/ /* FIX: undocumented modification of sig */ /*@-mods@*/ /* FIX: undocumented modification of sig */
for (hi = headerInitIterator(sig); for (hi = headerInitIterator(sig);
@ -60,7 +61,7 @@ void headerMergeLegacySigs(Header h, const Header sig)
} }
if (ptr == NULL) continue; /* XXX can't happen */ if (ptr == NULL) continue; /* XXX can't happen */
if (!headerIsEntry(h, tag)) if (!headerIsEntry(h, tag))
(void) hae(h, tag, type, ptr, count); xx = hae(h, tag, type, ptr, count);
} }
hi = headerFreeIterator(hi); hi = headerFreeIterator(hi);
} }
@ -72,6 +73,7 @@ Header headerRegenSigHeader(const Header h)
HeaderIterator hi; HeaderIterator hi;
int_32 tag, stag, type, count; int_32 tag, stag, type, count;
const void * ptr; const void * ptr;
int xx;
/*@-mods@*/ /* FIX: undocumented modification of h */ /*@-mods@*/ /* FIX: undocumented modification of h */
for (hi = headerInitIterator(h); for (hi = headerInitIterator(h);
@ -109,7 +111,7 @@ Header headerRegenSigHeader(const Header h)
} }
if (ptr == NULL) continue; /* XXX can't happen */ if (ptr == NULL) continue; /* XXX can't happen */
if (!headerIsEntry(sig, stag)) if (!headerIsEntry(sig, stag))
(void) headerAddEntry(sig, stag, type, ptr, count); xx = headerAddEntry(sig, stag, type, ptr, count);
} }
hi = headerFreeIterator(hi); hi = headerFreeIterator(hi);
return sig; return sig;

182
lib/psm.c
View File

@ -57,15 +57,15 @@ int rpmVersionCompare(Header first, Header second)
return 1; return 1;
} }
(void) headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL); rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
(void) headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL); rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);
rc = rpmvercmp(one, two); rc = rpmvercmp(one, two);
if (rc) if (rc)
return rc; return rc;
(void) headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL); rc = headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL);
(void) headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL); rc = headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL);
return rpmvercmp(one, two); return rpmvercmp(one, two);
} }
@ -321,7 +321,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
HME_t hme = (HME_t)fi->hme; HME_t hme = (HME_t)fi->hme;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData); HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
fileAction * actions = fi->actions; fileAction * actions = fi->actions;
int i, j, k, fc; int i, j, k, fc, xx;
rpmTagType type = 0; rpmTagType type = 0;
int_32 count = 0; int_32 count = 0;
int_32 dirNamesCount, dirCount; int_32 dirNamesCount, dirCount;
@ -354,16 +354,17 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_CONFLICTFLAGS RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_CONFLICTFLAGS
}; };
(void) hge(h, RPMTAG_SIZE, NULL, (void **) &fileSizes, NULL); xx = hge(h, RPMTAG_SIZE, NULL, (void **) &fileSizes, NULL);
fileSize = *fileSizes; fileSize = *fileSizes;
(void) hge(newH, RPMTAG_FILESIZES, NULL, (void **) &fileSizes, &count); xx = hge(newH, RPMTAG_FILESIZES, NULL, (void **) &fileSizes, &count);
for (i = 0, fc = 0; i < count; i++) for (i = 0, fc = 0; i < count; i++)
if (actions[i] != FA_SKIPMULTILIB) { if (actions[i] != FA_SKIPMULTILIB) {
fc++; fc++;
fileSize += fileSizes[i]; fileSize += fileSizes[i];
} }
(void) hme(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1); xx = hme(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1);
/*@-sizeoftype@*/
for (i = 0; mergeTags[i]; i++) { for (i = 0; mergeTags[i]; i++) {
if (!hge(newH, mergeTags[i], &type, (void **) &data, &count)) if (!hge(newH, mergeTags[i], &type, (void **) &data, &count))
continue; continue;
@ -374,7 +375,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++) for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB) if (actions[j] != FA_SKIPMULTILIB)
((int_8 *) newdata)[k++] = ((int_8 *) data)[j]; ((int_8 *) newdata)[k++] = ((int_8 *) data)[j];
(void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc); xx = headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata); free (newdata);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
case RPM_INT16_TYPE: case RPM_INT16_TYPE:
@ -382,7 +383,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++) for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB) if (actions[j] != FA_SKIPMULTILIB)
((int_16 *) newdata)[k++] = ((int_16 *) data)[j]; ((int_16 *) newdata)[k++] = ((int_16 *) data)[j];
(void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc); xx = headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata); free (newdata);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
case RPM_INT32_TYPE: case RPM_INT32_TYPE:
@ -390,7 +391,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++) for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB) if (actions[j] != FA_SKIPMULTILIB)
((int_32 *) newdata)[k++] = ((int_32 *) data)[j]; ((int_32 *) newdata)[k++] = ((int_32 *) data)[j];
(void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc); xx = headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata); free (newdata);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
case RPM_STRING_ARRAY_TYPE: case RPM_STRING_ARRAY_TYPE:
@ -398,7 +399,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++) for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB) if (actions[j] != FA_SKIPMULTILIB)
((char **) newdata)[k++] = ((char **) data)[j]; ((char **) newdata)[k++] = ((char **) data)[j];
(void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc); xx = headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata); free (newdata);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
default: default:
@ -409,16 +410,17 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
} }
data = hfd(data, type); data = hfd(data, type);
} }
(void) hge(newH, RPMTAG_DIRINDEXES, NULL, (void **) &newDirIndexes, &count); /*@=sizeoftype@*/
(void) hge(newH, RPMTAG_DIRNAMES, NULL, (void **) &newDirNames, NULL); xx = hge(newH, RPMTAG_DIRINDEXES, NULL, (void **) &newDirIndexes, &count);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); xx = hge(newH, RPMTAG_DIRNAMES, NULL, (void **) &newDirNames, NULL);
(void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &data, &dirNamesCount); xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &data, &dirNamesCount);
dirNames = xcalloc(dirNamesCount + fc, sizeof(char *)); dirNames = xcalloc(dirNamesCount + fc, sizeof(*dirNames));
for (i = 0; i < dirNamesCount; i++) for (i = 0; i < dirNamesCount; i++)
dirNames[i] = ((char **) data)[i]; dirNames[i] = ((char **) data)[i];
dirCount = dirNamesCount; dirCount = dirNamesCount;
newdata = xcalloc(fc, sizeof(int_32)); newdata = xcalloc(fc, sizeof(*newDirIndexes));
for (i = 0, k = 0; i < count; i++) { for (i = 0, k = 0; i < count; i++) {
if (actions[i] == FA_SKIPMULTILIB) if (actions[i] == FA_SKIPMULTILIB)
continue; continue;
@ -429,9 +431,9 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
dirNames[dirCount++] = newDirNames[newDirIndexes[i]]; dirNames[dirCount++] = newDirNames[newDirIndexes[i]];
((int_32 *) newdata)[k++] = j; ((int_32 *) newdata)[k++] = j;
} }
(void) headerAddOrAppendEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, newdata, fc); xx = headerAddOrAppendEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, newdata, fc);
if (dirCount > dirNamesCount) if (dirCount > dirNamesCount)
(void) headerAddOrAppendEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE, xx = headerAddOrAppendEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames + dirNamesCount, dirNames + dirNamesCount,
dirCount - dirNamesCount); dirCount - dirNamesCount);
data = hfd(data, -1); data = hfd(data, -1);
@ -448,12 +450,12 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
if (!hge(newH, requireTags[i], &nnt, (void **) &newNames, &newCount)) if (!hge(newH, requireTags[i], &nnt, (void **) &newNames, &newCount))
continue; continue;
(void) hge(newH, requireTags[i+1], &nvt, (void **) &newEVR, NULL); xx = hge(newH, requireTags[i+1], &nvt, (void **) &newEVR, NULL);
(void) hge(newH, requireTags[i+2], NULL, (void **) &newFlags, NULL); xx = hge(newH, requireTags[i+2], NULL, (void **) &newFlags, NULL);
if (hge(h, requireTags[i], &rnt, (void **) &Names, &Count)) if (hge(h, requireTags[i], &rnt, (void **) &Names, &Count))
{ {
(void) hge(h, requireTags[i+1], NULL, (void **) &EVR, NULL); xx = hge(h, requireTags[i+1], NULL, (void **) &EVR, NULL);
(void) hge(h, requireTags[i+2], NULL, (void **) &Flags, NULL); xx = hge(h, requireTags[i+2], NULL, (void **) &Flags, NULL);
for (j = 0; j < newCount; j++) for (j = 0; j < newCount; j++)
for (k = 0; k < Count; k++) for (k = 0; k < Count; k++)
if (!strcmp (newNames[j], Names[k]) if (!strcmp (newNames[j], Names[k])
@ -476,11 +478,11 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
k++; k++;
} }
if (k) { if (k) {
(void) headerAddOrAppendEntry(h, requireTags[i], xx = headerAddOrAppendEntry(h, requireTags[i],
RPM_STRING_ARRAY_TYPE, newNames, k); RPM_STRING_ARRAY_TYPE, newNames, k);
(void) headerAddOrAppendEntry(h, requireTags[i+1], xx = headerAddOrAppendEntry(h, requireTags[i+1],
RPM_STRING_ARRAY_TYPE, newEVR, k); RPM_STRING_ARRAY_TYPE, newEVR, k);
(void) headerAddOrAppendEntry(h, requireTags[i+2], RPM_INT32_TYPE, xx = headerAddOrAppendEntry(h, requireTags[i+2], RPM_INT32_TYPE,
newFlags, k); newFlags, k);
} }
newNames = hfd(newNames, nnt); newNames = hfd(newNames, nnt);
@ -508,7 +510,7 @@ static int markReplacedFiles(PSM_t psm)
Header h; Header h;
unsigned int * offsets; unsigned int * offsets;
unsigned int prev; unsigned int prev;
int num; int num, xx;
if (!(fi->fc > 0 && fi->replaced)) if (!(fi->fc > 0 && fi->replaced))
return 0; return 0;
@ -533,8 +535,8 @@ static int markReplacedFiles(PSM_t psm)
} }
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0); mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0);
(void) rpmdbAppendIterator(mi, offsets, num); xx = rpmdbAppendIterator(mi, offsets, num);
(void) rpmdbSetIteratorRewrite(mi, 1); xx = rpmdbSetIteratorRewrite(mi, 1);
sfi = replaced; sfi = replaced;
while ((h = rpmdbNextIterator(mi)) != NULL) { while ((h = rpmdbNextIterator(mi)) != NULL) {
@ -556,7 +558,7 @@ static int markReplacedFiles(PSM_t psm)
if (modified == 0) { if (modified == 0) {
/* Modified header will be rewritten. */ /* Modified header will be rewritten. */
modified = 1; modified = 1;
(void) rpmdbSetIteratorModified(mi, modified); xx = rpmdbSetIteratorModified(mi, modified);
} }
num++; num++;
} }
@ -855,7 +857,7 @@ static int runScript(PSM_t psm, Header h,
pid_t child; pid_t child;
int status = 0; int status = 0;
const char * fn = NULL; const char * fn = NULL;
int i; int i, xx;
int freePrefixes = 0; int freePrefixes = 0;
FD_t out; FD_t out;
rpmRC rc = RPMRC_OK; rpmRC rc = RPMRC_OK;
@ -865,16 +867,16 @@ static int runScript(PSM_t psm, Header h,
return 0; return 0;
if (!progArgv) { if (!progArgv) {
argv = alloca(5 * sizeof(char *)); argv = alloca(5 * sizeof(*argv));
argv[0] = "/bin/sh"; argv[0] = "/bin/sh";
argc = 1; argc = 1;
} else { } else {
argv = alloca((progArgc + 4) * sizeof(char *)); argv = alloca((progArgc + 4) * sizeof(*argv));
memcpy(argv, progArgv, progArgc * sizeof(char *)); memcpy(argv, progArgv, progArgc * sizeof(*argv));
argc = progArgc; argc = progArgc;
} }
(void) headerNVR(h, &n, &v, &r); xx = headerNVR(h, &n, &v, &r);
if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (void **) &prefixes, &numPrefixes)) { if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (void **) &prefixes, &numPrefixes)) {
freePrefixes = 1; freePrefixes = 1;
} else if (hge(h, RPMTAG_INSTALLPREFIX, NULL, (void **) &oldPrefix, NULL)) { } else if (hge(h, RPMTAG_INSTALLPREFIX, NULL, (void **) &oldPrefix, NULL)) {
@ -902,10 +904,13 @@ static int runScript(PSM_t psm, Header h,
if (rpmIsDebug() && if (rpmIsDebug() &&
(!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash"))) (!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash")))
(void) Fwrite("set -x\n", sizeof(char), 7, fd); {
static const char set_x[] = "set -x\n";
xx = Fwrite(set_x, sizeof(set_x[0]), sizeof(set_x)-1, fd);
}
(void) Fwrite(script, sizeof(script[0]), strlen(script), fd); xx = Fwrite(script, sizeof(script[0]), strlen(script), fd);
(void) Fclose(fd); xx = Fclose(fd);
{ const char * sn = fn; { const char * sn = fn;
if (!ts->chrootDone && if (!ts->chrootDone &&
@ -953,25 +958,25 @@ static int runScript(PSM_t psm, Header h,
pipes[0] = pipes[1] = 0; pipes[0] = pipes[1] = 0;
/* make stdin inaccessible */ /* make stdin inaccessible */
(void) pipe(pipes); xx = pipe(pipes);
(void) close(pipes[1]); xx = close(pipes[1]);
(void) dup2(pipes[0], STDIN_FILENO); xx = dup2(pipes[0], STDIN_FILENO);
(void) close(pipes[0]); xx = close(pipes[0]);
/*@-branchstate@*/ /*@-branchstate@*/
if (ts->scriptFd != NULL) { if (ts->scriptFd != NULL) {
int sfdno = Fileno(ts->scriptFd); int sfdno = Fileno(ts->scriptFd);
int ofdno = Fileno(out); int ofdno = Fileno(out);
if (sfdno != STDERR_FILENO) if (sfdno != STDERR_FILENO)
(void) dup2(sfdno, STDERR_FILENO); xx = dup2(sfdno, STDERR_FILENO);
if (ofdno != STDOUT_FILENO) if (ofdno != STDOUT_FILENO)
(void) dup2(ofdno, STDOUT_FILENO); xx = dup2(ofdno, STDOUT_FILENO);
/* make sure we don't close stdin/stderr/stdout by mistake! */ /* make sure we don't close stdin/stderr/stdout by mistake! */
if (ofdno > STDERR_FILENO && ofdno != sfdno) { if (ofdno > STDERR_FILENO && ofdno != sfdno) {
(void) Fclose (out); xx = Fclose (out);
} }
if (sfdno > STDERR_FILENO) { if (sfdno > STDERR_FILENO) {
(void) Fclose (ts->scriptFd); xx = Fclose (ts->scriptFd);
} }
} }
/*@=branchstate@*/ /*@=branchstate@*/
@ -983,7 +988,7 @@ static int runScript(PSM_t psm, Header h,
if (ipath && ipath[5] != '%') if (ipath && ipath[5] != '%')
path = ipath; path = ipath;
(void) doputenv(path); xx = doputenv(path);
/*@-modobserver@*/ /*@-modobserver@*/
ipath = _free(ipath); ipath = _free(ipath);
/*@=modobserver@*/ /*@=modobserver@*/
@ -992,12 +997,12 @@ static int runScript(PSM_t psm, Header h,
for (i = 0; i < numPrefixes; i++) { for (i = 0; i < numPrefixes; i++) {
sprintf(prefixBuf, "RPM_INSTALL_PREFIX%d=%s", i, prefixes[i]); sprintf(prefixBuf, "RPM_INSTALL_PREFIX%d=%s", i, prefixes[i]);
(void) doputenv(prefixBuf); xx = doputenv(prefixBuf);
/* backwards compatibility */ /* backwards compatibility */
if (i == 0) { if (i == 0) {
sprintf(prefixBuf, "RPM_INSTALL_PREFIX=%s", prefixes[i]); sprintf(prefixBuf, "RPM_INSTALL_PREFIX=%s", prefixes[i]);
(void) doputenv(prefixBuf); xx = doputenv(prefixBuf);
} }
} }
@ -1010,11 +1015,11 @@ static int runScript(PSM_t psm, Header h,
case URL_IS_UNKNOWN: case URL_IS_UNKNOWN:
if (!ts->chrootDone && !(rootDir[0] == '/' && rootDir[1] == '\0')) { if (!ts->chrootDone && !(rootDir[0] == '/' && rootDir[1] == '\0')) {
/*@-superuser -noeffect @*/ /*@-superuser -noeffect @*/
(void) chroot(rootDir); xx = chroot(rootDir);
/*@=superuser =noeffect @*/ /*@=superuser =noeffect @*/
} }
(void) chdir("/"); xx = chdir("/");
(void) execv(argv[0], (char *const *)argv); xx = execv(argv[0], (char *const *)argv);
break; break;
default: default:
break; break;
@ -1041,12 +1046,12 @@ static int runScript(PSM_t psm, Header h,
if (freePrefixes) prefixes = hfd(prefixes, ipt); if (freePrefixes) prefixes = hfd(prefixes, ipt);
(void) Fclose(out); /* XXX dup'd STDOUT_FILENO */ xx = Fclose(out); /* XXX dup'd STDOUT_FILENO */
/*@-branchstate@*/ /*@-branchstate@*/
if (script) { if (script) {
if (!rpmIsDebug()) if (!rpmIsDebug())
(void) unlink(fn); xx = unlink(fn);
fn = _free(fn); fn = _free(fn);
} }
/*@=branchstate@*/ /*@=branchstate@*/
@ -1073,17 +1078,18 @@ static rpmRC runInstScript(PSM_t psm)
rpmTagType ptt, stt; rpmTagType ptt, stt;
const char * script; const char * script;
rpmRC rc = RPMRC_OK; rpmRC rc = RPMRC_OK;
int xx;
/* /*
* headerGetEntry() sets the data pointer to NULL if the entry does * headerGetEntry() sets the data pointer to NULL if the entry does
* not exist. * not exist.
*/ */
(void) hge(fi->h, psm->progTag, &ptt, (void **) &programArgv, &programArgc); xx = hge(fi->h, psm->progTag, &ptt, (void **) &programArgv, &programArgc);
(void) hge(fi->h, psm->scriptTag, &stt, (void **) &script, NULL); xx = hge(fi->h, psm->scriptTag, &stt, (void **) &script, NULL);
/*@-branchstate@*/ /*@-branchstate@*/
if (programArgv && ptt == RPM_STRING_TYPE) { if (programArgv && ptt == RPM_STRING_TYPE) {
argv = alloca(sizeof(char *)); argv = alloca(sizeof(*argv));
*argv = (const char *) programArgv; *argv = (const char *) programArgv;
} else { } else {
argv = (const char **) programArgv; argv = (const char **) programArgv;
@ -1127,7 +1133,7 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
const char * sourceName; const char * sourceName;
int numTriggers; int numTriggers;
rpmRC rc = RPMRC_OK; rpmRC rc = RPMRC_OK;
int i; int i, xx;
int skip; int skip;
if (!( hge(triggeredH, RPMTAG_TRIGGERNAME, &tnt, if (!( hge(triggeredH, RPMTAG_TRIGGERNAME, &tnt,
@ -1139,7 +1145,7 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
) )
return 0; return 0;
(void) headerNVR(sourceH, &sourceName, NULL, NULL); xx = headerNVR(sourceH, &sourceName, NULL, NULL);
for (i = 0; i < numTriggers; i++) { for (i = 0; i < numTriggers; i++) {
rpmTagType tit, tst, tpt; rpmTagType tit, tst, tpt;
@ -1173,7 +1179,7 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
) )
continue; continue;
(void) headerNVR(triggeredH, &triggerPackageName, NULL, NULL); xx = headerNVR(triggeredH, &triggerPackageName, NULL, NULL);
{ int arg1; { int arg1;
int index; int index;
@ -1360,6 +1366,7 @@ int psmStage(PSM_t psm, pkgStage stage)
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData); HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
rpmRC rc = psm->rc; rpmRC rc = psm->rc;
int saveerrno; int saveerrno;
int xx;
/*@-branchstate@*/ /*@-branchstate@*/
switch (stage) { switch (stage) {
@ -1386,9 +1393,9 @@ int psmStage(PSM_t psm, pkgStage stage)
assert(psm->mi == NULL); assert(psm->mi == NULL);
psm->mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, fi->name, 0); psm->mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, fi->name, 0);
(void) rpmdbSetIteratorRE(psm->mi, RPMTAG_VERSION, xx = rpmdbSetIteratorRE(psm->mi, RPMTAG_VERSION,
RPMMIRE_DEFAULT, fi->version); RPMMIRE_DEFAULT, fi->version);
(void) rpmdbSetIteratorRE(psm->mi, RPMTAG_RELEASE, xx = rpmdbSetIteratorRE(psm->mi, RPMTAG_RELEASE,
RPMMIRE_DEFAULT, fi->release); RPMMIRE_DEFAULT, fi->release);
while ((psm->oh = rpmdbNextIterator(psm->mi))) { while ((psm->oh = rpmdbNextIterator(psm->mi))) {
@ -1428,10 +1435,10 @@ assert(psm->mi == NULL);
rpmBuildFileList(fi->h, &fi->apath, NULL); rpmBuildFileList(fi->h, &fi->apath, NULL);
if (fi->fuser == NULL) if (fi->fuser == NULL)
(void) hge(fi->h, RPMTAG_FILEUSERNAME, NULL, xx = hge(fi->h, RPMTAG_FILEUSERNAME, NULL,
(void **) &fi->fuser, NULL); (void **) &fi->fuser, NULL);
if (fi->fgroup == NULL) if (fi->fgroup == NULL)
(void) hge(fi->h, RPMTAG_FILEGROUPNAME, NULL, xx = hge(fi->h, RPMTAG_FILEGROUPNAME, NULL,
(void **) &fi->fgroup, NULL); (void **) &fi->fgroup, NULL);
if (fi->fuids == NULL) if (fi->fuids == NULL)
fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc); fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc);
@ -1526,7 +1533,7 @@ assert(psm->mi == NULL);
/* Add remove transaction id to header. */ /* Add remove transaction id to header. */
if (psm->oh) if (psm->oh)
{ int_32 tid = ts->id; { int_32 tid = ts->id;
(void) headerAddEntry(psm->oh, RPMTAG_REMOVETID, xx = headerAddEntry(psm->oh, RPMTAG_REMOVETID,
RPM_INT32_TYPE, &tid, 1); RPM_INT32_TYPE, &tid, 1);
} }
@ -1634,10 +1641,10 @@ assert(psm->mi == NULL);
rc = fsmSetup(fi->fsm, FSM_PKGINSTALL, ts, fi, rc = fsmSetup(fi->fsm, FSM_PKGINSTALL, ts, fi,
psm->cfd, NULL, &psm->failedFile); psm->cfd, NULL, &psm->failedFile);
(void) fsmTeardown(fi->fsm); xx = fsmTeardown(fi->fsm);
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */ saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
(void) Fclose(psm->cfd); xx = Fclose(psm->cfd);
psm->cfd = NULL; psm->cfd = NULL;
errno = saveerrno; /* XXX FIXME: Fclose with libio destroys errno */ errno = saveerrno; /* XXX FIXME: Fclose with libio destroys errno */
@ -1656,7 +1663,7 @@ assert(psm->mi == NULL);
psm->what = RPMCALLBACK_INST_PROGRESS; psm->what = RPMCALLBACK_INST_PROGRESS;
psm->amount = (fi->archiveSize ? fi->archiveSize : 100); psm->amount = (fi->archiveSize ? fi->archiveSize : 100);
psm->total = psm->amount; psm->total = psm->amount;
(void) psmStage(psm, PSM_NOTIFY); xx = psmStage(psm, PSM_NOTIFY);
} }
if (psm->goal == PSM_PKGERASE) { if (psm->goal == PSM_PKGERASE) {
@ -1667,16 +1674,16 @@ assert(psm->mi == NULL);
psm->what = RPMCALLBACK_UNINST_START; psm->what = RPMCALLBACK_UNINST_START;
psm->amount = fi->fc; /* XXX W2DO? looks wrong. */ psm->amount = fi->fc; /* XXX W2DO? looks wrong. */
psm->total = fi->fc; psm->total = fi->fc;
(void) psmStage(psm, PSM_NOTIFY); xx = psmStage(psm, PSM_NOTIFY);
rc = fsmSetup(fi->fsm, FSM_PKGERASE, ts, fi, rc = fsmSetup(fi->fsm, FSM_PKGERASE, ts, fi,
NULL, NULL, &psm->failedFile); NULL, NULL, &psm->failedFile);
(void) fsmTeardown(fi->fsm); xx = fsmTeardown(fi->fsm);
psm->what = RPMCALLBACK_UNINST_STOP; psm->what = RPMCALLBACK_UNINST_STOP;
psm->amount = 0; /* XXX W2DO? looks wrong. */ psm->amount = 0; /* XXX W2DO? looks wrong. */
psm->total = fi->fc; psm->total = fi->fc;
(void) psmStage(psm, PSM_NOTIFY); xx = psmStage(psm, PSM_NOTIFY);
} }
if (psm->goal == PSM_PKGSAVE) { if (psm->goal == PSM_PKGSAVE) {
@ -1691,7 +1698,7 @@ assert(psm->mi == NULL);
break; break;
} }
/*@-nullpass@*/ /* LCL: psm->fd != NULL here. */ /*@-nullpass@*/ /* LCL: psm->fd != NULL here. */
(void) Fflush(psm->fd); xx = Fflush(psm->fd);
psm->cfd = Fdopen(fdDup(Fileno(psm->fd)), psm->rpmio_flags); psm->cfd = Fdopen(fdDup(Fileno(psm->fd)), psm->rpmio_flags);
/*@=nullpass@*/ /*@=nullpass@*/
if (psm->cfd == NULL) { /* XXX can't happen */ if (psm->cfd == NULL) { /* XXX can't happen */
@ -1701,10 +1708,10 @@ assert(psm->mi == NULL);
rc = fsmSetup(fi->fsm, FSM_PKGBUILD, ts, fi, psm->cfd, rc = fsmSetup(fi->fsm, FSM_PKGBUILD, ts, fi, psm->cfd,
NULL, &psm->failedFile); NULL, &psm->failedFile);
(void) fsmTeardown(fi->fsm); xx = fsmTeardown(fi->fsm);
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */ saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
(void) Fclose(psm->cfd); xx = Fclose(psm->cfd);
psm->cfd = NULL; psm->cfd = NULL;
errno = saveerrno; errno = saveerrno;
@ -1719,10 +1726,10 @@ assert(psm->mi == NULL);
int_32 installTime = (int_32) time(NULL); int_32 installTime = (int_32) time(NULL);
if (fi->fstates != NULL && fi->fc > 0) if (fi->fstates != NULL && fi->fc > 0)
(void) headerAddEntry(fi->h, RPMTAG_FILESTATES, RPM_CHAR_TYPE, xx = headerAddEntry(fi->h, RPMTAG_FILESTATES, RPM_CHAR_TYPE,
fi->fstates, fi->fc); fi->fstates, fi->fc);
(void) headerAddEntry(fi->h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE, xx = headerAddEntry(fi->h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE,
&installTime, 1); &installTime, 1);
if (ts->transFlags & RPMTRANS_FLAG_MULTILIB) { if (ts->transFlags & RPMTRANS_FLAG_MULTILIB) {
@ -1735,7 +1742,7 @@ assert(psm->mi == NULL);
{ {
multiLib = *p; multiLib = *p;
multiLib |= *newMultiLib; multiLib |= *newMultiLib;
(void) hme(psm->oh, RPMTAG_MULTILIBS, RPM_INT32_TYPE, xx = hme(psm->oh, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
&multiLib, 1); &multiLib, 1);
} }
rc = mergeFiles(fi, psm->oh, fi->h); rc = mergeFiles(fi, psm->oh, fi->h);
@ -1803,17 +1810,17 @@ assert(psm->mi == NULL);
} }
/* Restore root directory if changed. */ /* Restore root directory if changed. */
(void) psmStage(psm, PSM_CHROOT_OUT); xx = psmStage(psm, PSM_CHROOT_OUT);
break; break;
case PSM_UNDO: case PSM_UNDO:
break; break;
case PSM_FINI: case PSM_FINI:
/* Restore root directory if changed. */ /* Restore root directory if changed. */
(void) psmStage(psm, PSM_CHROOT_OUT); xx = psmStage(psm, PSM_CHROOT_OUT);
if (psm->fd) { if (psm->fd) {
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */ saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
(void) Fclose(psm->fd); xx = Fclose(psm->fd);
psm->fd = NULL; psm->fd = NULL;
errno = saveerrno; errno = saveerrno;
} }
@ -1861,7 +1868,7 @@ assert(psm->mi == NULL);
if (!rc) rc = psmStage(psm, PSM_PRE); if (!rc) rc = psmStage(psm, PSM_PRE);
if (!rc) rc = psmStage(psm, PSM_PROCESS); if (!rc) rc = psmStage(psm, PSM_PROCESS);
if (!rc) rc = psmStage(psm, PSM_POST); if (!rc) rc = psmStage(psm, PSM_POST);
(void) psmStage(psm, PSM_FINI); xx = psmStage(psm, PSM_FINI);
break; break;
case PSM_PKGCOMMIT: case PSM_PKGCOMMIT:
break; break;
@ -1869,9 +1876,12 @@ assert(psm->mi == NULL);
case PSM_CREATE: case PSM_CREATE:
break; break;
case PSM_NOTIFY: case PSM_NOTIFY:
if (ts && ts->notify) if (ts && ts->notify) {
/*@-noeffectuncon @*/ /* FIX: check rc */
(void) ts->notify(fi->h, psm->what, psm->amount, psm->total, (void) ts->notify(fi->h, psm->what, psm->amount, psm->total,
(fi->ap ? fi->ap->key : NULL), ts->notifyData); (fi->ap ? fi->ap->key : NULL), ts->notifyData);
/*@=noeffectuncon @*/
}
break; break;
case PSM_DESTROY: case PSM_DESTROY:
break; break;
@ -1881,7 +1891,7 @@ assert(psm->mi == NULL);
rc = fsmSetup(fi->fsm, FSM_PKGCOMMIT, ts, fi, rc = fsmSetup(fi->fsm, FSM_PKGCOMMIT, ts, fi,
NULL, NULL, &psm->failedFile); NULL, NULL, &psm->failedFile);
(void) fsmTeardown(fi->fsm); xx = fsmTeardown(fi->fsm);
break; break;
case PSM_CHROOT_IN: case PSM_CHROOT_IN:
@ -1899,7 +1909,7 @@ assert(psm->mi == NULL);
_loaded++; _loaded++;
} }
(void) chdir("/"); xx = chdir("/");
/*@-superuser@*/ /*@-superuser@*/
rc = chroot(ts->rootDir); rc = chroot(ts->rootDir);
/*@=superuser@*/ /*@=superuser@*/
@ -1919,7 +1929,7 @@ assert(psm->mi == NULL);
psm->chrootDone = ts->chrootDone = 0; psm->chrootDone = ts->chrootDone = 0;
if (ts->rpmdb != NULL) ts->rpmdb->db_chrootDone = 0; if (ts->rpmdb != NULL) ts->rpmdb->db_chrootDone = 0;
chroot_prefix = NULL; chroot_prefix = NULL;
(void) chdir(ts->currDir); xx = chdir(ts->currDir);
} }
break; break;
case PSM_SCRIPT: case PSM_SCRIPT:

View File

@ -692,8 +692,11 @@ restart:
break; break;
} }
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
/*@-noeffectuncon@*/ /* FIX: check rc */
(void) showPackage(qva, NULL, pkg->header); (void) showPackage(qva, NULL, pkg->header);
/*@=noeffectuncon@*/
}
spec = freeSpecVec(spec); spec = freeSpecVec(spec);
} break; } break;

View File

@ -33,9 +33,11 @@ int writeLead(FD_t fd, const struct rpmlead *lead)
l.osnum = htons(l.osnum); l.osnum = htons(l.osnum);
l.signature_type = htons(l.signature_type); l.signature_type = htons(l.signature_type);
/*@-sizeoftype@*/
if (Fwrite(&l, sizeof(char), sizeof(l), fd) != sizeof(l)) { if (Fwrite(&l, sizeof(char), sizeof(l), fd) != sizeof(l)) {
return 1; return 1;
} }
/*@=sizeoftype@*/
return 0; return 0;
} }

View File

@ -332,7 +332,7 @@ static int addCanon(canonEntry * table, int * tableLen, char * line,
(*tableLen) += 2; (*tableLen) += 2;
/*@-unqualifiedtrans@*/ /*@-unqualifiedtrans@*/
*table = xrealloc(*table, sizeof(struct canonEntry_s) * (*tableLen)); *table = xrealloc(*table, sizeof(**table) * (*tableLen));
/*@=unqualifiedtrans@*/ /*@=unqualifiedtrans@*/
t = & ((*table)[*tableLen - 2]); t = & ((*table)[*tableLen - 2]);
@ -382,7 +382,7 @@ static int addDefault(defaultEntry * table, int * tableLen, char * line,
(*tableLen)++; (*tableLen)++;
/*@-unqualifiedtrans@*/ /*@-unqualifiedtrans@*/
*table = xrealloc(*table, sizeof(struct defaultEntry_s) * (*tableLen)); *table = xrealloc(*table, sizeof(**table) * (*tableLen));
/*@=unqualifiedtrans@*/ /*@=unqualifiedtrans@*/
t = & ((*table)[*tableLen - 1]); t = & ((*table)[*tableLen - 1]);
@ -737,7 +737,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
/* Find keyword in table */ /* Find keyword in table */
searchOption.name = s; searchOption.name = s;
option = bsearch(&searchOption, optionTable, optionTableSize, option = bsearch(&searchOption, optionTable, optionTableSize,
sizeof(struct rpmOption), optionCompare); sizeof(optionTable[0]), optionCompare);
if (option) { /* For configuration variables ... */ if (option) { /* For configuration variables ... */
const char *arch, *val, *fn; const char *arch, *val, *fn;

View File

@ -125,6 +125,7 @@ static inline rpmRC checkSize(FD_t fd, int siglen, int pad, int datalen)
return RPMRC_OK; return RPMRC_OK;
} }
/*@-sizeoftype@*/
rc = (((sizeof(struct rpmlead) + siglen + pad + datalen) - st.st_size) rc = (((sizeof(struct rpmlead) + siglen + pad + datalen) - st.st_size)
? RPMRC_BADSIZE : RPMRC_OK); ? RPMRC_BADSIZE : RPMRC_OK);
@ -132,6 +133,7 @@ static inline rpmRC checkSize(FD_t fd, int siglen, int pad, int datalen)
_("Expected size: %12d = lead(%d)+sigs(%d)+pad(%d)+data(%d)\n"), _("Expected size: %12d = lead(%d)+sigs(%d)+pad(%d)+data(%d)\n"),
(int)sizeof(struct rpmlead)+siglen+pad+datalen, (int)sizeof(struct rpmlead)+siglen+pad+datalen,
(int)sizeof(struct rpmlead), siglen, pad, datalen); (int)sizeof(struct rpmlead), siglen, pad, datalen);
/*@=sizeoftype@*/
rpmMessage((rc == RPMRC_OK ? RPMMESS_DEBUG : RPMMESS_WARNING), rpmMessage((rc == RPMRC_OK ? RPMMESS_DEBUG : RPMMESS_WARNING),
_(" Actual size: %12d\n"), (int)st.st_size); _(" Actual size: %12d\n"), (int)st.st_size);
@ -488,7 +490,9 @@ verifyMD5Signature(const char * datafile, const byte * sig,
byte md5sum[16]; byte md5sum[16];
memset(md5sum, 0, sizeof(md5sum)); memset(md5sum, 0, sizeof(md5sum));
/*@-noeffectuncon@*/ /* FIX: check rc */
(void) fn(datafile, md5sum); (void) fn(datafile, md5sum);
/*@=noeffectuncon@*/
if (memcmp(md5sum, sig, 16)) { if (memcmp(md5sum, sig, 16)) {
sprintf(result, "MD5 sum mismatch\n" sprintf(result, "MD5 sum mismatch\n"
"Expected: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" "Expected: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
@ -518,7 +522,7 @@ verifyMD5Signature(const char * datafile, const byte * sig,
/*@=globuse@*/ /*@=globuse@*/
static rpmVerifySignatureReturn static rpmVerifySignatureReturn
verifyPGPSignature(const char * datafile, const void * sig, int count, verifyPGPSignature(const char * datafile, const byte * sig, int count,
/*@unused@*/ const rpmDigest dig, /*@out@*/ char * result) /*@unused@*/ const rpmDigest dig, /*@out@*/ char * result)
/*@globals rpmGlobalMacroContext, /*@globals rpmGlobalMacroContext,
fileSystem, internalState@*/ fileSystem, internalState@*/
@ -575,7 +579,7 @@ fprintf(stderr, "=============================== RSA verify %s: rc %d\n",
#else #else
{ FD_t sfd; { FD_t sfd;
if (!makeTempFile(NULL, &sigfile, &sfd)) { if (!makeTempFile(NULL, &sigfile, &sfd)) {
(void) Fwrite(sig, sizeof(char), count, sfd); (void) Fwrite(sig, sizeof(*sig), count, sfd);
(void) Fclose(sfd); (void) Fclose(sfd);
sfd = NULL; sfd = NULL;
} }
@ -663,7 +667,7 @@ fprintf(stderr, "=============================== RSA verify %s: rc %d\n",
} }
static rpmVerifySignatureReturn static rpmVerifySignatureReturn
verifyGPGSignature(const char * datafile, const void * sig, int count, verifyGPGSignature(const char * datafile, const byte * sig, int count,
/*@unused@*/ const rpmDigest dig, /*@out@*/ char * result) /*@unused@*/ const rpmDigest dig, /*@out@*/ char * result)
/*@globals rpmGlobalMacroContext, /*@globals rpmGlobalMacroContext,
fileSystem, internalState@*/ fileSystem, internalState@*/
@ -707,7 +711,7 @@ fprintf(stderr, "=============================== DSA verify %s: rc %d\n",
#else #else
{ FD_t sfd; { FD_t sfd;
if (!makeTempFile(NULL, &sigfile, &sfd)) { if (!makeTempFile(NULL, &sigfile, &sfd)) {
(void) Fwrite(sig, sizeof(char), count, sfd); (void) Fwrite(sig, sizeof(*sig), count, sfd);
(void) Fclose(sfd); (void) Fclose(sfd);
sfd = NULL; sfd = NULL;
} }

View File

@ -37,7 +37,7 @@ _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/
StringBuf newStringBuf(void) StringBuf newStringBuf(void)
{ {
StringBuf sb = xmalloc(sizeof(struct StringBufRec)); StringBuf sb = xmalloc(sizeof(*sb));
sb->free = sb->allocated = BUF_CHUNK; sb->free = sb->allocated = BUF_CHUNK;
sb->buf = xcalloc(sb->allocated, sizeof(*sb->buf)); sb->buf = xcalloc(sb->allocated, sizeof(*sb->buf));

View File

@ -367,7 +367,7 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
int haveRelocatedFile = 0; int haveRelocatedFile = 0;
int reldel = 0; int reldel = 0;
int len; int len;
int i, j; int i, j, xx;
if (!hge(origH, RPMTAG_PREFIXES, &validType, if (!hge(origH, RPMTAG_PREFIXES, &validType,
(void **) &validRelocations, &numValid)) (void **) &validRelocations, &numValid))
@ -388,7 +388,7 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
if (rawRelocations == NULL || numRelocations == 0) { if (rawRelocations == NULL || numRelocations == 0) {
if (numValid) { if (numValid) {
if (!headerIsEntry(origH, RPMTAG_INSTPREFIXES)) if (!headerIsEntry(origH, RPMTAG_INSTPREFIXES))
(void) hae(origH, RPMTAG_INSTPREFIXES, xx = hae(origH, RPMTAG_INSTPREFIXES,
validType, validRelocations, numValid); validType, validRelocations, numValid);
validRelocations = hfd(validRelocations, validType); validRelocations = hfd(validRelocations, validType);
} }
@ -510,18 +510,18 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
} }
if (numActual) if (numActual)
(void) hae(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE, xx = hae(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
(void **) actualRelocations, numActual); (void **) actualRelocations, numActual);
actualRelocations = _free(actualRelocations); actualRelocations = _free(actualRelocations);
validRelocations = hfd(validRelocations, validType); validRelocations = hfd(validRelocations, validType);
} }
(void) hge(h, RPMTAG_BASENAMES, NULL, (void **) &baseNames, &fileCount); xx = hge(h, RPMTAG_BASENAMES, NULL, (void **) &baseNames, &fileCount);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, &dirCount); xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, &dirCount);
(void) hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fFlags, NULL); xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fFlags, NULL);
(void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &fModes, NULL); xx = hge(h, RPMTAG_FILEMODES, NULL, (void **) &fModes, NULL);
skipDirList = alloca(dirCount * sizeof(*skipDirList)); skipDirList = alloca(dirCount * sizeof(*skipDirList));
memset(skipDirList, 0, dirCount * sizeof(*skipDirList)); memset(skipDirList, 0, dirCount * sizeof(*skipDirList));
@ -718,33 +718,33 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
rpmTagType t; rpmTagType t;
p = NULL; p = NULL;
(void) hge(h, RPMTAG_BASENAMES, &t, &p, &c); xx = hge(h, RPMTAG_BASENAMES, &t, &p, &c);
(void) hae(h, RPMTAG_ORIGBASENAMES, t, p, c); xx = hae(h, RPMTAG_ORIGBASENAMES, t, p, c);
p = hfd(p, t); p = hfd(p, t);
p = NULL; p = NULL;
(void) hge(h, RPMTAG_DIRNAMES, &t, &p, &c); xx = hge(h, RPMTAG_DIRNAMES, &t, &p, &c);
(void) hae(h, RPMTAG_ORIGDIRNAMES, t, p, c); xx = hae(h, RPMTAG_ORIGDIRNAMES, t, p, c);
p = hfd(p, t); p = hfd(p, t);
p = NULL; p = NULL;
(void) hge(h, RPMTAG_DIRINDEXES, &t, &p, &c); xx = hge(h, RPMTAG_DIRINDEXES, &t, &p, &c);
(void) hae(h, RPMTAG_ORIGDIRINDEXES, t, p, c); xx = hae(h, RPMTAG_ORIGDIRINDEXES, t, p, c);
p = hfd(p, t); p = hfd(p, t);
(void) hme(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE, xx = hme(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, fileCount); baseNames, fileCount);
fi->bnl = hfd(fi->bnl, RPM_STRING_ARRAY_TYPE); fi->bnl = hfd(fi->bnl, RPM_STRING_ARRAY_TYPE);
(void) hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc); xx = hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc);
(void) hme(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE, xx = hme(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirCount); dirNames, dirCount);
fi->dnl = hfd(fi->dnl, RPM_STRING_ARRAY_TYPE); fi->dnl = hfd(fi->dnl, RPM_STRING_ARRAY_TYPE);
(void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc); xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
(void) hme(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, xx = hme(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
dirIndexes, fileCount); dirIndexes, fileCount);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL); xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
} }
baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE); baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE);
@ -961,6 +961,7 @@ static int handleInstInstalledFiles(TFI_t fi, /*@null@*/ rpmdb db,
uint_32 * otherSizes; uint_32 * otherSizes;
uint_16 * otherModes; uint_16 * otherModes;
int numReplaced = 0; int numReplaced = 0;
int xx;
rpmdbMatchIterator mi; rpmdbMatchIterator mi;
@ -971,12 +972,12 @@ static int handleInstInstalledFiles(TFI_t fi, /*@null@*/ rpmdb db,
return 1; return 1;
} }
(void) hge(h, RPMTAG_FILEMD5S, &omtype, (void **) &otherMd5s, NULL); xx = hge(h, RPMTAG_FILEMD5S, &omtype, (void **) &otherMd5s, NULL);
(void) hge(h, RPMTAG_FILELINKTOS, &oltype, (void **) &otherLinks, NULL); xx = hge(h, RPMTAG_FILELINKTOS, &oltype, (void **) &otherLinks, NULL);
(void) hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL); xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
(void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &otherModes, NULL); xx = hge(h, RPMTAG_FILEMODES, NULL, (void **) &otherModes, NULL);
(void) hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &otherFlags, NULL); xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &otherFlags, NULL);
(void) hge(h, RPMTAG_FILESIZES, NULL, (void **) &otherSizes, NULL); xx = hge(h, RPMTAG_FILESIZES, NULL, (void **) &otherSizes, NULL);
fi->replaced = xmalloc(sharedCount * sizeof(*fi->replaced)); fi->replaced = xmalloc(sharedCount * sizeof(*fi->replaced));
@ -1049,7 +1050,7 @@ static int handleRmvdInstalledFiles(TFI_t fi, /*@null@*/ rpmdb db,
HGE_t hge = fi->hge; HGE_t hge = fi->hge;
Header h; Header h;
const char * otherStates; const char * otherStates;
int i; int i, xx;
rpmdbMatchIterator mi; rpmdbMatchIterator mi;
@ -1061,7 +1062,7 @@ static int handleRmvdInstalledFiles(TFI_t fi, /*@null@*/ rpmdb db,
return 1; return 1;
} }
(void) hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL); xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
for (i = 0; i < sharedCount; i++, shared++) { for (i = 0; i < sharedCount; i++, shared++) {
int otherFileNum, fileNum; int otherFileNum, fileNum;
@ -1606,6 +1607,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
struct psm_s psmbuf; struct psm_s psmbuf;
PSM_t psm = &psmbuf; PSM_t psm = &psmbuf;
void * tsi; void * tsi;
int xx;
/* FIXME: what if the same package is included in ts twice? */ /* FIXME: what if the same package is included in ts twice? */
@ -1683,7 +1685,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
ts->di[i].iavail = !(sfb.f_ffree == 0 && sfb.f_files == 0) ts->di[i].iavail = !(sfb.f_ffree == 0 && sfb.f_files == 0)
? sfb.f_ffree : -1; ? sfb.f_ffree : -1;
(void) stat(ts->filesystems[i], &sb); xx = stat(ts->filesystems[i], &sb);
ts->di[i].dev = sb.st_dev; ts->di[i].dev = sb.st_dev;
} }
} }
@ -1716,7 +1718,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
Header oldH; Header oldH;
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, alp->name, 0); mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, alp->name, 0);
while ((oldH = rpmdbNextIterator(mi)) != NULL) while ((oldH = rpmdbNextIterator(mi)) != NULL)
(void) ensureOlder(alp, oldH, ts->probs); xx = ensureOlder(alp, oldH, ts->probs);
mi = rpmdbFreeIterator(mi); mi = rpmdbFreeIterator(mi);
} }
@ -1724,9 +1726,9 @@ int rpmRunTransactions( rpmTransactionSet ts,
if (!(ts->ignoreSet & RPMPROB_FILTER_REPLACEPKG) && !alp->multiLib) { if (!(ts->ignoreSet & RPMPROB_FILTER_REPLACEPKG) && !alp->multiLib) {
rpmdbMatchIterator mi; rpmdbMatchIterator mi;
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, alp->name, 0); mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, alp->name, 0);
(void) rpmdbSetIteratorRE(mi, RPMTAG_VERSION, xx = rpmdbSetIteratorRE(mi, RPMTAG_VERSION,
RPMMIRE_DEFAULT, alp->version); RPMMIRE_DEFAULT, alp->version);
(void) rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, xx = rpmdbSetIteratorRE(mi, RPMTAG_RELEASE,
RPMMIRE_DEFAULT, alp->release); RPMMIRE_DEFAULT, alp->release);
while (rpmdbNextIterator(mi) != NULL) { while (rpmdbNextIterator(mi) != NULL) {
@ -1749,7 +1751,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
int fileCount; int fileCount;
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0); mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0);
(void) rpmdbAppendIterator(mi, ts->removedPackages, ts->numRemovedPackages); xx = rpmdbAppendIterator(mi, ts->removedPackages, ts->numRemovedPackages);
while ((h = rpmdbNextIterator(mi)) != NULL) { while ((h = rpmdbNextIterator(mi)) != NULL) {
if (headerGetEntry(h, RPMTAG_BASENAMES, NULL, NULL, &fileCount)) if (headerGetEntry(h, RPMTAG_BASENAMES, NULL, NULL, &fileCount))
totalFileCount += fileCount; totalFileCount += fileCount;
@ -1822,9 +1824,9 @@ int rpmRunTransactions( rpmTransactionSet ts,
tsi = tsFreeIterator(tsi); tsi = tsFreeIterator(tsi);
if (!ts->chrootDone) { if (!ts->chrootDone) {
(void) chdir("/"); xx = chdir("/");
/*@-superuser -noeffect @*/ /*@-superuser -noeffect @*/
(void) chroot(ts->rootDir); xx = chroot(ts->rootDir);
/*@=superuser =noeffect @*/ /*@=superuser =noeffect @*/
ts->chrootDone = 1; ts->chrootDone = 1;
if (ts->rpmdb) ts->rpmdb->db_chrootDone = 1; if (ts->rpmdb) ts->rpmdb->db_chrootDone = 1;
@ -1852,8 +1854,10 @@ int rpmRunTransactions( rpmTransactionSet ts,
} }
tsi = tsFreeIterator(tsi); tsi = tsFreeIterator(tsi);
/*@-noeffectuncon @*/ /* FIX: check rc */
NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_START, 6, ts->flEntries, NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_START, 6, ts->flEntries,
NULL, ts->notifyData)); NULL, ts->notifyData));
/*@=noeffectuncon@*/
/* =============================================== /* ===============================================
* Compute file disposition for each package in transaction set. * Compute file disposition for each package in transaction set.
@ -1863,8 +1867,10 @@ int rpmRunTransactions( rpmTransactionSet ts,
dbiIndexSet * matches; dbiIndexSet * matches;
int knownBad; int knownBad;
/*@-noeffectuncon @*/ /* FIX: check rc */
NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_PROGRESS, (fi - ts->flList), NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_PROGRESS, (fi - ts->flList),
ts->flEntries, NULL, ts->notifyData)); ts->flEntries, NULL, ts->notifyData));
/*@=noeffectuncon@*/
if (fi->fc == 0) continue; if (fi->fc == 0) continue;
@ -1938,13 +1944,13 @@ int rpmRunTransactions( rpmTransactionSet ts,
/* Determine the fate of each file. */ /* Determine the fate of each file. */
switch (fi->type) { switch (fi->type) {
case TR_ADDED: case TR_ADDED:
(void) handleInstInstalledFiles(fi, ts->rpmdb, shared, nexti - i, xx = handleInstInstalledFiles(fi, ts->rpmdb, shared, nexti - i,
!(beingRemoved || (ts->ignoreSet & RPMPROB_FILTER_REPLACEOLDFILES)), !(beingRemoved || (ts->ignoreSet & RPMPROB_FILTER_REPLACEOLDFILES)),
ts->probs, ts->transFlags); ts->probs, ts->transFlags);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
case TR_REMOVED: case TR_REMOVED:
if (!beingRemoved) if (!beingRemoved)
(void) handleRmvdInstalledFiles(fi, ts->rpmdb, shared, nexti - i); xx = handleRmvdInstalledFiles(fi, ts->rpmdb, shared, nexti - i);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
} }
} }
@ -1988,16 +1994,18 @@ int rpmRunTransactions( rpmTransactionSet ts,
if (ts->chrootDone) { if (ts->chrootDone) {
/*@-superuser -noeffect @*/ /*@-superuser -noeffect @*/
(void) chroot("."); xx = chroot(".");
/*@=superuser =noeffect @*/ /*@=superuser =noeffect @*/
ts->chrootDone = 0; ts->chrootDone = 0;
if (ts->rpmdb) ts->rpmdb->db_chrootDone = 0; if (ts->rpmdb) ts->rpmdb->db_chrootDone = 0;
chroot_prefix = NULL; chroot_prefix = NULL;
(void) chdir(ts->currDir); xx = chdir(ts->currDir);
} }
/*@-noeffectuncon @*/ /* FIX: check rc */
NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_STOP, 6, ts->flEntries, NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_STOP, 6, ts->flEntries,
NULL, ts->notifyData)); NULL, ts->notifyData));
/*@=noeffectuncon @*/
/* =============================================== /* ===============================================
* Free unused memory as soon as possible. * Free unused memory as soon as possible.
@ -2043,7 +2051,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
case TR_REMOVED: case TR_REMOVED:
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */ /*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
if (ts->transFlags & RPMTRANS_FLAG_REPACKAGE) if (ts->transFlags & RPMTRANS_FLAG_REPACKAGE)
(void) psmStage(psm, PSM_PKGSAVE); xx = psmStage(psm, PSM_PKGSAVE);
/*@=globs@*/ /*@=globs@*/
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
} }
@ -2083,8 +2091,10 @@ assert(alp == fi->ap);
rpmrc = rpmReadPackageHeader(alp->fd, &h, NULL, NULL, NULL); rpmrc = rpmReadPackageHeader(alp->fd, &h, NULL, NULL, NULL);
/*@=mustmod@*/ /*@=mustmod@*/
if (!(rpmrc == RPMRC_OK || rpmrc == RPMRC_BADSIZE)) { if (!(rpmrc == RPMRC_OK || rpmrc == RPMRC_BADSIZE)) {
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE, (void)ts->notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE,
0, 0, alp->key, ts->notifyData); 0, 0, alp->key, ts->notifyData);
/*@=noeffectuncon @*/
alp->fd = NULL; alp->fd = NULL;
ourrc++; ourrc++;
} else { } else {
@ -2129,8 +2139,10 @@ assert(alp == fi->ap);
h = headerFree(h); h = headerFree(h);
if (gotfd) { if (gotfd) {
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0, (void)ts->notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0,
alp->key, ts->notifyData); alp->key, ts->notifyData);
/*@=noeffectuncon @*/
alp->fd = NULL; alp->fd = NULL;
} }
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
@ -2147,7 +2159,7 @@ assert(alp == fi->ap);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
} }
(void) rpmdbSync(ts->rpmdb); xx = rpmdbSync(ts->rpmdb);
} }
tsi = tsFreeIterator(tsi); tsi = tsFreeIterator(tsi);

View File

@ -34,7 +34,7 @@ int rpmVerifyFile(const char * root, Header h, int filenum,
int rc; int rc;
struct stat sb; struct stat sb;
(void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &modeList, &count); rc = hge(h, RPMTAG_FILEMODES, NULL, (void **) &modeList, &count);
if (hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL)) if (hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL))
fileAttrs = fileFlags[filenum]; fileAttrs = fileFlags[filenum];
@ -145,8 +145,7 @@ int rpmVerifyFile(const char * root, Header h, int filenum,
if (!hge(h, RPMTAG_FILEMD5S, &mdt, (void **) &md5List, NULL)) if (!hge(h, RPMTAG_FILEMD5S, &mdt, (void **) &md5List, NULL))
*result |= RPMVERIFY_MD5; *result |= RPMVERIFY_MD5;
else { else {
rc = mdfile(filespec, md5sum); rc = mdfile(filespec, md5sum);
if (rc) if (rc)
*result |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5); *result |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
else if (strcmp(md5sum, md5List[filenum])) else if (strcmp(md5sum, md5List[filenum]))
@ -251,7 +250,7 @@ int rpmVerifyFile(const char * root, Header h, int filenum,
gid_t gid; gid_t gid;
if (hge(h, RPMTAG_FILEGROUPNAME, &gnt, (void **) &gnameList, NULL)) { if (hge(h, RPMTAG_FILEGROUPNAME, &gnt, (void **) &gnameList, NULL)) {
rc = gnameToGid(gnameList[filenum], &gid); rc = gnameToGid(gnameList[filenum], &gid);
if (rc || (gid != sb.st_gid)) if (rc || (gid != sb.st_gid))
*result |= RPMVERIFY_GROUP; *result |= RPMVERIFY_GROUP;
gnameList = hfd(gnameList, gnt); gnameList = hfd(gnameList, gnt);

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-10-15 13:39-0400\n" "POT-Creation-Date: 2001-10-16 10:48-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -18,48 +18,48 @@ msgstr ""
msgid "unknown errno" msgid "unknown errno"
msgstr "" msgstr ""
#: popt.c:903 #: popt.c:909
#, c-format #, c-format
msgid "option type (%d) not implemented in popt\n" msgid "option type (%d) not implemented in popt\n"
msgstr "" msgstr ""
#: popt.c:1114 #: popt.c:1120
msgid "missing argument" msgid "missing argument"
msgstr "" msgstr ""
#: popt.c:1116 #: popt.c:1122
msgid "unknown option" msgid "unknown option"
msgstr "" msgstr ""
#: popt.c:1118 #: popt.c:1124
msgid "mutually exclusive logical operations requested" msgid "mutually exclusive logical operations requested"
msgstr "" msgstr ""
#: popt.c:1120 #: popt.c:1126
msgid "opt->arg should not be NULL" msgid "opt->arg should not be NULL"
msgstr "" msgstr ""
#: popt.c:1122 #: popt.c:1128
msgid "aliases nested too deeply" msgid "aliases nested too deeply"
msgstr "" msgstr ""
#: popt.c:1124 #: popt.c:1130
msgid "error in parameter quoting" msgid "error in parameter quoting"
msgstr "" msgstr ""
#: popt.c:1126 #: popt.c:1132
msgid "invalid numeric value" msgid "invalid numeric value"
msgstr "" msgstr ""
#: popt.c:1128 #: popt.c:1134
msgid "number too large or too small" msgid "number too large or too small"
msgstr "" msgstr ""
#: popt.c:1130 #: popt.c:1136
msgid "memory allocation failed" msgid "memory allocation failed"
msgstr "" msgstr ""
#: popt.c:1134 #: popt.c:1140
msgid "unknown error" msgid "unknown error"
msgstr "" msgstr ""

View File

@ -67,9 +67,9 @@ static void invokeCallbacksPRE(poptContext con, const struct poptOption * opt)
poptCallbackType cb = (poptCallbackType)opt->arg; poptCallbackType cb = (poptCallbackType)opt->arg;
/*@=castfcnptr@*/ /*@=castfcnptr@*/
/* Perform callback. */ /* Perform callback. */
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/
cb(con, POPT_CALLBACK_REASON_PRE, NULL, NULL, opt->descrip); cb(con, POPT_CALLBACK_REASON_PRE, NULL, NULL, opt->descrip);
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
} }
} }
} }
@ -90,9 +90,9 @@ static void invokeCallbacksPOST(poptContext con, const struct poptOption * opt)
poptCallbackType cb = (poptCallbackType)opt->arg; poptCallbackType cb = (poptCallbackType)opt->arg;
/*@=castfcnptr@*/ /*@=castfcnptr@*/
/* Perform callback. */ /* Perform callback. */
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/
cb(con, POPT_CALLBACK_REASON_POST, NULL, NULL, opt->descrip); cb(con, POPT_CALLBACK_REASON_POST, NULL, NULL, opt->descrip);
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
} }
} }
} }
@ -130,10 +130,10 @@ static void invokeCallbacksOPTION(poptContext con,
const void * cbData = (cbopt->descrip ? cbopt->descrip : myData); const void * cbData = (cbopt->descrip ? cbopt->descrip : myData);
/* Perform callback. */ /* Perform callback. */
if (cb != NULL) { /* XXX program error */ if (cb != NULL) { /* XXX program error */
/*@-moduncon@*/ /*@-moduncon -noeffectuncon @*/
cb(con, POPT_CALLBACK_REASON_OPTION, myOpt, cb(con, POPT_CALLBACK_REASON_OPTION, myOpt,
con->os->nextArg, cbData); con->os->nextArg, cbData);
/*@=moduncon@*/ /*@=moduncon =noeffectuncon @*/
} }
/* Terminate (unless explcitly continuing). */ /* Terminate (unless explcitly continuing). */
if (!(cbopt->argInfo & POPT_CBFLAG_CONTINUE)) if (!(cbopt->argInfo & POPT_CBFLAG_CONTINUE))
@ -160,7 +160,7 @@ poptContext poptGetContext(const char * name, int argc, const char ** argv,
if (!(flags & POPT_CONTEXT_KEEP_FIRST)) if (!(flags & POPT_CONTEXT_KEEP_FIRST))
con->os->next = 1; /* skip argv[0] */ con->os->next = 1; /* skip argv[0] */
con->leftovers = calloc( (argc + 1), sizeof(char *) ); con->leftovers = calloc( (argc + 1), sizeof(*con->leftovers) );
/*@-dependenttrans -assignexpose@*/ /* FIX: W2DO? */ /*@-dependenttrans -assignexpose@*/ /* FIX: W2DO? */
con->options = options; con->options = options;
/*@=dependenttrans =assignexpose@*/ /*@=dependenttrans =assignexpose@*/
@ -510,6 +510,7 @@ static const char * findNextArg(/*@special@*/ poptContext con,
if (os->next == os->argc && os == con->optionStack) break; if (os->next == os->argc && os == con->optionStack) break;
if (os->argv != NULL) if (os->argv != NULL)
for (i = os->next; i < os->argc; i++) { for (i = os->next; i < os->argc; i++) {
/*@-sizeoftype@*/
if (os->argb && PBM_ISSET(i, os->argb)) if (os->argb && PBM_ISSET(i, os->argb))
/*@innercontinue@*/ continue; /*@innercontinue@*/ continue;
if (*os->argv[i] == '-') if (*os->argv[i] == '-')
@ -523,6 +524,7 @@ static const char * findNextArg(/*@special@*/ poptContext con,
PBM_SET(i, os->argb); PBM_SET(i, os->argb);
} }
/*@innerbreak@*/ break; /*@innerbreak@*/ break;
/*@=sizeoftype@*/
} }
if (os > con->optionStack) os--; if (os > con->optionStack) os--;
} while (arg == NULL); } while (arg == NULL);
@ -583,10 +585,12 @@ static void poptStripArg(/*@special@*/ poptContext con, int which)
/*@defines con->arg_strip @*/ /*@defines con->arg_strip @*/
/*@modifies con @*/ /*@modifies con @*/
{ {
/*@-sizeoftype@*/
if (con->arg_strip == NULL) if (con->arg_strip == NULL)
con->arg_strip = PBM_ALLOC(con->optionStack[0].argc); con->arg_strip = PBM_ALLOC(con->optionStack[0].argc);
if (con->arg_strip != NULL) /* XXX can't happen */ if (con->arg_strip != NULL) /* XXX can't happen */
PBM_SET(which, con->arg_strip); PBM_SET(which, con->arg_strip);
/*@=sizeoftype@*/
} }
static int poptSaveLong(const struct poptOption * opt, long aLong) static int poptSaveLong(const struct poptOption * opt, long aLong)
@ -678,10 +682,12 @@ int poptGetNextOpt(poptContext con)
char * localOptString, * optString; char * localOptString, * optString;
int thisopt; int thisopt;
/*@-sizeoftype@*/
if (con->os->argb && PBM_ISSET(con->os->next, con->os->argb)) { if (con->os->argb && PBM_ISSET(con->os->next, con->os->argb)) {
con->os->next++; con->os->next++;
continue; continue;
} }
/*@=sizeoftype@*/
thisopt = con->os->next; thisopt = con->os->next;
if (con->os->argv != NULL) /* XXX can't happen */ if (con->os->argv != NULL) /* XXX can't happen */
origOptString = con->os->argv[con->os->next++]; origOptString = con->os->argv[con->os->next++];
@ -1169,6 +1175,7 @@ int poptStrippedArgv(poptContext con, int argc, char ** argv)
int j = 1; int j = 1;
int i; int i;
/*@-sizeoftype@*/
if (con->arg_strip) if (con->arg_strip)
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
if (PBM_ISSET(i, con->arg_strip)) if (PBM_ISSET(i, con->arg_strip))
@ -1181,6 +1188,7 @@ int poptStrippedArgv(poptContext con, int argc, char ** argv)
argv[j] = (j < numargs) ? argv[i] : NULL; argv[j] = (j < numargs) ? argv[i] : NULL;
j++; j++;
} }
/*@=sizeoftype@*/
return numargs; return numargs;
} }

View File

@ -11,6 +11,15 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
#include <sys/ipc.h> #include <sys/ipc.h>
#endif #endif
#if defined(__LCLINT__)
typedef unsigned int u_int32_t;
typedef unsigned short u_int16_t;
typedef unsigned char u_int8_t;
/*@-incondefs@*/ /* LCLint 3.0.0.15 */
typedef int int32_t;
/*@=incondefs@*/
#endif
#include <db3/db.h> #include <db3/db.h>
#include <rpmlib.h> #include <rpmlib.h>
@ -83,7 +92,7 @@ static int cvtdberr(dbiIndex dbi, const char * msg, int error, int printit)
rc = error; rc = error;
if (printit && rc) { if (printit && rc) {
/*@-moduncon@*/ /*@-moduncon@*/ /* FIX: annotate db3 methods */
if (msg) if (msg)
rpmError(RPMERR_DBERR, _("db%d error(%d) from %s: %s\n"), rpmError(RPMERR_DBERR, _("db%d error(%d) from %s: %s\n"),
dbi->dbi_api, rc, msg, db_strerror(error)); dbi->dbi_api, rc, msg, db_strerror(error));
@ -122,7 +131,7 @@ static int db_fini(dbiIndex dbi, const char * dbhome,
if (rpmdb->db_remove_env || dbi->dbi_tear_down) { if (rpmdb->db_remove_env || dbi->dbi_tear_down) {
int xx; int xx;
/*@-moduncon@*/ /*@-moduncon@*/ /* FIX: annotate db3 methods */
xx = db_env_create(&dbenv, 0); xx = db_env_create(&dbenv, 0);
/*@=moduncon@*/ /*@=moduncon@*/
xx = cvtdberr(dbi, "db_env_create", rc, _debug); xx = cvtdberr(dbi, "db_env_create", rc, _debug);
@ -148,7 +157,7 @@ static int db3_fsync_disable(/*@unused@*/ int fd)
return 0; return 0;
} }
/*@-moduncon@*/ /*@-moduncon@*/ /* FIX: annotate db3 methods */
static int db_init(dbiIndex dbi, const char * dbhome, static int db_init(dbiIndex dbi, const char * dbhome,
/*@null@*/ const char * dbfile, /*@null@*/ const char * dbfile,
/*@unused@*/ /*@null@*/ const char * dbsubfile, /*@unused@*/ /*@null@*/ const char * dbsubfile,
@ -200,17 +209,19 @@ static int db_init(dbiIndex dbi, const char * dbhome,
return 1; return 1;
{ int xx; { int xx;
/*@-noeffectuncon@*/ /* FIX: annotate db3 methods */
dbenv->set_errcall(dbenv, rpmdb->db_errcall); dbenv->set_errcall(dbenv, rpmdb->db_errcall);
dbenv->set_errfile(dbenv, rpmdb->db_errfile); dbenv->set_errfile(dbenv, rpmdb->db_errfile);
dbenv->set_errpfx(dbenv, rpmdb->db_errpfx); dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
/*@=noeffectuncon@*/
/* dbenv->set_paniccall(???) */ /* dbenv->set_paniccall(???) */
(void) dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT, xx = dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
(dbi->dbi_verbose & DB_VERB_CHKPOINT)); (dbi->dbi_verbose & DB_VERB_CHKPOINT));
(void) dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK, xx = dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK,
(dbi->dbi_verbose & DB_VERB_DEADLOCK)); (dbi->dbi_verbose & DB_VERB_DEADLOCK));
(void) dbenv->set_verbose(dbenv, DB_VERB_RECOVERY, xx = dbenv->set_verbose(dbenv, DB_VERB_RECOVERY,
(dbi->dbi_verbose & DB_VERB_RECOVERY)); (dbi->dbi_verbose & DB_VERB_RECOVERY));
(void) dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR, xx = dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR,
(dbi->dbi_verbose & DB_VERB_WAITSFOR)); (dbi->dbi_verbose & DB_VERB_WAITSFOR));
/* dbenv->set_lg_max(???) */ /* dbenv->set_lg_max(???) */
/* dbenv->set_lk_conflicts(???) */ /* dbenv->set_lk_conflicts(???) */
@ -636,7 +647,7 @@ static int db3stat(dbiIndex dbi, unsigned int flags)
return rc; return rc;
} }
/*@-moduncon@*/ /*@-moduncon@*/ /* FIX: annotate db3 methods */
static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags) static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
/*@globals rpmGlobalMacroContext, /*@globals rpmGlobalMacroContext,
fileSystem @*/ fileSystem @*/
@ -705,23 +716,25 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
if (dbi->dbi_verify_on_close && !dbi->dbi_temporary) { if (dbi->dbi_verify_on_close && !dbi->dbi_temporary) {
DB_ENV * dbenv = NULL; DB_ENV * dbenv = NULL;
/*@-moduncon@*/ /*@-moduncon@*/ /* FIX: annotate db3 methods */
rc = db_env_create(&dbenv, 0); rc = db_env_create(&dbenv, 0);
/*@=moduncon@*/ /*@=moduncon@*/
rc = cvtdberr(dbi, "db_env_create", rc, _debug); rc = cvtdberr(dbi, "db_env_create", rc, _debug);
if (rc || dbenv == NULL) goto exit; if (rc || dbenv == NULL) goto exit;
/*@-noeffectuncon@*/ /* FIX: annotate db3 methods */
dbenv->set_errcall(dbenv, rpmdb->db_errcall); dbenv->set_errcall(dbenv, rpmdb->db_errcall);
dbenv->set_errfile(dbenv, rpmdb->db_errfile); dbenv->set_errfile(dbenv, rpmdb->db_errfile);
dbenv->set_errpfx(dbenv, rpmdb->db_errpfx); dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
/* dbenv->set_paniccall(???) */ /* dbenv->set_paniccall(???) */
(void) dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT, /*@=noeffectuncon@*/
xx = dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
(dbi->dbi_verbose & DB_VERB_CHKPOINT)); (dbi->dbi_verbose & DB_VERB_CHKPOINT));
(void) dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK, xx = dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK,
(dbi->dbi_verbose & DB_VERB_DEADLOCK)); (dbi->dbi_verbose & DB_VERB_DEADLOCK));
(void) dbenv->set_verbose(dbenv, DB_VERB_RECOVERY, xx = dbenv->set_verbose(dbenv, DB_VERB_RECOVERY,
(dbi->dbi_verbose & DB_VERB_RECOVERY)); (dbi->dbi_verbose & DB_VERB_RECOVERY));
(void) dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR, xx = dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR,
(dbi->dbi_verbose & DB_VERB_WAITSFOR)); (dbi->dbi_verbose & DB_VERB_WAITSFOR));
if (dbi->dbi_tmpdir) { if (dbi->dbi_tmpdir) {
@ -737,7 +750,7 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
rc = cvtdberr(dbi, "dbenv->open", rc, _debug); rc = cvtdberr(dbi, "dbenv->open", rc, _debug);
if (rc) goto exit; if (rc) goto exit;
/*@-moduncon@*/ /*@-moduncon@*/ /* FIX: annotate db3 methods */
rc = db_create(&db, dbenv, 0); rc = db_create(&db, dbenv, 0);
/*@=moduncon@*/ /*@=moduncon@*/
rc = cvtdberr(dbi, "db_create", rc, _debug); rc = cvtdberr(dbi, "db_create", rc, _debug);
@ -960,7 +973,7 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
if (rc == 0) { if (rc == 0) {
static int _lockdbfd = 0; static int _lockdbfd = 0;
/*@-moduncon@*/ /*@-moduncon@*/ /* FIX: annotate db3 methods */
rc = db_create(&db, dbenv, dbi->dbi_cflags); rc = db_create(&db, dbenv, dbi->dbi_cflags);
/*@=moduncon@*/ /*@=moduncon@*/
rc = cvtdberr(dbi, "db_create", rc, _debug); rc = cvtdberr(dbi, "db_create", rc, _debug);

View File

@ -4,6 +4,17 @@
#include "system.h" #include "system.h"
#if defined(__LCLINT__)
/*@-redef@*/
typedef unsigned int u_int32_t;
typedef unsigned short u_int16_t;
typedef unsigned char u_int8_t;
/*@-incondefs@*/ /* LCLint 3.0.0.15 */
typedef int int32_t;
/*@=incondefs@*/
/*@=redef@*/
#endif
#include <db3/db.h> #include <db3/db.h>
#include <rpmlib.h> #include <rpmlib.h>
@ -478,6 +489,7 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
/* /*
* Inverted lists have join length of 2, primary data has join length of 1. * Inverted lists have join length of 2, primary data has join length of 1.
*/ */
/*@-sizeoftype@*/
switch (rpmtag) { switch (rpmtag) {
case RPMDBI_PACKAGES: case RPMDBI_PACKAGES:
case RPMDBI_DEPENDS: case RPMDBI_DEPENDS:
@ -487,6 +499,7 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
dbi->dbi_jlen = 2 * sizeof(int_32); dbi->dbi_jlen = 2 * sizeof(int_32);
break; break;
} }
/*@=sizeoftype@*/
dbi->dbi_use_cursors = 1; /* db3 cursors are always used now. */ dbi->dbi_use_cursors = 1; /* db3 cursors are always used now. */

View File

@ -78,10 +78,12 @@ FD_t fadOpen(const char * path, int flags, mode_t perms)
if (fadGetFileSize(fd) == 0) { if (fadGetFileSize(fd) == 0) {
newHdr.magic = FA_MAGIC; newHdr.magic = FA_MAGIC;
newHdr.firstFree = 0; newHdr.firstFree = 0;
/*@-sizeoftype@*/
if (Fwrite(&newHdr, sizeof(char), sizeof(newHdr), fd) != sizeof(newHdr)) { if (Fwrite(&newHdr, sizeof(char), sizeof(newHdr), fd) != sizeof(newHdr)) {
(void) Fclose(fd); (void) Fclose(fd);
return NULL; return NULL;
} }
/*@=sizeoftype@*/
fadSetFirstFree(fd, 0); fadSetFirstFree(fd, 0);
fadSetFileSize(fd, sizeof(newHdr)); fadSetFileSize(fd, sizeof(newHdr));
} else { } else {
@ -127,7 +129,9 @@ unsigned int fadAlloc(FD_t fd, unsigned int size)
memset(&header, 0, sizeof(header)); memset(&header, 0, sizeof(header));
/* our internal idea of size includes overhead */ /* our internal idea of size includes overhead */
/*@-sizeoftype@*/
size += sizeof(struct faHeader) + sizeof(struct faFooter); size += sizeof(struct faHeader) + sizeof(struct faFooter);
/*@=sizeoftype@*/
/* Make sure they are allocing multiples of 64 bytes. It'll keep /* Make sure they are allocing multiples of 64 bytes. It'll keep
things less fragmented that way */ things less fragmented that way */
@ -387,6 +391,7 @@ static int fadSanity(FD_t fd, int offset, const struct faHeader * fh, int printi
{ {
int rc = 0; int rc = 0;
/*@-sizeoftype@*/
/* Check size range and alignment. */ /* Check size range and alignment. */
if (!(fh->size > 0 && fh->size <= 0x00200000 && (fh->size & 0x3f) == 0)) if (!(fh->size > 0 && fh->size <= 0x00200000 && (fh->size & 0x3f) == 0))
rc |= 0x1; rc |= 0x1;
@ -404,6 +409,7 @@ static int fadSanity(FD_t fd, int offset, const struct faHeader * fh, int printi
fh->freePrev < fadGetFileSize(fd) && fh->freePrev < fadGetFileSize(fd) &&
(fh->freePrev & 0x3f) == sizeof(struct faFileHeader)) ) (fh->freePrev & 0x3f) == sizeof(struct faFileHeader)) )
rc |= 0x4; rc |= 0x4;
/*@=sizeoftype@*/
/* Check that only the isFree bit is (possibly) set. */ /* Check that only the isFree bit is (possibly) set. */
if (fh->isFree & ~1) if (fh->isFree & ~1)
@ -431,9 +437,11 @@ int fadNextOffset(FD_t fd, unsigned int lastoff)
struct faHeader header; struct faHeader header;
int offset; int offset;
/*@-sizeoftype@*/
offset = (lastoff) offset = (lastoff)
? (lastoff - sizeof(header)) ? (lastoff - sizeof(header))
: sizeof(struct faFileHeader); : sizeof(struct faFileHeader);
/*@=sizeoftype@*/
if (offset >= fadGetFileSize(fd)) if (offset >= fadGetFileSize(fd))
return 0; return 0;

View File

@ -249,12 +249,13 @@ void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
rpmTagType bnt, dnt; rpmTagType bnt, dnt;
int_32 * dirIndexes; int_32 * dirIndexes;
int fileCount; int fileCount;
int xx;
if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount)) if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount))
return; return;
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList); fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList);
dirNames = hfd(dirNames, dnt); dirNames = hfd(dirNames, dnt);
baseNames = hfd(baseNames, bnt); baseNames = hfd(baseNames, bnt);

View File

@ -1,3 +1,4 @@
/*@-sizeoftype@*/
/** \ingroup rpmdb dbi /** \ingroup rpmdb dbi
* \file rpmdb/rpmdb.c * \file rpmdb/rpmdb.c
*/ */
@ -907,7 +908,7 @@ static int openDatabase(/*@null@*/ const char * prefix,
/*@modifies *dbp, fileSystem @*/ /*@modifies *dbp, fileSystem @*/
{ {
rpmdb db; rpmdb db;
int rc; int rc, xx;
unsigned int gflags = 0; /* dbiGet() flags */ unsigned int gflags = 0; /* dbiGet() flags */
static int _initialized = 0; static int _initialized = 0;
int justCheck = flags & RPMDB_FLAG_JUSTCHECK; int justCheck = flags & RPMDB_FLAG_JUSTCHECK;
@ -934,7 +935,7 @@ static int openDatabase(/*@null@*/ const char * prefix,
sprintf(filename, "%s/%s/__db.%03d", sprintf(filename, "%s/%s/__db.%03d",
(prefix ? prefix : ""), (dbpath ? dbpath : ""), i); (prefix ? prefix : ""), (dbpath ? dbpath : ""), i);
(void) rpmCleanPath(filename); (void) rpmCleanPath(filename);
(void) unlink(filename); xx = unlink(filename);
} }
} }
#endif #endif
@ -1001,7 +1002,6 @@ static int openDatabase(/*@null@*/ const char * prefix,
case RPMTAG_BASENAMES: case RPMTAG_BASENAMES:
{ void * keyp = NULL; { void * keyp = NULL;
DBC * dbcursor; DBC * dbcursor;
int xx;
/* We used to store the fileindexes as complete paths, rather then /* We used to store the fileindexes as complete paths, rather then
plain basenames. Let's see which version we are... */ plain basenames. Let's see which version we are... */
@ -1033,7 +1033,7 @@ static int openDatabase(/*@null@*/ const char * prefix,
exit: exit:
if (rc || justCheck || dbp == NULL) if (rc || justCheck || dbp == NULL)
(void) rpmdbClose(db); xx = rpmdbClose(db);
else else
*dbp = db; *dbp = db;
@ -1184,9 +1184,9 @@ static int rpmdbFindByFile(rpmdb db, /*@null@*/ const char * filespec,
continue; continue;
} }
(void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL); xx = hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
do { do {
fingerPrint fp2; fingerPrint fp2;
@ -1198,7 +1198,7 @@ static int rpmdbFindByFile(rpmdb db, /*@null@*/ const char * filespec,
/*@=nullpass@*/ /*@=nullpass@*/
rec->hdrNum = dbiIndexRecordOffset(allMatches, i); rec->hdrNum = dbiIndexRecordOffset(allMatches, i);
rec->tagNum = dbiIndexRecordFileNumber(allMatches, i); rec->tagNum = dbiIndexRecordFileNumber(allMatches, i);
(void) dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0); xx = dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0);
} }
prevoff = offset; prevoff = offset;
@ -2565,9 +2565,9 @@ int rpmdbAdd(rpmdb db, int iid, Header h)
if (iid != 0 && iid != -1) { if (iid != 0 && iid != -1) {
int_32 tid = iid; int_32 tid = iid;
(void) headerRemoveEntry(h, RPMTAG_REMOVETID); xx = headerRemoveEntry(h, RPMTAG_REMOVETID);
if (!headerIsEntry(h, RPMTAG_INSTALLTID)) if (!headerIsEntry(h, RPMTAG_INSTALLTID))
(void) headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1); xx = headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1);
} }
/* /*
@ -2576,7 +2576,7 @@ int rpmdbAdd(rpmdb db, int iid, Header h)
* being written to the package header database. * being written to the package header database.
*/ */
(void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count); xx = hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count);
if (_noDirTokens) if (_noDirTokens)
expandFilelist(h); expandFilelist(h);
@ -2672,7 +2672,7 @@ int rpmdbAdd(rpmdb db, int iid, Header h)
if (!dbi->dbi_no_dbsync) if (!dbi->dbi_no_dbsync)
xx = dbiSync(dbi, 0); xx = dbiSync(dbi, 0);
{ const char *n, *v, *r; { const char *n, *v, *r;
(void) headerNVR(h, &n, &v, &r); xx = headerNVR(h, &n, &v, &r);
rpmMessage(RPMMESS_DEBUG, " +++ %10u %s-%s-%s\n", hdrNum, n, v, r); rpmMessage(RPMMESS_DEBUG, " +++ %10u %s-%s-%s\n", hdrNum, n, v, r);
} }
} }
@ -2685,11 +2685,11 @@ int rpmdbAdd(rpmdb db, int iid, Header h)
rpmcnt = count; rpmcnt = count;
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
case RPMTAG_REQUIRENAME: case RPMTAG_REQUIRENAME:
(void) hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt); xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
(void) hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL); xx = hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
default: default:
(void) hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt); xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
/*@switchbreak@*/ break; /*@switchbreak@*/ break;
} }
@ -2822,7 +2822,7 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
rpmdbMatchIterator mi; rpmdbMatchIterator mi;
fingerPrintCache fpc; fingerPrintCache fpc;
Header h; Header h;
int i; int i, xx;
if (db == NULL) return 0; if (db == NULL) return 0;
@ -2830,7 +2830,7 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
/* Gather all matches from the database */ /* Gather all matches from the database */
for (i = 0; i < numItems; i++) { for (i = 0; i < numItems; i++) {
(void) rpmdbGrowIterator(mi, fpList[i].baseName, 0, i); xx = rpmdbGrowIterator(mi, fpList[i].baseName, 0, i);
matchList[i] = xcalloc(1, sizeof(*(matchList[i]))); matchList[i] = xcalloc(1, sizeof(*(matchList[i])));
} }
@ -2869,9 +2869,9 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
num = end - start; num = end - start;
/* Compute fingerprints for this header's matches */ /* Compute fingerprints for this header's matches */
(void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &fullBaseNames, NULL); xx = hge(h, RPMTAG_BASENAMES, &bnt, (void **) &fullBaseNames, NULL);
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fullDirIndexes, NULL); xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fullDirIndexes, NULL);
baseNames = xcalloc(num, sizeof(*baseNames)); baseNames = xcalloc(num, sizeof(*baseNames));
dirIndexes = xcalloc(num, sizeof(*dirIndexes)); dirIndexes = xcalloc(num, sizeof(*dirIndexes));
@ -2889,7 +2889,7 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
if (FP_EQUAL(fps[i], fpList[im->fpNum])) { if (FP_EQUAL(fps[i], fpList[im->fpNum])) {
/*@=nullpass@*/ /*@=nullpass@*/
/*@-usedef@*/ /*@-usedef@*/
(void) dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0); xx = dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0);
/*@=usedef@*/ /*@=usedef@*/
} }
} }
@ -3327,3 +3327,4 @@ exit:
return rc; return rc;
} }
/*@=globs@*/ /*@=globs@*/
/*@=sizeoftype@*/

View File

@ -52,7 +52,9 @@ rpmDigestInit(rpmDigestFlags flags)
if (flags & RPMDIGEST_MD5) { if (flags & RPMDIGEST_MD5) {
ctx->digestlen = 16; ctx->digestlen = 16;
ctx->datalen = 64; ctx->datalen = 64;
/*@-sizeoftype@*/ /* FIX: union, not void pointer */
ctx->param = xcalloc(1, sizeof(md5Param)); ctx->param = xcalloc(1, sizeof(md5Param));
/*@=sizeoftype@*/
ctx->Reset = (void *) md5Reset; ctx->Reset = (void *) md5Reset;
ctx->Update = (void *) md5Update; ctx->Update = (void *) md5Update;
ctx->Digest = (void *) md5Digest; ctx->Digest = (void *) md5Digest;
@ -61,13 +63,17 @@ rpmDigestInit(rpmDigestFlags flags)
if (flags & RPMDIGEST_SHA1) { if (flags & RPMDIGEST_SHA1) {
ctx->digestlen = 20; ctx->digestlen = 20;
ctx->datalen = 64; ctx->datalen = 64;
/*@-sizeoftype@*/ /* FIX: union, not void pointer */
ctx->param = xcalloc(1, sizeof(sha1Param)); ctx->param = xcalloc(1, sizeof(sha1Param));
/*@=sizeoftype@*/
ctx->Reset = (void *) sha1Reset; ctx->Reset = (void *) sha1Reset;
ctx->Update = (void *) sha1Update; ctx->Update = (void *) sha1Update;
ctx->Digest = (void *) sha1Digest; ctx->Digest = (void *) sha1Digest;
} }
/*@-noeffectuncon@*/ /* FIX: check rc */
(void) (*ctx->Reset) (ctx->param); (void) (*ctx->Reset) (ctx->param);
/*@=noeffectuncon@*/ /* FIX: check rc */
DPRINTF((stderr, "*** Init(%x) ctx %p param %p\n", flags, ctx, ctx->param)); DPRINTF((stderr, "*** Init(%x) ctx %p param %p\n", flags, ctx, ctx->param));
return ctx; return ctx;
@ -77,7 +83,9 @@ void
rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len) rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len)
{ {
DPRINTF((stderr, "*** Update(%p,%p,%d) param %p \"%s\"\n", ctx, data, len, ctx->param, ((char *)data))); DPRINTF((stderr, "*** Update(%p,%p,%d) param %p \"%s\"\n", ctx, data, len, ctx->param, ((char *)data)));
/*@-noeffectuncon@*/ /* FIX: check rc */
(void) (*ctx->Update) (ctx->param, data, len); (void) (*ctx->Update) (ctx->param, data, len);
/*@=noeffectuncon@*/
} }
/*@unchecked@*/ /*@unchecked@*/
@ -101,11 +109,15 @@ rpmDigestFinal(/*@only@*/ DIGEST_CTX ctx, /*@out@*/ void ** datap,
int i; int i;
DPRINTF((stderr, "*** Final(%p,%p,%p,%d) param %p digest %p\n", ctx, datap, lenp, asAscii, ctx->param, digest)); DPRINTF((stderr, "*** Final(%p,%p,%p,%d) param %p digest %p\n", ctx, datap, lenp, asAscii, ctx->param, digest));
/*@-noeffectuncon@*/ /* FIX: check rc */
(void) (*ctx->Digest) (ctx->param, digest); (void) (*ctx->Digest) (ctx->param, digest);
/*@=noeffectuncon@*/
/*@-sizeoftype@*/
if (IS_LITTLE_ENDIAN()) if (IS_LITTLE_ENDIAN())
for (i = 0; i < (ctx->digestlen/sizeof(uint32)); i++) for (i = 0; i < (ctx->digestlen/sizeof(uint32)); i++)
digest[i] = swapu32(digest[i]); digest[i] = swapu32(digest[i]);
/*@=sizeoftype@*/
/* Return final digest. */ /* Return final digest. */
/*@-branchstate@*/ /*@-branchstate@*/

View File

@ -890,7 +890,7 @@ grabArgs(MacroBuf mb, const MacroEntry me, const char * se, char lastc)
#endif #endif
/* Build argv array */ /* Build argv array */
argv = (const char **) alloca((argc + 1) * sizeof(char *)); argv = (const char **) alloca((argc + 1) * sizeof(*argv));
be[-1] = ' '; /* assert((be - 1) == (b + strlen(b) == buf + strlen(buf))) */ be[-1] = ' '; /* assert((be - 1) == (b + strlen(b) == buf + strlen(buf))) */
be[0] = '\0'; be[0] = '\0';
b = buf; b = buf;
@ -1643,7 +1643,7 @@ int isCompressed(const char * file, rpmCompressedMagic * compressed)
if (fd) (void) Fclose(fd); if (fd) (void) Fclose(fd);
return 1; return 1;
} }
nb = Fread(magic, sizeof(char), sizeof(magic), fd); nb = Fread(magic, sizeof(magic[0]), sizeof(magic), fd);
if (nb < 0) { if (nb < 0) {
rpmError(RPMERR_BADSPEC, _("File %s: %s\n"), file, Fstrerror(fd)); rpmError(RPMERR_BADSPEC, _("File %s: %s\n"), file, Fstrerror(fd));
rc = 1; rc = 1;

View File

@ -308,7 +308,7 @@ static inline /*@null@*/ FD_t XfdNew(const char * msg,
const char * file, unsigned line) const char * file, unsigned line)
/*@*/ /*@*/
{ {
FD_t fd = (FD_t) xmalloc(sizeof(struct _FD_s)); FD_t fd = xmalloc(sizeof(*fd));
if (fd == NULL) /* XXX xmalloc never returns NULL */ if (fd == NULL) /* XXX xmalloc never returns NULL */
return NULL; return NULL;
fd->nrefs = 0; fd->nrefs = 0;
@ -804,7 +804,7 @@ static int checkResponse(void * uu, FD_t ctrl,
URLSANE(u); URLSANE(u);
if (u->bufAlloced == 0 || u->buf == NULL) { if (u->bufAlloced == 0 || u->buf == NULL) {
u->bufAlloced = url_iobuf_size; u->bufAlloced = url_iobuf_size;
u->buf = xcalloc(u->bufAlloced, sizeof(char)); u->buf = xcalloc(u->bufAlloced, sizeof(u->buf[0]));
} }
buf = u->buf; buf = u->buf;
bufAlloced = u->bufAlloced; bufAlloced = u->bufAlloced;
@ -1236,10 +1236,12 @@ errxit:
return rc; return rc;
} }
/*@unchecked@*/ /*@unchecked@*/ /*@null@*/
/*@null@*/ static rpmCallbackFunction urlNotify = NULL; static rpmCallbackFunction urlNotify = NULL;
/*@unchecked@*/
/*@null@*/ static void * urlNotifyData = NULL; /*@unchecked@*/ /*@null@*/
static void * urlNotifyData = NULL;
/*@unchecked@*/ /*@unchecked@*/
static int urlNotifyCount = -1; static int urlNotifyCount = -1;
@ -1258,8 +1260,10 @@ int ufdCopy(FD_t sfd, FD_t tfd)
int notifier = -1; int notifier = -1;
if (urlNotify) { if (urlNotify) {
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)(*urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE, (void)(*urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE,
0, 0, NULL, urlNotifyData); 0, 0, NULL, urlNotifyData);
/*@=noeffectuncon @*/
} }
while (1) { while (1) {
@ -1283,8 +1287,10 @@ int ufdCopy(FD_t sfd, FD_t tfd)
if (urlNotify && urlNotifyCount > 0) { if (urlNotify && urlNotifyCount > 0) {
int n = itemsCopied/urlNotifyCount; int n = itemsCopied/urlNotifyCount;
if (n != notifier) { if (n != notifier) {
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)(*urlNotify) (NULL, RPMCALLBACK_INST_PROGRESS, (void)(*urlNotify) (NULL, RPMCALLBACK_INST_PROGRESS,
itemsCopied, 0, NULL, urlNotifyData); itemsCopied, 0, NULL, urlNotifyData);
/*@=noeffectuncon @*/
notifier = n; notifier = n;
} }
} }
@ -1296,8 +1302,10 @@ int ufdCopy(FD_t sfd, FD_t tfd)
/*@=modfilesys@*/ /*@=modfilesys@*/
if (urlNotify) { if (urlNotify) {
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)(*urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE, (void)(*urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE,
itemsCopied, itemsCopied, NULL, urlNotifyData); itemsCopied, itemsCopied, NULL, urlNotifyData);
/*@=noeffectuncon @*/
} }
return rc; return rc;
@ -2456,7 +2464,9 @@ static int bzdClose( /*@only@*/ void * cookie)
if (bzfile == NULL) return -2; if (bzfile == NULL) return -2;
fdstat_enter(fd, FDSTAT_CLOSE); fdstat_enter(fd, FDSTAT_CLOSE);
/*@-noeffectuncon@*/ /* FIX: check rc */
bzclose(bzfile); bzclose(bzfile);
/*@=noeffectuncon@*/
rc = 0; /* XXX FIXME */ rc = 0; /* XXX FIXME */
/* XXX TODO: preserve fd if errors */ /* XXX TODO: preserve fd if errors */
@ -3034,14 +3044,18 @@ ssize_t Pread(FD_t fd, void * buf, size_t count, _libio_off_t offset)
{ {
if (Fseek(fd, offset, SEEK_SET) < 0) if (Fseek(fd, offset, SEEK_SET) < 0)
return -1; return -1;
/*@-sizeoftype@*/
return Fread(buf, sizeof(char), count, fd); return Fread(buf, sizeof(char), count, fd);
/*@=sizeoftype@*/
} }
ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset) ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset)
{ {
if (Fseek(fd, offset, SEEK_SET) < 0) if (Fseek(fd, offset, SEEK_SET) < 0)
return -1; return -1;
/*@-sizeoftype@*/
return Fwrite(buf, sizeof(char), count, fd); return Fwrite(buf, sizeof(char), count, fd);
/*@=sizeoftype@*/
} }
static struct FDIO_s fpio_s = { static struct FDIO_s fpio_s = {

View File

@ -190,7 +190,9 @@ static void vrpmlog (unsigned code, const char *fmt, va_list ap)
++nrecs; ++nrecs;
if (_rpmlogCallback) { if (_rpmlogCallback) {
/*@-noeffectuncon@*/ /* FIX: useless callback */
_rpmlogCallback(); _rpmlogCallback();
/*@=noeffectuncon@*/
return; /* XXX Preserve legacy rpmError behavior. */ return; /* XXX Preserve legacy rpmError behavior. */
} }
} }

View File

@ -45,15 +45,6 @@ extern int chroot (const char *__path)
extern time_t timezone; extern time_t timezone;
#endif #endif
#if defined(__LCLINT__)
typedef unsigned int u_int32_t;
typedef unsigned short u_int16_t;
typedef unsigned char u_int8_t;
/*@-incondefs@*/ /* LCLint 3.0.0.15 */
typedef int int32_t;
/*@=incondefs@*/
#endif
/* Since major is a function on SVR4, we can't use `ifndef major'. */ /* Since major is a function on SVR4, we can't use `ifndef major'. */
#if MAJOR_IN_MKDEV #if MAJOR_IN_MKDEV
#include <sys/mkdev.h> #include <sys/mkdev.h>