RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/lib/ .splintrc depends.c psm.c query.c rpm...

From: Jeff Johnson <jbj@rpm5.org>
Date: Thu 15 Nov 2007 - 21:26:05 CET
Message-Id: <20071115202605.AE8D33484B6@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   15-Nov-2007 21:26:05
  Branch: HEAD                             Handle: 2007111520260301

  Modified files:
    rpm                     CHANGES
    rpm/lib                 .splintrc depends.c psm.c query.c rpmchecksig.c
                            rpmfc.c rpminstall.c rpmps.c rpmps.h rpmte.c
                            rpmts.c verify.c

  Log:
    - lib: identify and repair several minor flaws caught by splint.

  Summary:
    Revision    Changes     Path
    1.1829      +1  -0      rpm/CHANGES
    2.15        +25 -6      rpm/lib/.splintrc
    1.362       +2  -0      rpm/lib/depends.c
    2.261       +3  -3      rpm/lib/psm.c
    2.191       +1  -1      rpm/lib/query.c
    1.178       +9  -6      rpm/lib/rpmchecksig.c
    1.36        +0  -1      rpm/lib/rpmfc.c
    1.182       +9  -7      rpm/lib/rpminstall.c
    2.17        +3  -4      rpm/lib/rpmps.c
    2.14        +1  -1      rpm/lib/rpmps.h
    2.67        +0  -2      rpm/lib/rpmte.c
    2.120       +2  -2      rpm/lib/rpmts.c
    2.176       +2  -0      rpm/lib/verify.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1828 -r1.1829 CHANGES
  --- rpm/CHANGES	15 Nov 2007 17:27:58 -0000	1.1828
  +++ rpm/CHANGES	15 Nov 2007 20:26:03 -0000	1.1829
  @@ -1,4 +1,5 @@
   5.0a1 -> 5.0a2:
  +    - jbj: lib: identify and repair several minor flaws caught by splint.
       - jbj: rpmio: casts for integral conversions.
       - jbj: rpmio: casts for character <-> integral conversions.
       - jbj: first pass through header.c converting to uint32_t everywhere.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/.splintrc
  ============================================================================
  $ cvs diff -u -r2.14 -r2.15 .splintrc
  --- rpm/lib/.splintrc	14 Nov 2007 01:17:51 -0000	2.14
  +++ rpm/lib/.splintrc	15 Nov 2007 20:26:04 -0000	2.15
  @@ -16,22 +16,41 @@
   +slovak-fcns
   -bufferoverflowhigh
   
  --globuse
  --redecl		# 38
  -+voidabstract
  --warnlintcomments
  +-warnlintcomments	# 1 ARGSUSED in getdate.y
   
   -branchstate
   -compdef
  --evalorder
  --exportheader
  +-compmempass
   -globs
  +-globstate
  +-globuse
  +-incondefs
  +-infloops
  +-internalglobs
  +-modobserver
  +-mods
   -mustmod
  +-nullderef	# 11
   -nullpass	# 31
  +-nullptrarith	# 1
  +-nullstate	# 9
  +-predboolothers
  +-redecl		# 38
  +-usereleased
  +
  +-dependenttrans
  +-kepttrans
  +-observertrans
  +-onlytrans
  +-ownedtrans
  +-readonlytrans
  +-temptrans
  +-unqualifiedtrans
   
   # --- +partial artifacts
   -declundef
   -exportheadervar
  +-exportheader
   -exportlocal
   
   -enummemuse
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/depends.c
  ============================================================================
  $ cvs diff -u -r1.361 -r1.362 depends.c
  --- rpm/lib/depends.c	13 Nov 2007 13:34:42 -0000	1.361
  +++ rpm/lib/depends.c	15 Nov 2007 20:26:04 -0000	1.362
  @@ -558,10 +558,12 @@
   
   void rpmnsClean(void)
   {
  +/*@-refcounttrans@*/
       rpmlibP = rpmdsFree(rpmlibP);
       cpuinfoP = rpmdsFree(cpuinfoP);
       getconfP = rpmdsFree(getconfP);
       unameP = rpmdsFree(unameP);
  +/*@=refcounttrans@*/
       _sysinfo_path = _free(_sysinfo_path);
       sysinfo_path = _free(sysinfo_path);
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/psm.c
  ============================================================================
  $ cvs diff -u -r2.260 -r2.261 psm.c
  --- rpm/lib/psm.c	11 Nov 2007 22:07:45 -0000	2.260
  +++ rpm/lib/psm.c	15 Nov 2007 20:26:04 -0000	2.261
  @@ -250,7 +250,7 @@
   
   assert(fi->h != NULL);
   assert(fi->te->h == NULL);	/* XXX headerFree side effect */
  -    rpmteSetHeader(fi->te, fi->h);
  +    (void) rpmteSetHeader(fi->te, fi->h);
       fi->te->fd = fdLink(fd, "installSourcePackage");
   
       (void) headerMacrosLoad(fi->h);
  @@ -383,7 +383,7 @@
       if (h != NULL) h = headerFree(h);
   
       if (fi != NULL) {
  -	rpmteSetHeader(fi->te, NULL);
  +	(void) rpmteSetHeader(fi->te, NULL);
   	if (fi->te->fd != NULL)
   	    (void) Fclose(fi->te->fd);
   	fi->te->fd = NULL;
  @@ -2222,7 +2222,7 @@
   psm->te->h = headerFree(psm->te->h);
   #else
   	    if (psm->te != NULL)
  -		rpmteSetHeader(psm->te, NULL);
  +		(void) rpmteSetHeader(psm->te, NULL);
   #endif
   	    if (fi->h != NULL)
   		fi->h = headerFree(fi->h);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/query.c
  ============================================================================
  $ cvs diff -u -r2.190 -r2.191 query.c
  --- rpm/lib/query.c	13 Nov 2007 01:36:50 -0000	2.190
  +++ rpm/lib/query.c	15 Nov 2007 20:26:04 -0000	2.191
  @@ -386,7 +386,7 @@
   	    continue;
   
   	/* XXX don't print header tags twice. */
  -	if (tagValue(ext->name) >= 0)
  +	if (tagValue(ext->name) > 0)
   	    continue;
   	fprintf(fp, "%s\n", ext->name + 7);
       }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmchecksig.c
  ============================================================================
  $ cvs diff -u -r1.177 -r1.178 rpmchecksig.c
  --- rpm/lib/rpmchecksig.c	13 Nov 2007 03:54:31 -0000	1.177
  +++ rpm/lib/rpmchecksig.c	15 Nov 2007 20:26:04 -0000	1.178
  @@ -29,6 +29,7 @@
   /*@access Header @*/		/* XXX void * arg */
   /*@access pgpDig @*/
   /*@access pgpDigParams @*/
  +/*@access rpmwf @*/
   
   /*@unchecked@*/
   int _print_pkts = 0;
  @@ -785,7 +786,7 @@
   /**
    * @todo If the GPG key was known available, the md5 digest could be skipped.
    */
  -static int readFile(rpmts ts, FD_t fd, const char * fn, pgpDig dig)
  +static rpmRC readFile(rpmts ts, FD_t fd, const char * fn, pgpDig dig)
   	/*@globals fileSystem, internalState @*/
   	/*@modifies fd, *dig, fileSystem, internalState @*/
   {
  @@ -794,7 +795,7 @@
       HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
       unsigned char buf[4*BUFSIZ];
       ssize_t count;
  -    int rc = 1;
  +    rpmRC rc;
       int xx;
       int i;
   
  @@ -804,7 +805,7 @@
       {	Header h = NULL;
   	const char item[] = "Header";
   	const char * msg = NULL;
  -	rpmRC rc = rpmReadHeader(ts, fd, &h, &msg);
  +	rc = rpmReadHeader(ts, fd, &h, &msg);
   	if (rc != RPMRC_OK) {
   	    rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
   	    msg = _free(msg);
  @@ -884,7 +885,7 @@
   	(void) rpmDigestUpdate(dig->md5ctx, wf->p, wf->np);
   }
   
  -    rc = 0;
  +    rc = RPMRC_OK;	/* XXX unnecessary */
   
   exit:
       return rc;
  @@ -1015,7 +1016,9 @@
   #endif
   
   	/* Read the file, generating digest(s) on the fly. */
  -	if (dig == NULL || sigp == NULL || readFile(ts, fd, fn, dig)) {
  +	if (dig == NULL || sigp == NULL
  +	 || readFile(ts, fd, fn, dig) != RPMRC_OK)
  +	{
   	    res++;
   	    goto exit;
   	}
  @@ -1331,7 +1334,7 @@
   	}
   
   	if (fd != NULL) {
  -	    rpmpkgClean(fd);
  +	    (void) rpmpkgClean(fd);
   	    xx = Fclose(fd);
   	}
       }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfc.c
  ============================================================================
  $ cvs diff -u -r1.35 -r1.36 rpmfc.c
  --- rpm/lib/rpmfc.c	10 Nov 2007 18:06:42 -0000	1.35
  +++ rpm/lib/rpmfc.c	15 Nov 2007 20:26:04 -0000	1.36
  @@ -1532,7 +1532,6 @@
   assert(ac == he->c);
       if (he->p.ptr != NULL && he->c > 0) {
   	uint32_t * fcolors = he->p.ui32p;
  -	int i;
   
   	/* XXX Make sure only primary (i.e. Elf32/Elf64) colors are added. */
   	for (i = 0; i < he->c; i++)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpminstall.c
  ============================================================================
  $ cvs diff -u -r1.181 -r1.182 rpminstall.c
  --- rpm/lib/rpminstall.c	10 Nov 2007 18:06:42 -0000	1.181
  +++ rpm/lib/rpminstall.c	15 Nov 2007 20:26:04 -0000	1.182
  @@ -52,10 +52,8 @@
       rpmcliHashesTotal = (isatty (STDOUT_FILENO) ? 44 : 50);
   
       if (rpmcliHashesCurrent != rpmcliHashesTotal) {
  -/*@+relaxtypes@*/
  -	float pct = (total ? (((float) amount) / total) : 1.0);
  -	hashesNeeded = (rpmcliHashesTotal * pct) + 0.5;
  -/*@=relaxtypes@*/
  +	float pct = (float) (total ? (((float) amount) / total) : 1);
  +	hashesNeeded = (int)((rpmcliHashesTotal * pct) + 0.5);
   	while (hashesNeeded > rpmcliHashesCurrent) {
   	    if (isatty (STDOUT_FILENO)) {
   		int i;
  @@ -79,11 +77,9 @@
   	    if (isatty(STDOUT_FILENO)) {
   	        for (i = 1; i < rpmcliHashesCurrent; i++)
   		    (void) putchar ('#');
  -/*@+relaxtypes@*/
  -		pct = (rpmcliProgressTotal
  +		pct = (float) (rpmcliProgressTotal
   		    ? (((float) rpmcliProgressCurrent) / rpmcliProgressTotal)
   		    : 1);
  -/*@=relaxtypes@*/
   		fprintf(stdout, " [%3d%%]", (int)((100 * pct) + 0.5));
   	    }
   	    fprintf(stdout, "\n");
  @@ -288,18 +284,24 @@
   
   int rpmcliInstallCheck(rpmts ts)
   {
  +/*@-evalorder@*/
       return rpmcliInstallProblems(ts, _("Failed dependencies"), rpmtsCheck(ts));
  +/*@=evalorder@*/
   }
   
   int rpmcliInstallOrder(rpmts ts)
   {
  +/*@-evalorder@*/
       return rpmcliInstallProblems(ts, _("Ordering problems"), rpmtsOrder(ts));
  +/*@=evalorder@*/
   }
   
   int rpmcliInstallRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
   {
  +/*@-evalorder@*/
       return rpmcliInstallProblems(ts, _("Install/Erase problems"),
   			rpmtsRun(ts, okProbs, ignoreSet));
  +/*@=evalorder@*/
   }
   
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmps.c
  ============================================================================
  $ cvs diff -u -r2.16 -r2.17 rpmps.c
  --- rpm/lib/rpmps.c	9 Nov 2007 21:32:37 -0000	2.16
  +++ rpm/lib/rpmps.c	15 Nov 2007 20:26:04 -0000	2.17
  @@ -66,11 +66,10 @@
   rpmpsi rpmpsFreeIterator(rpmpsi psi)
   {
       if (psi != NULL) {
  -	rpmpsUnlink(psi->ps, "iter unref");
  -	free(psi);
  -	psi = NULL;
  +	psi->ps = rpmpsUnlink(psi->ps, "iter unref");
  +	psi = _free(psi);
       }
  -    return psi;
  +    return NULL;
   }
   
   int rpmpsNextIterator(rpmpsi psi)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmps.h
  ============================================================================
  $ cvs diff -u -r2.13 -r2.14 rpmps.h
  --- rpm/lib/rpmps.h	12 Nov 2007 12:30:46 -0000	2.13
  +++ rpm/lib/rpmps.h	15 Nov 2007 20:26:04 -0000	2.14
  @@ -76,7 +76,7 @@
   /**
    */
   struct rpmpsi_s {
  -    size_t ix;
  +    int ix;
       rpmps ps;
   };
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmte.c
  ============================================================================
  $ cvs diff -u -r2.66 -r2.67 rpmte.c
  --- rpm/lib/rpmte.c	10 Nov 2007 18:06:42 -0000	2.66
  +++ rpm/lib/rpmte.c	15 Nov 2007 20:26:04 -0000	2.67
  @@ -585,8 +585,6 @@
   	te->color |= val;
   	(void) rpmdsSetColor(ds, val);
   	val = refs[i];
  -	if (val >= 0)
  -	    val++;
   	(void) rpmdsSetRefs(ds, val);
       }
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmts.c
  ============================================================================
  $ cvs diff -u -r2.119 -r2.120 rpmts.c
  --- rpm/lib/rpmts.c	10 Nov 2007 18:06:42 -0000	2.119
  +++ rpm/lib/rpmts.c	15 Nov 2007 20:26:04 -0000	2.120
  @@ -919,7 +919,7 @@
   	D_("    i        dev    bsize       bavail       iavail mount point\n"));
   
       rc = rpmGetFilesystemList(&ts->filesystems, &ts->filesystemCount);
  -    if (rc || ts->filesystems == NULL || ts->filesystemCount <= 0)
  +    if (rc || ts->filesystems == NULL || ts->filesystemCount == 0)
   	return rc;
   
       /* Get available space on mounted file systems. */
  @@ -1070,7 +1070,7 @@
       int fc;
       int i;
   
  -    if (ts->filesystems == NULL || ts->filesystemCount <= 0)
  +    if (ts->filesystems == NULL || ts->filesystemCount == 0)
   	return;
   
       dsi = ts->dsi;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/verify.c
  ============================================================================
  $ cvs diff -u -r2.175 -r2.176 verify.c
  --- rpm/lib/verify.c	8 Nov 2007 20:33:18 -0000	2.175
  +++ rpm/lib/verify.c	15 Nov 2007 20:26:04 -0000	2.176
  @@ -20,7 +20,9 @@
   #include "ugid.h"
   #include "debug.h"
   
  +/*@access rpmfi @*/
   /*@access rpmpsm @*/	/* XXX for %verifyscript through rpmpsmStage() */
  +/*@access rpmProblem @*/
   
   #define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
   
  @@ .
Received on Thu Nov 15 21:26:05 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.