From: Panu Matilainen Date: Mon, 26 May 2008 10:14:53 +0000 (+0300) Subject: Convert rpmVersionComprare() to new headerGet() X-Git-Tag: rpm-4.6.0-rc1~473 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a32216d0299c6aa771ae849749c3f590db82a0d;p=platform%2Fupstream%2Frpm.git Convert rpmVersionComprare() to new headerGet() --- diff --git a/lib/psm.c b/lib/psm.c index be37293..de6dd10 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -66,32 +66,32 @@ struct rpmpsm_s { int rpmVersionCompare(Header first, Header second) { - const char * one, * two; - int32_t * epochOne, * epochTwo; - static int32_t zero = 0; + struct rpmtd_s one, two; + static uint32_t zero = 0; + uint32_t *epochOne = &zero, *epochTwo = &zero; int rc; - if (!headerGetEntry(first, RPMTAG_EPOCH, NULL, (rpm_data_t *) &epochOne, NULL)) - epochOne = &zero; - if (!headerGetEntry(second, RPMTAG_EPOCH, NULL, (rpm_data_t *) &epochTwo, NULL)) - epochTwo = &zero; + if (headerGet(first, RPMTAG_EPOCH, &one, HEADERGET_MINMEM)) + epochOne = rpmtdGetUint32(&one); + if (headerGet(second, RPMTAG_EPOCH, &two, HEADERGET_MINMEM)) + epochTwo = rpmtdGetUint32(&two); - if (*epochOne < *epochTwo) - return -1; - else if (*epochOne > *epochTwo) - return 1; + if (*epochOne < *epochTwo) + return -1; + else if (*epochOne > *epochTwo) + return 1; - rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (rpm_data_t *) &one, NULL); - rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (rpm_data_t *) &two, NULL); + headerGet(first, RPMTAG_VERSION, &one, HEADERGET_MINMEM); + headerGet(second, RPMTAG_VERSION, &two, HEADERGET_MINMEM); - rc = rpmvercmp(one, two); + rc = rpmvercmp(rpmtdGetString(&one), rpmtdGetString(&two)); if (rc) return rc; - rc = headerGetEntry(first, RPMTAG_RELEASE, NULL, (rpm_data_t *) &one, NULL); - rc = headerGetEntry(second, RPMTAG_RELEASE, NULL, (rpm_data_t *) &two, NULL); + headerGet(first, RPMTAG_RELEASE, &one, HEADERGET_MINMEM); + headerGet(second, RPMTAG_RELEASE, &two, HEADERGET_MINMEM); - return rpmvercmp(one, two); + return rpmvercmp(rpmtdGetString(&one), rpmtdGetString(&two)); } /**