Oops, rpmTagGetValue() expects tagname without RPMTAG_ prefix
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 22 May 2008 06:18:48 +0000 (09:18 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 22 May 2008 06:18:48 +0000 (09:18 +0300)
lib/query.c
python/rpmmodule.c

index 35c9aa2..615c88d 100644 (file)
@@ -263,7 +263,7 @@ void rpmDisplayQueryTags(FILE * fp)
     while ((tname = rpmtdNextString(names))) {
        sname = tname + strlen("RPMTAG_");
        if (rpmIsVerbose()) {
-           rpmTag tag = rpmTagGetValue(tname);
+           rpmTag tag = rpmTagGetValue(sname);
            rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
            fprintf(fp, "%-20s %6d", sname, tag);
            if (type > RPM_NULL_TYPE && type <= RPM_MAX_TYPE)
index 456724f..015cab6 100644 (file)
@@ -318,14 +318,15 @@ void init_rpm(void)
 #endif
 
     dict = PyDict_New();
-    {  const char *tname;
+    {  const char *tname, *sname;
        rpmtd names = rpmTagGetNames(1);
 
        while ((tname = rpmtdNextString(names))) {
-           tag = PyInt_FromLong(rpmTagGetValue(tname));
+           sname = tname + strlen("RPMTAG_");
+           tag = PyInt_FromLong(rpmTagGetValue(sname));
            PyDict_SetItemString(d, tname, tag);
            Py_DECREF(tag);
-           o = PyString_FromString(tname + strlen("RPMTAG_"));
+           o = PyString_FromString(sname);
            PyDict_SetItem(dict, tag, o);
            Py_DECREF(o);
        }