summaryrefslogtreecommitdiff
path: root/lib/headerutil.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-09-21 12:40:33 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-09-21 12:40:33 +0300
commitbe488096e0f011a42d4dd46fa7c3769054158383 (patch)
tree4818066b0d426e02c3381069d9961471b4be803e /lib/headerutil.c
parentbf4a383892acc8a5bb6bbf45e87ac96674a3ecd1 (diff)
downloadlibrpm-tizen-be488096e0f011a42d4dd46fa7c3769054158383.tar.gz
librpm-tizen-be488096e0f011a42d4dd46fa7c3769054158383.tar.bz2
librpm-tizen-be488096e0f011a42d4dd46fa7c3769054158383.zip
Use the new tag type/return type getters everywhere
- Instead of masking and bitfiddling all over the place, use the new getters to get the exact (enum) type directly. rpmTagGetType() is now unused within rpm but leaving around for backwards compatibility
Diffstat (limited to 'lib/headerutil.c')
-rw-r--r--lib/headerutil.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/headerutil.c b/lib/headerutil.c
index 6f526dca0..c3f930533 100644
--- a/lib/headerutil.c
+++ b/lib/headerutil.c
@@ -156,12 +156,13 @@ static int headerPutType(Header h, rpmTag tag, rpmTagType reqtype,
rpm_constdata_t data, rpm_count_t size)
{
struct rpmtd_s td;
- rpmTagType type = rpmTagGetType(tag);
+ rpmTagType type = rpmTagGetTagType(tag);
+ rpmTagReturnType retype = rpmTagGetReturnType(tag);
headerPutFlags flags = HEADERPUT_APPEND;
int valid = 1;
/* Basic sanity checks: type must match and there must be data to put */
- if ((type & RPM_MASK_TYPE) != reqtype
+ if (type != reqtype
|| size < 1 || data == NULL || h == NULL) {
valid = 0;
}
@@ -170,9 +171,9 @@ static int headerPutType(Header h, rpmTag tag, rpmTagType reqtype,
* Non-array types can't be appended to. Binary types use size
* for data length, for other non-array types size must be 1.
*/
- if ((type & RPM_MASK_RETURN_TYPE) != RPM_ARRAY_RETURN_TYPE) {
+ if (retype != RPM_ARRAY_RETURN_TYPE) {
flags = HEADERPUT_DEFAULT;
- if ((type & RPM_MASK_TYPE) != RPM_BIN_TYPE && size != 1) {
+ if (type != RPM_BIN_TYPE && size != 1) {
valid = 0;
}
}
@@ -180,7 +181,7 @@ static int headerPutType(Header h, rpmTag tag, rpmTagType reqtype,
if (valid) {
rpmtdReset(&td);
td.tag = tag;
- td.type = type & RPM_MASK_TYPE;
+ td.type = type;
td.data = (void *) data;
td.count = size;
@@ -192,7 +193,7 @@ static int headerPutType(Header h, rpmTag tag, rpmTagType reqtype,
int headerPutString(Header h, rpmTag tag, const char *val)
{
- rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
+ rpmTagType type = rpmTagGetTagType(tag);
const void *sptr = NULL;
/* string arrays expect char **, arrange that */