[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rpm-cvs
Subject:    [CVS] RPM: rpm-4_5: rpm/ CHANGES rpm/rpmdb/ header.c header.h header_i...
From:       "Jeff Johnson" <jbj () rpm5 ! org>
Date:       2007-10-23 16:43:14
Message-ID: 20071023164314.2EAF1348459 () rpm5 ! org
[Download RAW message or body]

  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-Oct-2007 18:43:14
  Branch: rpm-4_5                          Handle: 2007102317431201

  Modified files:           (Branch: rpm-4_5)
    rpm                     CHANGES
    rpm/rpmdb               header.c header.h header_internal.h

  Log:
    - jbj: eliminate warnings.

  Summary:
    Revision    Changes     Path
    1.1360.2.47 +2  -0      rpm/CHANGES
    1.48.2.5    +33 -31     rpm/rpmdb/header.c
    1.13.2.4    +4  -2      rpm/rpmdb/header.h
    1.13.2.3    +2  -2      rpm/rpmdb/header_internal.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1360.2.46 -r1.1360.2.47 CHANGES
  --- rpm/CHANGES	23 Oct 2007 15:53:07 -0000	1.1360.2.46
  +++ rpm/CHANGES	23 Oct 2007 16:43:12 -0000	1.1360.2.47
  @@ -1,4 +1,6 @@
   4.4.9 -> 4.5:
  +    - jbj: eliminate warnings.
  +    - jbj: keep the headerFoo() API invariant, eliminate warnings.
       - jbj: backport (and enable) tag data cache.
       - jbj: backport tag data typedef's, and add tag container.
       - jbj: convert rel to abs linkto dependency iff directory is known.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.c
  ============================================================================
  $ cvs diff -u -r1.48.2.4 -r1.48.2.5 header.c
  --- rpm/rpmdb/header.c	23 Oct 2007 15:53:08 -0000	1.48.2.4
  +++ rpm/rpmdb/header.c	23 Oct 2007 16:43:13 -0000	1.48.2.5
  @@ -467,7 +467,7 @@
    */
   static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
   		entryInfo pe,
  -		unsigned char * dataStart,
  +		void * dataStart,
   		/*@null@*/ const unsigned char * dataEnd,
   		int regionid)
   	/*@modifies *entry, *dataStart @*/
  @@ -501,7 +501,7 @@
   	    return -1;
   /*@=boundsread@*/
   
  -	ie.data = t = dataStart + ie.info.offset;
  +	ie.data = t = ((unsigned char *)dataStart) + ie.info.offset;
   	if (dataEnd && t >= dataEnd)
   	    return -1;
   
  @@ -539,7 +539,7 @@
   	if (ie.info.tag >= HEADER_I18NTABLE) {
   	    tprev = t;
   	} else {
  -	    tprev = dataStart;
  +	    tprev = (unsigned char *)dataStart;
   	    /* XXX HEADER_IMAGE tags don't include region sub-tag. */
   	    /*@-sizeoftype@*/
   	    if (ie.info.tag == HEADER_IMAGE)
  @@ -561,7 +561,7 @@
   		if (b[1] != ((int_32 *)it)[0])
   		    memcpy(it, b, sizeof(b));
   	    }
  -	    t = (char *) it;
  +	    t = (unsigned char *) it;
   	}   /*@switchbreak@*/ break;
   	case RPM_INT32_TYPE:
   	{   int_32 * it = (int_32 *)t;
  @@ -570,7 +570,7 @@
   		    return -1;
   		*it = htonl(*it);
   	    }
  -	    t = (char *) it;
  +	    t = (unsigned char *) it;
   	}   /*@switchbreak@*/ break;
   	case RPM_INT16_TYPE:
   	{   int_16 * it = (int_16 *) t;
  @@ -579,7 +579,7 @@
   		    return -1;
   		*it = htons(*it);
   	    }
  -	    t = (char *) it;
  +	    t = (unsigned char *) it;
   	}   /*@switchbreak@*/ break;
   /*@=bounds@*/
   	default:
  @@ -588,7 +588,7 @@
   	}
   
   	dl += ie.length;
  -	if (dataEnd && dataStart + dl > dataEnd) return -1;
  +	if (dataEnd && ((unsigned char *)dataStart) + dl > dataEnd) return -1;
   	tl += tdel;
   	ieprev = ie;	/* structure assignment */
   
  @@ -1886,7 +1886,7 @@
   	return 0;
       }
   
  -    rc = copyEntry(entry, type, p, c, 0);
  +    rc = copyEntry(entry, (int_32 *)type, p, c, 0);
   
       /* XXX 1 on success */
       return ((rc == 1) ? 1 : 0);
  @@ -2584,7 +2584,7 @@
   	    hsa->i++;
   	} else {
   	    HE_t he = rpmheClean(&tag->he);
  -	    if (!headerNextIterator(hsa->hi, &he->tag, &he->t, &he->p, &he->c))
  +	    if (!headerNextIterator(hsa->hi, &he->tag, (hTAG_t)&he->t, (hPTR_t *)&he->p.ptr, &he->c))
   		fmt = NULL;
   	    he = rpmheMark(he);
   	    he->avail = 1;
  @@ -3140,9 +3140,9 @@
    * @return		0 on success, 1 on failure
    */
   static int getExtension(headerSprintfArgs hsa, headerTagTagFunction fn,
  -		/*@out@*/ hTYP_t typeptr,
  -		/*@out@*/ hPTR_t * data,
  -		/*@out@*/ hCNT_t countptr,
  +		/*@out@*/ rpmTagType * typeptr,
  +		/*@out@*/ rpmTagData * data,
  +		/*@out@*/ rpmTagCount * countptr,
   		rpmec ec)
   	/*@modifies *typeptr, *data, *countptr, ec @*/
   	/*@requires maxSet(typeptr) >= 0 /\ maxSet(data) >= 0
  @@ -3155,7 +3155,7 @@
       }
   
       if (typeptr) *typeptr = ec->type;
  -    if (data) *data = ec->data;
  +    if (data) (*data).ptr = (void *)ec->data;
       if (countptr) *countptr = ec->count;
   
       return 0;
  @@ -3196,7 +3196,7 @@
       } else
       if (!he->avail) {
   	he->tag = tag->tagno;
  -	if (!headerGetEntry(hsa->h, he->tag, &he->t, &he->p, &he->c)) {
  +	if (!headerGetEntry(hsa->h, he->tag, (hTYP_t)&he->t, &he->p, &he->c)) {
   	    he->c = 1;
   	    he->t = RPM_STRING_TYPE;	
   	    he->p.str = "(none)";
  @@ -3388,15 +3388,15 @@
   		int element)
   	/*@modifies hsa @*/
   {
  +    HE_t he;
       char numbuf[64];	/* XXX big enuf for "Tag_0x01234567" */
       char * t, * te;
       int i, j;
       int numElements;
  -    int_32 type;
  -    int_32 count;
       sprintfToken spft;
       int condNumFormats;
       size_t need;
  +    int xx;
   
       /* we assume the token and header have been validated already! */
   
  @@ -3451,24 +3451,26 @@
   		spft->u.tag.arrayCount ||
   		spft->u.tag.justOne) continue;
   
  +	    he = &spft->u.tag.he;
   	    if (spft->u.tag.ext) {
  -/*@-boundswrite@*/
  -		if (getExtension(hsa, spft->u.tag.ext, &type, NULL, &count, 
  -				 hsa->ec + spft->u.tag.extNum))
  -		     continue;
  -/*@=boundswrite@*/
  +		xx = getExtension(hsa, spft->u.tag.ext, &he->t, &he->p, &he->c, 
  +				 hsa->ec + spft->u.tag.extNum);
   	    } else {
  -/*@-boundswrite@*/
  -		if (!headerGetEntry(hsa->h, spft->u.tag.tagno, &type, NULL, &count))
  -		    continue;
  -/*@=boundswrite@*/
  +		xx = headerGetEntry(hsa->h, spft->u.tag.tagno, (hTYP_t)&he->t, &he->p, &he->c);
  +		xx = (xx == 0);	/* XXX invert headerGetEntry return. */
   	    } 
  +	    if (xx) {
  +		(void) rpmheClean(he);
  +		continue;
  +	    }
  +	    (void) rpmheMark(he);
  +	    he->avail = 1;
   
  -	    if (type == RPM_BIN_TYPE || type == RPM_ASN1_TYPE || type == RPM_OPENPGP_TYPE)
  -		count = 1;	/* XXX count abused as no. of bytes. */
  +	    if (he->t == RPM_BIN_TYPE || he->t == RPM_ASN1_TYPE || he->t == RPM_OPENPGP_TYPE)
  +		he->c = 1;	/* XXX count abused as no. of bytes. */
   
  -	    if (numElements > 1 && count != numElements)
  -	    switch (type) {
  +	    if (numElements > 1 && he->c != numElements)
  +	    switch (he->t) {
   	    default:
   		hsa->errmsg =
   			_("array iterator used with different sized arrays");
  @@ -3480,8 +3482,8 @@
   	    case RPM_STRING_TYPE:
   		/*@switchbreak@*/ break;
   	    }
  -	    if (count > numElements)
  -		numElements = count;
  +	    if (he->c > numElements)
  +		numElements = he->c;
   	}
   
   	if (numElements == -1) {
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.h
  ============================================================================
  $ cvs diff -u -r1.13.2.3 -r1.13.2.4 header.h
  --- rpm/rpmdb/header.h	23 Oct 2007 15:53:08 -0000	1.13.2.3
  +++ rpm/rpmdb/header.h	23 Oct 2007 16:43:13 -0000	1.13.2.4
  @@ -168,13 +168,15 @@
   /** \ingroup header
    */
   typedef int_32 *	hTAG_t;
  -typedef rpmTagType *	hTYP_t;
   #ifdef	NOTYET
  +typedef rpmTagType *	hTYP_t;
   typedef rpmTagData *	hPTR_t;
  +typedef rpmTagCount *	hCNT_t;
   #else
  +typedef int_32 *	hTYP_t;
   typedef const void *	hPTR_t;
  +typedef int_32 *	hCNT_t;
   #endif
  -typedef rpmTagCount *	hCNT_t;
   
   /** \ingroup header
    */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header_internal.h
  ============================================================================
  $ cvs diff -u -r1.13.2.2 -r1.13.2.3 header_internal.h
  --- rpm/rpmdb/header_internal.h	23 Oct 2007 15:53:08 -0000	1.13.2.2
  +++ rpm/rpmdb/header_internal.h	23 Oct 2007 16:43:13 -0000	1.13.2.3
  @@ -172,9 +172,9 @@
   /*@-exportlocal@*/
   /*@-incondefs@*/
   int headerGetRawEntry(Header h, int_32 tag,
  -			/*@null@*/ /*@out@*/ hTYP_t type,
  +			/*@null@*/ /*@out@*/ rpmTagType * type,
   			/*@null@*/ /*@out@*/ void * p, 
  -			/*@null@*/ /*@out@*/ hCNT_t c)
  +			/*@null@*/ /*@out@*/ rpmTagCount * c)
   	/*@modifies *type, *p, *c @*/
   	/*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/;
   /*@=incondefs@*/
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic