RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/rpmdb/ hdrNVR.c header.c pkgio.c rpmtag.h ...

From: Jeff Johnson <jbj@rpm5.org>
Date: Fri 23 Nov 2007 - 08:06:02 CET
Message-Id: <20071123070602.4B56B34845F@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:   23-Nov-2007 08:06:02
  Branch: HEAD                             Handle: 2007112307060100

  Modified files:
    rpm                     CHANGES
    rpm/rpmdb               hdrNVR.c header.c pkgio.c rpmtag.h rpmwf.c rpmwf.h
                            signature.c
    rpm/rpmio               .splintrc rpmio.c rpmio.h rpmio_internal.h
                            rpmxar.c rpmxar.h

  Log:
    - splint fiddles for rpmxar and rpmTag.
    - bury timedRead in pkgio.c, eliminate everywhere else.

  Summary:
    Revision    Changes     Path
    1.1873      +2  -0      rpm/CHANGES
    1.35        +4  -4      rpm/rpmdb/hdrNVR.c
    1.129       +17 -5      rpm/rpmdb/header.c
    1.55        +31 -20     rpm/rpmdb/pkgio.c
    1.8         +5  -1      rpm/rpmdb/rpmtag.h
    1.16        +1  -0      rpm/rpmdb/rpmwf.c
    1.8         +11 -2      rpm/rpmdb/rpmwf.h
    1.32        +3  -3      rpm/rpmdb/signature.c
    1.19        +1  -1      rpm/rpmio/.splintrc
    1.108       +1  -2      rpm/rpmio/rpmio.c
    1.64        +0  -7      rpm/rpmio/rpmio.h
    2.92        +4  -4      rpm/rpmio/rpmio_internal.h
    2.5         +12 -3      rpm/rpmio/rpmxar.c
    2.5         +15 -2      rpm/rpmio/rpmxar.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1872 -r1.1873 CHANGES
  --- rpm/CHANGES	23 Nov 2007 05:34:08 -0000	1.1872
  +++ rpm/CHANGES	23 Nov 2007 07:06:01 -0000	1.1873
  @@ -1,4 +1,6 @@
   5.0a2 -> 5.0a3:
  +    - jbj: splint fiddles for rpmxar and rpmTag.
  +    - jbj: bury timedRead in pkgio.c, eliminate everywhere else.
       - jbj: eliminate (unused) hPTR_t.
       - jbj: hmm, a memory leak, add doco to the TODO file.
       - jbj: eliminate hTAG_t, use "rpmTag *" instead.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/hdrNVR.c
  ============================================================================
  $ cvs diff -u -r1.34 -r1.35 hdrNVR.c
  --- rpm/rpmdb/hdrNVR.c	17 Nov 2007 17:57:39 -0000	1.34
  +++ rpm/rpmdb/hdrNVR.c	23 Nov 2007 07:06:01 -0000	1.35
  @@ -238,7 +238,7 @@
           he->p.ptr = hfd(he->p.ptr, he->t))
       {
   	/* XXX Translate legacy signature tag values. */
  -	switch (he->tag) {
  +	switch ((rpmSigTag)he->tag) {
   	case RPMSIGTAG_SIZE:
   	    he->tag = RPMTAG_SIGSIZE;
   	    /*@switchbreak@*/ break;
  @@ -307,16 +307,16 @@
   	/* XXX Translate legacy signature tag values. */
   	switch (he->tag) {
   	case RPMTAG_SIGSIZE:
  -	    he->tag = RPMSIGTAG_SIZE;
  +	    he->tag = (rpmTag) RPMSIGTAG_SIZE;
   	    /*@switchbreak@*/ break;
   	case RPMTAG_SIGMD5:
  -	    he->tag = RPMSIGTAG_MD5;
  +	    he->tag = (rpmTag) RPMSIGTAG_MD5;
   	    /*@switchbreak@*/ break;
   	case RPMTAG_ARCHIVESIZE:
   	    /* XXX rpm-4.1 and later has archive size in signature header. */
   	    if (noArchiveSize)
   		continue;
  -	    he->tag = RPMSIGTAG_PAYLOADSIZE;
  +	    he->tag = (rpmTag) RPMSIGTAG_PAYLOADSIZE;
   	    /*@switchbreak@*/ break;
   	case RPMTAG_SHA1HEADER:
   	case RPMTAG_DSAHEADER:
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.c
  ============================================================================
  $ cvs diff -u -r1.128 -r1.129 header.c
  --- rpm/rpmdb/header.c	23 Nov 2007 00:29:47 -0000	1.128
  +++ rpm/rpmdb/header.c	23 Nov 2007 07:06:01 -0000	1.129
  @@ -27,6 +27,11 @@
   /*@unchecked@*/
   int _tagcache = 1;		/* XXX Cache tag data persistently? */
   
  +/*@access Header @*/
  +/*@access HeaderIterator @*/
  +/*@access headerSprintfExtension @*/
  +/*@access headerTagTableEntry @*/
  +
   /*@access entryInfo @*/
   /*@access indexEntry @*/
   
  @@ -486,7 +491,7 @@
   		entryInfo pe,
   		unsigned char * dataStart,
   		/*@null@*/ const unsigned char * dataEnd,
  -		int regionid)
  +		int32_t regionid)
   	/*@modifies *entry, *dataStart @*/
   {
       rpmTagData p;
  @@ -3319,7 +3324,7 @@
   static char * formatValue(headerSprintfArgs hsa, sprintfTag tag,
   		uint32_t element)
   	/*@globals headerCompoundFormats @*/
  -	/*@modifies hsa, tag, headerCompoundFormats @*/
  +	/*@modifies hsa, tag @*/
   {
       HE_t vhe = memset(alloca(sizeof(*vhe)), 0, sizeof(*vhe));
       HE_t he = &tag->he;
  @@ -3473,7 +3478,7 @@
   static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
   		uint32_t element)
   	/*@globals headerCompoundFormats @*/
  -	/*@modifies hsa, token, headerCompoundFormats @*/
  +	/*@modifies hsa, token @*/
   {
       char numbuf[64];	/* XXX big enuf for "Tag_0x01234567" */
       char * t, * te;
  @@ -3635,8 +3640,10 @@
   				(unsigned) tag->tagno);
   		    numbuf[sizeof(numbuf)-1] = '\0';
   		    tagN = numbuf;
  +/*@-type@*/
   		    tagT = numElements > 1
   			?  RPM_ARRAY_RETURN_TYPE : RPM_SCALAR_RETURN_TYPE;
  +/*@=type@*/
   		}
   		need = sizeof("  :     - ") + strlen(tagN);
   		te = t = hsaReserve(hsa, need);
  @@ -3644,11 +3651,16 @@
   		*te++ = ' ';
   		te = stpcpy(te, tagN);
   		*te++ = ':';
  +/*@-type@*/
   		*te++ = (((tagT & RPM_MASK_RETURN_TYPE) == RPM_ARRAY_RETURN_TYPE)
   			? '\n' : ' ');
  +/*@=type@*/
   		/* XXX Dirnames: in srpms need "    " indent */
  +/*@-type@*/
   		if (((tagT & RPM_MASK_RETURN_TYPE) == RPM_ARRAY_RETURN_TYPE)
  -		 && numElements == 1) {
  +		 && numElements == 1)
  +/*@=type@*/
  +		{
   		    te = stpcpy(te, "    ");
   		    if (tag->tagno != 1118)
   			te = stpcpy(te, "- ");
  @@ -3758,7 +3770,7 @@
   		/*@null@*/ const struct headerSprintfExtension_s * exts,
   		/*@null@*/ /*@out@*/ errmsg_t * errmsg)
   	/*@globals headerCompoundFormats @*/
  -	/*@modifies h, *errmsg, headerCompoundFormats @*/
  +	/*@modifies h, *errmsg @*/
   	/*@requires maxSet(errmsg) >= 0 @*/
   {
       headerSprintfArgs hsa = memset(alloca(sizeof(*hsa)), 0, sizeof(*hsa));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/pkgio.c
  ============================================================================
  $ cvs diff -u -r1.54 -r1.55 pkgio.c
  --- rpm/rpmdb/pkgio.c	22 Nov 2007 19:27:14 -0000	1.54
  +++ rpm/rpmdb/pkgio.c	23 Nov 2007 07:06:01 -0000	1.55
  @@ -59,6 +59,15 @@
   };
   /*@=type@*/
   
  +/**
  + */
  +/*@-exportheader@*/
  +/*@unused@*/ ssize_t timedRead(FD_t fd, /*@out@*/ void * bufptr, size_t length)
  +	/*@globals fileSystem @*/
  +	/*@modifies fd, *bufptr, fileSystem @*/;
  +#define	timedRead	(ufdio->read)
  +/*@=exportheader@*/
  +
   /*===============================================*/
   /** \ingroup header
    * Write (with unload) header to file handle.
  @@ -69,7 +78,7 @@
   static
   rpmRC rpmWriteHeader(FD_t fd, /*@null@*/ Header h, /*@null@*/ const char ** msg)
   	/*@globals fileSystem @*/
  -	/*@modifies fd, h, fileSystem @*/
  +	/*@modifies fd, h, *msg, fileSystem @*/
   {
       const void * uh = NULL;
       ssize_t nb;
  @@ -457,7 +466,7 @@
   static rpmRC rdLead(FD_t fd, /*@out@*/ /*@null@*/ void * ptr,
   		const char ** msg)
   	/*@globals fileSystem @*/
  -	/*@modifies *ptr, *msg, fileSystem @*/
  +	/*@modifies fd, *ptr, *msg, fileSystem @*/
   {
       rpmxar xar = fdGetXAR(fd);
       struct rpmlead ** leadp = ptr;
  @@ -497,6 +506,7 @@
       }
   
       /* With XAR, read lead from a xar archive file called "Lead". */
  +    xar = fdGetXAR(fd);
       if (xar != NULL) {
   	void *b = NULL;
   	size_t nb = 0;
  @@ -571,7 +581,7 @@
    */
   static rpmRC wrSignature(FD_t fd, void * ptr, /*@unused@*/ const char ** msg)
   	/*@globals fileSystem @*/
  -	/*@modifies fd, ptr, fileSystem @*/
  +	/*@modifies fd, ptr, *msg, fileSystem @*/
   {
       Header sigh = ptr;
       static unsigned char zero[8]
  @@ -726,7 +736,7 @@
   	(void) snprintf(buf, sizeof(buf),
   		_("tag[%d]: BAD, tag %u type %u offset %d count %u\n"),
   		0, (unsigned) entry->info.tag, (unsigned) entry->info.type,
  -		entry->info.offset, (unsigned) entry->info.count);
  +		(int)entry->info.offset, (unsigned) entry->info.count);
   	goto exit;
       }
   
  @@ -743,7 +753,7 @@
   	    (void) snprintf(buf, sizeof(buf),
   		_("region offset: BAD, tag %u type %u offset %d count %u\n"),
   		(unsigned) entry->info.tag, (unsigned) entry->info.type,
  -		entry->info.offset, (unsigned) entry->info.count);
  +		(int)entry->info.offset, (unsigned) entry->info.count);
   	    goto exit;
   	}
   
  @@ -768,7 +778,7 @@
   	    (void) snprintf(buf, sizeof(buf),
   		_("region trailer: BAD, tag %u type %u offset %d count %u\n"),
   		(unsigned) entry->info.tag, (unsigned) entry->info.type,
  -		entry->info.offset, (unsigned) entry->info.count);
  +		(int)entry->info.offset, (unsigned) entry->info.count);
   	    goto exit;
   	}
   /*@=sizeoftype@*/
  @@ -791,7 +801,7 @@
   	    (void) snprintf(buf, sizeof(buf),
   		_("sigh tag[%u]: BAD, tag %u type %u offset %d count %u\n"),
   		(unsigned) i, (unsigned) entry->info.tag, (unsigned) entry->info.type,
  -		entry->info.offset, (unsigned) entry->info.count);
  +		(int)entry->info.offset, (unsigned) entry->info.count);
   	    goto exit;
   	}
       }
  @@ -820,7 +830,7 @@
   
   	/* Print package component sizes. */
   
  -	he->tag = RPMSIGTAG_SIZE;
  +	he->tag = (rpmTag) RPMSIGTAG_SIZE;
   	xx = hge(sigh, he, 0);
   	if (xx) {
   	    size_t datasize = he->p.ui32p[0];
  @@ -903,7 +913,7 @@
   	(void) snprintf(buf, sizeof(buf),
   		_("tag[%d]: BAD, tag %u type %u offset %d count %u\n"),
   		0, (unsigned) entry->info.tag, (unsigned) entry->info.type,
  -		entry->info.offset, (unsigned) entry->info.count);
  +		(int)entry->info.offset, (unsigned) entry->info.count);
   	goto exit;
       }
   
  @@ -923,7 +933,7 @@
   	(void) snprintf(buf, sizeof(buf),
   		_("region offset: BAD, tag %u type %u offset %d count %u\n"),
   		(unsigned) entry->info.tag, (unsigned) entry->info.type,
  -		entry->info.offset, (unsigned) entry->info.count);
  +		(int)entry->info.offset, (unsigned) entry->info.count);
   	goto exit;
       }
   
  @@ -942,7 +952,7 @@
   	(void) snprintf(buf, sizeof(buf),
   		_("region trailer: BAD, tag %u type %u offset %d count %u\n"),
   		(unsigned) entry->info.tag, (unsigned) entry->info.type,
  -		entry->info.offset, (unsigned) entry->info.count);
  +		(int)entry->info.offset, (unsigned) entry->info.count);
   	goto exit;
       }
   /*@=sizeoftype@*/
  @@ -963,7 +973,7 @@
   	    (void) snprintf(buf, sizeof(buf),
   		_("tag[%u]: BAD, tag %u type %u offset %d count %u\n"),
   		(unsigned) i, (unsigned) entry->info.tag, (unsigned) entry->info.type,
  -		entry->info.offset, (unsigned) entry->info.count);
  +		(int)entry->info.offset, (unsigned) entry->info.count);
   	    goto exit;
   	}
   
  @@ -1028,7 +1038,7 @@
   	    (void) snprintf(buf, sizeof(buf),
   		_("tag[%d]: BAD, tag %u type %u offset %d count %u\n"),
   		xx+1, (unsigned) entry->info.tag, (unsigned) entry->info.type,
  -		entry->info.offset, (unsigned) entry->info.count);
  +		(int)entry->info.offset, (unsigned) entry->info.count);
   	    rc = RPMRC_FAIL;
   	} else {
   	    (void) snprintf(buf, sizeof(buf), "Header sanity check: OK\n");
  @@ -1176,9 +1186,10 @@
    * @retval *msg		failure msg
    * @return		rpmRC return code
    */
  -static rpmRC ckHeader(/*@unused@*/ FD_t fd, const void * ptr, const char ** msg)
  +static rpmRC ckHeader(/*@unused@*/ FD_t fd, const void * ptr,
  +		/*@unused@*/ const char ** msg)
   	/*@globals fileSystem @*/
  -	/*@modifies ptr, *msg, fileSystem @*/
  +	/*@modifies ptr, fileSystem @*/
   {
       rpmRC rc = RPMRC_OK;
       Header h;
  @@ -1217,7 +1228,6 @@
       Header h = NULL;
       const char * origin = NULL;
       rpmRC rc = RPMRC_FAIL;		/* assume failure */
  -    unsigned char * bh = NULL;
       int xx;
   
       /* Create (if not already) a signature parameters container. */
  @@ -1268,8 +1278,7 @@
       nb = (il * sizeof(struct entryInfo_s)) + dl;
   /*@=sizeoftype@*/
       uc = sizeof(il) + sizeof(dl) + nb;
  -    bh = xmalloc(uc);
  -    ei = (uint32_t *)bh;
  +    ei = (uint32_t *) xmalloc(uc);
       if ((xx = (int) timedRead(fd, (char *)&ei[2], nb)) != (int) nb) {
   	(void) snprintf(buf, sizeof(buf),
   		_("hdr blob(%u): BAD, read returned %d\n"), (unsigned)nb, xx);
  @@ -1290,7 +1299,7 @@
           goto exit;
       }
       h->flags |= HEADERFLAG_ALLOCATED;
  -    bh = NULL;	/* XXX will be freed with header */
  +    ei = NULL;	/* XXX will be freed with header */
   
       /* Save the opened path as the header origin. */
       origin = fdGetOPath(fd);
  @@ -1300,7 +1309,7 @@
   exit:
       if (hdrp && h && rc == RPMRC_OK)
   	*hdrp = headerLink(h);
  -    bh = _free(bh);
  +    ei = _free(ei);
       h = headerFree(h);
   
       if (msg != NULL && *msg == NULL && buf[0] != '\0') {
  @@ -1324,7 +1333,9 @@
   	/*@modifies fd, *ptr, *msg, fileSystem @*/
   {
       Header * hdrp = ptr;
  +/*@-compdef@*/
       return rpmReadHeader(fd, hdrp, msg);
  +/*@=compdef@*/
   }
   
   /**
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmtag.h
  ============================================================================
  $ cvs diff -u -r1.7 -r1.8 rpmtag.h
  --- rpm/rpmdb/rpmtag.h	23 Nov 2007 05:34:09 -0000	1.7
  +++ rpm/rpmdb/rpmtag.h	23 Nov 2007 07:06:01 -0000	1.8
  @@ -402,7 +402,7 @@
   /** \ingroup signature
    * Tags found in signature header from package.
    */
  -enum rpmtagSignature_e {
  +enum rpmSigTag_e {
       RPMSIGTAG_SIZE	= 1000,	/*!< internal Header+Payload size in bytes. */
       RPMSIGTAG_LEMD5_1	= 1001,	/*!< internal Broken MD5, take 1 @deprecated legacy. */
       RPMSIGTAG_PGP	= 1002,	/*!< internal PGP 2.6.3 signature. */
  @@ -424,6 +424,10 @@
   
   /** \ingroup header
    */
  +typedef enum rpmSigTag_e rpmSigTag;
  +
  +/** \ingroup header
  + */
   /*@-typeuse -fielduse@*/
   #if !defined(SWIG)
   struct _HE_s {
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmwf.c
  ============================================================================
  $ cvs diff -u -r1.15 -r1.16 rpmwf.c
  --- rpm/rpmdb/rpmwf.c	22 Nov 2007 18:50:27 -0000	1.15
  +++ rpm/rpmdb/rpmwf.c	23 Nov 2007 07:06:01 -0000	1.16
  @@ -11,6 +11,7 @@
   #include "debug.h"
   
   /*@access FD_t @*/
  +/*@access rpmxar @*/	/* XXX fprintf */
   
   /*@unchecked@*/
   int _rpmwf_debug = 0;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmwf.h
  ============================================================================
  $ cvs diff -u -r1.7 -r1.8 rpmwf.h
  --- rpm/rpmdb/rpmwf.h	21 Nov 2007 18:21:47 -0000	1.7
  +++ rpm/rpmdb/rpmwf.h	23 Nov 2007 07:06:01 -0000	1.8
  @@ -1,9 +1,18 @@
   #ifndef H_RPMWF
   #define H_RPMWF
   
  +/**
  + * \file rpmdb/rpmwf.h
  + * Structure(s)and methods for a archive wrapper format (e.g. XAR).
  + */
  +
  +#include <rpmxar.h>
  +
   /*@unchecked@*/
   extern int _rpmwf_debug;
   
  +/**
  + */
   typedef /*@abstract@*/ /*@refcounted@*/ struct rpmwf_s * rpmwf;
   
   #ifdef	_RPMWF_INTERNAL
  @@ -27,8 +36,8 @@
   /*@relnull@*/ /*@dependent@*/
       char * p;
       size_t np;
  -/*@relnull@*/
  -    void * xar;
  +/*@relnull@*/ /*@refcounted@*/
  +    rpmxar xar;
   /*@refs@*/
       int nrefs;			/*!< Reference count. */
   };
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/signature.c
  ============================================================================
  $ cvs diff -u -r1.31 -r1.32 signature.c
  --- rpm/rpmdb/signature.c	20 Nov 2007 22:39:00 -0000	1.31
  +++ rpm/rpmdb/signature.c	23 Nov 2007 07:06:01 -0000	1.32
  @@ -246,9 +246,9 @@
       {	FD_t fd;
   
   	rc = 0;
  -	fd = Fopen(sigfile, "r.fdio");
  +	fd = Fopen(sigfile, "r.ufdio");
   	if (fd != NULL && !Ferror(fd)) {
  -	    rc = (int) timedRead(fd, (void *)*pktp, *pktlenp);
  +	    rc = (int) Fread(*pktp, sizeof((*pktp)[0]), *pktlenp, fd);
   	    if (sigfile) (void) Unlink(sigfile);
   	    (void) Fclose(fd);
   	}
  @@ -367,7 +367,7 @@
   
   	if (SHA1 == NULL)
   	    goto exit;
  -	he->tag = RPMSIGTAG_SHA1;
  +	he->tag = (rpmTag) RPMSIGTAG_SHA1;
   	he->t = RPM_STRING_TYPE;
   	he->p.str = SHA1;
   	he->c = 1;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/.splintrc
  ============================================================================
  $ cvs diff -u -r1.18 -r1.19 .splintrc
  --- rpm/rpmio/.splintrc	15 Nov 2007 18:02:27 -0000	1.18
  +++ rpm/rpmio/.splintrc	23 Nov 2007 07:06:01 -0000	1.19
  @@ -1,4 +1,4 @@
  --I. -I.. -I../file/src -I/usr/include/neon -I../lua -I../lua/local -I/usr/include/beecrypt -I../zlib -DHAVE_CONFIG_H -D_GNU_SOURCE -D__STDC__=1 -DHAVE_NEON_NE_GET_RESPONSE_HEADER
  +-I. -I.. -I../file/src -I../xar/include -I/usr/include/neon -I../lua -I../lua/local -I/usr/include/beecrypt -I../zlib -DHAVE_CONFIG_H -D_GNU_SOURCE -D__STDC__=1 -DHAVE_NEON_NE_GET_RESPONSE_HEADER
   
   +partial
   +forcehints
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.c
  ============================================================================
  $ cvs diff -u -r1.107 -r1.108 rpmio.c
  --- rpm/rpmio/rpmio.c	22 Nov 2007 17:55:29 -0000	1.107
  +++ rpm/rpmio/rpmio.c	23 Nov 2007 07:06:01 -0000	1.108
  @@ -1691,7 +1691,7 @@
   	tosecs = data->rd_timeoutsecs;
   	data->rd_timeoutsecs = 10;
   	if (fdReadable(data, data->rd_timeoutsecs) > 0) {
  -	    while (timedRead(data, u->buf, u->bufAlloced) > 0)
  +	    while ((ufdio->read)(data, u->buf, u->bufAlloced) > 0)
   		u->buf[0] = '\0';
   	}
   	data->rd_timeoutsecs = tosecs;
  @@ -1895,7 +1895,6 @@
       size_t bytesRead;
       size_t total;
   
  -    /* XXX preserve timedRead() behavior */
       if (fdGetIo(fd) == fdio) {
   	struct stat sb;
   	int fdno = fdFileno(fd);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.h
  ============================================================================
  $ cvs diff -u -r1.63 -r1.64 rpmio.h
  --- rpm/rpmio/rpmio.h	20 Nov 2007 18:44:25 -0000	1.63
  +++ rpm/rpmio/rpmio.h	23 Nov 2007 07:06:01 -0000	1.64
  @@ -774,13 +774,6 @@
   	/*@globals fileSystem, internalState @*/
   	/*@modifies sfd, tfd, fileSystem, internalState @*/;
   
  -/**
  - */
  -/*@unused@*/ int timedRead(FD_t fd, /*@out@*/ void * bufptr, int length)
  -	/*@globals fileSystem @*/
  -	/*@modifies fd, *bufptr, fileSystem @*/;
  -#define	timedRead	(ufdio->read)
  -
   /*@-exportlocal@*/
   /**
    */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio_internal.h
  ============================================================================
  $ cvs diff -u -r2.91 -r2.92 rpmio_internal.h
  --- rpm/rpmio/rpmio_internal.h	21 Nov 2007 21:58:48 -0000	2.91
  +++ rpm/rpmio/rpmio_internal.h	23 Nov 2007 07:06:01 -0000	2.92
  @@ -347,7 +347,7 @@
    */
   /*@unused@*/ static inline
   void fdSetXAR(FD_t fd, rpmxar xar)
  -	/*@modifies fd @*/
  +	/*@modifies fd, xar @*/
   {
       FDSANE(fd);
       fd->xar = rpmxarLink(xar, "fdSetXAR");
  @@ -356,13 +356,13 @@
   /** \ingroup rpmio
    */
   /*@unused@*/ static inline
  -/*@null@*/ /*@kept@*/ void * fdGetXAR(FD_t fd)
  +/*@null@*/ rpmxar fdGetXAR(FD_t fd)
   	/*@*/
   {
       FDSANE(fd);
  -    /*@-retexpose -usereleased @*/
  +    /*@-compdef -refcounttrans -retexpose -usereleased @*/
       return fd->xar;
  -    /*@=retexpose =usereleased @*/
  +    /*@=compdef =refcounttrans =retexpose =usereleased @*/
   }
   
   /** \ingroup rpmio
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmxar.c
  ============================================================================
  $ cvs diff -u -r2.4 -r2.5 rpmxar.c
  --- rpm/rpmio/rpmxar.c	22 Nov 2007 23:05:36 -0000	2.4
  +++ rpm/rpmio/rpmxar.c	23 Nov 2007 07:06:01 -0000	2.5
  @@ -136,9 +136,9 @@
       xar->b = _free(xar->b);
       xar->bsize = xar->bx = 0;
   
  -/*@-moduncon@*/
  +/*@-moduncon -nullstate @*/
       rc = (int) xar_extract_tobuffersz(xar->x, xar->f, &xar->b, &xar->bsize);
  -/*@=moduncon@*/
  +/*@=moduncon =nullstate @*/
   if (_xar_debug)
   fprintf(stderr, "*** %s %p[%lu] rc %d\n", xar->member, xar->b, (unsigned long)xar->bsize, rc);
       if (rc)
  @@ -150,20 +150,28 @@
   int rpmxarSwapBuf(rpmxar xar, char * b, size_t bsize,
   		char ** obp, size_t * obsizep)
   {
  +/*@-modfilesys@*/
   if (_xar_debug)
   fprintf(stderr, "*** rpmxarSwapBuf(%p, %p[%u], %p, %p) %p[%u]\n", xar, b, (unsigned) bsize, obp, obsizep, xar->b, (unsigned) xar->bsize);
  +/*@=modfilesys@*/
       if (xar) {
   	if (obsizep != NULL)
   	    *obsizep = xar->bsize;
   	if (obp != NULL) {
  +/*@-onlytrans@*/
   	    *obp = xar->b;
  +/*@=onlytrans@*/
   	    xar->b = NULL;
   	}
   	xar->b = _free(xar->b);
  +/*@-assignexpose -temptrans @*/
   	xar->b = b;
  +/*@=assignexpose =temptrans @*/
   	xar->bsize = bsize;
       }
  +/*@-nullstate@*/
       return 0;
  +/*@=nullstate@*/
   }
   
   ssize_t xarRead(void * cookie, /*@out@*/ char * buf, size_t count)
  @@ -182,6 +190,7 @@
       rc = xar->bsize - xar->bx;
       if (rc > 0) {
   	if (count < rc) rc = count;
  +assert(xar->b != NULL);
   	memmove(buf, &xar->b[xar->bx], rc);
   	xar->bx += rc;
       } else
  @@ -191,7 +200,7 @@
   	rc = 0;
   
   if (_xar_debug)
  -fprintf(stderr, "*** xarRead(%p,%p,0x%x) %s %p[%u:%u] rc 0x%x\n", cookie, buf, (unsigned)count, xar->member, xar->b, (unsigned)xar->bx, (unsigned)xar->bsize, (unsigned)rc);
  +fprintf(stderr, "*** xarRead(%p,%p,0x%x) %s %p[%u:%u] rc 0x%x\n", cookie, buf, (unsigned)count, (xar->member ? xar->member : "(nil)"), xar->b, (unsigned)xar->bx, (unsigned)xar->bsize, (unsigned)rc);
   
       return rc;
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmxar.h
  ============================================================================
  $ cvs diff -u -r2.4 -r2.5 rpmxar.h
  --- rpm/rpmio/rpmxar.h	22 Nov 2007 23:05:36 -0000	2.4
  +++ rpm/rpmio/rpmxar.h	23 Nov 2007 07:06:01 -0000	2.5
  @@ -1,6 +1,11 @@
   #ifndef H_RPMXAR
   #define H_RPMXAR
   
  +/**
  + * \file rpmio/rpmxar.h
  + * Structure(s)and methods for a XAR archive wrapper format.
  + */
  +
   /*@unchecked@*/
   extern int _xar_debug;
   
  @@ -9,12 +14,16 @@
   #ifdef	_RPMXAR_INTERNAL
   struct rpmxar_s {
   #ifdef HAVE_XAR_H
  +/*@relnull@*/
       xar_t x;
  +/*@relnull@*/
       xar_file_t f;
  +/*@relnull@*/
       xar_iter_t i;
   #endif
   /*@null@*/
       const char * member;	/*!< Current archive member. */
  +/*@null@*/
       char * b;			/*!< Data buffer. */
       size_t bsize;		/*!< No. bytes of data. */
       size_t bx;			/*!< Data byte index. */
  @@ -66,13 +75,15 @@
   #define	rpmxarLink(_xar, _msg)	XrpmxarLink(_xar, _msg, __FILE__, __LINE__)
   
   /*@null@*/
  -rpmxar rpmxarFree(/*@only@*/ rpmxar xar)
  +rpmxar rpmxarFree(/*@killref@*/ /*@only@*/ rpmxar xar)
   	/*@modifies xar @*/;
   
  +/*@-globuse@*/
   /*@relnull@*/
   rpmxar rpmxarNew(const char * fn, const char * fmode)
   	/*@globals fileSystem @*/
  -	/*@modifies xar, fileSystem @*/;
  +	/*@modifies fileSystem @*/;
  +/*@=globuse@*/
   
   int rpmxarNext(rpmxar xar)
   	/*@globals fileSystem @*/
  @@ -89,11 +100,13 @@
   		/*@null@*/ char ** obp, /*@null@*/ size_t * obsizep)
   	/*@modifies xar, *obp, *obsizep @*/;
   
  +/*@-incondefs@*/
   ssize_t xarRead(void * cookie, /*@out@*/ char * buf, size_t count)
           /*@globals fileSystem, internalState @*/
           /*@modifies buf, fileSystem, internalState @*/
   	/*@requires maxSet(buf) >= (count - 1) @*/
   	/*@ensures maxRead(buf) == result @*/;
  +/*@=incondefs@*/
   
   #ifdef __cplusplus
   }
  @@ .
Received on Fri Nov 23 08:06:02 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.