summaryrefslogtreecommitdiff
path: root/lib/headerfmt.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2017-08-30 16:54:35 +0300
committerPanu Matilainen <pmatilai@redhat.com>2017-08-30 16:57:09 +0300
commit6adef6a3c729fc21ed2254bf2c557c2540995bf1 (patch)
tree7a7b90d2882ba73c37b387b430b7a81c9f7591fe /lib/headerfmt.c
parent1517c1a721c4ba0706c8f98f41d7f08728cc5165 (diff)
downloadrpm-6adef6a3c729fc21ed2254bf2c557c2540995bf1.tar.gz
Make queryformat array behavior consistent for all types
Always require matching number of elements regardless of data type and number of elements, and error out otherwise. Behaving differently for plain strings and binaries makes no sense, those checks are ancient artifacts that have long since ceased to produce what might've been originally intended behavior. A remaining quirk is the case where a tag doesn't exist at all, this produces (none)'s all the way down. Which doesn't seem terribly wrong, but neither does it seem really consistent with the rest of it. Dunno.
Diffstat (limited to 'lib/headerfmt.c')
-rw-r--r--lib/headerfmt.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/headerfmt.c b/lib/headerfmt.c
index 3f1880e5f..1f6390b5e 100644
--- a/lib/headerfmt.c
+++ b/lib/headerfmt.c
@@ -748,16 +748,10 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
found = 1;
count = rpmtdCount(td);
- if (numElements > 1 && count != numElements)
- switch (td->type) {
- default:
+ if (numElements > 0 && count != numElements) {
hsaError(hsa,
_("array iterator used with different sized arrays"));
return NULL;
- break;
- case RPM_BIN_TYPE:
- case RPM_STRING_TYPE:
- break;
}
if (count > numElements)
numElements = count;