diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-12-13 20:35:33 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-12-13 20:35:33 +0200 |
commit | 1e96ead46670088e6b867cc989eadbef092d5864 (patch) | |
tree | 6a884ee7056ff9d8ceb3161dd0b1b758c0a078a2 | |
parent | 7e56c6355bea552d89e8d5d0a317763a8cee4a4f (diff) | |
download | rpm-1e96ead46670088e6b867cc989eadbef092d5864.tar.gz rpm-1e96ead46670088e6b867cc989eadbef092d5864.tar.bz2 rpm-1e96ead46670088e6b867cc989eadbef092d5864.zip |
Use rpm_tagtype_t everywhere for rpm (header) tagtype type
- typedef'ed as uint32_t, doesn't matter much but negative types dont exist
- easy to grep, easy to change...
- define RPM_FORCEFREE_TYPE instead of -1 "magic" for forcing
headerFreeData (ugh), easier to grep for and change than "-1"
-rw-r--r-- | build/files.c | 4 | ||||
-rw-r--r-- | build/pack.c | 2 | ||||
-rw-r--r-- | build/parsePreamble.c | 4 | ||||
-rw-r--r-- | build/reqprov.c | 4 | ||||
-rw-r--r-- | lib/formats.c | 46 | ||||
-rw-r--r-- | lib/idtx.c | 4 | ||||
-rw-r--r-- | lib/legacy.c | 4 | ||||
-rw-r--r-- | lib/package.c | 10 | ||||
-rw-r--r-- | lib/psm.c | 22 | ||||
-rw-r--r-- | lib/rpmchecksig.c | 10 | ||||
-rw-r--r-- | lib/rpmds.c | 14 | ||||
-rw-r--r-- | lib/rpmfi.c | 30 | ||||
-rw-r--r-- | lib/rpminstall.c | 2 | ||||
-rw-r--r-- | lib/rpmlib.h | 10 | ||||
-rw-r--r-- | lib/rpmtag.h | 2 | ||||
-rw-r--r-- | lib/rpmts.c | 8 | ||||
-rw-r--r-- | lib/rpmts.h | 4 | ||||
-rw-r--r-- | lib/rpmts_internal.h | 2 | ||||
-rw-r--r-- | lib/signature.c | 2 | ||||
-rw-r--r-- | python/header-py.c | 8 | ||||
-rw-r--r-- | rpmdb/fprint.c | 2 | ||||
-rw-r--r-- | rpmdb/hdrNVR.c | 4 | ||||
-rw-r--r-- | rpmdb/header.c | 60 | ||||
-rw-r--r-- | rpmdb/header.h | 35 | ||||
-rw-r--r-- | rpmdb/header_common.c | 16 | ||||
-rw-r--r-- | rpmdb/header_internal.c | 2 | ||||
-rw-r--r-- | rpmdb/header_internal.h | 6 | ||||
-rw-r--r-- | rpmdb/header_method.h | 16 | ||||
-rw-r--r-- | rpmdb/rpmdb.c | 12 | ||||
-rw-r--r-- | rpmdb/tagname.c | 8 | ||||
-rw-r--r-- | tools/rpminject.c | 17 |
31 files changed, 187 insertions, 183 deletions
diff --git a/build/files.c b/build/files.c index f45fcf7dd..dc428a325 100644 --- a/build/files.c +++ b/build/files.c @@ -239,7 +239,7 @@ static void timeCheck(int tc, Header h) HFD_t hfd = headerFreeData; int * mtime; const char ** files; - rpmTagType fnt; + rpm_tagtype_t fnt; rpm_count_t count, x; time_t currentTime = time(NULL); @@ -2018,7 +2018,7 @@ exit: void initSourceHeader(rpmSpec spec) { HeaderIterator hi; - int32_t type; + rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; const void * ptr; diff --git a/build/pack.c b/build/pack.c index 2ba457780..db6228302 100644 --- a/build/pack.c +++ b/build/pack.c @@ -563,7 +563,7 @@ exit: /* XXX Fish the pkgid out of the signature header. */ if (sig != NULL && pkgidp != NULL) { - int32_t tagType; + rpm_tagtype_t tagType; unsigned char * MD5 = NULL; rpm_count_t c; int xx; diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 7c8d7996b..2da6d148a 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -192,7 +192,7 @@ static int isMemberInEntry(Header h, const char *name, rpm_tag_t tag) HGE_t hge = (HGE_t)headerGetEntryMinMemory; HFD_t hfd = headerFreeData; const char ** names; - rpmTagType type; + rpm_tagtype_t type; rpm_count_t count; if (!hge(h, tag, &type, (void **)&names, &count)) @@ -427,7 +427,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpm_tag_t tag, char ** array; int multiToken = 0; rpmsenseFlags tagflags; - rpmTagType type; + rpm_tagtype_t type; int len; rpm_count_t num; int rc; diff --git a/build/reqprov.c b/build/reqprov.c index b024fafb6..2f65a0bd8 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -15,7 +15,7 @@ int addReqProv(rpmSpec spec, Header h, rpm_tag_t tagN, HGE_t hge = (HGE_t)headerGetEntryMinMemory; HFD_t hfd = headerFreeData; const char ** names; - rpmTagType dnt; + rpm_tagtype_t dnt; rpm_tag_t nametag = 0; rpm_tag_t versiontag = 0; rpm_tag_t flagtag = 0; @@ -63,7 +63,7 @@ int addReqProv(rpmSpec spec, Header h, rpm_tag_t tagN, /* Check for duplicate dependencies. */ if (hge(h, nametag, &dnt, (void **) &names, &len)) { const char ** versions = NULL; - rpmTagType dvt = RPM_STRING_ARRAY_TYPE; + rpm_tagtype_t dvt = RPM_STRING_ARRAY_TYPE; int *flags = NULL; int *indexes = NULL; int duplicate = 0; diff --git a/lib/formats.c b/lib/formats.c index db0c27588..9eb702efa 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -24,7 +24,7 @@ * @param element (unused) * @return formatted string */ -static char * triggertypeFormat(int32_t type, const void * data, +static char * triggertypeFormat(rpm_tagtype_t type, const void * data, char * formatPrefix, int padding, int element) { @@ -55,7 +55,7 @@ static char * triggertypeFormat(int32_t type, const void * data, * @param element (unused) * @return formatted string */ -static char * permsFormat(int32_t type, const void * data, +static char * permsFormat(rpm_tagtype_t type, const void * data, char * formatPrefix, int padding, int element) { char * val; @@ -83,7 +83,7 @@ static char * permsFormat(int32_t type, const void * data, * @param element (unused) * @return formatted string */ -static char * fflagsFormat(int32_t type, const void * data, +static char * fflagsFormat(rpm_tagtype_t type, const void * data, char * formatPrefix, int padding, int element) { char * val; @@ -129,7 +129,7 @@ static char * fflagsFormat(int32_t type, const void * data, * @param element no. bytes of binary data * @return formatted string */ -static char * armorFormat(int32_t type, const void * data, +static char * armorFormat(rpm_tagtype_t type, const void * data, char * formatPrefix, int padding, int element) { @@ -177,7 +177,7 @@ static char * armorFormat(int32_t type, const void * data, * @param element * @return formatted string */ -static char * base64Format(int32_t type, const void * data, +static char * base64Format(rpm_tagtype_t type, const void * data, char * formatPrefix, int padding, int element) { char * val; @@ -253,7 +253,7 @@ static char * xmlstrcpy(char * t, const char * s) * @param element (unused) * @return formatted string */ -static char * xmlFormat(int32_t type, const void * data, +static char * xmlFormat(rpm_tagtype_t type, const void * data, char * formatPrefix, int padding, int element) { @@ -343,7 +343,7 @@ static char * xmlFormat(int32_t type, const void * data, * @param element (unused) * @return formatted string */ -static char * pgpsigFormat(int32_t type, const void * data, +static char * pgpsigFormat(rpm_tagtype_t type, const void * data, char * formatPrefix, int padding, int element) { @@ -450,7 +450,7 @@ static char * pgpsigFormat(int32_t type, const void * data, * @param element (unused) * @return formatted string */ -static char * depflagsFormat(int32_t type, const void * data, +static char * depflagsFormat(rpm_tagtype_t type, const void * data, char * formatPrefix, int padding, int element) { char * val; @@ -512,14 +512,14 @@ static int fsnamesTag( Header h, int32_t * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int instprefixTag(Header h, rpmTagType * type, +static int instprefixTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; HFD_t hfd = headerFreeData; - rpmTagType ipt; + rpm_tagtype_t ipt; char ** array; if (hge(h, RPMTAG_INSTALLPREFIX, type, (void **)data, count)) { @@ -545,7 +545,7 @@ static int instprefixTag(Header h, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int fssizesTag(Header h, rpmTagType * type, +static int fssizesTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { @@ -595,13 +595,13 @@ static int fssizesTag(Header h, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int triggercondsTag(Header h, rpmTagType * type, +static int triggercondsTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; HFD_t hfd = headerFreeData; - rpmTagType tnt, tvt, tst; + rpm_tagtype_t tnt, tvt, tst; int32_t * indices, * flags; char ** names, ** versions; rpm_count_t numNames, numScripts; @@ -668,13 +668,13 @@ static int triggercondsTag(Header h, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int triggertypeTag(Header h, rpmTagType * type, +static int triggertypeTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; HFD_t hfd = headerFreeData; - rpmTagType tst; + rpm_tagtype_t tst; int32_t * indices, * flags; const char ** conds; const char ** s; @@ -726,7 +726,7 @@ static int triggertypeTag(Header h, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int filenamesTag(Header h, rpmTagType * type, +static int filenamesTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { @@ -745,7 +745,7 @@ static int filenamesTag(Header h, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int fileclassTag(Header h, rpmTagType * type, +static int fileclassTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { @@ -764,7 +764,7 @@ static int fileclassTag(Header h, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int fileprovideTag(Header h, rpmTagType * type, +static int fileprovideTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { @@ -783,7 +783,7 @@ static int fileprovideTag(Header h, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int filerequireTag(Header h, rpmTagType * type, +static int filerequireTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { @@ -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, rpm_tag_t tag, rpmTagType * type, +static int i18nTag(Header h, rpm_tag_t tag, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { @@ -904,7 +904,7 @@ static int i18nTag(Header h, rpm_tag_t tag, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int summaryTag(Header h, rpmTagType * type, +static int summaryTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { @@ -920,7 +920,7 @@ static int summaryTag(Header h, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int descriptionTag(Header h, rpmTagType * type, +static int descriptionTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { @@ -936,7 +936,7 @@ static int descriptionTag(Header h, rpmTagType * type, * @retval *freeData data-was-malloc'ed indicator * @return 0 on success */ -static int groupTag(Header h, rpmTagType * type, +static int groupTag(Header h, rpm_tagtype_t* type, const void ** data, rpm_count_t * count, int * freeData) { diff --git a/lib/idtx.c b/lib/idtx.c index eb81769d6..026c152a7 100644 --- a/lib/idtx.c +++ b/lib/idtx.c @@ -76,7 +76,7 @@ IDTX IDTXload(rpmts ts, rpm_tag_t tag) (void) rpmdbSetIteratorRE(mi, RPMTAG_NAME, RPMMIRE_DEFAULT, '!gpg-pubkey'); #endif while ((h = rpmdbNextIterator(mi)) != NULL) { - rpmTagType type = RPM_NULL_TYPE; + rpm_tagtype_t type = RPM_NULL_TYPE; rpm_count_t count = 0; int32_t * tidp; @@ -125,7 +125,7 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpm_tag_t tag) if (xx == 0) for (i = 0; i < ac; i++) { - rpmTagType type; + rpm_tagtype_t type; rpm_count_t count; int isSource; diff --git a/lib/legacy.c b/lib/legacy.c index 4241282ab..709a9250d 100644 --- a/lib/legacy.c +++ b/lib/legacy.c @@ -33,7 +33,7 @@ void compressFilelist(Header h) const char ** dirNames; const char ** baseNames; uint32_t * dirIndexes; - rpmTagType fnt; + rpm_tagtype_t fnt; rpm_count_t count, i; int xx; int dirIndex = -1; @@ -147,7 +147,7 @@ void providePackageNVR(Header h) int32_t pFlags = RPMSENSE_EQUAL; const char ** provides = NULL; const char ** providesEVR = NULL; - rpmTagType pnt, pvt; + rpm_tagtype_t pnt, pvt; int32_t * provideFlags = NULL; rpm_count_t providesCount, i; int xx; diff --git a/lib/package.c b/lib/package.c index 2f36162d8..eac595b84 100644 --- a/lib/package.c +++ b/lib/package.c @@ -87,7 +87,7 @@ void headerMergeLegacySigs(Header h, const Header sigh) HFD_t hfd = (HFD_t) headerFreeData; HAE_t hae = (HAE_t) headerAddEntry; HeaderIterator hi; - int32_t type; + rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; const void * ptr; @@ -171,7 +171,7 @@ Header headerRegenSigHeader(const Header h, int noArchiveSize) HeaderIterator hi; rpm_count_t count; rpm_tag_t tag, stag; - int32_t type; + rpm_tagtype_t type; const void * ptr; int xx; @@ -684,7 +684,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp) rpmlead l = NULL; Header sigh = NULL; rpm_tag_t sigtag; - int32_t sigtype; + rpm_tagtype_t sigtype; const void * sig; rpm_count_t siglen; rpmtsOpX opx; @@ -825,7 +825,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp) goto exit; } { void * uh = NULL; - int32_t uht; + rpm_tagtype_t uht; rpm_count_t uhc; if (!headerGetEntry(h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc)) @@ -852,7 +852,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp) } case RPMSIGTAG_SHA1: { void * uh = NULL; - int32_t uht; + rpm_tagtype_t uht; rpm_count_t uhc; if (!headerGetEntry(h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc)) @@ -102,7 +102,7 @@ const char ** argv; int32_t * i32p; } body; char numbuf[32]; - rpmTagType type; + rpm_tagtype_t type; for (tagm = tagMacros; tagm->macroname != NULL; tagm++) { if (!hge(h, tagm->tag, &type, (void **) &body, NULL)) @@ -285,7 +285,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, } /* XXX FIXME: can't do endian neutral MD5 verification yet. */ -fi->fmd5s = hfd(fi->fmd5s, -1); +fi->fmd5s = hfd(fi->fmd5s, RPM_FORCEFREE_TYPE); /* XXX FIXME: don't do per-file mapping, force global flags. */ fi->fmapflags = _free(fi->fmapflags); @@ -338,7 +338,7 @@ fi->fmd5s = hfd(fi->fmd5s, -1); int sourcelen = strlen(_sourcedir) + 2; char * t; - fi->dnl = hfd(fi->dnl, -1); + fi->dnl = hfd(fi->dnl, RPM_FORCEFREE_TYPE); fi->dc = 2; fi->dnl = xmalloc(fi->dc * sizeof(*fi->dnl) @@ -583,7 +583,7 @@ static rpmRC runScript(rpmpsm psm, Header h, rpm_tag_t stag, int argc = 0; const char ** prefixes = NULL; rpm_count_t numPrefixes; - rpmTagType ipt; + rpm_tagtype_t ipt; const char * oldPrefix; int maxPrefixLength; int len; @@ -910,7 +910,7 @@ static rpmRC runInstScript(rpmpsm psm) void ** progArgv; rpm_count_t progArgc; const char ** argv; - rpmTagType ptt, stt; + rpm_tagtype_t ptt, stt; const char * script; rpmRC rc = RPMRC_OK; int xx; @@ -980,7 +980,7 @@ static rpmRC handleOneTrigger(const rpmpsm psm, (void) rpmdsSetNoPromote(trigger, 1); while ((i = rpmdsNext(trigger)) >= 0) { - rpmTagType tit, tst, tpt; + rpm_tagtype_t tit, tst, tpt; const char * Name; int32_t Flags = rpmdsFlags(trigger); @@ -1097,7 +1097,7 @@ static rpmRC runImmedTriggers(rpmpsm psm) const char ** triggerNames; rpm_count_t numTriggers, numTriggerIndices; rpm_count_t * triggerIndices; - rpmTagType tnt, tit; + rpm_tagtype_t tnt, tit; unsigned char * triggersRun; rpmRC rc = RPMRC_OK; @@ -1476,7 +1476,7 @@ assert(psm->mi == NULL); /* Regenerate original header. */ { void * uh = NULL; - int32_t uht; + rpm_tagtype_t uht; rpm_count_t uhc; if (headerGetEntry(fi->h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc)) { @@ -1486,7 +1486,7 @@ assert(psm->mi == NULL); if (headerGetEntry(fi->h, RPMTAG_HEADERIMAGE, &uht, &uh, &uhc)) { HeaderIterator hi; - int32_t type; + rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; hPTR_t ptr; @@ -1818,8 +1818,8 @@ assert(psm->mi == NULL); psm->rpmio_flags = _free(psm->rpmio_flags); psm->failedFile = _free(psm->failedFile); - fi->fgroup = hfd(fi->fgroup, -1); - fi->fuser = hfd(fi->fuser, -1); + fi->fgroup = hfd(fi->fgroup, RPM_FORCEFREE_TYPE); + fi->fuser = hfd(fi->fuser, RPM_FORCEFREE_TYPE); fi->apath = _free(fi->apath); fi->fstates = _free(fi->fstates); break; diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c index 3fb805948..100f7b813 100644 --- a/lib/rpmchecksig.c +++ b/lib/rpmchecksig.c @@ -124,7 +124,7 @@ exit: static int getSignid(Header sig, rpm_tag_t sigtag, pgpKeyID_t signid) { void * pkt = NULL; - int32_t pkttyp = 0; + rpm_tagtype_t pkttyp = 0; rpm_count_t pktlen = 0; int rc = 1; @@ -162,7 +162,7 @@ static int rpmReSign(rpmts ts, Header sigh = NULL; const char * msg; void * uh = NULL; - int32_t uht; + rpm_tagtype_t uht; rpm_count_t uhc; int res = EXIT_FAILURE; int deleting = (qva->qva_mode == RPMSIGN_DEL_SIGNATURE); @@ -218,7 +218,7 @@ static int rpmReSign(rpmts ts, /* Dump the immutable region (if present). */ if (headerGetEntry(sigh, RPMTAG_HEADERSIGNATURES, &uht, &uh, &uhc)) { HeaderIterator hi; - int32_t type; + rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; hPTR_t ptr; @@ -478,7 +478,7 @@ static int readFile(FD_t fd, const char * fn, pgpDig dig) if (headerIsEntry(h, RPMTAG_HEADERIMMUTABLE)) { void * uh; - int32_t uht; + rpm_tagtype_t uht; rpm_count_t uhc; if (!headerGetEntry(h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc) @@ -523,7 +523,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, char missingKeys[7164], * m; char untrustedKeys[7164], * u; rpm_tag_t sigtag; - int32_t sigtype; + rpm_tagtype_t sigtype; const void * sig; pgpDig dig; pgpDigParams sigp; diff --git a/lib/rpmds.c b/lib/rpmds.c index 2dce7d462..322c54045 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -36,7 +36,7 @@ struct rpmds_s { int32_t * Refs; /*!< No. of file refs. */ int32_t BT; /*!< Package build time tie breaker. */ rpm_tag_t tagN; /*!< Header tag. */ - rpmTagType Nt, EVRt, Ft; /*!< Tag data types. */ + rpm_tagtype_t Nt, EVRt, Ft; /*!< Tag data types. */ int32_t Count; /*!< No. of elements */ int i; /*!< Element index. */ unsigned l; /*!< Low element (bsearch). */ @@ -123,13 +123,13 @@ rpmds rpmdsNew(Header h, rpm_tag_t tagN, int flags) HGE_t hge = (scareMem ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry); rpm_tag_t tagBT = RPMTAG_BUILDTIME; - rpmTagType BTt; + rpm_tagtype_t BTt; int32_t * BTp; rpm_tag_t tagEVR, tagF; rpmds ds = NULL; const char * Type; const char ** N; - rpmTagType Nt; + rpm_tagtype_t Nt; rpm_count_t Count; if (tagN == RPMTAG_PROVIDENAME) { @@ -298,9 +298,9 @@ rpmds rpmdsThis(Header h, rpm_tag_t tagN, int32_t Flags) ds->tagN = tagN; ds->Count = 1; ds->N = N; - ds->Nt = -1; /* XXX to insure that hfd will free */ + ds->Nt = RPM_FORCEFREE_TYPE; /* XXX to insure that hfd will free */ ds->EVR = EVR; - ds->EVRt = -1; /* XXX to insure that hfd will free */ + ds->EVRt = RPM_FORCEFREE_TYPE; /* XXX to insure that hfd will free */ ds->Flags = xmalloc(sizeof(*ds->Flags)); ds->Flags[0] = Flags; ds->i = 0; { char pre[2]; @@ -345,9 +345,9 @@ rpmds rpmdsSingle(rpm_tag_t tagN, const char * N, const char * EVR, int32_t Flag } ds->Count = 1; ds->N = xmalloc(sizeof(*ds->N)); ds->N[0] = N; - ds->Nt = -1; /* XXX to insure that hfd will free */ + ds->Nt = RPM_FORCEFREE_TYPE; /* XXX to insure that hfd will free */ ds->EVR = xmalloc(sizeof(*ds->EVR)); ds->EVR[0] = EVR; - ds->EVRt = -1; /* XXX to insure that hfd will free */ + ds->EVRt = RPM_FORCEFREE_TYPE; /* XXX to insure that hfd will free */ ds->Flags = xmalloc(sizeof(*ds->Flags)); ds->Flags[0] = Flags; ds->i = 0; { char t[2]; diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 100052ee2..2e369252a 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -629,7 +629,7 @@ Header relocateFileList(const rpmts ts, rpmfi fi, rpmRelocation * relocations = NULL; int numRelocations; const char ** validRelocations; - rpmTagType validType; + rpm_tagtype_t validType; const char ** baseNames; const char ** dirNames; uint32_t * dirIndexes; @@ -1003,7 +1003,7 @@ dColors[j] |= fColors[i]; if (nrelocated) { rpm_count_t c; void * d; - rpmTagType t; + rpm_tagtype_t t; d = NULL; xx = hge(h, RPMTAG_BASENAMES, &t, &d, &c); @@ -1061,18 +1061,18 @@ fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, fi->Type, fi->fc); fi->posttransprog = _free(fi->posttransprog); if (fi->fc > 0) { - fi->bnl = hfd(fi->bnl, -1); - fi->dnl = hfd(fi->dnl, -1); + fi->bnl = hfd(fi->bnl, RPM_FORCEFREE_TYPE); + fi->dnl = hfd(fi->dnl, RPM_FORCEFREE_TYPE); - fi->flinks = hfd(fi->flinks, -1); - fi->flangs = hfd(fi->flangs, -1); - fi->fmd5s = hfd(fi->fmd5s, -1); + fi->flinks = hfd(fi->flinks, RPM_FORCEFREE_TYPE); + fi->flangs = hfd(fi->flangs, RPM_FORCEFREE_TYPE); + fi->fmd5s = hfd(fi->fmd5s, RPM_FORCEFREE_TYPE); fi->md5s = _free(fi->md5s); - fi->cdict = hfd(fi->cdict, -1); + fi->cdict = hfd(fi->cdict, RPM_FORCEFREE_TYPE); - fi->fuser = hfd(fi->fuser, -1); - fi->fgroup = hfd(fi->fgroup, -1); + fi->fuser = hfd(fi->fuser, RPM_FORCEFREE_TYPE); + fi->fgroup = hfd(fi->fgroup, RPM_FORCEFREE_TYPE); fi->fstates = _free(fi->fstates); @@ -1101,10 +1101,10 @@ fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, fi->Type, fi->fc); fi->apath = _free(fi->apath); fi->fmapflags = _free(fi->fmapflags); - fi->obnl = hfd(fi->obnl, -1); - fi->odnl = hfd(fi->odnl, -1); + fi->obnl = hfd(fi->obnl, RPM_FORCEFREE_TYPE); + fi->odnl = hfd(fi->odnl, RPM_FORCEFREE_TYPE); - fi->fcontexts = hfd(fi->fcontexts, -1); + fi->fcontexts = hfd(fi->fcontexts, RPM_FORCEFREE_TYPE); fi->actions = _free(fi->actions); fi->replacedSizes = _free(fi->replacedSizes); @@ -1263,7 +1263,7 @@ if (fi->actions == NULL) for (j = 0; j < 16; j++, t++, fmd5 += 2) *t = (nibble(fmd5[0]) << 4) | nibble(fmd5[1]); } - fi->fmd5s = hfd(fi->fmd5s, -1); + fi->fmd5s = hfd(fi->fmd5s, RPM_FORCEFREE_TYPE); } /* XXX TR_REMOVED doesn;t need fmtimes, frdevs, finodes, or fcontexts */ @@ -1549,7 +1549,7 @@ void rpmfiBuildFNames(Header h, rpm_tag_t tagN, int size; rpm_tag_t dirNameTag = 0; rpm_tag_t dirIndexesTag = 0; - rpmTagType bnt, dnt; + rpm_tagtype_t bnt, dnt; char * t; int i, xx; diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 16aac5281..c0841b35c 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -473,7 +473,7 @@ if (fileURL[0] == '=') { if (eiu->relocations) { const char ** paths; - int pft; + rpm_tagtype_t pft; rpm_count_t c; if (headerGetEntry(eiu->h, RPMTAG_PREFIXES, &pft, diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 8fa41e85d..730d13a35 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -184,11 +184,11 @@ void rpmFreeRpmrc(void); * Prototype for headerFreeData() vector. * * @param data address of data (or NULL) - * @param type type of data (or -1 to force free) + * @param type type of data (or to force free) * @return NULL always */ typedef - void * (*HFD_t) (const void * data, rpmTagType type); + void * (*HFD_t) (const void * data, rpm_tagtype_t type); /** * Prototype for headerGetEntry() vector. @@ -205,7 +205,7 @@ typedef * @return 1 on success, 0 on failure */ typedef int (*HGE_t) (Header h, rpm_tag_t tag, - rpmTagType * type, + rpm_tagtype_t * type, void ** p, rpm_count_t * c); @@ -224,7 +224,7 @@ typedef int (*HGE_t) (Header h, rpm_tag_t tag, * @param c number of values * @return 1 on success, 0 on failure */ -typedef int (*HAE_t) (Header h, rpm_tag_t tag, rpmTagType type, +typedef int (*HAE_t) (Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); /** @@ -238,7 +238,7 @@ typedef int (*HAE_t) (Header h, rpm_tag_t tag, rpmTagType type, * @param c number of values * @return 1 on success, 0 on failure */ -typedef int (*HME_t) (Header h, rpm_tag_t tag, rpmTagType type, +typedef int (*HME_t) (Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); /** diff --git a/lib/rpmtag.h b/lib/rpmtag.h index b06583019..7664bbbe0 100644 --- a/lib/rpmtag.h +++ b/lib/rpmtag.h @@ -290,7 +290,7 @@ const char * rpmTagGetName(rpm_tag_t tag); * @param tag tag value * @return tag data type, RPM_NULL_TYPE on not found. */ -int rpmTagGetType(rpm_tag_t tag); +rpm_tagtype_t rpmTagGetType(rpm_tag_t tag); /** \ingroup rpmtag * Return tag value from name. diff --git a/lib/rpmts.c b/lib/rpmts.c index 5dede5909..fdc753c85 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -298,7 +298,7 @@ fprintf(stderr, "*** free pkt %p[%d] id %08x %08x\n", ts->pkpkt, ts->pkpktlen, p mi = rpmtsInitIterator(ts, RPMTAG_PUBKEYS, sigp->signid, sizeof(sigp->signid)); while ((h = rpmdbNextIterator(mi)) != NULL) { const char ** pubkeys; - int32_t pt; + rpm_tagtype_t pt; rpm_count_t pc; if (!headerGetEntry(h, RPMTAG_PUBKEYS, &pt, (void **)&pubkeys, &pc)) @@ -1151,9 +1151,9 @@ rpm_tag_t rpmtsSigtag(const rpmts ts) return sigtag; } -int32_t rpmtsSigtype(const rpmts ts) +rpm_tagtype_t rpmtsSigtype(const rpmts ts) { - int32_t sigtype = 0; + rpm_tagtype_t sigtype = 0; if (ts != NULL) sigtype = ts->sigtype; return sigtype; @@ -1175,7 +1175,7 @@ size_t rpmtsSiglen(const rpmts ts) return siglen; } -int rpmtsSetSig(rpmts ts, rpm_tag_t sigtag, int32_t sigtype, +int rpmtsSetSig(rpmts ts, rpm_tag_t sigtag, rpm_tagtype_t sigtype, const void * sig, size_t siglen) { if (ts != NULL) { diff --git a/lib/rpmts.h b/lib/rpmts.h index a4323867c..17ff2af59 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -527,7 +527,7 @@ rpm_tag_t rpmtsSigtag(const rpmts ts); * @param ts transaction set * @return signature tag type */ -int32_t rpmtsSigtype(const rpmts ts); +rpm_tagtype_t rpmtsSigtype(const rpmts ts); /** \ingroup rpmts * Get signature tag data, i.e. from header. @@ -553,7 +553,7 @@ size_t rpmtsSiglen(const rpmts ts); * @return 0 always */ int rpmtsSetSig(rpmts ts, - rpm_tag_t sigtag, int32_t sigtype, + rpm_tag_t sigtag, rpm_tagtype_t sigtype, const void * sig, size_t siglen); /** \ingroup rpmts diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h index 49757c3c6..147ff709a 100644 --- a/lib/rpmts_internal.h +++ b/lib/rpmts_internal.h @@ -98,7 +98,7 @@ struct rpmts_s { const char * fn; /*!< Current package fn. */ rpm_tag_t sigtag; /*!< Current package signature tag. */ - int32_t sigtype; /*!< Current package signature data type. */ + rpm_tagtype_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 b4efb8882..029c4c3cd 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -638,7 +638,7 @@ static int makeHDRSignature(Header sigh, const char * file, int32_t sigTag, if (headerIsEntry(h, RPMTAG_HEADERIMMUTABLE)) { DIGEST_CTX ctx; void * uh; - int32_t uht; + rpm_tagtype_t uht; rpm_count_t uhc; if (!headerGetEntry(h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc) diff --git a/python/header-py.c b/python/header-py.c index bc799d2d6..e3f93605a 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -144,7 +144,7 @@ static PyObject * hdrKeyList(hdrObject * s) PyObject * list, *o; HeaderIterator hi; rpm_tag_t tag; - int type; + rpm_tagtype_t type; list = PyList_New(0); @@ -357,7 +357,7 @@ rpm_tag_t 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, rpm_tag_t tag, int32_t *type, +static int dressedHeaderGetEntry(Header h, rpm_tag_t tag, rpm_tagtype_t *type, void **p, rpm_count_t *c) { switch (tag) { @@ -408,7 +408,7 @@ static int dressedHeaderGetEntry(Header h, rpm_tag_t tag, int32_t *type, */ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) { - int tagtype, type; + rpm_tagtype_t tagtype, type; rpm_tag_t tag = RPMTAG_NOT_FOUND; rpm_count_t count, i; void * data; @@ -776,7 +776,7 @@ int rpmMergeHeaders(PyObject * list, FD_t fd, int matchTag) hdrObject * hdr; rpm_count_t c, count = 0; rpm_tag_t tag; - int type; + rpm_tagtype_t type; void * p; Py_BEGIN_ALLOW_THREADS diff --git a/rpmdb/fprint.c b/rpmdb/fprint.c index d32e1086f..46392e5fd 100644 --- a/rpmdb/fprint.c +++ b/rpmdb/fprint.c @@ -244,7 +244,7 @@ void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList); HGE_t hge = (HGE_t)headerGetEntryMinMemory; HFD_t hfd = headerFreeData; const char ** baseNames, ** dirNames; - rpmTagType bnt, dnt; + rpm_tagtype_tbnt, dnt; uint32_t * dirIndexes; int fileCount; int xx; diff --git a/rpmdb/hdrNVR.c b/rpmdb/hdrNVR.c index 398e326b9..5a215b45c 100644 --- a/rpmdb/hdrNVR.c +++ b/rpmdb/hdrNVR.c @@ -8,7 +8,7 @@ int headerNVR(Header h, const char **np, const char **vp, const char **rp) { - int type; + rpm_tagtype_t type; rpm_count_t count; if (np) { @@ -33,7 +33,7 @@ int headerNEVRA(Header h, const char **np, const char **ep, const char **vp, const char **rp, const char **ap) { - int type; + rpm_tagtype_t type; rpm_count_t count; headerNVR(h, np, vp, rp); diff --git a/rpmdb/header.c b/rpmdb/header.c index e3ece2b37..a143ef780 100644 --- a/rpmdb/header.c +++ b/rpmdb/header.c @@ -276,7 +276,7 @@ unsigned int _headerSizeof(Header h, enum hMagic magicp) for (i = 0, entry = h->index; i < h->indexUsed; i++, entry++) { unsigned diff; - int32_t type; + rpm_tagtype_t type; /* Regions go in as is ... */ if (ENTRY_IS_REGION(entry)) { @@ -316,7 +316,7 @@ unsigned int _headerSizeof(Header h, enum hMagic magicp) * @param pend pointer to end of data (or NULL) * @return no. bytes in data, -1 on failure */ -static int dataLength(int32_t type, hPTR_t p, rpm_count_t count, int onDisk, +static int dataLength(rpm_tagtype_t type, hPTR_t p, rpm_count_t count, int onDisk, hPTR_t pend) { const unsigned char * s = p; @@ -411,7 +411,7 @@ static int regionSwab(indexEntry entry, int il, int dl, memset(&ieprev, 0, sizeof(ieprev)); for (; il > 0; il--, pe++) { struct indexEntry_s ie; - int32_t type; + rpm_tagtype_t type; ie.info.tag = ntohl(pe->tag); ie.info.type = ntohl(pe->type); @@ -529,7 +529,7 @@ static void * doHeaderUnload(Header h, int32_t il = 0; int32_t dl = 0; indexEntry entry; - int32_t type; + rpm_tagtype_t type; int i; int drlen, ndribbles; int driplen, ndrips; @@ -778,7 +778,7 @@ void * _headerUnload(Header h) * @return header entry */ static -indexEntry findEntry(Header h, rpm_tag_t tag, int32_t type) +indexEntry findEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type) { indexEntry entry, entry2, last; struct indexEntry_s key; @@ -1197,7 +1197,7 @@ int _headerIsEntry(Header h, rpm_tag_t tag) * @return 1 on success, otherwise error. */ static int copyEntry(const indexEntry entry, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c, int minMem) @@ -1431,7 +1431,7 @@ headerFindI18NString(Header h, indexEntry entry) * @return 1 on success, 0 on not found */ static int intGetEntry(Header h, rpm_tag_t tag, - int32_t * type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c, int minMem) @@ -1473,7 +1473,7 @@ static int intGetEntry(Header h, rpm_tag_t tag, * @return NULL always */ static void * _headerFreeTag(Header h, - const void * data, rpmTagType type) + const void * data, rpm_tagtype_t type) { if (data) { if (type == -1 || @@ -1500,7 +1500,7 @@ static void * _headerFreeTag(Header h, */ static int _headerGetEntry(Header h, rpm_tag_t tag, - hTYP_t type, + rpm_tagtype_t * type, void ** p, rpm_count_t * c) { @@ -1521,14 +1521,14 @@ int _headerGetEntry(Header h, rpm_tag_t tag, */ static int _headerGetEntryMinMemory(Header h, rpm_tag_t tag, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c) { return intGetEntry(h, tag, type, p, c, 1); } -int headerGetRawEntry(Header h, rpm_tag_t tag, int32_t * type, hPTR_t * p, +int headerGetRawEntry(Header h, rpm_tag_t tag, rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c) { indexEntry entry; @@ -1553,7 +1553,7 @@ int headerGetRawEntry(Header h, rpm_tag_t tag, int32_t * type, hPTR_t * p, /** */ -static void copyData(int32_t type, void * dstPtr, const void * srcPtr, +static void copyData(rpm_tagtype_t type, void * dstPtr, const void * srcPtr, rpm_count_t cnt, int dataLength) { switch (type) { @@ -1587,7 +1587,7 @@ static void copyData(int32_t type, void * dstPtr, const void * srcPtr, * @return (malloc'ed) copy of entry data, NULL on error */ static void * -grabData(int32_t type, hPTR_t p, rpm_count_t c, int * lengthPtr) +grabData(rpm_tagtype_t type, hPTR_t p, rpm_count_t c, int * lengthPtr) { void * data = NULL; int length; @@ -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, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) +int _headerAddEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c) { indexEntry entry; void * data; @@ -1675,7 +1675,7 @@ int _headerAddEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_c * @return 1 on success, 0 on failure */ static -int _headerAppendEntry(Header h, rpm_tag_t tag, int32_t type, +int _headerAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c) { indexEntry entry; @@ -1723,7 +1723,7 @@ int _headerAppendEntry(Header h, rpm_tag_t tag, int32_t type, * @return 1 on success, 0 on failure */ static -int _headerAddOrAppendEntry(Header h, rpm_tag_t tag, int32_t type, +int _headerAddOrAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c) { return (findEntry(h, tag, type) @@ -1886,7 +1886,7 @@ int _headerAddI18NString(Header h, rpm_tag_t tag, const char * string, * @return 1 on success, 0 on failure */ static -int _headerModifyEntry(Header h, rpm_tag_t tag, int32_t type, +int _headerModifyEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c) { indexEntry entry; @@ -2032,7 +2032,7 @@ HeaderIterator _headerInitIterator(Header h) static int _headerNextIterator(HeaderIterator hi, rpm_tag_t * tag, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c) { @@ -2072,7 +2072,7 @@ Header _headerCopy(Header h) { Header nh = _headerNew(); HeaderIterator hi; - int32_t type; + rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; hPTR_t ptr; @@ -2149,7 +2149,7 @@ static sprintfToken hsaNext(headerSprintfArgs hsa) hsa->i++; } else { rpm_tag_t tagno; - int32_t type; + rpm_tagtype_t type; rpm_count_t count; if (!_headerNextIterator(hsa->hi, &tagno, &type, NULL, &count)) @@ -2647,7 +2647,7 @@ static int parseExpression(headerSprintfArgs hsa, sprintfToken token, * @return 0 on success, 1 on failure */ static int getExtension(headerSprintfArgs hsa, headerTagTagFunction fn, - hTYP_t typeptr, + rpm_tagtype_t * typeptr, hPTR_t * data, rpm_count_t * countptr, rpmec ec) @@ -2678,7 +2678,7 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element) size_t need = 0; char * t, * te; char buf[20]; - int32_t type; + rpm_tagtype_t type; rpm_count_t count; hPTR_t data; unsigned int intVal; @@ -2841,7 +2841,7 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token, char * t, * te; int i, j; int numElements; - int32_t type; + rpm_tagtype_t type; rpm_count_t count; sprintfToken spft; int condNumFormats; @@ -3114,7 +3114,7 @@ exit: * @param element (unused) * @return formatted string */ -static char * octalFormat(int32_t type, hPTR_t data, +static char * octalFormat(rpm_tagtype_t type, hPTR_t data, char * formatPrefix, int padding,int element) { char * val; @@ -3139,7 +3139,7 @@ static char * octalFormat(int32_t type, hPTR_t data, * @param element (unused) * @return formatted string */ -static char * hexFormat(int32_t type, hPTR_t data, +static char * hexFormat(rpm_tagtype_t type, hPTR_t data, char * formatPrefix, int padding,int element) { char * val; @@ -3157,7 +3157,7 @@ static char * hexFormat(int32_t type, hPTR_t data, /** */ -static char * realDateFormat(int32_t type, hPTR_t data, +static char * realDateFormat(rpm_tagtype_t type, hPTR_t data, char * formatPrefix, int padding,int element, const char * strftimeFormat) { @@ -3194,7 +3194,7 @@ static char * realDateFormat(int32_t type, hPTR_t data, * @param element (unused) * @return formatted string */ -static char * dateFormat(int32_t type, hPTR_t data, +static char * dateFormat(rpm_tagtype_t type, hPTR_t data, char * formatPrefix, int padding, int element) { return realDateFormat(type, data, formatPrefix, padding, element, @@ -3210,7 +3210,7 @@ static char * dateFormat(int32_t type, hPTR_t data, * @param element (unused) * @return formatted string */ -static char * dayFormat(int32_t type, hPTR_t data, +static char * dayFormat(rpm_tagtype_t type, hPTR_t data, char * formatPrefix, int padding, int element) { return realDateFormat(type, data, formatPrefix, padding, element, @@ -3226,7 +3226,7 @@ static char * dayFormat(int32_t type, hPTR_t data, * @param element (unused) * @return formatted string */ -static char * shescapeFormat(int32_t type, hPTR_t data, +static char * shescapeFormat(rpm_tagtype_t type, hPTR_t data, char * formatPrefix, int padding,int element) { char * result, * dst, * src, * buf; @@ -3286,7 +3286,7 @@ void _headerCopyTags(Header headerFrom, Header headerTo, rpm_tag_t * tagstocopy) for (p = tagstocopy; *p != 0; p++) { char *s; - int32_t type; + rpm_tagtype_t type; rpm_count_t count; if (_headerIsEntry(headerTo, *p)) continue; diff --git a/rpmdb/header.h b/rpmdb/header.h index f8dd86bcb..1d49a2113 100644 --- a/rpmdb/header.h +++ b/rpmdb/header.h @@ -92,10 +92,10 @@ typedef const char * errmsg_t; /** \ingroup header */ -typedef int32_t * hTYP_t; typedef const void * hPTR_t; typedef int32_t rpm_tag_t; +typedef uint32_t rpm_tagtype_t; typedef uint32_t rpm_count_t; /** \ingroup header @@ -112,8 +112,8 @@ typedef struct headerIterator_s * HeaderIterator; typedef struct headerTagTableEntry_s * headerTagTableEntry; struct headerTagTableEntry_s { const char * name; /*!< Tag name. */ - int val; /*!< Tag numeric value. */ - int type; /*!< Tag type. */ + rpm_tag_t val; /*!< Tag numeric value. */ + rpm_tagtype_t type; /*!< Tag type. */ }; /** @@ -141,7 +141,7 @@ enum headerSprintfExtensionType { * @param element RPM_BIN_TYPE: no. bytes of data * @return formatted string */ -typedef char * (*headerTagFormatFunction)(int32_t type, +typedef char * (*headerTagFormatFunction)(rpm_tagtype_t type, const void * data, char * formatPrefix, int padding, rpm_count_t element); @@ -157,7 +157,7 @@ typedef char * (*headerTagFormatFunction)(int32_t type, * @return 0 on success */ typedef int (*headerTagTagFunction) (Header h, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * data, rpm_count_t * count, int * freeData); @@ -207,6 +207,7 @@ typedef enum rpmTagType_e { RPM_I18NSTRING_TYPE = 9, RPM_MASK_TYPE = 0x0000ffff #define RPM_MAX_TYPE 9 +#define RPM_FORCEFREE_TYPE UINT32_MAX } rpmTagType; /** \ingroup header @@ -269,7 +270,7 @@ typedef union hRET_s { */ typedef struct HE_s { rpm_tag_t tag; - hTYP_t typ; + rpm_tagtype_t * typ; union { hPTR_t * ptr; hRET_t * ret; @@ -394,7 +395,7 @@ int headerIsEntry(Header h, rpm_tag_t tag); * @param type type of data (or -1 to force free) * @return NULL always */ -void * headerFreeTag(Header h, const void * data, rpmTagType type); +void * headerFreeTag(Header h, const void * data, rpm_tagtype_t type); /** \ingroup header * Retrieve tag value. @@ -410,7 +411,7 @@ void * headerFreeTag(Header h, const void * data, rpmTagType type); * @return 1 on success, 0 on failure */ int headerGetEntry(Header h, rpm_tag_t tag, - hTYP_t type, + rpm_tagtype_t * type, void ** p, rpm_count_t * c); @@ -427,7 +428,7 @@ int headerGetEntry(Header h, rpm_tag_t tag, * @return 1 on success, 0 on failure */ int headerGetEntryMinMemory(Header h, rpm_tag_t tag, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c); @@ -445,7 +446,7 @@ int headerGetEntryMinMemory(Header h, rpm_tag_t tag, * @param c number of values * @return 1 on success, 0 on failure */ -int headerAddEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); +int headerAddEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); /** \ingroup header * Append element to tag array in header. @@ -461,7 +462,7 @@ int headerAddEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_co * @param c number of values * @return 1 on success, 0 on failure */ -int headerAppendEntry(Header h, rpm_tag_t tag, int32_t type, +int headerAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); /** \ingroup header @@ -474,7 +475,7 @@ int headerAppendEntry(Header h, rpm_tag_t tag, int32_t type, * @param c number of values * @return 1 on success, 0 on failure */ -int headerAddOrAppendEntry(Header h, rpm_tag_t tag, int32_t type, +int headerAddOrAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); /** \ingroup header @@ -510,7 +511,7 @@ int headerAddI18NString(Header h, rpm_tag_t tag, const char * string, * @param c number of values * @return 1 on success, 0 on failure */ -int headerModifyEntry(Header h, rpm_tag_t tag, int32_t type, +int headerModifyEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); /** \ingroup header @@ -573,7 +574,7 @@ HeaderIterator headerInitIterator(Header h); */ int headerNextIterator(HeaderIterator hi, rpm_tag_t * tag, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c); @@ -585,14 +586,14 @@ int headerNextIterator(HeaderIterator hi, * @todo Remove from API. * * @param data address of data (or NULL) - * @param type type of data (or -1 to force free) + * @param type type of data (or RPM_FORCEFREE_TYPE to force free) * @return NULL always */ static inline -void * headerFreeData( const void * data, rpmTagType type) +void * headerFreeData( const void * data, rpm_tagtype_t type) { if (data) { - if (type == -1 || + if (type == RPM_FORCEFREE_TYPE || type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE || type == RPM_BIN_TYPE) diff --git a/rpmdb/header_common.c b/rpmdb/header_common.c index 233497071..20f01232d 100644 --- a/rpmdb/header_common.c +++ b/rpmdb/header_common.c @@ -102,13 +102,13 @@ int headerIsEntry(Header h, rpm_tag_t tag) } void * headerFreeTag(Header h, - const void * data, rpmTagType type) + const void * data, rpm_tagtype_t type) { return (h2hv(h)->hdrfreetag) (h, data, type); } int headerGetEntry(Header h, rpm_tag_t tag, - hTYP_t type, + rpm_tagtype_t * type, void ** p, rpm_count_t * c) { @@ -116,25 +116,25 @@ int headerGetEntry(Header h, rpm_tag_t tag, } int headerGetEntryMinMemory(Header h, rpm_tag_t tag, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c) { return (h2hv(h)->hdrgetmin) (h, tag, type, p, c); } -int headerAddEntry(Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c) +int headerAddEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c) { return (h2hv(h)->hdradd) (h, tag, type, p, c); } -int headerAppendEntry(Header h, rpm_tag_t tag, int32_t type, +int headerAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c) { return (h2hv(h)->hdrappend) (h, tag, type, p, c); } -int headerAddOrAppendEntry(Header h, rpm_tag_t tag, int32_t type, +int headerAddOrAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c) { return (h2hv(h)->hdraddorappend) (h, tag, type, p, c); @@ -146,7 +146,7 @@ int headerAddI18NString(Header h, rpm_tag_t tag, const char * string, return (h2hv(h)->hdraddi18n) (h, tag, string, lang); } -int headerModifyEntry(Header h, rpm_tag_t tag, int32_t type, +int headerModifyEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c) { return (h2hv(h)->hdrmodify) (h, tag, type, p, c); @@ -184,7 +184,7 @@ HeaderIterator headerInitIterator(Header h) int headerNextIterator(HeaderIterator hi, rpm_tag_t * tag, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c) { diff --git a/rpmdb/header_internal.c b/rpmdb/header_internal.c index 36cb84ef2..15d99f26a 100644 --- a/rpmdb/header_internal.c +++ b/rpmdb/header_internal.c @@ -11,7 +11,7 @@ char ** headerGetLangs(Header h) { char **s, *e, **table; - int type; + rpm_tagtype_t type; rpm_count_t i, count; if (!headerGetRawEntry(h, HEADER_I18NTABLE, &type, (const void **)&s, &count)) diff --git a/rpmdb/header_internal.h b/rpmdb/header_internal.h index 375c4bc45..b56831fdd 100644 --- a/rpmdb/header_internal.h +++ b/rpmdb/header_internal.h @@ -24,7 +24,7 @@ typedef struct entryInfo_s * entryInfo; struct entryInfo_s { rpm_tag_t tag; /*!< Tag identifier. */ - int32_t type; /*!< Tag data type. */ + rpm_tagtype_t type; /*!< Tag data type. */ int32_t offset; /*!< Offset into data segment (ondisk only). */ rpm_count_t count; /*!< Number of tag elements. */ }; @@ -84,7 +84,7 @@ struct sprintfTag_s { */ typedef struct rpmec_s * rpmec; struct rpmec_s { - int32_t type; + rpm_tagtype_t type; rpm_count_t count; int avail; int freeit; @@ -148,7 +148,7 @@ char ** headerGetLangs(Header h); * @return 1 on success, 0 on failure */ int headerGetRawEntry(Header h, rpm_tag_t tag, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c); diff --git a/rpmdb/header_method.h b/rpmdb/header_method.h index d16f57d54..b7c6f9ff7 100644 --- a/rpmdb/header_method.h +++ b/rpmdb/header_method.h @@ -143,7 +143,7 @@ int (*HDRisentry) (Header h, rpm_tag_t tag); */ typedef void * (*HDRfreetag) (Header h, - const void * data, rpmTagType type); + const void * data, rpm_tagtype_t type); /** \ingroup header * Retrieve tag value. @@ -160,7 +160,7 @@ void * (*HDRfreetag) (Header h, */ typedef int (*HDRget) (Header h, rpm_tag_t tag, - hTYP_t type, + rpm_tagtype_t * type, void ** p, rpm_count_t * c); @@ -178,7 +178,7 @@ int (*HDRget) (Header h, rpm_tag_t tag, */ typedef int (*HDRgetmin) (Header h, rpm_tag_t tag, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c); @@ -197,7 +197,7 @@ int (*HDRgetmin) (Header h, rpm_tag_t tag, * @return 1 on success, 0 on failure */ typedef -int (*HDRadd) (Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); +int (*HDRadd) (Header h, rpm_tag_t tag, rpm_tagtype_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, rpm_tag_t tag, int32_t type, const void * p, rpm_count_ * @return 1 on success, 0 on failure */ typedef -int (*HDRappend) (Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); +int (*HDRappend) (Header h, rpm_tag_t tag, rpm_tagtype_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, rpm_tag_t tag, int32_t type, const void * p, rpm_cou * @return 1 on success, 0 on failure */ typedef -int (*HDRaddorappend) (Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); +int (*HDRaddorappend) (Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); /** \ingroup header * Add locale specific tag to header. @@ -264,7 +264,7 @@ int (*HDRaddi18n) (Header h, rpm_tag_t tag, const char * string, * @return 1 on success, 0 on failure */ typedef -int (*HDRmodify) (Header h, rpm_tag_t tag, int32_t type, const void * p, rpm_count_t c); +int (*HDRmodify) (Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); /** \ingroup header * Delete tag in header. @@ -332,7 +332,7 @@ HeaderIterator (*HDRinititer) (Header h); typedef int (*HDRnextiter) (HeaderIterator hi, rpm_tag_t * tag, - hTYP_t type, + rpm_tagtype_t * type, hPTR_t * p, rpm_count_t * c); diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 2361ca785..2e1085d5c 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -1097,7 +1097,7 @@ static int rpmdbFindByFile(rpmdb db, const char * filespec, HFD_t hfd = headerFreeData; const char * dirName; const char * baseName; - rpmTagType bnt, dnt; + rpm_tagtype_t bnt, dnt; fingerPrintCache fpc; fingerPrint fp1; dbiIndex dbi = NULL; @@ -1842,7 +1842,7 @@ static int mireSkip (const rpmdbMatchIterator mi) int8_t * i8p; } u; char numbuf[32]; - rpmTagType t; + rpm_tagtype_t t; rpm_count_t c; miRE mire; static int32_t zero = 0; @@ -2470,7 +2470,7 @@ memset(data, 0, sizeof(*data)); dbiIndex dbi; const char *av[1]; const char ** rpmvals = NULL; - rpmTagType rpmtype = 0; + rpm_tagtype_t rpmtype = 0; rpm_count_t rpmcnt = 0; rpm_tag_t rpmtag; int xx; @@ -2703,7 +2703,7 @@ DBT * data = alloca(sizeof(*data)); HFD_t hfd = headerFreeData; sigset_t signalMask; const char ** baseNames; - rpmTagType bnt; + rpm_tagtype_t bnt; rpm_count_t count = 0; dbiIndex dbi; int dbix; @@ -2823,7 +2823,7 @@ memset(data, 0, sizeof(*data)); for (dbix = 0; dbix < dbiTagsMax; dbix++) { const char *av[1]; const char **rpmvals = NULL; - rpmTagType rpmtype = 0; + rpm_tagtype_t rpmtype = 0; rpm_count_t rpmcnt = 0; rpm_tag_t rpmtag; int32_t * requireFlags; @@ -3160,7 +3160,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */ const char ** dirNames; const char ** baseNames; const char ** fullBaseNames; - rpmTagType bnt, dnt; + rpm_tagtype_t bnt, dnt; uint32_t * dirIndexes; uint32_t * fullDirIndexes; fingerPrint * fps; diff --git a/rpmdb/tagname.c b/rpmdb/tagname.c index 655981617..de7f1b549 100644 --- a/rpmdb/tagname.c +++ b/rpmdb/tagname.c @@ -20,7 +20,7 @@ struct headerTagIndices_s { int byValueSize; /*!< no. of entries. */ int (*byValueCmp) (const void * avp, const void * bvp); /*!< compare entries by value. */ const char * (*tagName) (rpm_tag_t value); /* Return name from value. */ - int (*tagType) (rpm_tag_t value); /* Return type from value. */ + rpm_tagtype_t (*tagType) (rpm_tag_t value); /* Return type from value. */ }; /** @@ -84,7 +84,7 @@ assert(n == rpmTagTableSize); /* forward refs */ static const char * _tagName(rpm_tag_t tag); -static int _tagType(rpm_tag_t tag); +static rpm_tagtype_t _tagType(rpm_tag_t tag); static rpm_tag_t _tagValue(const char * tagstr); static struct headerTagIndices_s _rpmTags = { @@ -175,7 +175,7 @@ static const char * _tagName(rpm_tag_t tag) return nameBuf; } -static int _tagType(rpm_tag_t tag) +static rpm_tagtype_t _tagType(rpm_tag_t tag) { const struct headerTagTableEntry_s *t; int comparison, i, l, u; @@ -279,7 +279,7 @@ const char * rpmTagGetName(rpm_tag_t tag) * @param tag tag value * @return tag data type, RPM_NULL_TYPE on not found. */ -int rpmTagGetType(rpm_tag_t tag) +rpm_tagtype_t rpmTagGetType(rpm_tag_t tag) { return ((*rpmTags->tagType)(tag)); } diff --git a/tools/rpminject.c b/tools/rpminject.c index 5b823e8a2..fca32fcb2 100644 --- a/tools/rpminject.c +++ b/tools/rpminject.c @@ -41,8 +41,8 @@ static const char * pr_injmode(injmode_t injmode) enum cvtaction {CA_OLD, CA_NEW, CA_OMIT, CA_ERR}; -static enum cvtaction convertAMD(enum cvtaction ca, int32_t type, - void ** nvalsp, int32_t *ncountp, cmd_t *newc) +static enum cvtaction convertAMD(enum cvtaction ca, rpm_tagtype_t type, + void ** nvalsp, rpm_count_t *ncountp, cmd_t *newc) { int i; @@ -118,8 +118,8 @@ static enum cvtaction convertAMD(enum cvtaction ca, int32_t type, return ca; } -static enum cvtaction convertExistingAMD(int32_t tag, int32_t type, - hPTR_t valsp, int32_t *countp, void ** nvalsp, int32_t *ncountp, +static enum cvtaction convertExistingAMD(rpm_tag_t tag, rpm_tagtype_t type, + hPTR_t valsp, rpm_count_t *countp, void ** nvalsp, rpm_count_t *ncountp, cmd_t *cmds[], int ncmds) { cmd_t *newc = NULL; @@ -192,7 +192,9 @@ static enum cvtaction convertExistingAMD(int32_t tag, int32_t type, static Header headerCopyWithConvert(Header h, cmd_t *cmds[], int ncmds) { - int32_t tag, type, count; + rpm_tag_t tag; + rpm_tagtype_t type; + rpm_count_t count; hPTR_t vals; HeaderIterator headerIter; Header res = headerNew(); @@ -202,7 +204,7 @@ Header headerCopyWithConvert(Header h, cmd_t *cmds[], int ncmds) while (headerNextIterator(headerIter, &tag, &type, &vals, &count)) { enum cvtaction ca; void *nvals; - int32_t ncount; + rpm_count_t ncount; nvals = NULL; ncount = 0; @@ -296,7 +298,8 @@ headerInject(Header *hdrp, cmd_t *cmds[], int ncmds) rc = headerIsEntry(h, c->tagval); if (!rc && !c->done && c->injmode != INJ_DELETE) { - int32_t type, ncount; + rpm_tagtype_t type; + rpm_count_t ncount; void *nvals; enum cvtaction ca; |