RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm-4_5: rpm/rpmdb/ header.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Tue 23 Oct 2007 - 18:50:13 CEST
Message-Id: <20071023165013.1411A348459@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-Oct-2007 18:50:13
  Branch: rpm-4_5                          Handle: 2007102317501200

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

  Log:
     - jbj: eliminate splint fluff.

  Summary:
    Revision    Changes     Path
    1.48.2.6    +0  -184    rpm/rpmdb/header.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.c
  ============================================================================
  $ cvs diff -u -r1.48.2.5 -r1.48.2.6 header.c
  --- rpm/rpmdb/header.c	23 Oct 2007 16:43:13 -0000	1.48.2.5
  +++ rpm/rpmdb/header.c	23 Oct 2007 16:50:12 -0000	1.48.2.6
  @@ -215,11 +215,9 @@
   {
       Header h = xcalloc(1, sizeof(*h));
   
  -/*@-boundsread@*/
       /*@-assignexpose@*/
       h->hv = *hdrVec;		/* structure assignment */
       /*@=assignexpose@*/
  -/*@=boundsread@*/
       h->blob = NULL;
       h->origin = NULL;
       h->instance = 0;
  @@ -257,9 +255,7 @@
   	/*@modifies h @*/
   {
       if (!(h->flags & HEADERFLAG_SORTED)) {
  -/*@-boundsread@*/
   	qsort(h->index, h->indexUsed, sizeof(*h->index), indexCmp);
  -/*@=boundsread@*/
   	h->flags |= HEADERFLAG_SORTED;
       }
   }
  @@ -291,9 +287,7 @@
   void headerUnsort(Header h)
   	/*@modifies h @*/
   {
  -/*@-boundsread@*/
       qsort(h->index, h->indexUsed, sizeof(*h->index), offsetCmp);
  -/*@=boundsread@*/
   }
   
   /** \ingroup header
  @@ -349,7 +343,6 @@
   
   	/* Alignment */
   	type = entry->info.type;
  -/*@-boundsread@*/
   	if (typeSizes[type] > 1) {
   	    diff = typeSizes[type] - (size % typeSizes[type]);
   	    if (diff != typeSizes[type]) {
  @@ -357,7 +350,6 @@
   		pad += diff;
   	    }
   	}
  -/*@=boundsread@*/
   
   	/*@-sizeoftype@*/
   	size += sizeof(struct entryInfo_s) + entry->length;
  @@ -388,13 +380,11 @@
       case RPM_STRING_TYPE:
   	if (count != 1)
   	    return -1;
  -/*@-boundsread@*/
   	while (*s++) {
   	    if (se && s > se)
   		return -1;
   	    length++;
   	}
  -/*@=boundsread@*/
   	length++;	/* count nul terminator too. */
   	break;
   
  @@ -406,31 +396,25 @@
   	if (onDisk) {
   	    while (count--) {
   		length++;       /* count nul terminator too */
  -/*@-boundsread@*/
                  while (*s++) {
   		    if (se && s > se)
   			return -1;
   		    length++;
   		}
  -/*@=boundsread@*/
   	    }
   	} else {
   	    const char ** av = (const char **)p;
  -/*@-boundsread@*/
   	    while (count--) {
   		/* add one for null termination */
   		length += strlen(*av++) + 1;
   	    }
  -/*@=boundsread@*/
   	}
   	break;
   
       default:
  -/*@-boundsread@*/
   	if (typeSizes[type] == -1)
   	    return -1;
   	length = typeSizes[(type & 0xf)] * count;
  -/*@=boundsread@*/
   	if (length < 0 || (se && (s + length) > se))
   	    return -1;
   	break;
  @@ -478,9 +462,7 @@
       int tl = dl;
       struct indexEntry_s ieprev;
   
  -/*@-boundswrite@*/
       memset(&ieprev, 0, sizeof(ieprev));
  -/*@=boundswrite@*/
       for (; il > 0; il--, pe++) {
   	struct indexEntry_s ie;
   	int_32 type;
  @@ -496,10 +478,8 @@
   	    return -1;
   	if (hdrchkData(ie.info.offset))
   	    return -1;
  -/*@-boundsread@*/
   	if (hdrchkAlign(ie.info.type, ie.info.offset))
   	    return -1;
  -/*@=boundsread@*/
   
   	ie.data = t = ((unsigned char *)dataStart) + ie.info.offset;
   	if (dataEnd && t >= dataEnd)
  @@ -513,15 +493,12 @@
   
   	if (entry) {
   	    ie.info.offset = regionid;
  -/*@-boundswrite@*/
   	    *entry = ie;	/* structure assignment */
  -/*@=boundswrite@*/
   	    entry++;
   	}
   
   	/* Alignment */
   	type = ie.info.type;
  -/*@-boundsread@*/
   	if (typeSizes[type] > 1) {
   	    unsigned diff;
   	    diff = typeSizes[type] - (dl % typeSizes[type]);
  @@ -531,7 +508,6 @@
   		    ieprev.length += diff;
   	    }
   	}
  -/*@=boundsread@*/
   	tdel = (tprev ? (t - tprev) : 0);
   	if (ieprev.info.type == RPM_I18NSTRING_TYPE)
   	    tdel = ieprev.length;
  @@ -549,7 +525,6 @@
   
   	/* Perform endian conversions */
   	switch (ntohl(pe->type)) {
  -/*@-bounds@*/
   	case RPM_INT64_TYPE:
   	{   int_64 * it = (int_64 *)t;
   	    int_32 b[2];
  @@ -581,7 +556,6 @@
   	    }
   	    t = (unsigned char *) it;
   	}   /*@switchbreak@*/ break;
  -/*@=bounds@*/
   	default:
   	    t += ie.length;
   	    /*@switchbreak@*/ break;
  @@ -709,11 +683,9 @@
   
       len = sizeof(il) + sizeof(dl) + (il * sizeof(*pe)) + dl;
   
  -/*@-boundswrite@*/
       ei = xmalloc(len);
       ei[0] = htonl(il);
       ei[1] = htonl(dl);
  -/*@=boundswrite@*/
   
       pe = (entryInfo) &ei[2];
       dataStart = te = (char *) (pe + il);
  @@ -746,10 +718,8 @@
   		int_32 stei[4];
   
   		legacy = 1;
  -/*@-boundswrite@*/
   		memcpy(pe+1, src, rdl);
   		memcpy(te, src + rdl, rdlen);
  -/*@=boundswrite@*/
   		te += rdlen;
   
   		pe->offset = htonl(te - dataStart);
  @@ -757,9 +727,7 @@
   		stei[1] = pe->type;
   		stei[2] = htonl(-rdl-entry->info.count);
   		stei[3] = pe->count;
  -/*@-boundswrite@*/
   		memcpy(te, stei, entry->info.count);
  -/*@=boundswrite@*/
   		te += entry->info.count;
   		ril++;
   		rdlen += entry->info.count;
  @@ -770,10 +738,8 @@
   
   	    } else {
   
  -/*@-boundswrite@*/
   		memcpy(pe+1, src + sizeof(*pe), ((ril-1) * sizeof(*pe)));
   		memcpy(te, src + (ril * sizeof(*pe)), rdlen+entry->info.count+drlen);
  -/*@=boundswrite@*/
   		te += rdlen;
   		{   /*@-castexpose@*/
   		    entryInfo se = (entryInfo)src;
  @@ -809,9 +775,7 @@
   	    unsigned diff;
   	    diff = typeSizes[type] - ((te - dataStart) % typeSizes[type]);
   	    if (diff != typeSizes[type]) {
  -/*@-boundswrite@*/
   		memset(te, 0, diff);
  -/*@=boundswrite@*/
   		te += diff;
   		pad += diff;
   	    }
  @@ -820,7 +784,6 @@
   	pe->offset = htonl(te - dataStart);
   
   	/* copy data w/ endian conversions */
  -/*@-boundswrite@*/
   	switch (entry->info.type) {
   	case RPM_INT64_TYPE:
   	{   int_32 b[2];
  @@ -867,7 +830,6 @@
   	    te += entry->length;
   	    /*@switchbreak@*/ break;
   	}
  -/*@=boundswrite@*/
   	pe++;
       }
      
  @@ -902,9 +864,7 @@
   	/*@modifies h @*/
   {
       int length;
  -/*@-boundswrite@*/
       void * uh = doHeaderUnload(h, &length);
  -/*@=boundswrite@*/
       return uh;
   }
   
  @@ -927,10 +887,8 @@
   
       key.info.tag = tag;
   
  -/*@-boundswrite@*/
       entry2 = entry = 
   	bsearch(&key, h->index, h->indexUsed, sizeof(*h->index), indexCmp);
  -/*@=boundswrite@*/
       if (entry == NULL)
   	return NULL;
   
  @@ -997,10 +955,8 @@
       if (ne > 0) {
   	h->indexUsed -= ne;
   	ne = last - first;
  -/*@-boundswrite@*/
   	if (ne > 0)
   	    memmove(entry, first, (ne * sizeof(*entry)));
  -/*@=boundswrite@*/
       }
   
       return 0;
  @@ -1162,12 +1118,10 @@
   	    }
   
   	    /* If any duplicate entries were replaced, move new entries down. */
  -/*@-boundswrite@*/
   	    if (h->indexUsed < (save - ne)) {
   		memmove(h->index + h->indexUsed, firstEntry,
   			(ne * sizeof(*entry)));
   	    }
  -/*@=boundswrite@*/
   	    h->indexUsed += ne;
   	  }
   	}
  @@ -1264,9 +1218,7 @@
       Header nh;
       int length;
       /*@-onlytrans@*/
  -/*@-boundswrite@*/
       void * uh = doHeaderUnload(h, &length);
  -/*@=boundswrite@*/
       const char * origin;
       int_32 instance = h->instance;
       int xx;
  @@ -1285,10 +1237,8 @@
   	uh = _free(uh);
       nh->flags |= HEADERFLAG_ALLOCATED;
       if (ENTRY_IS_REGION(nh->index)) {
  -/*@-boundswrite@*/
   	if (tag == HEADER_SIGNATURES || tag == HEADER_IMMUTABLE)
   	    nh->index[0].info.tag = tag;
  -/*@=boundswrite@*/
       }
       if (origin != NULL) {
   	xx = headerSetOrigin(nh, origin);
  @@ -1308,10 +1258,8 @@
   	/*@*/
   {
       int_32 * ei = (int_32 *) uh;
  -/*@-boundsread@*/
       int_32 il = ntohl(ei[0]);		/* index length */
       int_32 dl = ntohl(ei[1]);		/* data length */
  -/*@=boundsread@*/
       /*@-sizeoftype@*/
       size_t pvlen = sizeof(il) + sizeof(dl) +
   			(il * sizeof(struct entryInfo_s)) + dl;
  @@ -1320,19 +1268,13 @@
       Header h = NULL;
   
       /* Sanity checks on header intro. */
  -    /*@-branchstate@*/
       if (!(hdrchkTags(il) || hdrchkData(dl)) && pvlen < headerMaxbytes) {
  -/*@-boundsread@*/
   	nuh = memcpy(xmalloc(pvlen), uh, pvlen);
  -/*@=boundsread@*/
   	if ((h = headerLoad(nuh)) != NULL)
   	    h->flags |= HEADERFLAG_ALLOCATED;
       }
  -    /*@=branchstate@*/
  -    /*@-branchstate@*/
       if (h == NULL)
   	nuh = _free(nuh);
  -    /*@=branchstate@*/
       return h;
   }
   
  @@ -1369,7 +1311,6 @@
   
       i = 0;
   
  -/*@-boundsread@*/
       if (magicp == HEADER_MAGIC_YES) {
   	magic = block[i++];
   	if (memcmp(&magic, header_magic, sizeof(magic)))
  @@ -1379,7 +1320,6 @@
       
       il = ntohl(block[i]);	i++;
       dl = ntohl(block[i]);	i++;
  -/*@=boundsread@*/
   
       /*@-sizeoftype@*/
       len = sizeof(il) + sizeof(dl) + (il * sizeof(struct entryInfo_s)) + dl;
  @@ -1389,19 +1329,15 @@
       if (hdrchkTags(il) || hdrchkData(dl) || len > headerMaxbytes)
   	goto exit;
   
  -/*@-boundswrite@*/
       ei = xmalloc(len);
       ei[0] = htonl(il);
       ei[1] = htonl(dl);
       len -= sizeof(il) + sizeof(dl);
  -/*@=boundswrite@*/
   
  -/*@-boundsread@*/
       /*@-type@*/ /* FIX: cast? */
       if (timedRead(fd, (char *)&ei[2], len) != len)
   	goto exit;
       /*@=type@*/
  -/*@=boundsread@*/
       
       h = headerLoad(ei);
   
  @@ -1441,18 +1377,14 @@
   
       if (h == NULL)
   	return 1;
  -/*@-boundswrite@*/
       uh = doHeaderUnload(h, &length);
  -/*@=boundswrite@*/
       if (uh == NULL)
   	return 1;
       switch (magicp) {
       case HEADER_MAGIC_YES:
  -/*@-boundsread@*/
   	/*@-sizeoftype@*/
   	nb = Fwrite(header_magic, sizeof(char), sizeof(header_magic), fd);
   	/*@=sizeoftype@*/
  -/*@=boundsread@*/
   	if (nb != sizeof(header_magic))
   	    goto exit;
   	break;
  @@ -1519,9 +1451,7 @@
   	    /*@-castexpose@*/
   	    entryInfo pe = (entryInfo) (ei + 2);
   	    /*@=castexpose@*/
  -/*@-boundsread@*/
   	    char * dataStart = (char *) (pe + ntohl(ei[0]));
  -/*@=boundsread@*/
   	    int_32 rdl = -entry->info.offset;	/* negative offset */
   	    int_32 ril = rdl/sizeof(*pe);
   
  @@ -1536,7 +1466,6 @@
   		rdl += REGION_TAG_COUNT;
   	    }
   
  -/*@-bounds@*/
   	    *p = xmalloc(count);
   	    ei = (int_32 *) *p;
   	    ei[0] = htonl(ril);
  @@ -1548,7 +1477,6 @@
   
   	    dataStart = (char *) memcpy(pe + ril, dataStart, rdl);
   	    /*@=sizeoftype@*/
  -/*@=bounds@*/
   
   	    rc = regionSwab(NULL, ril, 0, pe, dataStart, NULL, 0);
   	    /* XXX 1 on success. */
  @@ -1575,7 +1503,6 @@
   	char * t;
   	int i;
   
  -/*@-bounds@*/
   	/*@-mods@*/
   	if (minMem) {
   	    *p = xmalloc(tableSize);
  @@ -1589,11 +1516,8 @@
   	    memcpy(t, entry->data, entry->length);
   	}
   	/*@=mods@*/
  -/*@=bounds@*/
   	for (i = 0; i < count; i++) {
  -/*@-boundswrite@*/
   	    *ptrEntry++ = t;
  -/*@=boundswrite@*/
   	    t = strchr(t, 0);
   	    t++;
   	}
  @@ -1719,7 +1643,6 @@
   	return entry->data;
       /*@=mods@*/
   
  -/*@-boundsread@*/
       for (l = lang; *l != '\0'; l = le) {
   	const char *td;
   	char *ed;
  @@ -1742,7 +1665,6 @@
   
   	}
       }
  -/*@=boundsread@*/
   
       return entry->data;
   }
  @@ -1809,7 +1731,6 @@
   	/*@modifies data @*/
   {
       if (data) {
  -	/*@-branchstate@*/
   	if (type == -1 ||
   	    type == RPM_STRING_ARRAY_TYPE ||
   	    type == RPM_I18NSTRING_TYPE ||
  @@ -1817,7 +1738,6 @@
   	    type == RPM_ASN1_TYPE ||
   	    type == RPM_OPENPGP_TYPE)
   		data = _free(data);
  -	/*@=branchstate@*/
       }
       return NULL;
   }
  @@ -1904,7 +1824,6 @@
       {	const char ** av = (const char **) srcPtr;
   	char * t = dstPtr;
   
  -/*@-bounds@*/
   	while (cnt-- > 0 && dataLength > 0) {
   	    const char * s;
   	    if ((s = *av++) == NULL)
  @@ -1913,13 +1832,10 @@
   		*t++ = *s++;
   	    } while (s[-1] && --dataLength > 0);
   	}
  -/*@=bounds@*/
       }	break;
   
       default:
  -/*@-boundswrite@*/
   	memmove(dstPtr, srcPtr, dataLength);
  -/*@=boundswrite@*/
   	break;
       }
   }
  @@ -1942,12 +1858,10 @@
       int length;
   
       length = dataLength(type, p, c, 0, NULL);
  -/*@-branchstate@*/
       if (length > 0) {
   	data = xmalloc(length);
   	copyData(type, data, p, c, length);
       }
  -/*@=branchstate@*/
   
       if (lengthPtr)
   	*lengthPtr = length;
  @@ -1986,9 +1900,7 @@
   	return 0;
   
       length = 0;
  -/*@-boundswrite@*/
       data = grabData(type, p, c, &length);
  -/*@=boundswrite@*/
       if (data == NULL || length <= 0)
   	return 0;
   
  @@ -2007,10 +1919,8 @@
       entry->data = data;
       entry->length = length;
   
  -/*@-boundsread@*/
       if (h->indexUsed > 0 && tag < h->index[h->indexUsed-1].info.tag)
   	h->flags &= ~HEADERFLAG_SORTED;
  -/*@=boundsread@*/
       h->indexUsed++;
   
       return 1;
  @@ -2054,9 +1964,7 @@
   
       if (ENTRY_IN_REGION(entry)) {
   	char * t = xmalloc(entry->length + length);
  -/*@-bounds@*/
   	memcpy(t, entry->data, entry->length);
  -/*@=bounds@*/
   	entry->data = t;
   	entry->info.offset = 0;
       } else
  @@ -2149,9 +2057,7 @@
   
       if (!table)
   	return 0;
  -    /*@-branchstate@*/
       if (!lang) lang = "C";
  -    /*@=branchstate@*/
   
       {	const char * l = table->data;
   	for (langNum = 0; langNum < table->info.count; langNum++) {
  @@ -2288,12 +2194,10 @@
       entry->data = data;
       entry->length = length;
   
  -    /*@-branchstate@*/
       if (ENTRY_IN_REGION(entry)) {
   	entry->info.offset = 0;
       } else
   	oldData = _free(oldData);
  -    /*@=branchstate@*/
   
       return 1;
   }
  @@ -2500,7 +2404,6 @@
       int_32 tag, type, count;
       hPTR_t ptr;
      
  -    /*@-branchstate@*/
       for (hi = headerInitIterator(h);
   	headerNextIterator(hi, &tag, &type, &ptr, &count);
   	ptr = headerFreeData((void *)ptr, type))
  @@ -2508,7 +2411,6 @@
   	if (ptr) (void) headerAddEntry(nh, tag, type, ptr, count);
       }
       hi = headerFreeIterator(hi);
  -    /*@=branchstate@*/
   
       return headerReload(nh, HEADER_IMAGE);
   }
  @@ -2708,15 +2610,11 @@
   	goto bingo;
       }
   
  -/*@-branchstate@*/
       if (strncmp("RPMTAG_", name, sizeof("RPMTAG_")-1)) {
  -/*@-boundswrite@*/
   	char * t = alloca(strlen(name) + sizeof("RPMTAG_"));
   	(void) stpcpy( stpcpy(t, "RPMTAG_"), name);
   	name = t;
  -/*@=boundswrite@*/
       }
  -/*@=branchstate@*/
   
       /* Search extensions for specific tag override. */
       for (ext = hsa->exts; ext != NULL && ext->type != HEADER_EXT_LAST;
  @@ -2820,29 +2718,23 @@
   		    /*@=temptrans =assignexpose@*/
   		}
   		start++;
  -/*@-boundswrite@*/
   		*dst++ = *start++;
  -/*@=boundswrite@*/
   		/*@switchbreak@*/ break;
   	    } 
   
   	    token = format + numTokens++;
  -/*@-boundswrite@*/
   	    *dst++ = '\0';
  -/*@=boundswrite@*/
   	    start++;
   
   	    if (*start == '|') {
   		char * newEnd;
   
   		start++;
  -/*@-boundswrite@*/
   		if (parseExpression(hsa, token, start, &newEnd))
   		{
   		    format = freeFormat(format, numTokens);
   		    return 1;
   		}
  -/*@=boundswrite@*/
   		start = newEnd;
   		/*@switchbreak@*/ break;
   	    }
  @@ -2862,9 +2754,7 @@
   		return 1;
   	    }
   
  -/*@-boundswrite@*/
   	    *chptr++ = '\0';
  -/*@=boundswrite@*/
   
   	    while (start < chptr) {
   		if (xisdigit(*start)) {
  @@ -2891,17 +2781,13 @@
   		format = freeFormat(format, numTokens);
   		return 1;
   	    }
  -/*@-boundswrite@*/
   	    *next++ = '\0';
  -/*@=boundswrite@*/
   
   	    chptr = start;
   	    while (*chptr && *chptr != ':') chptr++;
   
   	    if (*chptr != '\0') {
  -/*@-boundswrite@*/
   		*chptr++ = '\0';
  -/*@=boundswrite@*/
   		if (!*chptr) {
   		    hsa->errmsg = _("empty tag format");
   		    format = freeFormat(format, numTokens);
  @@ -2933,13 +2819,10 @@
   	    /*@switchbreak@*/ break;
   
   	case '[':
  -/*@-boundswrite@*/
   	    *dst++ = '\0';
   	    *start++ = '\0';
  -/*@=boundswrite@*/
   	    token = format + numTokens++;
   
  -/*@-boundswrite@*/
   	    if (parseFormat(hsa, start,
   			    &token->u.array.format,
   			    &token->u.array.numTokens,
  @@ -2948,7 +2831,6 @@
   		format = freeFormat(format, numTokens);
   		return 1;
   	    }
  -/*@=boundswrite@*/
   
   	    if (!start) {
   		hsa->errmsg = _("] expected at end of array");
  @@ -2968,9 +2850,7 @@
   		format = freeFormat(format, numTokens);
   		return 1;
   	    }
  -/*@-boundswrite@*/
   	    *start++ = '\0';
  -/*@=boundswrite@*/
   	    if (endPtr) *endPtr = start;
   	    done = 1;
   	    /*@switchbreak@*/ break;
  @@ -2981,9 +2861,7 @@
   		format = freeFormat(format, numTokens);
   		return 1;
   	    }
  -/*@-boundswrite@*/
   	    *start++ = '\0';
  -/*@=boundswrite@*/
   	    if (endPtr) *endPtr = start;
   	    done = 1;
   	    /*@switchbreak@*/ break;
  @@ -2997,14 +2875,12 @@
   		/*@=temptrans =assignexpose@*/
   	    }
   
  -/*@-boundswrite@*/
   	    if (*start == '\\') {
   		start++;
   		*dst++ = escapedChar(*start++);
   	    } else {
   		*dst++ = *start++;
   	    }
  -/*@=boundswrite@*/
   	    /*@switchbreak@*/ break;
   	}
   	if (done)
  @@ -3012,10 +2888,8 @@
       }
       /*@=infloops@*/
   
  -/*@-boundswrite@*/
       if (dst != NULL)
           *dst = '\0';
  -/*@=boundswrite@*/
   
       for (i = 0; i < numTokens; i++) {
   	token = format + i;
  @@ -3029,7 +2903,6 @@
       return 0;
   }
   
  -/*@-boundswrite@*/
   static int parseExpression(headerSprintfArgs hsa, sprintfToken token,
   		char * str, /*@out@*/ char ** endPtr)
   {
  @@ -3127,7 +3000,6 @@
   
       return 0;
   }
  -/*@=boundswrite@*/
   
   /**
    * Call a header extension only once, saving results.
  @@ -3185,14 +3057,12 @@
   
       memset(buf, 0, sizeof(buf));
       if (tag->ext) {
  -/*@-boundswrite -branchstate @*/
   	if (getExtension(hsa, tag->ext, &he->t, &he->p, &he->c, hsa->ec + tag->extNum))
   	{
   	    he->t = RPM_STRING_TYPE;	
   	    he->c = 1;
   	    he->p.str = "(none)";
   	}
  -/*@=boundswrite =branchstate @*/
       } else
       if (!he->avail) {
   	he->tag = tag->tagno;
  @@ -3228,11 +3098,8 @@
       }
       he->avail = 1;
   
  -/*@-boundswrite@*/
       (void) stpcpy( stpcpy(buf, "%"), tag->format);
  -/*@=boundswrite@*/
   
  -    /*@-branchstate@*/
       if (he->p.ptr)
       switch (he->t) {
       case RPM_STRING_ARRAY_TYPE:
  @@ -3337,7 +3204,6 @@
   	    static char hex[] = "0123456789abcdef";
   	    const char * s = he->p.str;
   
  -/*@-boundswrite@*/
   	    need = 2*he->c + tag->pad;
   	    val = t = xmalloc(need+1);
   	    while (he->c-- > 0) {
  @@ -3347,7 +3213,6 @@
   		*t++ = hex[ (i     ) & 0xf ];
   	    }
   	    *t = '\0';
  -/*@=boundswrite@*/
   #endif
   	}
   	break;
  @@ -3357,21 +3222,16 @@
   	val = xstrdup("(unknown type)");
   	break;
       }
  -    /*@=branchstate@*/
   
       if (!_tagcache)
   	(void) rpmheClean(he);
   
  -    /*@-branchstate@*/
       if (val && need > 0) {
   	t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   	te = stpcpy(t, val);
  -/*@=boundswrite@*/
   	hsa->vallen += (te - t);
   	val = _free(val);
       }
  -    /*@=branchstate@*/
   
       return (hsa->val + hsa->vallen);
   }
  @@ -3408,9 +3268,7 @@
   	need = token->u.string.len;
   	if (need == 0) break;
   	t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   	te = stpcpy(t, token->u.string.string);
  -/*@=boundswrite@*/
   	hsa->vallen += (te - t);
   	break;
   
  @@ -3490,9 +3348,7 @@
   #ifdef	DYING	/* XXX lots of pugly "(none)" lines with --conflicts. */
   	    need = sizeof("(none)\n") - 1;
   	    t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   	    te = stpcpy(t, "(none)\n");
  -/*@=boundswrite@*/
   	    hsa->vallen += (te - t);
   #endif
   	} else {
  @@ -3519,9 +3375,7 @@
   		}
   		need = sizeof("  <rpmTag name=\"\">\n") + strlen(tagN);
   		te = t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   		te = stpcpy( stpcpy( stpcpy(te, "  <rpmTag name=\""), tagN), "\">\n");
  -/*@=boundswrite@*/
   		hsa->vallen += (te - t);
   	    }
   	    if (isyaml) {
  @@ -3538,7 +3392,6 @@
   		}
   		need = sizeof("  :     - ") + strlen(tagN);
   		te = t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   		*te++ = ' ';
   		*te++ = ' ';
   		te = stpcpy(te, tagN);
  @@ -3553,7 +3406,6 @@
   			te = stpcpy(te, "- ");
   		}
   		*te = '\0';
  -/*@=boundswrite@*/
   		hsa->vallen += (te - t);
   	    }
   
  @@ -3571,18 +3423,14 @@
   	    if (isxml) {
   		need = sizeof("  </rpmTag>\n") - 1;
   		te = t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   		te = stpcpy(te, "  </rpmTag>\n");
  -/*@=boundswrite@*/
   		hsa->vallen += (te - t);
   	    }
   	    if (isyaml) {
   #if 0
   		need = sizeof("\n") - 1;
   		te = t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   		te = stpcpy(te, "\n");
  -/*@=boundswrite@*/
   		hsa->vallen += (te - t);
   #endif
   	    }
  @@ -3633,9 +3481,7 @@
       for (ext = exts; ext != NULL && ext->type != HEADER_EXT_LAST;
   	ext = (ext->type == HEADER_EXT_MORE ? ext->u.more : ext+1))
       {
  -/*@-boundswrite@*/
   	if (ec[i].freeit) ec[i].data = _free(ec[i].data);
  -/*@=boundswrite@*/
   	i++;
       }
   
  @@ -3678,10 +3524,8 @@
   /*@=castexpose@*/
       hsa->errmsg = NULL;
   
  -/*@-boundswrite@*/
       if (parseFormat(hsa, hsa->fmt, &hsa->format, &hsa->numTokens, NULL, PARSER_BEGIN))
   	goto exit;
  -/*@=boundswrite@*/
   
       hsa->ec = rpmecNew(hsa->exts);
       hsa->val = xstrdup("");
  @@ -3698,17 +3542,13 @@
       if (isxml) {
   	need = sizeof("<rpmHeader>\n") - 1;
   	t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   	te = stpcpy(t, "<rpmHeader>\n");
  -/*@=boundswrite@*/
   	hsa->vallen += (te - t);
       }
       if (isyaml) {
   	need = sizeof("- !!omap\n") - 1;
   	t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   	te = stpcpy(t, "- !!omap\n");
  -/*@=boundswrite@*/
   	hsa->vallen += (te - t);
       }
   
  @@ -3725,17 +3565,13 @@
       if (isxml) {
   	need = sizeof("</rpmHeader>\n") - 1;
   	t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   	te = stpcpy(t, "</rpmHeader>\n");
  -/*@=boundswrite@*/
   	hsa->vallen += (te - t);
       }
       if (isyaml) {
   	need = sizeof("\n") - 1;
   	t = hsaReserve(hsa, need);
  -/*@-boundswrite@*/
   	te = stpcpy(t, "\n");
  -/*@=boundswrite@*/
   	hsa->vallen += (te - t);
       }
   
  @@ -3772,17 +3608,13 @@
   
       if (type == RPM_INT32_TYPE) {
   	val = xmalloc(20 + padding);
  -/*@-boundswrite@*/
   	strcat(formatPrefix, "o");
  -/*@=boundswrite@*/
   	/*@-formatconst@*/
   	sprintf(val, formatPrefix, *((int_32 *) data));
   	/*@=formatconst@*/
       } else if (type == RPM_INT64_TYPE) {
   	val = xmalloc(40 + padding);
  -/*@-boundswrite@*/
   	strcat(formatPrefix, "llo");
  -/*@=boundswrite@*/
   	/*@-formatconst@*/
   	sprintf(val, formatPrefix, *((int_64 *) data));
   	/*@=formatconst@*/
  @@ -3809,17 +3641,13 @@
   
       if (type == RPM_INT32_TYPE) {
   	val = xmalloc(20 + padding);
  -/*@-boundswrite@*/
   	strcat(formatPrefix, "x");
  -/*@=boundswrite@*/
   	/*@-formatconst@*/
   	sprintf(val, formatPrefix, *((int_32 *) data));
   	/*@=formatconst@*/
       } else if (type == RPM_INT64_TYPE) {
   	val = xmalloc(40 + padding);
  -/*@-boundswrite@*/
   	strcat(formatPrefix, "llx");
  -/*@=boundswrite@*/
   	/*@-formatconst@*/
   	sprintf(val, formatPrefix, *((int_64 *) data));
   	/*@=formatconst@*/
  @@ -3853,9 +3681,7 @@
   	char buf[50];
   
   	val = xmalloc(50 + padding);
  -/*@-boundswrite@*/
   	strcat(formatPrefix, "s");
  -/*@=boundswrite@*/
   
   	/* this is important if sizeof(int_32) ! sizeof(time_t) */
   	{   time_t dateint = *((int_32 *) data);
  @@ -3923,30 +3749,23 @@
   
       if (type == RPM_INT32_TYPE) {
   	result = xmalloc(padding + 20);
  -/*@-boundswrite@*/
   	strcat(formatPrefix, "d");
  -/*@=boundswrite@*/
   	/*@-formatconst@*/
   	sprintf(result, formatPrefix, *((int_32 *) data));
   	/*@=formatconst@*/
       } else if (type == RPM_INT64_TYPE) {
   	result = xmalloc(padding + 40);
  -/*@-boundswrite@*/
   	strcat(formatPrefix, "lld");
  -/*@=boundswrite@*/
   	/*@-formatconst@*/
   	sprintf(result, formatPrefix, *((int_64 *) data));
   	/*@=formatconst@*/
       } else {
   	buf = alloca(strlen(data) + padding + 2);
  -/*@-boundswrite@*/
   	strcat(formatPrefix, "s");
  -/*@=boundswrite@*/
   	/*@-formatconst@*/
   	sprintf(buf, formatPrefix, data);
   	/*@=formatconst@*/
   
  -/*@-boundswrite@*/
   	result = dst = xmalloc(strlen(buf) * 4 + 3);
   	*dst++ = '\'';
   	for (src = buf; *src != '\0'; src++) {
  @@ -3961,7 +3780,6 @@
   	}
   	*dst++ = '\'';
   	*dst = '\0';
  -/*@=boundswrite@*/
   
       }
   
  @@ -4000,10 +3818,8 @@
   	int_32 count;
   	if (headerIsEntry(headerTo, *p))
   	    continue;
  -/*@-boundswrite@*/
   	if (!headerGetEntryMinMemory(headerFrom, *p, &type, &s, &count))
   	    continue;
  -/*@=boundswrite@*/
   	(void) headerAddEntry(headerTo, *p, type, s, count);
   	s = headerFreeData(s, type);
       }
  @@ .
Received on Tue Oct 23 18:50:13 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.