Eliminate redundant "uc" field from hdr blob struct

The ondisk-size is already there in pvlen so this is completely
redundant. The uc argument is only used for verifying whether
caller expectation of the size matches, and that is made again
optional here as well.
This commit is contained in:
Panu Matilainen 2017-01-11 11:26:21 +02:00
parent 1ce844ab26
commit 7c6b9d057c
3 changed files with 4 additions and 6 deletions

View File

@ -1914,7 +1914,6 @@ rpmRC hdrblobInit(const void *uh, size_t uc,
memset(blob, 0, sizeof(*blob));
blob->ei = (int32_t *) uh; /* discards const */
blob->uc = uc;
blob->il = ntohl(blob->ei[0]);
blob->dl = ntohl(blob->ei[1]);
blob->pe = (entryInfo) &(blob->ei[2]);
@ -1924,9 +1923,9 @@ rpmRC hdrblobInit(const void *uh, size_t uc,
blob->dataEnd = blob->dataStart + blob->dl;
/* Is the blob the right size? */
if (blob->pvlen >= headerMaxbytes || blob->pvlen != blob->uc) {
rasprintf(emsg, _("blob size(%zd): BAD, 8 + 16 * il(%d) + dl(%d)"),
blob->uc, blob->il, blob->dl);
if (blob->pvlen >= headerMaxbytes || (uc && blob->pvlen != uc)) {
rasprintf(emsg, _("blob size(%d): BAD, 8 + 16 * il(%d) + dl(%d)"),
blob->pvlen, blob->il, blob->dl);
goto exit;
}

View File

@ -22,7 +22,6 @@ struct entryInfo_s {
typedef struct hdrblob_s * hdrblob;
struct hdrblob_s {
int32_t *ei;
size_t uc;
int32_t il;
int32_t dl;
entryInfo pe;

View File

@ -140,7 +140,7 @@ static int readFile(FD_t fd, const char * fn, rpmDigestBundle hdrbundle)
if (blob.regionTag == RPMTAG_HEADERIMMUTABLE) {
rpmDigestBundleUpdate(hdrbundle,
rpm_header_magic, sizeof(rpm_header_magic));
rpmDigestBundleUpdate(hdrbundle, blob.ei, blob.uc);
rpmDigestBundleUpdate(hdrbundle, blob.ei, blob.pvlen);
}
/* Read the payload from the package. */