From e63293b0ea1c6a3a4be6aca328ee9fae4c3bfcdb Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 19 May 2010 15:33:52 +0300 Subject: [PATCH] Use pgpValString() for :pgpsig header formatting (RhBug:587755) - instead of copy-slopping (and forgetting to do so whenever something changes) just use the values we know from pgpVals.. --- lib/formats.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/lib/formats.c b/lib/formats.c index 0700955..3113c80 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -517,33 +517,11 @@ static char * pgpsigFormat(rpmtd td, char * formatPrefix) nb += 100; val = t = xrealloc(val, nb + 1); - switch (sigp->pubkey_algo) { - case PGPPUBKEYALGO_DSA: - t = stpcpy(t, "DSA"); - break; - case PGPPUBKEYALGO_RSA: - t = stpcpy(t, "RSA"); - break; - default: - (void) snprintf(t, nb - (t - val), "%d", sigp->pubkey_algo); - t += strlen(t); - break; - } + t = stpcpy(t, pgpValString(PGPVAL_PUBKEYALGO, sigp->pubkey_algo)); if (t + 5 >= val + nb) goto again; *t++ = '/'; - switch (sigp->hash_algo) { - case PGPHASHALGO_MD5: - t = stpcpy(t, "MD5"); - break; - case PGPHASHALGO_SHA1: - t = stpcpy(t, "SHA1"); - break; - default: - (void) snprintf(t, nb - (t - val), "%d", sigp->hash_algo); - t += strlen(t); - break; - } + t = stpcpy(t, pgpValString(PGPVAL_HASHALGO, sigp->hash_algo)); if (t + strlen (", ") + 1 >= val + nb) goto again; -- 2.7.4