Make triggertypeFormat() work for any numeric type

This commit is contained in:
Panu Matilainen 2008-11-17 12:37:42 +02:00
parent f31b790c31
commit 5580fe23d5
1 changed files with 14 additions and 12 deletions

View File

@ -200,21 +200,23 @@ static char * shescapeFormat(rpmtd td, char * formatPrefix)
*/
static char * triggertypeFormat(rpmtd td, char * formatPrefix)
{
const uint32_t * item = rpmtdGetUint32(td);
char * val;
if (rpmtdType(td) != RPM_INT32_TYPE)
if (rpmtdClass(td) != RPM_NUMERIC_CLASS) {
val = xstrdup(_("(not a number)"));
else if (*item & RPMSENSE_TRIGGERPREIN)
val = xstrdup("prein");
else if (*item & RPMSENSE_TRIGGERIN)
val = xstrdup("in");
else if (*item & RPMSENSE_TRIGGERUN)
val = xstrdup("un");
else if (*item & RPMSENSE_TRIGGERPOSTUN)
val = xstrdup("postun");
else
val = xstrdup("");
} else {
uint64_t item = rpmtdGetNumber(td);
if (item & RPMSENSE_TRIGGERPREIN)
val = xstrdup("prein");
else if (item & RPMSENSE_TRIGGERIN)
val = xstrdup("in");
else if (item & RPMSENSE_TRIGGERUN)
val = xstrdup("un");
else if (item & RPMSENSE_TRIGGERPOSTUN)
val = xstrdup("postun");
else
val = xstrdup("");
}
return val;
}