summaryrefslogtreecommitdiff
path: root/lib/query.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-09-22 12:32:02 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-09-22 12:32:02 +0300
commiteae127b7d835a2cdccd0abad75141efd8cb3a2bf (patch)
tree1904ffd22f46fa2fc93ebd1010bfe78562cb19e3 /lib/query.c
parenta90f65f38b17b7ba993d9d4b7d1677ce0fd4417a (diff)
downloadlibrpm-tizen-eae127b7d835a2cdccd0abad75141efd8cb3a2bf.tar.gz
librpm-tizen-eae127b7d835a2cdccd0abad75141efd8cb3a2bf.tar.bz2
librpm-tizen-eae127b7d835a2cdccd0abad75141efd8cb3a2bf.zip
Unbreak --tid and --querybynumber
- broken ages ago somewhere between 4.4.x and 4.6.x by typing changes presumably - C99 strtoul() can figure the base on its own, remove unnecessary work
Diffstat (limited to 'lib/query.c')
-rw-r--r--lib/query.c44
1 files changed, 10 insertions, 34 deletions
diff --git a/lib/query.c b/lib/query.c
index 3337f08a8..831eef798 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -416,22 +416,10 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
} break;
case RPMQV_TID:
- { int mybase = 10;
- const char * myarg = arg;
- char * end = NULL;
- unsigned long iid;
-
- /* XXX should be in strtoul */
- if (*myarg == '0') {
- myarg++;
- mybase = 8;
- if (*myarg == 'x') {
- myarg++;
- mybase = 16;
- }
- }
- iid = strtoul(myarg, &end, mybase);
- if ((*end) || (end == arg) || (iid == ULONG_MAX)) {
+ { char * end = NULL;
+ rpm_tid_t iid = strtoul(arg, &end, 0);
+
+ if ((*end) || (end == arg) || (iid == UINT_MAX)) {
rpmlog(RPMLOG_ERR, _("malformed %s: %s\n"), "tid", arg);
return 1;
}
@@ -502,31 +490,19 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
} break;
case RPMQV_DBOFFSET:
- { int mybase = 10;
- const char * myarg = arg;
- char * end = NULL;
- unsigned long recOffset;
-
- /* XXX should be in strtoul */
- if (*myarg == '0') {
- myarg++;
- mybase = 8;
- if (*myarg == 'x') {
- myarg++;
- mybase = 16;
- }
- }
- recOffset = strtoul(myarg, &end, mybase);
- if ((*end) || (end == arg) || (recOffset == ULONG_MAX)) {
+ { char * end = NULL;
+ unsigned int recOffset = strtoul(arg, &end, 0);
+
+ if ((*end) || (end == arg) || (recOffset == UINT_MAX)) {
rpmlog(RPMLOG_ERR, _("invalid package number: %s\n"), arg);
return 1;
}
- rpmlog(RPMLOG_DEBUG, "package record number: %lu\n", recOffset);
+ rpmlog(RPMLOG_DEBUG, "package record number: %u\n", recOffset);
/* RPMDBI_PACKAGES */
qva->qva_mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, &recOffset, sizeof(recOffset));
if (qva->qva_mi == NULL) {
rpmlog(RPMLOG_ERR,
- _("record %lu could not be read\n"), recOffset);
+ _("record %u could not be read\n"), recOffset);
res = 1;
} else
res = rpmcliShowMatches(qva, ts);