diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-12-13 19:32:37 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-12-13 19:32:37 +0200 |
commit | 7e56c6355bea552d89e8d5d0a317763a8cee4a4f (patch) | |
tree | c18ddebb9e8e6da144d00909c61fdcecdf718057 /rpmdb | |
parent | cbd7a684a4cd88bfa3383658790be3c37230707a (diff) | |
download | librpm-tizen-7e56c6355bea552d89e8d5d0a317763a8cee4a4f.tar.gz librpm-tizen-7e56c6355bea552d89e8d5d0a317763a8cee4a4f.tar.bz2 librpm-tizen-7e56c6355bea552d89e8d5d0a317763a8cee4a4f.zip |
Use rpm_tag_t everywhere for rpm (header) tag type
- typedef'ed as int32_t for now, negative values used in some places for
error cases
- easy to grep, easy to change...
- add RPMTAG_NOT_FOUND define, used in place of -1 "magic",
Diffstat (limited to 'rpmdb')
-rw-r--r-- | rpmdb/db3.c | 2 | ||||
-rw-r--r-- | rpmdb/dbconfig.c | 2 | ||||
-rw-r--r-- | rpmdb/header.c | 39 | ||||
-rw-r--r-- | rpmdb/header.h | 26 | ||||
-rw-r--r-- | rpmdb/header_common.c | 22 | ||||
-rw-r--r-- | rpmdb/header_internal.h | 6 | ||||
-rw-r--r-- | rpmdb/header_method.h | 24 | ||||
-rw-r--r-- | rpmdb/rpmdb.c | 34 | ||||
-rw-r--r-- | rpmdb/rpmdb.h | 6 | ||||
-rw-r--r-- | rpmdb/rpmdb_internal.h | 12 | ||||
-rw-r--r-- | rpmdb/sqlite.c | 2 | ||||
-rw-r--r-- | rpmdb/tagname.c | 30 |
12 files changed, 103 insertions, 102 deletions
diff --git a/rpmdb/db3.c b/rpmdb/db3.c index 1a6d9d489..7e7fc1aa3 100644 --- a/rpmdb/db3.c +++ b/rpmdb/db3.c @@ -762,7 +762,7 @@ exit: return rc; } -static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip) +static int db3open(rpmdb rpmdb, rpm_tag_t rpmtag, dbiIndex * dbip) { extern struct _dbiVec db3vec; const char * urlfn = NULL; diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c index 2edf3914a..e38a3650a 100644 --- a/rpmdb/dbconfig.c +++ b/rpmdb/dbconfig.c @@ -262,7 +262,7 @@ dbiIndex db3Free(dbiIndex dbi) static const char *db3_config_default = "db3:hash:mpool:cdb:usecursors:verbose:mp_mmapsize=8Mb:cachesize=512Kb:pagesize=512:perms=0644"; -dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag) +dbiIndex db3New(rpmdb rpmdb, rpm_tag_t rpmtag) { dbiIndex dbi = xcalloc(1, sizeof(*dbi)); char dbiTagMacro[128]; diff --git a/rpmdb/header.c b/rpmdb/header.c index 35251026a..e3ece2b37 100644 --- a/rpmdb/header.c +++ b/rpmdb/header.c @@ -778,7 +778,7 @@ void * _headerUnload(Header h) * @return header entry */ static -indexEntry findEntry(Header h, int32_t tag, int32_t type) +indexEntry findEntry(Header h, rpm_tag_t tag, int32_t type) { indexEntry entry, entry2, last; struct indexEntry_s key; @@ -824,7 +824,7 @@ indexEntry findEntry(Header h, int32_t tag, int32_t type) * @return 0 on success, 1 on failure (INCONSISTENT) */ static -int _headerRemoveEntry(Header h, int32_t tag) +int _headerRemoveEntry(Header h, rpm_tag_t tag) { indexEntry last = h->index + h->indexUsed; indexEntry entry, first; @@ -1017,7 +1017,7 @@ errxit: * @return on-disk header (with offsets) */ static -Header _headerReload(Header h, int tag) +Header _headerReload(Header h, rpm_tag_t tag) { Header nh; size_t length; @@ -1179,7 +1179,7 @@ exit: * @return 1 on success, 0 on failure */ static -int _headerIsEntry(Header h, int32_t tag) +int _headerIsEntry(Header h, rpm_tag_t tag) { /* FIX: h modified by sort. */ return (findEntry(h, tag, RPM_NULL_TYPE) ? 1 : 0); @@ -1430,8 +1430,8 @@ headerFindI18NString(Header h, indexEntry entry) * @param minMem string pointers reference header memory? * @return 1 on success, 0 on not found */ -static int intGetEntry(Header h, int32_t tag, - hTAG_t type, +static int intGetEntry(Header h, rpm_tag_t tag, + int32_t * type, hPTR_t * p, rpm_count_t * c, int minMem) @@ -1499,7 +1499,7 @@ static void * _headerFreeTag(Header h, * @return 1 on success, 0 on failure */ static -int _headerGetEntry(Header h, int32_t tag, +int _headerGetEntry(Header h, rpm_tag_t tag, hTYP_t type, void ** p, rpm_count_t * c) @@ -1520,7 +1520,7 @@ int _headerGetEntry(Header h, int32_t tag, * @return 1 on success, 0 on failure */ static -int _headerGetEntryMinMemory(Header h, int32_t tag, +int _headerGetEntryMinMemory(Header h, rpm_tag_t tag, hTYP_t type, hPTR_t * p, rpm_count_t * c) @@ -1528,7 +1528,7 @@ int _headerGetEntryMinMemory(Header h, int32_t tag, return intGetEntry(h, tag, type, p, c, 1); } -int headerGetRawEntry(Header h, int32_t tag, int32_t * type, hPTR_t * p, +int headerGetRawEntry(Header h, rpm_tag_t tag, int32_t * type, hPTR_t * p, rpm_count_t * c) { indexEntry entry; @@ -1618,7 +1618,7 @@ grabData(int32_t type, hPTR_t p, rpm_count_t c, int * lengthPtr) * @return 1 on success, 0 on failure */ static -int _headerAddEntry(Header h, int32_t tag, int32_t type, const void * p, rpm_count_t c) +int _headerAddEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) { indexEntry entry; void * data; @@ -1675,7 +1675,7 @@ int _headerAddEntry(Header h, int32_t tag, int32_t type, const void * p, rpm_cou * @return 1 on success, 0 on failure */ static -int _headerAppendEntry(Header h, int32_t tag, int32_t type, +int _headerAppendEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) { indexEntry entry; @@ -1723,7 +1723,7 @@ int _headerAppendEntry(Header h, int32_t tag, int32_t type, * @return 1 on success, 0 on failure */ static -int _headerAddOrAppendEntry(Header h, int32_t tag, int32_t type, +int _headerAddOrAppendEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) { return (findEntry(h, tag, type) @@ -1752,7 +1752,7 @@ int _headerAddOrAppendEntry(Header h, int32_t tag, int32_t type, * @return 1 on success, 0 on failure */ static -int _headerAddI18NString(Header h, int32_t tag, const char * string, +int _headerAddI18NString(Header h, rpm_tag_t tag, const char * string, const char * lang) { indexEntry table, entry; @@ -1886,7 +1886,7 @@ int _headerAddI18NString(Header h, int32_t tag, const char * string, * @return 1 on success, 0 on failure */ static -int _headerModifyEntry(Header h, int32_t tag, int32_t type, +int _headerModifyEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) { indexEntry entry; @@ -2031,7 +2031,7 @@ HeaderIterator _headerInitIterator(Header h) */ static int _headerNextIterator(HeaderIterator hi, - hTAG_t tag, + rpm_tag_t * tag, hTYP_t type, hPTR_t * p, rpm_count_t * c) @@ -2072,7 +2072,8 @@ Header _headerCopy(Header h) { Header nh = _headerNew(); HeaderIterator hi; - int32_t tag, type; + int32_t type; + rpm_tag_t tag; rpm_count_t count; hPTR_t ptr; @@ -2147,7 +2148,7 @@ static sprintfToken hsaNext(headerSprintfArgs hsa) if (hsa->hi == NULL) { hsa->i++; } else { - int32_t tagno; + rpm_tag_t tagno; int32_t type; rpm_count_t count; @@ -3276,9 +3277,9 @@ const struct headerSprintfExtension_s headerDefaultFormats[] = { * @param tagstocopy array of tags that are copied */ static -void _headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy) +void _headerCopyTags(Header headerFrom, Header headerTo, rpm_tag_t * tagstocopy) { - int * p; + rpm_tag_t * p; if (headerFrom == headerTo) return; diff --git a/rpmdb/header.h b/rpmdb/header.h index dd5993027..f8dd86bcb 100644 --- a/rpmdb/header.h +++ b/rpmdb/header.h @@ -92,10 +92,10 @@ typedef const char * errmsg_t; /** \ingroup header */ -typedef int32_t * hTAG_t; typedef int32_t * hTYP_t; typedef const void * hPTR_t; +typedef int32_t rpm_tag_t; typedef uint32_t rpm_count_t; /** \ingroup header @@ -268,7 +268,7 @@ typedef union hRET_s { /** */ typedef struct HE_s { - int32_t tag; + rpm_tag_t tag; hTYP_t typ; union { hPTR_t * ptr; @@ -385,7 +385,7 @@ int headerWrite(FD_t fd, Header h, enum hMagic magicp); * @param tag tag * @return 1 on success, 0 on failure */ -int headerIsEntry(Header h, int32_t tag); +int headerIsEntry(Header h, rpm_tag_t tag); /** \ingroup header * Free data allocated when retrieved from header. @@ -409,7 +409,7 @@ void * headerFreeTag(Header h, const void * data, rpmTagType type); * @retval *c number of values (or NULL) * @return 1 on success, 0 on failure */ -int headerGetEntry(Header h, int32_t tag, +int headerGetEntry(Header h, rpm_tag_t tag, hTYP_t type, void ** p, rpm_count_t * c); @@ -426,7 +426,7 @@ int headerGetEntry(Header h, int32_t tag, * @retval *c number of values (or NULL) * @return 1 on success, 0 on failure */ -int headerGetEntryMinMemory(Header h, int32_t tag, +int headerGetEntryMinMemory(Header h, rpm_tag_t tag, hTYP_t type, hPTR_t * p, rpm_count_t * c); @@ -445,7 +445,7 @@ int headerGetEntryMinMemory(Header h, int32_t tag, * @param c number of values * @return 1 on success, 0 on failure */ -int headerAddEntry(Header h, int32_t tag, int32_t type, const void * p, rpm_count_t c); +int headerAddEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); /** \ingroup header * Append element to tag array in header. @@ -461,7 +461,7 @@ int headerAddEntry(Header h, int32_t tag, int32_t type, const void * p, rpm_coun * @param c number of values * @return 1 on success, 0 on failure */ -int headerAppendEntry(Header h, int32_t tag, int32_t type, +int headerAppendEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); /** \ingroup header @@ -474,7 +474,7 @@ int headerAppendEntry(Header h, int32_t tag, int32_t type, * @param c number of values * @return 1 on success, 0 on failure */ -int headerAddOrAppendEntry(Header h, int32_t tag, int32_t type, +int headerAddOrAppendEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); /** \ingroup header @@ -497,7 +497,7 @@ int headerAddOrAppendEntry(Header h, int32_t tag, int32_t type, * @param lang locale * @return 1 on success, 0 on failure */ -int headerAddI18NString(Header h, int32_t tag, const char * string, +int headerAddI18NString(Header h, rpm_tag_t tag, const char * string, const char * lang); /** \ingroup header @@ -510,7 +510,7 @@ int headerAddI18NString(Header h, int32_t tag, const char * string, * @param c number of values * @return 1 on success, 0 on failure */ -int headerModifyEntry(Header h, int32_t tag, int32_t type, +int headerModifyEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); /** \ingroup header @@ -522,7 +522,7 @@ int headerModifyEntry(Header h, int32_t tag, int32_t type, * @param tag tag * @return 0 on success, 1 on failure (INCONSISTENT) */ -int headerRemoveEntry(Header h, int32_t tag); +int headerRemoveEntry(Header h, rpm_tag_t tag); /** \ingroup header * Return formatted output string from header tags. @@ -546,7 +546,7 @@ char * headerSprintf(Header h, const char * fmt, * @param headerTo destination header * @param tagstocopy array of tags that are copied */ -void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy); +void headerCopyTags(Header headerFrom, Header headerTo, rpm_tag_t * tagstocopy); /** \ingroup header * Destroy header tag iterator. @@ -572,7 +572,7 @@ HeaderIterator headerInitIterator(Header h); * @return 1 on success, 0 on failure */ int headerNextIterator(HeaderIterator hi, - hTAG_t tag, + rpm_tag_t * tag, hTYP_t type, hPTR_t * p, rpm_count_t * c); diff --git a/rpmdb/header_common.c b/rpmdb/header_common.c index bc9e892e2..233497071 100644 --- a/rpmdb/header_common.c +++ b/rpmdb/header_common.c @@ -95,7 +95,7 @@ int headerWrite(FD_t fd, Header h, enum hMagic magicp) return (h2hv(h)->hdrwrite) (fd, h, magicp); } -int headerIsEntry(Header h, int32_t tag) +int headerIsEntry(Header h, rpm_tag_t tag) { if (h == NULL) return 0; return (h2hv(h)->hdrisentry) (h, tag); @@ -107,7 +107,7 @@ void * headerFreeTag(Header h, return (h2hv(h)->hdrfreetag) (h, data, type); } -int headerGetEntry(Header h, int32_t tag, +int headerGetEntry(Header h, rpm_tag_t tag, hTYP_t type, void ** p, rpm_count_t * c) @@ -115,7 +115,7 @@ int headerGetEntry(Header h, int32_t tag, return (h2hv(h)->hdrget) (h, tag, type, p, c); } -int headerGetEntryMinMemory(Header h, int32_t tag, +int headerGetEntryMinMemory(Header h, rpm_tag_t tag, hTYP_t type, hPTR_t * p, rpm_count_t * c) @@ -123,36 +123,36 @@ int headerGetEntryMinMemory(Header h, int32_t tag, return (h2hv(h)->hdrgetmin) (h, tag, type, p, c); } -int headerAddEntry(Header h, int32_t tag, int32_t type, const void * p, rpm_count_t c) +int headerAddEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) { return (h2hv(h)->hdradd) (h, tag, type, p, c); } -int headerAppendEntry(Header h, int32_t tag, int32_t type, +int headerAppendEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) { return (h2hv(h)->hdrappend) (h, tag, type, p, c); } -int headerAddOrAppendEntry(Header h, int32_t tag, int32_t type, +int headerAddOrAppendEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) { return (h2hv(h)->hdraddorappend) (h, tag, type, p, c); } -int headerAddI18NString(Header h, int32_t tag, const char * string, +int headerAddI18NString(Header h, rpm_tag_t tag, const char * string, const char * lang) { return (h2hv(h)->hdraddi18n) (h, tag, string, lang); } -int headerModifyEntry(Header h, int32_t tag, int32_t type, +int headerModifyEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) { return (h2hv(h)->hdrmodify) (h, tag, type, p, c); } -int headerRemoveEntry(Header h, int32_t tag) +int headerRemoveEntry(Header h, rpm_tag_t tag) { return (h2hv(h)->hdrremove) (h, tag); } @@ -165,7 +165,7 @@ char * headerSprintf(Header h, const char * fmt, return (h2hv(h)->hdrsprintf) (h, fmt, tbltags, extensions, errmsg); } -void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy) +void headerCopyTags(Header headerFrom, Header headerTo, rpm_tag_t * tagstocopy) { /* FIX: add rc */ hdrVec->hdrcopytags(headerFrom, headerTo, tagstocopy); @@ -183,7 +183,7 @@ HeaderIterator headerInitIterator(Header h) } int headerNextIterator(HeaderIterator hi, - hTAG_t tag, + rpm_tag_t * tag, hTYP_t type, hPTR_t * p, rpm_count_t * c) diff --git a/rpmdb/header_internal.h b/rpmdb/header_internal.h index b0b2abb49..375c4bc45 100644 --- a/rpmdb/header_internal.h +++ b/rpmdb/header_internal.h @@ -23,7 +23,7 @@ */ typedef struct entryInfo_s * entryInfo; struct entryInfo_s { - int32_t tag; /*!< Tag identifier. */ + rpm_tag_t tag; /*!< Tag identifier. */ int32_t type; /*!< Tag data type. */ int32_t offset; /*!< Offset into data segment (ondisk only). */ rpm_count_t count; /*!< Number of tag elements. */ @@ -71,7 +71,7 @@ struct sprintfTag_s { headerTagFormatFunction fmt; headerTagTagFunction ext; /*!< NULL if tag element is invalid */ int extNum; - int32_t tag; + rpm_tag_t tag; int justOne; int arrayCount; char * format; @@ -147,7 +147,7 @@ char ** headerGetLangs(Header h); * @retval c address of number of values (or NULL) * @return 1 on success, 0 on failure */ -int headerGetRawEntry(Header h, int32_t tag, +int headerGetRawEntry(Header h, rpm_tag_t tag, hTYP_t type, hPTR_t * p, rpm_count_t * c); diff --git a/rpmdb/header_method.h b/rpmdb/header_method.h index c92671463..d16f57d54 100644 --- a/rpmdb/header_method.h +++ b/rpmdb/header_method.h @@ -80,7 +80,7 @@ void * (*HDRunload) (Header h); * @return on-disk header (with offsets) */ typedef -Header (*HDRreload) (Header h, int tag); +Header (*HDRreload) (Header h, rpm_tag_t tag); /** \ingroup header * Duplicate a header. @@ -132,7 +132,7 @@ int (*HDRwrite) (FD_t fd, Header h, enum hMagic magicp); * @return 1 on success, 0 on failure */ typedef -int (*HDRisentry) (Header h, int32_t tag); +int (*HDRisentry) (Header h, rpm_tag_t tag); /** \ingroup header * Free data allocated when retrieved from header. @@ -159,7 +159,7 @@ void * (*HDRfreetag) (Header h, * @return 1 on success, 0 on failure */ typedef -int (*HDRget) (Header h, int32_t tag, +int (*HDRget) (Header h, rpm_tag_t tag, hTYP_t type, void ** p, rpm_count_t * c); @@ -177,7 +177,7 @@ int (*HDRget) (Header h, int32_t tag, * @return 1 on success, 0 on failure */ typedef -int (*HDRgetmin) (Header h, int32_t tag, +int (*HDRgetmin) (Header h, rpm_tag_t tag, hTYP_t type, hPTR_t * p, rpm_count_t * c); @@ -197,7 +197,7 @@ int (*HDRgetmin) (Header h, int32_t tag, * @return 1 on success, 0 on failure */ typedef -int (*HDRadd) (Header h, int32_t tag, int32_t type, const void * p, rpm_count_t c); +int (*HDRadd) (Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); /** \ingroup header * Append element to tag array in header. @@ -214,7 +214,7 @@ int (*HDRadd) (Header h, int32_t tag, int32_t type, const void * p, rpm_count_t * @return 1 on success, 0 on failure */ typedef -int (*HDRappend) (Header h, int32_t tag, int32_t type, const void * p, rpm_count_t c); +int (*HDRappend) (Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); /** \ingroup header * Add or append element to tag array in header. @@ -227,7 +227,7 @@ int (*HDRappend) (Header h, int32_t tag, int32_t type, const void * p, rpm_count * @return 1 on success, 0 on failure */ typedef -int (*HDRaddorappend) (Header h, int32_t tag, int32_t type, const void * p, rpm_count_t c); +int (*HDRaddorappend) (Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); /** \ingroup header * Add locale specific tag to header. @@ -250,7 +250,7 @@ int (*HDRaddorappend) (Header h, int32_t tag, int32_t type, const void * p, rpm_ * @return 1 on success, 0 on failure */ typedef -int (*HDRaddi18n) (Header h, int32_t tag, const char * string, +int (*HDRaddi18n) (Header h, rpm_tag_t tag, const char * string, const char * lang); /** \ingroup header @@ -264,7 +264,7 @@ int (*HDRaddi18n) (Header h, int32_t tag, const char * string, * @return 1 on success, 0 on failure */ typedef -int (*HDRmodify) (Header h, int32_t tag, int32_t type, const void * p, rpm_count_t c); +int (*HDRmodify) (Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); /** \ingroup header * Delete tag in header. @@ -276,7 +276,7 @@ int (*HDRmodify) (Header h, int32_t tag, int32_t type, const void * p, rpm_count * @return 0 on success, 1 on failure (INCONSISTENT) */ typedef -int (*HDRremove) (Header h, int32_t tag); +int (*HDRremove) (Header h, rpm_tag_t tag); /** \ingroup header * Return formatted output string from header tags. @@ -302,7 +302,7 @@ char * (*HDRsprintf) (Header h, const char * fmt, * @param tagstocopy array of tags that are copied */ typedef -void (*HDRcopytags) (Header headerFrom, Header headerTo, hTAG_t tagstocopy); +void (*HDRcopytags) (Header headerFrom, Header headerTo, rpm_tag_t * tagstocopy); /** \ingroup header * Destroy header tag iterator. @@ -331,7 +331,7 @@ HeaderIterator (*HDRinititer) (Header h); */ typedef int (*HDRnextiter) (HeaderIterator hi, - hTAG_t tag, + rpm_tag_t * tag, hTYP_t type, hPTR_t * p, rpm_count_t * c); diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 01c96b4d4..2361ca785 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -39,8 +39,8 @@ static int _db_filter_dups = 0; #define _DBI_PERMS 0644 #define _DBI_MAJOR -1 -int * dbiTags = NULL; -int dbiTagsMax = 0; +rpm_tag_t * dbiTags = NULL; +rpm_tag_t dbiTagsMax = 0; /* We use this to comunicate back to the the rpm transaction * what their install instance was on a rpmdbAdd(). @@ -123,7 +123,7 @@ static int printable(const void * ptr, size_t len) * @param rpmtag rpm header tag * @return dbi index, -1 on error */ -static int dbiTagToDbix(int rpmtag) +static int dbiTagToDbix(rpm_tag_t rpmtag) { int dbix; @@ -144,7 +144,7 @@ static void dbiTagsInit(void) "Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filemd5s:Depends:Pubkeys"; char * dbiTagStr = NULL; char * o, * oe; - int rpmtag; + rpm_tag_t rpmtag; dbiTagStr = rpmExpand("%{?_dbi_tags}", NULL); if (!(dbiTagStr && *dbiTagStr)) { @@ -174,7 +174,7 @@ static void dbiTagsInit(void) if (oe && *oe) *oe++ = '\0'; rpmtag = rpmTagGetValue(o); - if (rpmtag < 0) { + if (rpmtag != RPMTAG_NOT_FOUND) { rpmlog(RPMLOG_WARNING, _("dbiTagsInit: unrecognized tag name: \"%s\" ignored\n"), o); continue; @@ -210,7 +210,7 @@ static struct _dbiVec *mydbvecs[] = { DB1vec, DB1vec, DB2vec, DB3vec, SQLITEvec, NULL }; -dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, unsigned int flags) +dbiIndex dbiOpen(rpmdb db, rpm_tag_t rpmtag, unsigned int flags) { int dbix; dbiIndex dbi = NULL; @@ -577,7 +577,7 @@ dbiIndexSet dbiFreeIndexSet(dbiIndexSet set) { } typedef struct miRE_s { - rpmTag tag; /*!< header tag */ + rpm_tag_t tag; /*!< header tag */ rpmMireMode mode; /*!< pattern match mode */ const char * pattern; /*!< pattern string */ int notmatch; /*!< like "grep -v" */ @@ -592,7 +592,7 @@ struct rpmdbMatchIterator_s { const void * mi_keyp; size_t mi_keylen; rpmdb mi_db; - rpmTag mi_rpmtag; + rpm_tag_t mi_rpmtag; dbiIndexSet mi_set; DBC * mi_dbc; DBT mi_key; @@ -704,7 +704,7 @@ static struct rpmdb_s dbTemplate = { _DB_MAJOR, _DB_ERRPFX }; -static int isTemporaryDB(int rpmtag) +static int isTemporaryDB(rpm_tag_t rpmtag) { int rc = 0; switch (rpmtag) { @@ -768,7 +768,7 @@ int rpmdbOpenAll(rpmdb db) return rc; } -int rpmdbCloseDBI(rpmdb db, int rpmtag) +int rpmdbCloseDBI(rpmdb db, rpm_tag_t rpmtag) { int dbix; int rc = 0; @@ -965,7 +965,7 @@ static int openDatabase(const char * prefix, if (dbiTags != NULL) for (dbix = 0; rc == 0 && dbix < dbiTagsMax; dbix++) { dbiIndex dbi; - int rpmtag; + rpm_tag_t rpmtag; /* Filter out temporary databases */ if (isTemporaryDB((rpmtag = dbiTags[dbix]))) @@ -1640,7 +1640,7 @@ static int mireCmp(const void * a, const void * b) * @param pattern pattern to duplicate * @return duplicated pattern */ -static char * mireDup(rpmTag tag, rpmMireMode *modep, +static char * mireDup(rpm_tag_t tag, rpmMireMode *modep, const char * pattern) { const char * s; @@ -1728,7 +1728,7 @@ static char * mireDup(rpmTag tag, rpmMireMode *modep, return pat; } -int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag, +int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpm_tag_t tag, rpmMireMode mode, const char * pattern) { static rpmMireMode defmode = (rpmMireMode)-1; @@ -2279,7 +2279,7 @@ int rpmdbAppendIterator(rpmdbMatchIterator mi, const int * hdrNums, int nHdrNums return 0; } -rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag, +rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpm_tag_t rpmtag, const void * keyp, size_t keylen) { rpmdbMatchIterator mi; @@ -2472,7 +2472,7 @@ memset(data, 0, sizeof(*data)); const char ** rpmvals = NULL; rpmTagType rpmtype = 0; rpm_count_t rpmcnt = 0; - int rpmtag; + rpm_tag_t rpmtag; int xx; rpm_count_t i, j; @@ -2825,7 +2825,7 @@ memset(data, 0, sizeof(*data)); const char **rpmvals = NULL; rpmTagType rpmtype = 0; rpm_count_t rpmcnt = 0; - int rpmtag; + rpm_tag_t rpmtag; int32_t * requireFlags; rpmRC rpmrc; int i, j; @@ -3344,7 +3344,7 @@ static int rpmdbMoveDatabase(const char * prefix, if (dbiTags != NULL) for (i = 0; i < dbiTagsMax; i++) { const char * base; - int rpmtag; + rpm_tag_t rpmtag; /* Filter out temporary databases */ if (isTemporaryDB((rpmtag = dbiTags[i]))) diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h index 92b4eb7bc..4afa4117c 100644 --- a/rpmdb/rpmdb.h +++ b/rpmdb/rpmdb.h @@ -118,7 +118,7 @@ int rpmdbVerify(const char * prefix); * @param rpmtag rpm tag * @return 0 on success */ -int rpmdbCloseDBI(rpmdb db, int rpmtag); +int rpmdbCloseDBI(rpmdb db, rpm_tag_t rpmtag); /** \ingroup rpmdb * Close all database indices and free rpmdb. @@ -197,7 +197,7 @@ int rpmdbPruneIterator(rpmdbMatchIterator mi, * @param pattern pattern to match * @return 0 on success */ -int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag, +int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpm_tag_t tag, rpmMireMode mode, const char * pattern); /** \ingroup rpmdb @@ -235,7 +235,7 @@ int rpmdbSetHdrChk(rpmdbMatchIterator mi, rpmts ts, * @param keylen key data length (0 will use strlen(keyp)) * @return NULL on failure */ -rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag, +rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpm_tag_t rpmtag, const void * keyp, size_t keylen); /** \ingroup rpmdb diff --git a/rpmdb/rpmdb_internal.h b/rpmdb/rpmdb_internal.h index aa99651fe..7e6b1a223 100644 --- a/rpmdb/rpmdb_internal.h +++ b/rpmdb/rpmdb_internal.h @@ -54,7 +54,7 @@ struct _dbiVec { * @param rpmtag rpm tag * @return 0 on success */ - int (*open) (rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip); + int (*open) (rpmdb rpmdb, rpm_tag_t rpmtag, dbiIndex * dbip); /** \ingroup dbi * Close index database, and destroy database handle. @@ -292,7 +292,7 @@ unsigned char * dbi_lk_conflicts; unsigned int dbi_q_extentsize; rpmdb dbi_rpmdb; /*!< the parent rpm database */ - rpmTag dbi_rpmtag; /*!< rpm tag used for index */ + rpm_tag_t dbi_rpmtag; /*!< rpm tag used for index */ int dbi_jlen; /*!< size of join key */ DB * dbi_db; /*!< Berkeley DB * handle */ @@ -358,7 +358,7 @@ extern "C" { * @param rpmtag rpm tag * @return index database handle */ -dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag); +dbiIndex db3New(rpmdb rpmdb, rpm_tag_t rpmtag); /** \ingroup db3 * Destroy index database handle instance. @@ -382,7 +382,7 @@ extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags); * @param flags (unused) * @return index database handle */ -dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, +dbiIndex dbiOpen(rpmdb db, rpm_tag_t rpmtag, unsigned int flags); /* FIX: vector annotations */ @@ -655,8 +655,8 @@ unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno); /** \ingroup rpmdb * Tags for which rpmdb indices will be built. */ -extern int * dbiTags; -extern int dbiTagsMax; +extern rpm_tag_t * dbiTags; +extern rpm_tag_t dbiTagsMax; #ifndef __APPLE__ /** diff --git a/rpmdb/sqlite.c b/rpmdb/sqlite.c index 07e551241..5e52ae0ff 100644 --- a/rpmdb/sqlite.c +++ b/rpmdb/sqlite.c @@ -766,7 +766,7 @@ leaveChroot(dbi); * @param dbip * @return 0 on success */ -static int sql_open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip) +static int sql_open(rpmdb rpmdb, rpm_tag_t rpmtag, dbiIndex * dbip) { extern struct _dbiVec sqlitevec; diff --git a/rpmdb/tagname.c b/rpmdb/tagname.c index 90f463ec4..655981617 100644 --- a/rpmdb/tagname.c +++ b/rpmdb/tagname.c @@ -15,12 +15,12 @@ struct headerTagIndices_s { headerTagTableEntry * byName; /*!< header tags sorted by name. */ int byNameSize; /*!< no. of entries. */ int (*byNameCmp) (const void * avp, const void * bvp); /*!< compare entries by name. */ - int (*tagValue) (const char * name); /* return value from name. */ + rpm_tag_t (*tagValue) (const char * name); /* return value from name. */ headerTagTableEntry * byValue; /*!< header tags sorted by value. */ int byValueSize; /*!< no. of entries. */ int (*byValueCmp) (const void * avp, const void * bvp); /*!< compare entries by value. */ - const char * (*tagName) (int value); /* Return name from value. */ - int (*tagType) (int value); /* Return type from value. */ + const char * (*tagName) (rpm_tag_t value); /* Return name from value. */ + int (*tagType) (rpm_tag_t value); /* Return type from value. */ }; /** @@ -83,9 +83,9 @@ assert(n == rpmTagTableSize); /* forward refs */ -static const char * _tagName(int tag); -static int _tagType(int tag); -static int _tagValue(const char * tagstr); +static const char * _tagName(rpm_tag_t tag); +static int _tagType(rpm_tag_t tag); +static rpm_tag_t _tagValue(const char * tagstr); static struct headerTagIndices_s _rpmTags = { tagLoadIndex, @@ -95,7 +95,7 @@ static struct headerTagIndices_s _rpmTags = { headerTagIndices rpmTags = &_rpmTags; -static const char * _tagName(int tag) +static const char * _tagName(rpm_tag_t tag) { static char nameBuf[128]; /* XXX yuk */ const struct headerTagTableEntry_s *t; @@ -175,7 +175,7 @@ static const char * _tagName(int tag) return nameBuf; } -static int _tagType(int tag) +static int _tagType(rpm_tag_t tag) { const struct headerTagTableEntry_s *t; int comparison, i, l, u; @@ -223,7 +223,7 @@ static int _tagType(int tag) return RPM_NULL_TYPE; } -static int _tagValue(const char * tagstr) +static rpm_tag_t _tagValue(const char * tagstr) { const struct headerTagTableEntry_s *t; int comparison, i, l, u; @@ -249,7 +249,7 @@ static int _tagValue(const char * tagstr) if (_rpmTags.byName == NULL) xx = tagLoadIndex(&_rpmTags.byName, &_rpmTags.byNameSize, tagCmpName); if (_rpmTags.byName == NULL) - return -1; + return RPMTAG_NOT_FOUND; l = 0; u = _rpmTags.byNameSize; @@ -266,10 +266,10 @@ static int _tagValue(const char * tagstr) else return t->val; } - return -1; + return RPMTAG_NOT_FOUND; } -const char * rpmTagGetName(int tag) +const char * rpmTagGetName(rpm_tag_t tag) { return ((*rpmTags->tagName)(tag)); } @@ -279,7 +279,7 @@ const char * rpmTagGetName(int tag) * @param tag tag value * @return tag data type, RPM_NULL_TYPE on not found. */ -int rpmTagGetType(int tag) +int rpmTagGetType(rpm_tag_t tag) { return ((*rpmTags->tagType)(tag)); } @@ -287,9 +287,9 @@ int rpmTagGetType(int tag) /** * Return tag value from name. * @param tagstr name of tag - * @return tag value, -1 on not found + * @return tag value, RPMTAG_NOT_FOUND on not found */ -int rpmTagGetValue(const char * tagstr) +rpm_tag_t rpmTagGetValue(const char * tagstr) { return ((*rpmTags->tagValue)(tagstr)); } |