summaryrefslogtreecommitdiff
path: root/lib/header.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-12 16:53:26 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-12 16:53:26 +0300
commitecd8c6c44149b880e672accc416d593c551de72e (patch)
treed40e9df2e21e3c8c3ef413549d6089fa52887ba2 /lib/header.c
parentf081d3da6658f7ea4ea7c3ba4355d2dcd34721fc (diff)
downloadrpm-ecd8c6c44149b880e672accc416d593c551de72e.tar.gz
rpm-ecd8c6c44149b880e672accc416d593c551de72e.tar.bz2
rpm-ecd8c6c44149b880e672accc416d593c551de72e.zip
Move headerVerifyInfo() to header.[ch] where it logically belongs
- removes the need for copy-paste typeAlign array in package.c
Diffstat (limited to 'lib/header.c')
-rw-r--r--lib/header.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/header.c b/lib/header.c
index beee4dafe..a64cb18eb 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -139,6 +139,33 @@ Header headerNew(void)
return headerLink(h);
}
+int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate)
+{
+ entryInfo pe = (entryInfo) pev;
+ entryInfo info = iv;
+ int i;
+
+ for (i = 0; i < il; i++) {
+ info->tag = ntohl(pe[i].tag);
+ info->type = ntohl(pe[i].type);
+ info->offset = ntohl(pe[i].offset);
+ if (negate)
+ info->offset = -info->offset;
+ info->count = ntohl(pe[i].count);
+
+ if (hdrchkType(info->type))
+ return i;
+ if (hdrchkAlign(info->type, info->offset))
+ return i;
+ if (!negate && hdrchkRange(dl, info->offset))
+ return i;
+ if (hdrchkData(info->count))
+ return i;
+
+ }
+ return -1;
+}
+
/**
*/
static int indexCmp(const void * avp, const void * bvp)