diff options
55 files changed, 256 insertions, 243 deletions
diff --git a/build/files.c b/build/files.c index 54c664639..f45fcf7dd 100644 --- a/build/files.c +++ b/build/files.c @@ -1620,7 +1620,7 @@ static rpmRC recurseDir(FileList fl, const char * diskURL) * @return RPMRC_OK on success */ static rpmRC processMetadataFile(Package pkg, FileList fl, const char * fileURL, - rpmTag tag) + rpm_tag_t tag) { const char * buildURL = "%{_builddir}/%{?buildsubdir}/"; const char * fn = NULL; @@ -2018,7 +2018,8 @@ exit: void initSourceHeader(rpmSpec spec) { HeaderIterator hi; - int32_t tag, type; + int32_t type; + rpm_tag_t tag; rpm_count_t count; const void * ptr; diff --git a/build/pack.c b/build/pack.c index 05554653b..2ba457780 100644 --- a/build/pack.c +++ b/build/pack.c @@ -145,7 +145,7 @@ static StringBuf addFileToTagAux(rpmSpec spec, /** */ -static int addFileToTag(rpmSpec spec, const char * file, Header h, int tag) +static int addFileToTag(rpmSpec spec, const char * file, Header h, rpm_tag_t tag) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; StringBuf sb = newStringBuf(); @@ -167,7 +167,7 @@ static int addFileToTag(rpmSpec spec, const char * file, Header h, int tag) /** */ -static int addFileToArrayTag(rpmSpec spec, const char *file, Header h, int tag) +static int addFileToArrayTag(rpmSpec spec, const char *file, Header h, rpm_tag_t tag) { StringBuf sb = newStringBuf(); char *s; @@ -594,7 +594,7 @@ exit: return rc; } -static int32_t copyTags[] = { +static rpm_tag_t copyTags[] = { RPMTAG_CHANGELOGTIME, RPMTAG_CHANGELOGNAME, RPMTAG_CHANGELOGTEXT, diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 458da39f2..7c8d7996b 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -15,7 +15,7 @@ /** */ -static rpmTag copyTagsDuringParse[] = { +static rpm_tag_t copyTagsDuringParse[] = { RPMTAG_EPOCH, RPMTAG_VERSION, RPMTAG_RELEASE, @@ -38,7 +38,7 @@ static rpmTag copyTagsDuringParse[] = { /** */ -static rpmTag requiredTags[] = { +static rpm_tag_t requiredTags[] = { RPMTAG_NAME, RPMTAG_VERSION, RPMTAG_RELEASE, @@ -50,7 +50,7 @@ static rpmTag requiredTags[] = { /** */ -static void addOrAppendListEntry(Header h, int32_t tag, char * line) +static void addOrAppendListEntry(Header h, rpm_tag_t tag, char * line) { int xx; int argc; @@ -187,7 +187,7 @@ static inline char * findLastChar(char * s) /** */ -static int isMemberInEntry(Header h, const char *name, rpmTag tag) +static int isMemberInEntry(Header h, const char *name, rpm_tag_t tag) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; HFD_t hfd = headerFreeData; @@ -249,7 +249,7 @@ static int checkForRequired(Header h, const char * NVR) /* LCL: parse error here with modifies */ { int res = RPMRC_OK; - rpmTag * p; + rpm_tag_t * p; for (p = requiredTags; *p != 0; p++) { if (!headerIsEntry(h, *p)) { @@ -272,7 +272,7 @@ static int checkForRequired(Header h, const char * NVR) static int checkForDuplicates(Header h, const char * NVR) { int res = RPMRC_OK; - int lastTag, tag; + rpm_tag_t lastTag, tag; HeaderIterator hi; for (hi = headerInitIterator(h), lastTag = 0; @@ -293,7 +293,7 @@ static int checkForDuplicates(Header h, const char * NVR) /** */ static struct optionalTag { - rpmTag ot_tag; + rpm_tag_t ot_tag; const char * ot_mac; } optionalTags[] = { { RPMTAG_VENDOR, "%{vendor}" }, @@ -377,7 +377,7 @@ exit: return rc; } -spectag stashSt(rpmSpec spec, Header h, int tag, const char * lang) +spectag stashSt(rpmSpec spec, Header h, rpm_tag_t tag, const char * lang) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; spectag t = NULL; @@ -417,7 +417,7 @@ extern int noLang; /** */ -static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag, +static int handlePreambleTag(rpmSpec spec, Package pkg, rpm_tag_t tag, const char *macro, const char *lang) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -675,7 +675,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag, /** */ typedef struct PreambleRec_s { - rpmTag tag; + rpm_tag_t tag; int len; int multiLang; int obsolete; @@ -742,7 +742,7 @@ static inline void initPreambleList(void) /** */ -static int findPreambleTag(rpmSpec spec,rpmTag * tag, +static int findPreambleTag(rpmSpec spec,rpm_tag_t * tag, const char ** macro, char * lang) { PreambleRec p; @@ -846,7 +846,7 @@ int parsePreamble(rpmSpec spec, int initialPackage) return rc; while (! (nextPart = isPart(spec->line))) { const char * macro; - rpmTag tag; + rpm_tag_t tag; /* Skip blank lines */ linep = spec->line; @@ -891,7 +891,7 @@ int parsePreamble(rpmSpec spec, int initialPackage) if (pkg != spec->packages) headerCopyTags(spec->packages->header, pkg->header, - (int32_t *)copyTagsDuringParse); + (rpm_tag_t *)copyTagsDuringParse); if (checkForRequired(pkg->header, NVR)) return RPMRC_FAIL; diff --git a/build/parseReqs.c b/build/parseReqs.c index a4bc213b8..162f54f3f 100644 --- a/build/parseReqs.c +++ b/build/parseReqs.c @@ -32,7 +32,7 @@ const char * token; #define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;} #define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;} -rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN, +rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpm_tag_t tagN, int index, rpmsenseFlags tagflags) { const char *r, *re, *v, *ve; diff --git a/build/parseScript.c b/build/parseScript.c index e4c36f621..a4b3224d0 100644 --- a/build/parseScript.c +++ b/build/parseScript.c @@ -74,10 +74,10 @@ int parseScript(rpmSpec spec, int parsePart) const char **progArgv = NULL; int progArgc; char *partname = NULL; - rpmTag reqtag = 0; - rpmTag tag = 0; + rpm_tag_t reqtag = 0; + rpm_tag_t tag = 0; int tagflags = 0; - rpmTag progtag = 0; + rpm_tag_t progtag = 0; int flag = PART_SUBNAME; Package pkg; StringBuf sb = NULL; diff --git a/build/reqprov.c b/build/reqprov.c index b9ef8b342..b024fafb6 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -8,7 +8,7 @@ #include <rpm/rpmbuild.h> #include "debug.h" -int addReqProv(rpmSpec spec, Header h, rpmTag tagN, +int addReqProv(rpmSpec spec, Header h, rpm_tag_t tagN, const char * N, const char * EVR, rpmsenseFlags Flags, int index) { @@ -16,10 +16,10 @@ int addReqProv(rpmSpec spec, Header h, rpmTag tagN, HFD_t hfd = headerFreeData; const char ** names; rpmTagType dnt; - rpmTag nametag = 0; - rpmTag versiontag = 0; - rpmTag flagtag = 0; - rpmTag indextag = 0; + rpm_tag_t nametag = 0; + rpm_tag_t versiontag = 0; + rpm_tag_t flagtag = 0; + rpm_tag_t indextag = 0; rpm_count_t len; rpmsenseFlags extra = RPMSENSE_ANY; int xx; diff --git a/build/rpmbuild.h b/build/rpmbuild.h index 2754a3769..3913f67c3 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -244,7 +244,7 @@ int parsePrep(rpmSpec spec); * @param tagflags dependency flags already known from context * @return RPMRC_OK on success, RPMRC_FAIL on failure */ -rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char * field, rpmTag tagN, +rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char * field, rpm_tag_t tagN, int index, rpmsenseFlags tagflags); /** \ingroup rpmbuild @@ -327,7 +327,7 @@ Package freePackage(Package pkg); * @param index (0 always) * @return 0 always */ -int addReqProv(rpmSpec spec, Header h, rpmTag tagN, +int addReqProv(rpmSpec spec, Header h, rpm_tag_t tagN, const char * N, const char * EVR, rpmsenseFlags Flags, int index); diff --git a/build/rpmfc.c b/build/rpmfc.c index b93bf3e85..b48adfe31 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -300,7 +300,7 @@ static int rpmfcSaveArg(ARGV_t * argvp, const char * key) static char * rpmfcFileDep(char * buf, int ix, rpmds ds) { - int32_t tagN = rpmdsTagN(ds); + rpm_tag_t tagN = rpmdsTagN(ds); char deptype = 'X'; buf[0] = '\0'; @@ -803,7 +803,8 @@ static int rpmfcELF(rpmfc fc) struct stat sb, * st = &sb; const char * soname = NULL; rpmds * depsp, ds; - int32_t tagN, dsContext; + rpm_tag_t tagN; + int32_t dsContext; char * t; int xx; int isElf64; @@ -1345,9 +1346,9 @@ typedef struct DepMsg_s * DepMsg_t; struct DepMsg_s { const char * msg; const char * argv[4]; - rpmTag ntag; - rpmTag vtag; - rpmTag ftag; + rpm_tag_t ntag; + rpm_tag_t vtag; + rpm_tag_t ftag; int mask; int xor; }; @@ -1457,7 +1458,8 @@ static int rpmfcGenerateDependsHelper(const rpmSpec spec, Package pkg, rpmfi fi) appendLineStringBuf(sb_stdin, rpmfiFN(fi)); for (dm = DepMsgs; dm->msg != NULL; dm++) { - int tag, tagflags; + rpm_tag_t tag; + int tagflags; char * s; int xx; diff --git a/build/rpmspec.h b/build/rpmspec.h index dc511485d..64dca0ce0 100644 --- a/build/rpmspec.h +++ b/build/rpmspec.h @@ -209,7 +209,7 @@ struct OpenFileInfo * newOpenFileInfo(void); * @param tag tag * @param lang locale */ -spectag stashSt(rpmSpec spec, Header h, int tag, const char * lang); +spectag stashSt(rpmSpec spec, Header h, rpm_tag_t tag, const char * lang); /** \ingroup rpmbuild * addSource. @@ -218,7 +218,7 @@ spectag stashSt(rpmSpec spec, Header h, int tag, const char * lang); * @param field field to parse * @param tag tag */ -int addSource(rpmSpec spec, Package pkg, const char * field, int tag); +int addSource(rpmSpec spec, Package pkg, const char * field, rpm_tag_t tag); /** \ingroup rpmbuild * parseNoSource. @@ -226,7 +226,7 @@ int addSource(rpmSpec spec, Package pkg, const char * field, int tag); * @param field field to parse * @param tag tag */ -int parseNoSource(rpmSpec spec, const char * field, int tag); +int parseNoSource(rpmSpec spec, const char * field, rpm_tag_t tag); #ifdef __cplusplus } diff --git a/build/spec.c b/build/spec.c index ddffb48f6..64d2a08bf 100644 --- a/build/spec.c +++ b/build/spec.c @@ -198,7 +198,7 @@ static inline struct Source *findSource(rpmSpec spec, int num, int flag) return NULL; } -int parseNoSource(rpmSpec spec, const char * field, int tag) +int parseNoSource(rpmSpec spec, const char * field, rpm_tag_t tag) { const char *f, *fe; const char *name; @@ -242,7 +242,7 @@ int parseNoSource(rpmSpec spec, const char * field, int tag) return 0; } -int addSource(rpmSpec spec, Package pkg, const char *field, int tag) +int addSource(rpmSpec spec, Package pkg, const char *field, rpm_tag_t tag) { struct Source *p; int flag = 0; diff --git a/lib/formats.c b/lib/formats.c index 7333368fc..db0c27588 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -812,7 +812,7 @@ static const char * _macro_i18ndomains = "%{?_i18ndomains}"; * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int i18nTag(Header h, int32_t tag, rpmTagType * type, +static int i18nTag(Header h, rpm_tag_t tag, rpmTagType * type, const void ** data, rpm_count_t * count, int * freeData) { diff --git a/lib/idtx.c b/lib/idtx.c index 3c2240048..eb81769d6 100644 --- a/lib/idtx.c +++ b/lib/idtx.c @@ -64,7 +64,7 @@ IDTX IDTXsort(IDTX idtx) return idtx; } -IDTX IDTXload(rpmts ts, rpmTag tag) +IDTX IDTXload(rpmts ts, rpm_tag_t tag) { IDTX idtx = NULL; rpmdbMatchIterator mi; @@ -107,7 +107,7 @@ IDTX IDTXload(rpmts ts, rpmTag tag) return IDTXsort(idtx); } -IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag) +IDTX IDTXglob(rpmts ts, const char * globstr, rpm_tag_t tag) { IDTX idtx = NULL; HGE_t hge = (HGE_t) headerGetEntry; diff --git a/lib/idtx.h b/lib/idtx.h index 956be7183..a4f8c2300 100644 --- a/lib/idtx.h +++ b/lib/idtx.h @@ -64,7 +64,7 @@ IDTX IDTXsort(IDTX idtx); * @param tag rpm tag * @return id index */ -IDTX IDTXload(rpmts ts, rpmTag tag); +IDTX IDTXload(rpmts ts, rpm_tag_t tag); /** * Load tag (instance,value) pairs from packages, and return sorted id index. @@ -73,7 +73,7 @@ IDTX IDTXload(rpmts ts, rpmTag tag); * @param tag rpm tag * @return id index */ -IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag); +IDTX IDTXglob(rpmts ts, const char * globstr, rpm_tag_t tag); #ifdef __cplusplus } diff --git a/lib/package.c b/lib/package.c index 796b0aecb..2f36162d8 100644 --- a/lib/package.c +++ b/lib/package.c @@ -87,7 +87,8 @@ void headerMergeLegacySigs(Header h, const Header sigh) HFD_t hfd = (HFD_t) headerFreeData; HAE_t hae = (HAE_t) headerAddEntry; HeaderIterator hi; - int32_t tag, type; + int32_t type; + rpm_tag_t tag; rpm_count_t count; const void * ptr; int xx; @@ -169,7 +170,8 @@ Header headerRegenSigHeader(const Header h, int noArchiveSize) Header sigh = rpmNewSignature(); HeaderIterator hi; rpm_count_t count; - int32_t tag, stag, type; + rpm_tag_t tag, stag; + int32_t type; const void * ptr; int xx; @@ -681,7 +683,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp) ssize_t count; rpmlead l = NULL; Header sigh = NULL; - int32_t sigtag; + rpm_tag_t sigtag; int32_t sigtype; const void * sig; rpm_count_t siglen; @@ -76,7 +76,7 @@ int rpmVersionCompare(Header first, Header second) */ static struct tagMacro { const char * macroname; /*!< Macro name to define. */ - rpmTag tag; /*!< Header tag to use for value. */ + rpm_tag_t tag; /*!< Header tag to use for value. */ } tagMacros[] = { { "name", RPMTAG_NAME }, { "version", RPMTAG_VERSION }, @@ -407,7 +407,7 @@ static char * SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin"; * @param tag scriptlet tag * @return name of scriptlet */ -static const char * tag2sln(int tag) +static const char * tag2sln(rpm_tag_t tag) { switch (tag) { case RPMTAG_PRETRANS: return "%pretrans"; @@ -425,9 +425,9 @@ static const char * tag2sln(int tag) return "%unknownscript"; } -static int triggertag(uint32_t sense) +static rpm_tag_t triggertag(rpm_tag_t sense) { - int tag = 0; + rpm_tag_t tag = 0; switch (sense) { case RPMSENSE_TRIGGERIN: tag = RPMTAG_TRIGGERIN; @@ -474,7 +474,7 @@ static pid_t psmWait(rpmpsm psm) /** * Run internal Lua script. */ -static rpmRC runLuaScript(rpmpsm psm, Header h, rpmTag stag, +static rpmRC runLuaScript(rpmpsm psm, Header h, rpm_tag_t stag, unsigned int progArgc, const char **progArgv, const char *script, int arg1, int arg2) { @@ -571,7 +571,7 @@ static const char * ldconfig_path = "/sbin/ldconfig"; * @param arg2 ditto, but for the target package * @return 0 on success */ -static rpmRC runScript(rpmpsm psm, Header h, rpmTag stag, +static rpmRC runScript(rpmpsm psm, Header h, rpm_tag_t stag, unsigned int progArgc, const char ** progArgv, const char * script, int arg1, int arg2) { @@ -1486,7 +1486,8 @@ assert(psm->mi == NULL); if (headerGetEntry(fi->h, RPMTAG_HEADERIMAGE, &uht, &uh, &uhc)) { HeaderIterator hi; - int32_t tag, type; + int32_t type; + rpm_tag_t tag; rpm_count_t count; hPTR_t ptr; Header oh; diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c index 8e7d9bbea..3fb805948 100644 --- a/lib/rpmchecksig.c +++ b/lib/rpmchecksig.c @@ -121,7 +121,7 @@ exit: * @retval signid signer fingerprint * @return 0 on success */ -static int getSignid(Header sig, int sigtag, pgpKeyID_t signid) +static int getSignid(Header sig, rpm_tag_t sigtag, pgpKeyID_t signid) { void * pkt = NULL; int32_t pkttyp = 0; @@ -155,7 +155,7 @@ static int rpmReSign(rpmts ts, FD_t fd = NULL; FD_t ofd = NULL; rpmlead lead; - int32_t sigtag; + rpm_tag_t sigtag; const char *rpm, *trpm; const char *sigtarget = NULL; char tmprpm[1024+1]; @@ -218,7 +218,8 @@ static int rpmReSign(rpmts ts, /* Dump the immutable region (if present). */ if (headerGetEntry(sigh, RPMTAG_HEADERSIGNATURES, &uht, &uh, &uhc)) { HeaderIterator hi; - int32_t tag, type; + int32_t type; + rpm_tag_t tag; rpm_count_t count; hPTR_t ptr; Header oh; @@ -521,7 +522,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, char buf[8192], * b; char missingKeys[7164], * m; char untrustedKeys[7164], * u; - int32_t sigtag; + rpm_tag_t sigtag; int32_t sigtype; const void * sig; pgpDig dig; diff --git a/lib/rpmds.c b/lib/rpmds.c index 4bbdd66fe..2dce7d462 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -35,7 +35,7 @@ struct rpmds_s { uint32_t * Color; /*!< Bit(s) calculated from file color(s). */ int32_t * Refs; /*!< No. of file refs. */ int32_t BT; /*!< Package build time tie breaker. */ - rpmTag tagN; /*!< Header tag. */ + rpm_tag_t tagN; /*!< Header tag. */ rpmTagType Nt, EVRt, Ft; /*!< Tag data types. */ int32_t Count; /*!< No. of elements */ int i; /*!< Element index. */ @@ -67,7 +67,7 @@ fprintf(stderr, "--> ds %p ++ %d %s\n", ds, ds->nrefs, msg); rpmds rpmdsFree(rpmds ds) { HFD_t hfd = headerFreeData; - rpmTag tagEVR, tagF; + rpm_tag_t tagEVR, tagF; if (ds == NULL) return NULL; @@ -117,15 +117,15 @@ fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count); return NULL; } -rpmds rpmdsNew(Header h, rpmTag tagN, int flags) +rpmds rpmdsNew(Header h, rpm_tag_t tagN, int flags) { int scareMem = (flags & 0x1); HGE_t hge = (scareMem ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry); - rpmTag tagBT = RPMTAG_BUILDTIME; + rpm_tag_t tagBT = RPMTAG_BUILDTIME; rpmTagType BTt; int32_t * BTp; - rpmTag tagEVR, tagF; + rpm_tag_t tagEVR, tagF; rpmds ds = NULL; const char * Type; const char ** N; @@ -241,7 +241,7 @@ char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds) return tbuf; } -rpmds rpmdsThis(Header h, rpmTag tagN, int32_t Flags) +rpmds rpmdsThis(Header h, rpm_tag_t tagN, int32_t Flags) { HGE_t hge = (HGE_t) headerGetEntryMinMemory; rpmds ds = NULL; @@ -314,7 +314,7 @@ exit: return rpmdsLink(ds, (ds ? ds->Type : RPMDBG())); } -rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int32_t Flags) +rpmds rpmdsSingle(rpm_tag_t tagN, const char * N, const char * EVR, int32_t Flags) { rpmds ds = NULL; const char * Type; @@ -425,9 +425,9 @@ int32_t rpmdsFlags(const rpmds ds) return Flags; } -rpmTag rpmdsTagN(const rpmds ds) +rpm_tag_t rpmdsTagN(const rpmds ds) { - rpmTag tagN = 0; + rpm_tag_t tagN = 0; if (ds != NULL) tagN = ds->tagN; diff --git a/lib/rpmds.h b/lib/rpmds.h index 81ac79c70..5c0d91bb0 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -119,7 +119,7 @@ rpmds rpmdsFree(rpmds ds); * @param flags scareMem(0x1) * @return new dependency set */ -rpmds rpmdsNew(Header h, rpmTag tagN, int flags); +rpmds rpmdsNew(Header h, rpm_tag_t tagN, int flags); /** \ingroup rpmds * Return new formatted dependency string. @@ -136,7 +136,7 @@ char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds); * @param Flags comparison flags * @return new dependency set */ -rpmds rpmdsThis(Header h, rpmTag tagN, int32_t Flags); +rpmds rpmdsThis(Header h, rpm_tag_t tagN, int32_t Flags); /** \ingroup rpmds * Create, load and initialize a dependency set of size 1. @@ -146,7 +146,7 @@ rpmds rpmdsThis(Header h, rpmTag tagN, int32_t Flags); * @param Flags comparison flags * @return new dependency set */ -rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int32_t Flags); +rpmds rpmdsSingle(rpm_tag_t tagN, const char * N, const char * EVR, int32_t Flags); /** \ingroup rpmds * Return dependency set count. @@ -203,7 +203,7 @@ int32_t rpmdsFlags(const rpmds ds); * @param ds dependency set * @return current dependency type, 0 on invalid */ -rpmTag rpmdsTagN(const rpmds ds); +rpm_tag_t rpmdsTagN(const rpmds ds); /** \ingroup rpmds * Return dependency build time. diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 234f2fdfd..100052ee2 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -1145,7 +1145,7 @@ static inline unsigned char nibble(char c) if (hge((_h), (_tag), NULL, (void **) &(_data), NULL)) \ _data = xstrdup(_data) -rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, int scareMem) +rpmfi rpmfiNew(const rpmts ts, Header h, rpm_tag_t tagN, int scareMem) { HGE_t hge = (scareMem ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry); @@ -1441,7 +1441,7 @@ exit: if (fcp) *fcp = ac; } -void rpmfiBuildFDeps(Header h, rpmTag tagN, +void rpmfiBuildFDeps(Header h, rpm_tag_t tagN, const char *** fdepsp, rpm_count_t * fcp) { int scareMem = 0; @@ -1536,7 +1536,7 @@ exit: if (fcp) *fcp = ac; } -void rpmfiBuildFNames(Header h, rpmTag tagN, +void rpmfiBuildFNames(Header h, rpm_tag_t tagN, const char *** fnp, rpm_count_t * fcp) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -1547,8 +1547,8 @@ void rpmfiBuildFNames(Header h, rpmTag tagN, rpm_count_t count; const char ** fileNames; int size; - rpmTag dirNameTag = 0; - rpmTag dirIndexesTag = 0; + rpm_tag_t dirNameTag = 0; + rpm_tag_t dirIndexesTag = 0; rpmTagType bnt, dnt; char * t; int i, xx; diff --git a/lib/rpmfi.h b/lib/rpmfi.h index ebce59fa7..c5df627c9 100644 --- a/lib/rpmfi.h +++ b/lib/rpmfi.h @@ -342,7 +342,7 @@ rpmfi rpmfiFree(rpmfi fi); * @param scareMem Use pointers to refcounted header memory? * @return new file info set */ -rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, int scareMem); +rpmfi rpmfiNew(const rpmts ts, Header h, rpm_tag_t tagN, int scareMem); /** \ingroup rpmfi * Retrieve file classes from header. @@ -367,7 +367,7 @@ void rpmfiBuildFClasses(Header h, * @retval *fdepsp array of file dependencies * @retval *fcp number of files */ -void rpmfiBuildFDeps(Header h, rpmTag tagN, +void rpmfiBuildFDeps(Header h, rpm_tag_t tagN, const char *** fdepsp, rpm_count_t * fcp); /** \ingroup rpmfi @@ -387,7 +387,7 @@ void rpmfiBuildFDeps(Header h, rpmTag tagN, * @retval *fnp array of file names * @retval *fcp number of files */ -void rpmfiBuildFNames(Header h, rpmTag tagN, +void rpmfiBuildFNames(Header h, rpm_tag_t tagN, const char *** fnp, rpm_count_t * fcp); /** \ingroup rpmfi diff --git a/lib/rpmfi_internal.h b/lib/rpmfi_internal.h index 4d51e1e77..831f0bd16 100644 --- a/lib/rpmfi_internal.h +++ b/lib/rpmfi_internal.h @@ -25,7 +25,7 @@ struct rpmfi_s { const char * Type; /*!< Tag name. */ - rpmTag tagN; /*!< Header tag. */ + rpm_tag_t tagN; /*!< Header tag. */ Header h; /*!< Header for file info set (or NULL) */ /*?null?*/ diff --git a/lib/rpmgi.c b/lib/rpmgi.c index 0cc5fd7eb..f9e7fa9a1 100644 --- a/lib/rpmgi.c +++ b/lib/rpmgi.c @@ -26,7 +26,7 @@ rpmgiFlags giFlags = RPMGI_NONE; */ struct rpmgi_s { rpmts ts; /*!< Iterator transaction set. */ - int tag; /*!< Iterator type. */ + rpm_tag_t tag; /*!< Iterator type. */ const void * keyp; /*!< Iterator key. */ size_t keylen; /*!< Iterator key length. */ @@ -339,7 +339,7 @@ fprintf(stderr, "*** gi %p\tmi %p\n", gi, gi->mi); if (gi->argv != NULL) for (av = (const char **) gi->argv; *av != NULL; av++) { - int tag = RPMTAG_NAME; + rpm_tag_t tag = RPMTAG_NAME; const char * pat; char * a, * ae; @@ -350,7 +350,7 @@ fprintf(stderr, "*** gi %p\tmi %p\n", gi, gi->mi); if ((ae = strchr(a, '=')) != NULL) { *ae++ = '\0'; tag = rpmTagGetValue(a); - if (tag < 0) { + if (tag == RPMTAG_NOT_FOUND) { rpmlog(RPMLOG_NOTICE, _("unknown tag: \"%s\"\n"), a); res = 1; } @@ -432,7 +432,7 @@ rpmgi rpmgiFree(rpmgi gi) return NULL; } -rpmgi rpmgiNew(rpmts ts, int tag, const void * keyp, size_t keylen) +rpmgi rpmgiNew(rpmts ts, rpm_tag_t tag, const void * keyp, size_t keylen) { rpmgi gi = xcalloc(1, sizeof(*gi)); diff --git a/lib/rpmgi.h b/lib/rpmgi.h index 42cadf7c7..4596c1101 100644 --- a/lib/rpmgi.h +++ b/lib/rpmgi.h @@ -74,7 +74,7 @@ rpmgi rpmgiFree(rpmgi gi); * @param keylen key data length (0 will use strlen(keyp)) * @return new iterator */ -rpmgi rpmgiNew(rpmts ts, int tag, const void * keyp, +rpmgi rpmgiNew(rpmts ts, rpm_tag_t tag, const void * keyp, size_t keylen); /** \ingroup rpmgi diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 6f7b9f848..8fa41e85d 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -204,7 +204,7 @@ typedef * @retval c address of number of values (or NULL) * @return 1 on success, 0 on failure */ -typedef int (*HGE_t) (Header h, rpmTag tag, +typedef int (*HGE_t) (Header h, rpm_tag_t tag, rpmTagType * type, void ** p, rpm_count_t * c); @@ -224,7 +224,7 @@ typedef int (*HGE_t) (Header h, rpmTag tag, * @param c number of values * @return 1 on success, 0 on failure */ -typedef int (*HAE_t) (Header h, rpmTag tag, rpmTagType type, +typedef int (*HAE_t) (Header h, rpm_tag_t tag, rpmTagType type, const void * p, rpm_count_t c); /** @@ -238,7 +238,7 @@ typedef int (*HAE_t) (Header h, rpmTag tag, rpmTagType type, * @param c number of values * @return 1 on success, 0 on failure */ -typedef int (*HME_t) (Header h, rpmTag tag, rpmTagType type, +typedef int (*HME_t) (Header h, rpm_tag_t tag, rpmTagType type, const void * p, rpm_count_t c); /** @@ -251,7 +251,7 @@ typedef int (*HME_t) (Header h, rpmTag tag, rpmTagType type, * @param tag tag * @return 0 on success, 1 on failure (INCONSISTENT) */ -typedef int (*HRE_t) (Header h, int32_t tag); +typedef int (*HRE_t) (Header h, rpm_tag_t tag); /** * We pass these around as an array with a sentinel. diff --git a/lib/rpmtag.h b/lib/rpmtag.h index d2c899931..b06583019 100644 --- a/lib/rpmtag.h +++ b/lib/rpmtag.h @@ -275,6 +275,7 @@ typedef enum rpmTag_e { } rpmTag; #define RPMTAG_EXTERNAL_TAG 1000000 +#define RPMTAG_NOT_FOUND -1 /** \ingroup rpmtag @@ -282,20 +283,20 @@ typedef enum rpmTag_e { * @param tag tag value * @return tag name, "(unknown)" on not found */ -const char * rpmTagGetName(int tag); +const char * rpmTagGetName(rpm_tag_t tag); /** \ingroup rpmtag * Return tag data type from value. * @param tag tag value * @return tag data type, RPM_NULL_TYPE on not found. */ -int rpmTagGetType(int tag); +int rpmTagGetType(rpm_tag_t tag); /** \ingroup rpmtag * Return tag value from name. * @param tagstr name of tag * @return tag value, -1 on not found */ -int rpmTagGetValue(const char * tagstr); +rpm_tag_t rpmTagGetValue(const char * tagstr); #endif /* _RPMTAG_H */ diff --git a/lib/rpmte.c b/lib/rpmte.c index bbbe6dd1f..1fe8c3a1e 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -470,7 +470,7 @@ fnpyKey rpmteKey(rpmte te) return (te != NULL ? te->key : NULL); } -rpmds rpmteDS(rpmte te, rpmTag tag) +rpmds rpmteDS(rpmte te, rpm_tag_t tag) { if (te == NULL) return NULL; @@ -493,7 +493,7 @@ rpmds rpmteDS(rpmte te, rpmTag tag) return NULL; } -rpmfi rpmteFI(rpmte te, rpmTag tag) +rpmfi rpmteFI(rpmte te, rpm_tag_t tag) { if (te == NULL) return NULL; @@ -504,7 +504,7 @@ rpmfi rpmteFI(rpmte te, rpmTag tag) return NULL; } -void rpmteColorDS(rpmte te, rpmTag tag) +void rpmteColorDS(rpmte te, rpm_tag_t tag) { rpmfi fi = rpmteFI(te, RPMTAG_BASENAMES); rpmds ds = rpmteDS(te, tag); diff --git a/lib/rpmte.h b/lib/rpmte.h index fd0724bd5..82d7bcaca 100644 --- a/lib/rpmte.h +++ b/lib/rpmte.h @@ -346,7 +346,7 @@ fnpyKey rpmteKey(rpmte te); * @param tag dependency tag * @return dependency tag set */ -rpmds rpmteDS(rpmte te, rpmTag tag); +rpmds rpmteDS(rpmte te, rpm_tag_t tag); /** \ingroup rpmte * Retrieve file info tag set from transaction element. @@ -354,14 +354,14 @@ rpmds rpmteDS(rpmte te, rpmTag tag); * @param tag file info tag (RPMTAG_BASENAMES) * @return file info tag set */ -rpmfi rpmteFI(rpmte te, rpmTag tag); +rpmfi rpmteFI(rpmte te, rpm_tag_t tag); /** \ingroup rpmte * Calculate transaction element dependency colors/refs from file info. * @param te transaction element * @param tag dependency tag (RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME) */ -void rpmteColorDS(rpmte te, rpmTag tag); +void rpmteColorDS(rpmte te, rpm_tag_t tag); /** \ingroup rpmte * Return transaction element index. diff --git a/lib/rpmts.c b/lib/rpmts.c index 88c5f9a11..5dede5909 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -179,7 +179,7 @@ static int isArch(const char * arch) } /* keyp might no be defined. */ -rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, +rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpm_tag_t rpmtag, const void * keyp, size_t keylen) { rpmdbMatchIterator mi; @@ -601,7 +601,7 @@ int rpmtsSolve(rpmts ts, rpmds ds, const void * data) Header h; size_t bhnamelen; time_t bhtime; - rpmTag rpmtag; + rpm_tag_t rpmtag; const char * keyp; size_t keylen; int rc = 1; /* assume not found */ @@ -1143,9 +1143,9 @@ int32_t rpmtsSetTid(rpmts ts, int32_t tid) return otid; } -int32_t rpmtsSigtag(const rpmts ts) +rpm_tag_t rpmtsSigtag(const rpmts ts) { - int32_t sigtag = 0; + rpm_tag_t sigtag = 0; if (ts != NULL) sigtag = ts->sigtag; return sigtag; @@ -1175,8 +1175,8 @@ size_t rpmtsSiglen(const rpmts ts) return siglen; } -int rpmtsSetSig(rpmts ts, - int32_t sigtag, int32_t sigtype, const void * sig, size_t siglen) +int rpmtsSetSig(rpmts ts, rpm_tag_t sigtag, int32_t sigtype, + const void * sig, size_t siglen) { if (ts != NULL) { if (ts->sig && ts->sigtype) diff --git a/lib/rpmts.h b/lib/rpmts.h index 881c5c825..a4323867c 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -281,7 +281,7 @@ int rpmtsVerifyDB(rpmts ts); * @param keylen key data length (0 will use strlen(keyp)) * @return NULL on failure */ -rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, +rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpm_tag_t rpmtag, const void * keyp, size_t keylen); /** \ingroup rpmts @@ -520,7 +520,7 @@ int32_t rpmtsSetTid(rpmts ts, int32_t tid); * @param ts transaction set * @return signature tag */ -int32_t rpmtsSigtag(const rpmts ts); +rpm_tag_t rpmtsSigtag(const rpmts ts); /** \ingroup rpmts * Get signature tag type. @@ -553,7 +553,7 @@ size_t rpmtsSiglen(const rpmts ts); * @return 0 always */ int rpmtsSetSig(rpmts ts, - int32_t sigtag, int32_t sigtype, + rpm_tag_t sigtag, int32_t sigtype, const void * sig, size_t siglen); /** \ingroup rpmts diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h index a437193b1..49757c3c6 100644 --- a/lib/rpmts_internal.h +++ b/lib/rpmts_internal.h @@ -97,7 +97,7 @@ struct rpmts_s { rpmVSFlags vsflags; /*!< Signature/digest verification flags. */ const char * fn; /*!< Current package fn. */ - int32_t sigtag; /*!< Current package signature tag. */ + rpm_tag_t sigtag; /*!< Current package signature tag. */ int32_t sigtype; /*!< Current package signature data type. */ const void * sig; /*!< Current package signature. */ int32_t siglen; /*!< Current package signature length. */ diff --git a/lib/signature.c b/lib/signature.c index 977e78c4e..b4efb8882 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -218,7 +218,7 @@ rpmRC rpmReadSignature(FD_t fd, Header * sighp, sigType sig_type, (void) memcpy(info, dataEnd, REGION_TAG_COUNT); /* XXX Really old packages have HEADER_IMAGE, not HEADER_SIGNATURES. */ if (info->tag == htonl(RPMTAG_HEADERIMAGE)) { - int32_t stag = htonl(RPMTAG_HEADERSIGNATURES); + rpm_tag_t stag = htonl(RPMTAG_HEADERSIGNATURES); info->tag = stag; memcpy(dataEnd, &stag, sizeof(stag)); } @@ -1088,7 +1088,7 @@ verifyRSASignature(rpmts ts, char * t, #ifdef NOTYET int32_t siglen = rpmtsSiglen(ts); #endif - int32_t sigtag = rpmtsSigtag(ts); + rpm_tag_t sigtag = rpmtsSigtag(ts); pgpDig dig = rpmtsDig(ts); pgpDigParams sigp = rpmtsSignature(ts); SECOidTag sigalg; @@ -1236,7 +1236,7 @@ verifyDSASignature(rpmts ts, char * t, #ifdef NOTYET int32_t siglen = rpmtsSiglen(ts); #endif - int32_t sigtag = rpmtsSigtag(ts); + rpm_tag_t sigtag = rpmtsSigtag(ts); pgpDig dig = rpmtsDig(ts); pgpDigParams sigp = rpmtsSignature(ts); rpmRC res; @@ -1325,7 +1325,7 @@ rpmVerifySignature(const rpmts ts, char * result) { const void * sig = rpmtsSig(ts); int32_t siglen = rpmtsSiglen(ts); - int32_t sigtag = rpmtsSigtag(ts); + rpm_tag_t sigtag = rpmtsSigtag(ts); pgpDig dig = rpmtsDig(ts); rpmRC res; @@ -10,7 +10,7 @@ extern int _rpmds_debug; int main(int argc, char *argv[]) { - rpmTag tagN = RPMTAG_REQUIRENAME; + rpm_tag_t tagN = RPMTAG_REQUIRENAME; rpmds ds = NULL; rpmds dsA; rpmds dsA1; @@ -84,7 +84,7 @@ main(int argc, char *argv[]) rpmts ts = NULL; rpmVSFlags vsflags; rpmgi gi = NULL; - int gitag = RPMDBI_PACKAGES; + rpm_tag_t gitag = RPMDBI_PACKAGES; const char ** av; int ac; int rc = 0; @@ -98,7 +98,7 @@ main(int argc, char *argv[]) if (gitagstr != NULL) { gitag = rpmTagGetValue(gitagstr); - if (gitag < 0) { + if (gitag == RPMTAG_NOT_FOUND) { fprintf(stderr, _("unknown --tag argument: %s\n"), gitagstr); exit(EXIT_FAILURE); } diff --git a/python/header-py.c b/python/header-py.c index da2086ee5..bc799d2d6 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -143,7 +143,8 @@ static PyObject * hdrKeyList(hdrObject * s) { PyObject * list, *o; HeaderIterator hi; - int tag, type; + rpm_tag_t tag; + int type; list = PyList_New(0); @@ -330,7 +331,7 @@ static void hdr_dealloc(hdrObject * s) /** \ingroup py_c */ -long tagNumFromPyObject (PyObject *item) +rpm_tag_t tagNumFromPyObject (PyObject *item) { char * str; @@ -340,7 +341,7 @@ long tagNumFromPyObject (PyObject *item) str = PyString_AsString(item); return rpmTagGetValue(str); } - return -1; + return RPMTAG_NOT_FOUND; } /** \ingroup py_c @@ -356,7 +357,7 @@ long tagNumFromPyObject (PyObject *item) * @retval c address of number of values * @return 0 on success, 1 on bad magic, 2 on error */ -static int dressedHeaderGetEntry(Header h, int32_t tag, int32_t *type, +static int dressedHeaderGetEntry(Header h, rpm_tag_t tag, int32_t *type, void **p, rpm_count_t *c) { switch (tag) { @@ -407,7 +408,8 @@ static int dressedHeaderGetEntry(Header h, int32_t tag, int32_t *type, */ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) { - int tagtype, type, tag = -1; + int tagtype, type; + rpm_tag_t tag = RPMTAG_NOT_FOUND; rpm_count_t count, i; void * data; PyObject * o, * metao; @@ -422,7 +424,7 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) ext = PyCObject_AsVoidPtr(item); else tag = tagNumFromPyObject (item); - if (tag == -1 && PyString_Check(item)) { + if (tag == RPMTAG_NOT_FOUND && PyString_Check(item)) { /* if we still don't have the tag, go looking for the header extensions */ str = PyString_AsString(item); @@ -439,7 +441,7 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) if (ext) { ext->u.tagFunction(s->h, &type, (const void **) &data, &count, &freeData); } else { - if (tag == -1) { + if (tag == RPMTAG_NOT_FOUND) { PyErr_SetString(PyExc_KeyError, "unknown header tag"); return NULL; } @@ -773,7 +775,8 @@ int rpmMergeHeaders(PyObject * list, FD_t fd, int matchTag) int32_t * oldMatch; hdrObject * hdr; rpm_count_t c, count = 0; - int type, tag; + rpm_tag_t tag; + int type; void * p; Py_BEGIN_ALLOW_THREADS diff --git a/python/header-py.h b/python/header-py.h index 5410d721d..ecfb54a34 100644 --- a/python/header-py.h +++ b/python/header-py.h @@ -21,7 +21,7 @@ hdrObject * hdr_Wrap(Header h); Header hdrGetHeader(hdrObject * h); -long tagNumFromPyObject (PyObject *item); +rpm_tag_t tagNumFromPyObject (PyObject *item); PyObject * labelCompare (PyObject * self, PyObject * args); PyObject * versionCompare (PyObject * self, PyObject * args, PyObject * kwds); diff --git a/python/rpmdb-py.c b/python/rpmdb-py.c index c07350ea3..2ce60889f 100644 --- a/python/rpmdb-py.c +++ b/python/rpmdb-py.c @@ -109,7 +109,7 @@ rpmdb_Match (rpmdbObject * s, PyObject * args, PyObject * kwds) PyObject *TagN = NULL; char *key = NULL; int len = 0; - int tag = RPMDBI_PACKAGES; + rpm_tag_t tag = RPMDBI_PACKAGES; char * kwlist[] = {"tagNumber", "key", "len", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Ozi", kwlist, diff --git a/python/rpmds-py.c b/python/rpmds-py.c index a7a3179e5..00363ccab 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -212,7 +212,7 @@ rpmds_iternext(rpmdsObject * s) if (rpmdsNext(s->ds) >= 0) { const char * N = rpmdsN(s->ds); const char * EVR = rpmdsEVR(s->ds); - int tagN = rpmdsTagN(s->ds); + rpm_tag_t tagN = rpmdsTagN(s->ds); int Flags = rpmdsFlags(s->ds); if (N != NULL) N = xstrdup(N); @@ -451,7 +451,7 @@ static int rpmds_init(rpmdsObject * s, PyObject *args, PyObject *kwds) { hdrObject * ho = NULL; PyObject * to = NULL; - int tagN = RPMTAG_REQUIRENAME; + rpm_tag_t tagN = RPMTAG_REQUIRENAME; int flags = 0; char * kwlist[] = {"header", "tag", "flags", NULL}; @@ -591,7 +591,7 @@ rpmdsObject * rpmds_Single(PyObject * s, PyObject * args, PyObject * kwds) { PyObject * to = NULL; - int tagN = RPMTAG_PROVIDENAME; + rpm_tag_t tagN = RPMTAG_PROVIDENAME; const char * N; const char * EVR = NULL; int Flags = 0; @@ -618,7 +618,7 @@ hdr_dsFromHeader(PyObject * s, PyObject * args, PyObject * kwds) { hdrObject * ho = (hdrObject *)s; PyObject * to = NULL; - rpmTag tagN = RPMTAG_REQUIRENAME; + rpm_tag_t tagN = RPMTAG_REQUIRENAME; int flags = 0; char * kwlist[] = {"to", "flags", NULL}; @@ -640,7 +640,7 @@ rpmdsObject * hdr_dsOfHeader(PyObject * s) { hdrObject * ho = (hdrObject *)s; - int tagN = RPMTAG_PROVIDENAME; + rpm_tag_t tagN = RPMTAG_PROVIDENAME; int Flags = RPMSENSE_EQUAL; return rpmds_Wrap( rpmdsThis(hdrGetHeader(ho), tagN, Flags) ); diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index 5508d5a88..580b2b574 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -398,7 +398,7 @@ static int rpmfi_init(rpmfiObject * s, PyObject *args, PyObject *kwds) hdrObject * ho = NULL; PyObject * to = NULL; rpmts ts = NULL; /* XXX FIXME: fiFromHeader should be a ts method. */ - int tagN = RPMTAG_BASENAMES; + rpm_tag_t tagN = RPMTAG_BASENAMES; int flags = 0; char * kwlist[] = {"header", "tag", "flags", NULL}; @@ -539,7 +539,7 @@ hdr_fiFromHeader(PyObject * s, PyObject * args, PyObject * kwds) hdrObject * ho = (hdrObject *)s; PyObject * to = NULL; rpmts ts = NULL; /* XXX FIXME: fiFromHeader should be a ts method. */ - rpmTag tagN = RPMTAG_BASENAMES; + rpm_tag_t tagN = RPMTAG_BASENAMES; int flags = 0; char * kwlist[] = {"tag", "flags", NULL}; diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c index 783be04d2..0017ce81e 100644 --- a/python/rpmmi-py.c +++ b/python/rpmmi-py.c @@ -138,7 +138,7 @@ rpmmi_Pattern(rpmmiObject * s, PyObject * args, PyObject * kwds) PyObject *TagN = NULL; int type; char * pattern; - rpmTag tag; + rpm_tag_t tag; char * kwlist[] = {"tag", "type", "patern", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ois:Pattern", kwlist, diff --git a/python/rpmmodule.c b/python/rpmmodule.c index 3bfd97465..4bfa1e013 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -349,6 +349,8 @@ void init_rpm(void) PyDict_SetItemString(d, #val, o=PyInt_FromLong( val )); \ Py_DECREF(o); + REGISTER_ENUM(RPMTAG_NOT_FOUND); + REGISTER_ENUM(RPMFILE_STATE_NORMAL); REGISTER_ENUM(RPMFILE_STATE_REPLACED); REGISTER_ENUM(RPMFILE_STATE_NOTINSTALLED); diff --git a/python/rpmte-py.c b/python/rpmte-py.c index cc8db45f5..b9eae475b 100644 --- a/python/rpmte-py.c +++ b/python/rpmte-py.c @@ -188,7 +188,7 @@ rpmte_DS(rpmteObject * s, PyObject * args, PyObject * kwds) { PyObject * TagN = NULL; rpmds ds; - rpmTag tag; + rpm_tag_t tag; char * kwlist[] = {"tag", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:DS", kwlist, &TagN)) @@ -218,7 +218,7 @@ rpmte_FI(rpmteObject * s, PyObject * args, PyObject * kwds) { PyObject * TagN = NULL; rpmfi fi; - rpmTag tag; + rpm_tag_t tag; char * kwlist[] = {"tag", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:FI", kwlist, &TagN)) diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 55957584b..af6e71cc5 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -502,7 +502,7 @@ static PyObject * rpmts_IDTXload(rpmtsObject * s) { PyObject * result = NULL; - rpmTag tag = RPMTAG_INSTALLTID; + rpm_tag_t tag = RPMTAG_INSTALLTID; IDTX idtx; if (_rpmts_debug) @@ -542,7 +542,7 @@ static PyObject * rpmts_IDTXglob(rpmtsObject * s) { PyObject * result = NULL; - rpmTag tag = RPMTAG_REMOVETID; + rpm_tag_t tag = RPMTAG_REMOVETID; const char * globstr; IDTX idtx; @@ -1256,7 +1256,7 @@ rpmts_Match(rpmtsObject * s, PyObject * args, PyObject * kwds) /* XXX lkey *must* be a 32 bit integer, int "works" on all known platforms. */ int lkey = 0; int len = 0; - int tag = RPMDBI_PACKAGES; + rpm_tag_t tag = RPMDBI_PACKAGES; char * kwlist[] = {"tagNumber", "key", NULL}; if (_rpmts_debug) 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)); } diff --git a/tools/rpminject.c b/tools/rpminject.c index de4499e53..5b823e8a2 100644 --- a/tools/rpminject.c +++ b/tools/rpminject.c @@ -497,8 +497,7 @@ main(int argc, char *argv[]) ncmds++; } c->tagval = rpmTagGetValue(optArg); - if (!((c->tagval >= RPMTAG_NAME && c->tagval < RPMTAG_FIRSTFREE_TAG) - || c->tagval >= RPMTAG_EXTERNAL_TAG)) + if (c->tagval == RPMTAG_NOT_FOUND) errx(EXIT_FAILURE, _("unknown rpm tag \"--tag %s\""), optArg); c->tag = xstrdup(optArg); break; |