summaryrefslogtreecommitdiff
path: root/lib/package.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-14 10:29:07 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-14 10:29:07 +0300
commitc0bdbb0946203ec2f53c6eff3f64558a2876e6a0 (patch)
treece14f7745e00ebe45d8f2ca353a28e5157faa0f7 /lib/package.c
parentdf23089b1f0e15e4e0adc4a97c143b7cf9680127 (diff)
downloadrpm-c0bdbb0946203ec2f53c6eff3f64558a2876e6a0.tar.gz
rpm-c0bdbb0946203ec2f53c6eff3f64558a2876e6a0.tar.bz2
rpm-c0bdbb0946203ec2f53c6eff3f64558a2876e6a0.zip
Convert headerRegenSigHeader() to new header iterator interface
Diffstat (limited to 'lib/package.c')
-rw-r--r--lib/package.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/lib/package.c b/lib/package.c
index 16960a406..dd9809ec1 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -109,60 +109,51 @@ void headerMergeLegacySigs(Header h, const Header sigh)
Header headerRegenSigHeader(const Header h, int noArchiveSize)
{
- HFD_t hfd = (HFD_t) headerFreeData;
Header sigh = rpmNewSignature();
HeaderIterator hi;
- rpm_count_t count;
- rpmTag tag, stag;
- rpmTagType type;
- rpm_data_t ptr;
- int xx;
+ struct rpmtd_s td;
- for (hi = headerInitIterator(h);
- headerNextIterator(hi, &tag, &type, &ptr, &count);
- ptr = hfd(ptr, type))
- {
- switch (tag) {
+ for (hi = headerInitIterator(h); headerNext(hi, &td); rpmtdFreeData(&td)) {
+ switch (td.tag) {
/* XXX Translate legacy signature tag values. */
case RPMTAG_SIGSIZE:
- stag = RPMSIGTAG_SIZE;
+ td.tag = RPMSIGTAG_SIZE;
break;
case RPMTAG_SIGLEMD5_1:
- stag = RPMSIGTAG_LEMD5_1;
+ td.tag = RPMSIGTAG_LEMD5_1;
break;
case RPMTAG_SIGPGP:
- stag = RPMSIGTAG_PGP;
+ td.tag = RPMSIGTAG_PGP;
break;
case RPMTAG_SIGLEMD5_2:
- stag = RPMSIGTAG_LEMD5_2;
+ td.tag = RPMSIGTAG_LEMD5_2;
break;
case RPMTAG_SIGMD5:
- stag = RPMSIGTAG_MD5;
+ td.tag = RPMSIGTAG_MD5;
break;
case RPMTAG_SIGGPG:
- stag = RPMSIGTAG_GPG;
+ td.tag = RPMSIGTAG_GPG;
break;
case RPMTAG_SIGPGP5:
- stag = RPMSIGTAG_PGP5;
+ td.tag = RPMSIGTAG_PGP5;
break;
case RPMTAG_ARCHIVESIZE:
/* XXX rpm-4.1 and later has archive size in signature header. */
if (noArchiveSize)
continue;
- stag = RPMSIGTAG_PAYLOADSIZE;
+ td.tag = RPMSIGTAG_PAYLOADSIZE;
break;
case RPMTAG_SHA1HEADER:
case RPMTAG_DSAHEADER:
case RPMTAG_RSAHEADER:
default:
- if (!(tag >= HEADER_SIGBASE && tag < HEADER_TAGBASE))
+ if (!(td.tag >= HEADER_SIGBASE && td.tag < HEADER_TAGBASE))
continue;
- stag = tag;
break;
}
- if (ptr == NULL) continue; /* XXX can't happen */
- if (!headerIsEntry(sigh, stag))
- xx = headerAddEntry(sigh, stag, type, ptr, count);
+ if (td.data == NULL) continue; /* XXX can't happen */
+ if (!headerIsEntry(sigh, td.tag))
+ (void) headerPut(sigh, &td, HEADERPUT_DEFAULT);
}
hi = headerFreeIterator(hi);
return sigh;