From addac6a86be1a6c7a668f97c9d7a0d85277f6779 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 19 Dec 2007 12:05:56 +0200 Subject: [PATCH] Add rpm_data_t (and _constdata_t) for header data, use everywhere - consistent, easy to grep for and change... - bogus consts removed where spotted --- build/files.c | 8 ++--- build/pack.c | 4 +-- build/parsePreamble.c | 8 ++--- build/reqprov.c | 8 ++--- lib/depends.c | 4 +-- lib/formats.c | 66 ++++++++++++++++++++--------------------- lib/idtx.c | 4 +-- lib/legacy.c | 12 ++++---- lib/package.c | 10 +++---- lib/psm.c | 54 +++++++++++++++++----------------- lib/rpmchecksig.c | 8 ++--- lib/rpmds.c | 12 ++++---- lib/rpmfi.c | 78 ++++++++++++++++++++++++------------------------- lib/rpminstall.c | 2 +- lib/rpmlib.h | 8 ++--- lib/rpmte.c | 8 ++--- lib/rpmts.c | 12 ++++---- lib/rpmts.h | 4 +-- lib/rpmts_internal.h | 2 +- lib/signature.c | 14 ++++----- lib/transaction.c | 4 +-- python/header-py.c | 4 +-- rpm2cpio.c | 2 +- rpmdb/fprint.c | 6 ++-- rpmdb/hdrNVR.c | 12 ++++---- rpmdb/header.c | 75 ++++++++++++++++++++++++----------------------- rpmdb/header.h | 28 +++++++++--------- rpmdb/header_common.c | 17 ++++++----- rpmdb/header_internal.c | 2 +- rpmdb/header_internal.h | 6 ++-- rpmdb/header_method.h | 20 ++++++++----- rpmdb/rpmdb.c | 24 +++++++-------- tools/rpmcache.c | 6 ++-- tools/rpminject.c | 4 +-- 34 files changed, 272 insertions(+), 264 deletions(-) diff --git a/build/files.c b/build/files.c index a0d26c3..76e02b9 100644 --- a/build/files.c +++ b/build/files.c @@ -243,8 +243,8 @@ static void timeCheck(int tc, Header h) rpm_count_t count, x; time_t currentTime = time(NULL); - x = hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &files, &count); - x = hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtime, NULL); + x = hge(h, RPMTAG_OLDFILENAMES, &fnt, (rpm_data_t *) &files, &count); + x = hge(h, RPMTAG_FILEMTIMES, NULL, (rpm_data_t *) &mtime, NULL); for (x = 0; x < count; x++) { if ((currentTime - mtime[x]) > tc) @@ -1826,7 +1826,7 @@ static rpmRC processPackageFiles(rpmSpec spec, Package pkg, /* XXX spec->buildRootURL == NULL, then xstrdup("") is returned */ fl.buildRootURL = rpmGenPath(spec->rootURL, spec->buildRootURL, NULL); - if (hge(pkg->header, RPMTAG_DEFAULTPREFIX, NULL, (void **)&fl.prefix, NULL)) + if (hge(pkg->header, RPMTAG_DEFAULTPREFIX, NULL, (rpm_data_t *)&fl.prefix, NULL)) fl.prefix = xstrdup(fl.prefix); else fl.prefix = NULL; @@ -2023,7 +2023,7 @@ void initSourceHeader(rpmSpec spec) rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; - const void * ptr; + rpm_data_t ptr; spec->sourceHeader = headerNew(); /* Only specific tags are added to the source package header */ diff --git a/build/pack.c b/build/pack.c index 34a3e15..c6f3d79 100644 --- a/build/pack.c +++ b/build/pack.c @@ -151,7 +151,7 @@ static int addFileToTag(rpmSpec spec, const char * file, Header h, rpm_tag_t tag StringBuf sb = newStringBuf(); char *s; - if (hge(h, tag, NULL, (void **)&s, NULL)) { + if (hge(h, tag, NULL, (rpm_data_t *)&s, NULL)) { appendLineStringBuf(sb, s); (void) headerRemoveEntry(h, tag); } @@ -567,7 +567,7 @@ exit: unsigned char * MD5 = NULL; rpm_count_t c; int xx; - xx = headerGetEntry(sig, RPMSIGTAG_MD5, &tagType, (void **)&MD5, &c); + xx = headerGetEntry(sig, RPMSIGTAG_MD5, &tagType, (rpm_data_t *)&MD5, &c); if (tagType == RPM_BIN_TYPE && MD5 != NULL && c == 16) *pkgidp = MD5; } diff --git a/build/parsePreamble.c b/build/parsePreamble.c index fe44970..35c28c5 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -195,7 +195,7 @@ static int isMemberInEntry(Header h, const char *name, rpm_tag_t tag) rpm_tagtype_t type; rpm_count_t count; - if (!hge(h, tag, &type, (void **)&names, &count)) + if (!hge(h, tag, &type, (rpm_data_t *)&names, &count)) return -1; while (count--) { if (!xstrcasecmp(names[count], name)) @@ -313,7 +313,7 @@ static void fillOutMainPackage(Header h) if (!headerIsEntry(h, ot->ot_tag)) { char *val = rpmExpand(ot->ot_mac, NULL); if (val && *val != '%') - (void) headerAddEntry(h, ot->ot_tag, RPM_STRING_TYPE, (void *)val, 1); + (void) headerAddEntry(h, ot->ot_tag, RPM_STRING_TYPE, val, 1); val = _free(val); } } @@ -396,7 +396,7 @@ spectag stashSt(rpmSpec spec, Header h, rpm_tag_t tag, const char * lang) t->t_msgid = NULL; if (!(t->t_lang && strcmp(t->t_lang, RPMBUILD_DEFAULT_LANG))) { char *n; - if (hge(h, RPMTAG_NAME, NULL, (void **) &n, NULL)) { + if (hge(h, RPMTAG_NAME, NULL, (rpm_data_t *) &n, NULL)) { char buf[1024]; sprintf(buf, "%s(%s)", n, rpmTagGetName(tag)); t->t_msgid = xstrdup(buf); @@ -542,7 +542,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpm_tag_t tag, } break; case RPMTAG_PREFIXES: addOrAppendListEntry(pkg->header, tag, field); - xx = hge(pkg->header, tag, &type, (void **)&array, &num); + xx = hge(pkg->header, tag, &type, (rpm_data_t *)&array, &num); while (num--) { len = strlen(array[num]); if (array[num][len - 1] == '/' && len > 1) { diff --git a/build/reqprov.c b/build/reqprov.c index 2f65a0b..e205e5d 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -61,7 +61,7 @@ int addReqProv(rpmSpec spec, Header h, rpm_tag_t tagN, EVR = ""; /* Check for duplicate dependencies. */ - if (hge(h, nametag, &dnt, (void **) &names, &len)) { + if (hge(h, nametag, &dnt, (rpm_data_t *) &names, &len)) { const char ** versions = NULL; rpm_tagtype_t dvt = RPM_STRING_ARRAY_TYPE; int *flags = NULL; @@ -69,11 +69,11 @@ int addReqProv(rpmSpec spec, Header h, rpm_tag_t tagN, int duplicate = 0; if (flagtag) { - xx = hge(h, versiontag, &dvt, (void **) &versions, NULL); - xx = hge(h, flagtag, NULL, (void **) &flags, NULL); + xx = hge(h, versiontag, &dvt, (rpm_data_t *) &versions, NULL); + xx = hge(h, flagtag, NULL, (rpm_data_t *) &flags, NULL); } if (indextag) - xx = hge(h, indextag, NULL, (void **) &indexes, NULL); + xx = hge(h, indextag, NULL, (rpm_data_t *) &indexes, NULL); while (len > 0) { len--; diff --git a/lib/depends.c b/lib/depends.c index 254138a..87f381e 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -128,9 +128,9 @@ int rpmtsAddInstallElement(rpmts ts, Header h, * FIXME: only catches previously added, older packages. */ arch = NULL; - xx = hge(h, RPMTAG_ARCH, NULL, (void **)&arch, NULL); + xx = hge(h, RPMTAG_ARCH, NULL, (rpm_data_t *)&arch, NULL); os = NULL; - xx = hge(h, RPMTAG_OS, NULL, (void **)&os, NULL); + xx = hge(h, RPMTAG_OS, NULL, (rpm_data_t *)&os, NULL); hcolor = headerGetColor(h); pkgKey = RPMAL_NOMATCH; diff --git a/lib/formats.c b/lib/formats.c index e548d24..f41eb7e 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -24,7 +24,7 @@ * @param element (unused) * @return formatted string */ -static char * triggertypeFormat(rpm_tagtype_t type, const void * data, +static char * triggertypeFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { @@ -55,7 +55,7 @@ static char * triggertypeFormat(rpm_tagtype_t type, const void * data, * @param element (unused) * @return formatted string */ -static char * permsFormat(rpm_tagtype_t type, const void * data, +static char * permsFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { char * val; @@ -83,7 +83,7 @@ static char * permsFormat(rpm_tagtype_t type, const void * data, * @param element (unused) * @return formatted string */ -static char * fflagsFormat(rpm_tagtype_t type, const void * data, +static char * fflagsFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { char * val; @@ -129,7 +129,7 @@ static char * fflagsFormat(rpm_tagtype_t type, const void * data, * @param element no. bytes of binary data * @return formatted string */ -static char * armorFormat(rpm_tagtype_t type, const void * data, +static char * armorFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { @@ -179,7 +179,7 @@ static char * armorFormat(rpm_tagtype_t type, const void * data, * @param element * @return formatted string */ -static char * base64Format(rpm_tagtype_t type, const void * data, +static char * base64Format(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { char * val; @@ -255,7 +255,7 @@ static char * xmlstrcpy(char * t, const char * s) * @param element (unused) * @return formatted string */ -static char * xmlFormat(rpm_tagtype_t type, const void * data, +static char * xmlFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { @@ -346,7 +346,7 @@ static char * xmlFormat(rpm_tagtype_t type, const void * data, * @param element (unused) * @return formatted string */ -static char * pgpsigFormat(rpm_tagtype_t type, const void * data, +static char * pgpsigFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { @@ -453,7 +453,7 @@ static char * pgpsigFormat(rpm_tagtype_t type, const void * data, * @param element (unused) * @return formatted string */ -static char * depflagsFormat(rpm_tagtype_t type, const void * data, +static char * depflagsFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { char * val; @@ -491,7 +491,7 @@ static char * depflagsFormat(rpm_tagtype_t type, const void * data, * @return 0 on success */ static int fsnamesTag( Header h, int32_t * type, - void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { const char ** list; @@ -516,7 +516,7 @@ static int fsnamesTag( Header h, int32_t * type, * @return 0 on success */ static int instprefixTag(Header h, rpm_tagtype_t* type, - const void ** data, + rpm_data_t * data, rpm_count_t * count, int * freeData) { @@ -525,10 +525,10 @@ static int instprefixTag(Header h, rpm_tagtype_t* type, rpm_tagtype_t ipt; char ** array; - if (hge(h, RPMTAG_INSTALLPREFIX, type, (void **)data, count)) { + if (hge(h, RPMTAG_INSTALLPREFIX, type, (rpm_data_t *)data, count)) { if (freeData) *freeData = 0; return 0; - } else if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (void **) &array, count)) { + } else if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (rpm_data_t *) &array, count)) { if (type) *type = RPM_STRING_TYPE; if (data) *data = xstrdup(array[0]); if (freeData) *freeData = 1; @@ -549,7 +549,7 @@ static int instprefixTag(Header h, rpm_tagtype_t* type, * @return 0 on success */ static int fssizesTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -558,7 +558,7 @@ static int fssizesTag(Header h, rpm_tagtype_t* type, uint32_t * usages; rpm_count_t numFiles; - if (!hge(h, RPMTAG_FILESIZES, NULL, (void **) &filesizes, &numFiles)) { + if (!hge(h, RPMTAG_FILESIZES, NULL, (rpm_data_t *) &filesizes, &numFiles)) { filesizes = NULL; numFiles = 0; filenames = NULL; @@ -599,7 +599,7 @@ static int fssizesTag(Header h, rpm_tagtype_t* type, * @return 0 on success */ static int triggercondsTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -615,15 +615,15 @@ static int triggercondsTag(Header h, rpm_tagtype_t* type, int xx; char buf[5]; - if (!hge(h, RPMTAG_TRIGGERNAME, &tnt, (void **) &names, &numNames)) { + if (!hge(h, RPMTAG_TRIGGERNAME, &tnt, (rpm_data_t *) &names, &numNames)) { *freeData = 0; return 0; } - xx = hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, NULL); - xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL); - xx = hge(h, RPMTAG_TRIGGERVERSION, &tvt, (void **) &versions, NULL); - xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts); + xx = hge(h, RPMTAG_TRIGGERINDEX, NULL, (rpm_data_t *) &indices, NULL); + xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (rpm_data_t *) &flags, NULL); + xx = hge(h, RPMTAG_TRIGGERVERSION, &tvt, (rpm_data_t *) &versions, NULL); + xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (rpm_data_t *) &s, &numScripts); s = hfd(s, tst); *freeData = 1; @@ -672,7 +672,7 @@ static int triggercondsTag(Header h, rpm_tagtype_t* type, * @return 0 on success */ static int triggertypeTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -685,13 +685,13 @@ static int triggertypeTag(Header h, rpm_tagtype_t* type, rpm_count_t numScripts, numNames; rpm_count_t i, j; - if (!hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, &numNames)) { + if (!hge(h, RPMTAG_TRIGGERINDEX, NULL, (rpm_data_t *) &indices, &numNames)) { *freeData = 0; return 1; } - xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL); - xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts); + xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (rpm_data_t *) &flags, NULL); + xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (rpm_data_t *) &s, &numScripts); s = hfd(s, tst); *freeData = 1; @@ -730,7 +730,7 @@ static int triggertypeTag(Header h, rpm_tagtype_t* type, * @return 0 on success */ static int filenamesTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { *type = RPM_STRING_ARRAY_TYPE; @@ -749,7 +749,7 @@ static int filenamesTag(Header h, rpm_tagtype_t* type, * @return 0 on success */ static int fileclassTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { *type = RPM_STRING_ARRAY_TYPE; @@ -768,7 +768,7 @@ static int fileclassTag(Header h, rpm_tagtype_t* type, * @return 0 on success */ static int fileprovideTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { *type = RPM_STRING_ARRAY_TYPE; @@ -787,7 +787,7 @@ static int fileprovideTag(Header h, rpm_tagtype_t* type, * @return 0 on success */ static int filerequireTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { *type = RPM_STRING_ARRAY_TYPE; @@ -816,7 +816,7 @@ static const char * _macro_i18ndomains = "%{?_i18ndomains}"; * @return 0 on success */ static int i18nTag(Header h, rpm_tag_t tag, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -884,7 +884,7 @@ static int i18nTag(Header h, rpm_tag_t tag, rpm_tagtype_t* type, dstring = _free(dstring); - rc = hge(h, tag, type, (void **)data, count); + rc = hge(h, tag, type, data, count); if (rc && (*data) != NULL) { *data = xstrdup(*data); @@ -908,7 +908,7 @@ static int i18nTag(Header h, rpm_tag_t tag, rpm_tagtype_t* type, * @return 0 on success */ static int summaryTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { return i18nTag(h, RPMTAG_SUMMARY, type, data, count, freeData); @@ -924,7 +924,7 @@ static int summaryTag(Header h, rpm_tagtype_t* type, * @return 0 on success */ static int descriptionTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { return i18nTag(h, RPMTAG_DESCRIPTION, type, data, count, freeData); @@ -940,7 +940,7 @@ static int descriptionTag(Header h, rpm_tagtype_t* type, * @return 0 on success */ static int groupTag(Header h, rpm_tagtype_t* type, - const void ** data, rpm_count_t * count, + rpm_data_t * data, rpm_count_t * count, int * freeData) { return i18nTag(h, RPMTAG_GROUP, type, data, count, freeData); diff --git a/lib/idtx.c b/lib/idtx.c index 4d7e1f9..dfa898e 100644 --- a/lib/idtx.c +++ b/lib/idtx.c @@ -81,7 +81,7 @@ IDTX IDTXload(rpmts ts, rpm_tag_t tag) int32_t * tidp; tidp = NULL; - if (!hge(h, tag, &type, (void **)&tidp, &count) || tidp == NULL) + if (!hge(h, tag, &type, (rpm_data_t *)&tidp, &count) || tidp == NULL) continue; if (type == RPM_INT32_TYPE && (*tidp == 0 || *tidp == -1)) @@ -153,7 +153,7 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpm_tag_t tag) } tidp = NULL; - if (hge(h, tag, &type, (void **) &tidp, &count) && tidp != NULL) { + if (hge(h, tag, &type, (rpm_data_t *) &tidp, &count) && tidp != NULL) { idtx = IDTXgrow(idtx, 1); if (idtx == NULL || idtx->idt == NULL) diff --git a/lib/legacy.c b/lib/legacy.c index 735889d..0d29c6c 100644 --- a/lib/legacy.c +++ b/lib/legacy.c @@ -49,7 +49,7 @@ void compressFilelist(Header h) return; /* Already converted. */ } - if (!hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &fileNames, &count)) + if (!hge(h, RPMTAG_OLDFILENAMES, &fnt, (rpm_data_t *) &fileNames, &count)) return; /* no file list */ if (fileNames == NULL || count <= 0) return; @@ -159,7 +159,7 @@ void providePackageNVR(Header h) return; pEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1); *p = '\0'; - if (hge(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) { + if (hge(h, RPMTAG_EPOCH, NULL, (rpm_data_t *) &epoch, NULL)) { sprintf(p, "%d:", *epoch); while (*p != '\0') p++; @@ -170,13 +170,13 @@ void providePackageNVR(Header h) * Rpm prior to 3.0.3 does not have versioned provides. * If no provides at all are available, we can just add. */ - if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, &providesCount)) + if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (rpm_data_t *) &provides, &providesCount)) goto exit; /* * Otherwise, fill in entries on legacy packages. */ - if (!hge(h, RPMTAG_PROVIDEVERSION, &pvt, (void **) &providesEVR, NULL)) { + if (!hge(h, RPMTAG_PROVIDEVERSION, &pvt, (rpm_data_t *) &providesEVR, NULL)) { for (i = 0; i < providesCount; i++) { const char * vdummy = ""; int32_t fdummy = RPMSENSE_ANY; @@ -188,7 +188,7 @@ void providePackageNVR(Header h) goto exit; } - xx = hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL); + xx = hge(h, RPMTAG_PROVIDEFLAGS, NULL, (rpm_data_t *) &provideFlags, NULL); /* LCL: providesEVR is not NULL */ if (provides && providesEVR && provideFlags) @@ -236,7 +236,7 @@ void legacyRetrofit(Header h) * careful. This fixup makes queries give the new values though, * which is quite handy. */ - if (headerGetEntry(h, RPMTAG_DEFAULTPREFIX, NULL, (void **) &prefix, NULL)) + if (headerGetEntry(h, RPMTAG_DEFAULTPREFIX, NULL, (rpm_data_t *) &prefix, NULL)) { const char * nprefix = stripTrailingChar(alloca_strdup(prefix), '/'); (void) headerAddEntry(h, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE, diff --git a/lib/package.c b/lib/package.c index 9e10867..0db650c 100644 --- a/lib/package.c +++ b/lib/package.c @@ -90,7 +90,7 @@ void headerMergeLegacySigs(Header h, const Header sigh) rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; - const void * ptr; + rpm_data_t ptr; int xx; for (hi = headerInitIterator(sigh); @@ -172,7 +172,7 @@ Header headerRegenSigHeader(const Header h, int noArchiveSize) rpm_count_t count; rpm_tag_t tag, stag; rpm_tagtype_t type; - const void * ptr; + rpm_data_t ptr; int xx; for (hi = headerInitIterator(h); @@ -685,7 +685,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp) Header sigh = NULL; rpm_tag_t sigtag; rpm_tagtype_t sigtype; - const void * sig; + rpm_data_t sig; rpm_count_t siglen; rpmtsOpX opx; size_t nb; @@ -806,7 +806,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp) /* Retrieve the tag parameters from the signature header. */ sig = NULL; - xx = headerGetEntry(sigh, sigtag, &sigtype, (void **) &sig, &siglen); + xx = headerGetEntry(sigh, sigtag, &sigtype, &sig, &siglen); if (sig == NULL) { rc = RPMRC_FAIL; goto exit; @@ -956,7 +956,7 @@ rpmRC headerCheckPayloadFormat(Header h) { const char *payloadfmt = NULL; xx = headerGetEntry(h, RPMTAG_PAYLOADFORMAT, NULL, - (void **)&payloadfmt, NULL); + (rpm_data_t *)&payloadfmt, NULL); /* * XXX Ugh, rpm 3.x packages don't have payload format tag. Instead * of blinly allowing, should check somehow (HDRID existence or... ?) diff --git a/lib/psm.c b/lib/psm.c index f4ce17b..e8bf7ec 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -83,9 +83,9 @@ int rpmVersionCompare(Header first, Header second) static int32_t zero = 0; int rc; - if (!headerGetEntry(first, RPMTAG_EPOCH, NULL, (void **) &epochOne, NULL)) + if (!headerGetEntry(first, RPMTAG_EPOCH, NULL, (rpm_data_t *) &epochOne, NULL)) epochOne = &zero; - if (!headerGetEntry(second, RPMTAG_EPOCH, NULL, (void **) &epochTwo, NULL)) + if (!headerGetEntry(second, RPMTAG_EPOCH, NULL, (rpm_data_t *) &epochTwo, NULL)) epochTwo = &zero; if (*epochOne < *epochTwo) @@ -93,15 +93,15 @@ int rpmVersionCompare(Header first, Header second) else if (*epochOne > *epochTwo) return 1; - rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL); - rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL); + rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (rpm_data_t *) &one, NULL); + rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (rpm_data_t *) &two, NULL); rc = rpmvercmp(one, two); if (rc) return rc; - rc = headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL); - rc = headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL); + rc = headerGetEntry(first, RPMTAG_RELEASE, NULL, (rpm_data_t *) &one, NULL); + rc = headerGetEntry(second, RPMTAG_RELEASE, NULL, (rpm_data_t *) &two, NULL); return rpmvercmp(one, two); } @@ -141,7 +141,7 @@ const char ** argv; rpm_tagtype_t type; for (tagm = tagMacros; tagm->macroname != NULL; tagm++) { - if (!hge(h, tagm->tag, &type, (void **) &body, NULL)) + if (!hge(h, tagm->tag, &type, (rpm_data_t *) &body, NULL)) continue; switch (type) { case RPM_INT32_TYPE: @@ -218,7 +218,7 @@ static rpmRC markReplacedFiles(const rpmpsm psm) modified = 0; - if (!hge(h, RPMTAG_FILESTATES, NULL, (void **)&secStates, &count)) + if (!hge(h, RPMTAG_FILESTATES, NULL, (rpm_data_t *)&secStates, &count)) continue; prev = rpmdbGetIteratorOffset(mi); @@ -316,7 +316,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, if (cookie) { *cookie = NULL; - if (hge(fi->h, RPMTAG_COOKIE, NULL, (void **) cookie, NULL)) + if (hge(fi->h, RPMTAG_COOKIE, NULL, (rpm_data_t *) cookie, NULL)) *cookie = xstrdup(*cookie); } @@ -639,7 +639,7 @@ static rpmRC runScript(rpmpsm psm, Header h, rpm_tag_t stag, /* XXX FIXME: except for %verifyscript, rpmteNEVR can be used. */ xx = headerNVR(h, &n, &v, &r); - xx = hge(h, RPMTAG_ARCH, NULL, (void **) &a, NULL); + xx = hge(h, RPMTAG_ARCH, NULL, (rpm_data_t *) &a, NULL); if (progArgv && strcmp(progArgv[0], "") == 0) { #ifdef WITH_LUA @@ -719,9 +719,9 @@ static rpmRC runScript(rpmpsm psm, Header h, rpm_tag_t stag, } #endif - if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (void **) &prefixes, &numPrefixes)) { + if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (rpm_data_t *) &prefixes, &numPrefixes)) { freePrefixes = 1; - } else if (hge(h, RPMTAG_INSTALLPREFIX, NULL, (void **) &oldPrefix, NULL)) { + } else if (hge(h, RPMTAG_INSTALLPREFIX, NULL, (rpm_data_t *) &oldPrefix, NULL)) { prefixes = &oldPrefix; numPrefixes = 1; } else { @@ -943,11 +943,11 @@ static rpmRC runInstScript(rpmpsm psm) rpmfi fi = psm->fi; HGE_t hge = fi->hge; HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData); - void ** progArgv; + rpm_data_t * progArgv; rpm_count_t progArgc; const char ** argv; rpm_tagtype_t ptt, stt; - const char * script; + char * script; rpmRC rc = RPMRC_OK; int xx; @@ -955,8 +955,8 @@ static rpmRC runInstScript(rpmpsm psm) * headerGetEntry() sets the data pointer to NULL if the entry does * not exist. */ - xx = hge(fi->h, psm->scriptTag, &stt, (void **) &script, NULL); - xx = hge(fi->h, psm->progTag, &ptt, (void **) &progArgv, &progArgc); + xx = hge(fi->h, psm->scriptTag, &stt, (rpm_data_t *) &script, NULL); + xx = hge(fi->h, psm->progTag, &ptt, (rpm_data_t *) &progArgv, &progArgc); if (progArgv == NULL && script == NULL) goto exit; @@ -1035,11 +1035,11 @@ static rpmRC handleOneTrigger(const rpmpsm psm, continue; if (!( hge(triggeredH, RPMTAG_TRIGGERINDEX, &tit, - (void **) &triggerIndices, NULL) && + (rpm_data_t *) &triggerIndices, NULL) && hge(triggeredH, RPMTAG_TRIGGERSCRIPTS, &tst, - (void **) &triggerScripts, NULL) && + (rpm_data_t *) &triggerScripts, NULL) && hge(triggeredH, RPMTAG_TRIGGERSCRIPTPROG, &tpt, - (void **) &triggerProgs, NULL)) + (rpm_data_t *) &triggerProgs, NULL)) ) continue; @@ -1140,9 +1140,9 @@ static rpmRC runImmedTriggers(rpmpsm psm) if (fi->h == NULL) return rc; /* XXX can't happen */ if (!( hge(fi->h, RPMTAG_TRIGGERNAME, &tnt, - (void **) &triggerNames, &numTriggers) && + (rpm_data_t *) &triggerNames, &numTriggers) && hge(fi->h, RPMTAG_TRIGGERINDEX, &tit, - (void **) &triggerIndices, &numTriggerIndices)) + (rpm_data_t *) &triggerIndices, &numTriggerIndices)) ) return rc; @@ -1438,7 +1438,7 @@ assert(psm->mi == NULL); * need the leading / stripped. */ { const char * p; - xx = hge(fi->h, RPMTAG_DEFAULTPREFIX, NULL, (void **) &p, NULL); + xx = hge(fi->h, RPMTAG_DEFAULTPREFIX, NULL, (rpm_data_t *) &p, NULL); fi->striplen = (xx ? strlen(p) + 1 : 1); } fi->mapflags = @@ -1451,10 +1451,10 @@ assert(psm->mi == NULL); if (fi->fuser == NULL) xx = hge(fi->h, RPMTAG_FILEUSERNAME, NULL, - (void **) &fi->fuser, NULL); + (rpm_data_t *) &fi->fuser, NULL); if (fi->fgroup == NULL) xx = hge(fi->h, RPMTAG_FILEGROUPNAME, NULL, - (void **) &fi->fgroup, NULL); + (rpm_data_t *) &fi->fgroup, NULL); rc = RPMRC_OK; } if (psm->goal == PSM_PKGERASE || psm->goal == PSM_PKGSAVE) { @@ -1559,7 +1559,7 @@ assert(psm->mi == NULL); rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; - hPTR_t ptr; + rpm_data_t ptr; Header oh; /* Load the original header from the blob. */ @@ -1570,7 +1570,7 @@ assert(psm->mi == NULL); for (hi = headerInitIterator(oh); headerNextIterator(hi, &tag, &type, &ptr, &count); - ptr = headerFreeData((void *)ptr, type)) + ptr = headerFreeData(ptr, type)) { if (tag == RPMTAG_ARCHIVESIZE) noArchiveSize = 1; @@ -1985,7 +1985,7 @@ assert(psm->mi == NULL); char * t; if (!hge(fi->h, RPMTAG_PAYLOADCOMPRESSOR, NULL, - (void **) &payload_compressor, NULL)) + (rpm_data_t *) &payload_compressor, NULL)) payload_compressor = "gzip"; psm->rpmio_flags = t = xmalloc(sizeof("w9.gzdio")); *t = '\0'; diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c index 9d62bfc..d909faa 100644 --- a/lib/rpmchecksig.c +++ b/lib/rpmchecksig.c @@ -110,7 +110,7 @@ exit: */ static int getSignid(Header sig, rpm_tag_t sigtag, pgpKeyID_t signid) { - void * pkt = NULL; + rpm_data_t pkt = NULL; rpm_tagtype_t pkttyp = 0; rpm_count_t pktlen = 0; int rc = 1; @@ -213,7 +213,7 @@ static int rpmReSign(rpmts ts, rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; - hPTR_t ptr; + rpm_data_t ptr; Header oh; Header nh; @@ -516,7 +516,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, char untrustedKeys[7164], * u; rpm_tag_t sigtag; rpm_tagtype_t sigtype; - const void * sig; + rpm_data_t sig; pgpDig dig; pgpDigParams sigp; rpm_count_t siglen; @@ -586,7 +586,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, /* XXX RSA needs the hash_algo, so decode early. */ if (sigtag == RPMSIGTAG_RSA || sigtag == RPMSIGTAG_PGP) { - xx = headerGetEntry(sigh, sigtag, &sigtype, (void **)&sig, &siglen); + xx = headerGetEntry(sigh, sigtag, &sigtype, (rpm_data_t *)&sig, &siglen); xx = pgpPrtPkts(sig, siglen, dig, 0); sig = headerFreeData(sig, sigtype); /* XXX assume same hash_algo in header-only and header+payload */ diff --git a/lib/rpmds.c b/lib/rpmds.c index 6337b21..79720e6 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -159,7 +159,7 @@ rpmds rpmdsNew(Header h, rpm_tag_t tagN, int flags) } else goto exit; - if (hge(h, tagN, &Nt, (void **) &N, &Count) + if (hge(h, tagN, &Nt, (rpm_data_t *) &N, &Count) && N != NULL && Count > 0) { int xx; @@ -175,12 +175,12 @@ rpmds rpmdsNew(Header h, rpm_tag_t tagN, int flags) ds->Count = Count; ds->nopromote = _rpmds_nopromote; - xx = hge(h, tagEVR, &ds->EVRt, (void **) &ds->EVR, NULL); - xx = hge(h, tagF, &ds->Ft, (void **) &ds->Flags, NULL); + xx = hge(h, tagEVR, &ds->EVRt, (rpm_data_t *) &ds->EVR, NULL); + xx = hge(h, tagF, &ds->Ft, (rpm_data_t *) &ds->Flags, NULL); if (!scareMem && ds->Flags != NULL) ds->Flags = memcpy(xmalloc(ds->Count * sizeof(*ds->Flags)), ds->Flags, ds->Count * sizeof(*ds->Flags)); - xx = hge(h, tagBT, &BTt, (void **) &BTp, NULL); + xx = hge(h, tagBT, &BTt, (rpm_data_t *) &BTp, NULL); ds->BT = (xx && BTp != NULL && BTt == RPM_INT32_TYPE ? *BTp : 0); ds->Color = xcalloc(Count, sizeof(*ds->Color)); ds->Refs = xcalloc(Count, sizeof(*ds->Refs)); @@ -271,7 +271,7 @@ rpmds rpmdsThis(Header h, rpm_tag_t tagN, int32_t Flags) xx = headerNVR(h, &n, &v, &r); ep = NULL; - xx = hge(h, RPMTAG_EPOCH, NULL, (void **)&ep, NULL); + xx = hge(h, RPMTAG_EPOCH, NULL, (rpm_data_t *)&ep, NULL); t = xmalloc(sizeof(*N) + strlen(n) + 1); N = (const char **) t; @@ -964,7 +964,7 @@ int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote) t = alloca(21 + strlen(v) + 1 + strlen(r) + 1); pkgEVR = t; *t = '\0'; - if (hge(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) { + if (hge(h, RPMTAG_EPOCH, NULL, (rpm_data_t *) &epoch, NULL)) { sprintf(t, "%d:", *epoch); while (*t != '\0') t++; diff --git a/lib/rpmfi.c b/lib/rpmfi.c index ab544af..8c05d29 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -650,7 +650,7 @@ Header relocateFileList(const rpmts ts, rpmfi fi, int i, j, xx; if (!hge(origH, RPMTAG_PREFIXES, &validType, - (void **) &validRelocations, &numValid)) + (rpm_data_t *) &validRelocations, &numValid)) numValid = 0; assert(p != NULL); @@ -792,18 +792,18 @@ assert(p != NULL); if (numActual) xx = hae(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE, - (void **) actualRelocations, numActual); + (rpm_data_t *) actualRelocations, numActual); actualRelocations = _free(actualRelocations); validRelocations = hfd(validRelocations, validType); } - xx = hge(h, RPMTAG_BASENAMES, NULL, (void **) &baseNames, &fileCount); - xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); - xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, &dirCount); - xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fFlags, NULL); - xx = hge(h, RPMTAG_FILECOLORS, NULL, (void **) &fColors, NULL); - xx = hge(h, RPMTAG_FILEMODES, NULL, (void **) &fModes, NULL); + xx = hge(h, RPMTAG_BASENAMES, NULL, (rpm_data_t *) &baseNames, &fileCount); + xx = hge(h, RPMTAG_DIRINDEXES, NULL, (rpm_data_t *) &dirIndexes, NULL); + xx = hge(h, RPMTAG_DIRNAMES, NULL, (rpm_data_t *) &dirNames, &dirCount); + xx = hge(h, RPMTAG_FILEFLAGS, NULL, (rpm_data_t *) &fFlags, NULL); + xx = hge(h, RPMTAG_FILECOLORS, NULL, (rpm_data_t *) &fColors, NULL); + xx = hge(h, RPMTAG_FILEMODES, NULL, (rpm_data_t *) &fModes, NULL); dColors = alloca(dirCount * sizeof(*dColors)); memset(dColors, 0, dirCount * sizeof(*dColors)); @@ -1023,16 +1023,16 @@ dColors[j] |= fColors[i]; xx = hme(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE, baseNames, fileCount); fi->bnl = hfd(fi->bnl, RPM_STRING_ARRAY_TYPE); - xx = hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc); + xx = hge(h, RPMTAG_BASENAMES, NULL, (rpm_data_t *) &fi->bnl, &fi->fc); xx = hme(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE, dirNames, dirCount); fi->dnl = hfd(fi->dnl, RPM_STRING_ARRAY_TYPE); - xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc); + xx = hge(h, RPMTAG_DIRNAMES, NULL, (rpm_data_t *) &fi->dnl, &fi->dc); xx = hme(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, dirIndexes, fileCount); - xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL); + xx = hge(h, RPMTAG_DIRINDEXES, NULL, (rpm_data_t *) &fi->dil, NULL); } baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE); @@ -1142,7 +1142,7 @@ static inline unsigned char nibble(char c) /* XXX Ick, not SEF. */ #define _fdupestring(_h, _tag, _data) \ - if (hge((_h), (_tag), NULL, (void **) &(_data), NULL)) \ + if (hge((_h), (_tag), NULL, (rpm_data_t *) &(_data), NULL)) \ _data = xstrdup(_data) rpmfi rpmfiNew(const rpmts ts, Header h, rpm_tag_t tagN, int scareMem) @@ -1188,7 +1188,7 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpm_tag_t tagN, int scareMem) fi->fsm = newFSM(); /* 0 means unknown */ - xx = hge(h, RPMTAG_ARCHIVESIZE, NULL, (void **) &uip, NULL); + xx = hge(h, RPMTAG_ARCHIVESIZE, NULL, (rpm_data_t *) &uip, NULL); fi->archivePos = 0; fi->archiveSize = (xx ? *uip : 0); @@ -1198,31 +1198,31 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpm_tag_t tagN, int scareMem) _fdupestring(h, RPMTAG_POSTTRANS, fi->posttrans); _fdupestring(h, RPMTAG_POSTTRANSPROG, fi->posttransprog); - if (!hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc)) { + if (!hge(h, RPMTAG_BASENAMES, NULL, (rpm_data_t *) &fi->bnl, &fi->fc)) { fi->fc = 0; fi->dc = 0; goto exit; } - xx = hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc); - xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL); - xx = hge(h, RPMTAG_FILEMODES, NULL, (void **) &fi->fmodes, NULL); - xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fi->fflags, NULL); - xx = hge(h, RPMTAG_FILEVERIFYFLAGS, NULL, (void **) &fi->vflags, NULL); - xx = hge(h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL); - - xx = hge(h, RPMTAG_FILECOLORS, NULL, (void **) &fi->fcolors, NULL); + xx = hge(h, RPMTAG_DIRNAMES, NULL, (rpm_data_t *) &fi->dnl, &fi->dc); + xx = hge(h, RPMTAG_DIRINDEXES, NULL, (rpm_data_t *) &fi->dil, NULL); + xx = hge(h, RPMTAG_FILEMODES, NULL, (rpm_data_t *) &fi->fmodes, NULL); + xx = hge(h, RPMTAG_FILEFLAGS, NULL, (rpm_data_t *) &fi->fflags, NULL); + xx = hge(h, RPMTAG_FILEVERIFYFLAGS, NULL, (rpm_data_t *) &fi->vflags, NULL); + xx = hge(h, RPMTAG_FILESIZES, NULL, (rpm_data_t *) &fi->fsizes, NULL); + + xx = hge(h, RPMTAG_FILECOLORS, NULL, (rpm_data_t *) &fi->fcolors, NULL); fi->color = 0; if (fi->fcolors != NULL) for (i = 0; i < fi->fc; i++) fi->color |= fi->fcolors[i]; - xx = hge(h, RPMTAG_CLASSDICT, NULL, (void **) &fi->cdict, &fi->ncdict); - xx = hge(h, RPMTAG_FILECLASS, NULL, (void **) &fi->fcdictx, NULL); + xx = hge(h, RPMTAG_CLASSDICT, NULL, (rpm_data_t *) &fi->cdict, &fi->ncdict); + xx = hge(h, RPMTAG_FILECLASS, NULL, (rpm_data_t *) &fi->fcdictx, NULL); - xx = hge(h, RPMTAG_DEPENDSDICT, NULL, (void **) &fi->ddict, &fi->nddict); - xx = hge(h, RPMTAG_FILEDEPENDSX, NULL, (void **) &fi->fddictx, NULL); - xx = hge(h, RPMTAG_FILEDEPENDSN, NULL, (void **) &fi->fddictn, NULL); + xx = hge(h, RPMTAG_DEPENDSDICT, NULL, (rpm_data_t *) &fi->ddict, &fi->nddict); + xx = hge(h, RPMTAG_FILEDEPENDSX, NULL, (rpm_data_t *) &fi->fddictx, NULL); + xx = hge(h, RPMTAG_FILEDEPENDSN, NULL, (rpm_data_t *) &fi->fddictn, NULL); - xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL); + xx = hge(h, RPMTAG_FILESTATES, NULL, (rpm_data_t *) &fi->fstates, NULL); if (xx == 0 || fi->fstates == NULL) fi->fstates = xcalloc(fi->fc, sizeof(*fi->fstates)); else @@ -1240,11 +1240,11 @@ if (fi->actions == NULL) fi->mapflags = CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID; - xx = hge(h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL); - xx = hge(h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL); + xx = hge(h, RPMTAG_FILELINKTOS, NULL, (rpm_data_t *) &fi->flinks, NULL); + xx = hge(h, RPMTAG_FILELANGS, NULL, (rpm_data_t *) &fi->flangs, NULL); fi->fmd5s = NULL; - xx = hge(h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL); + xx = hge(h, RPMTAG_FILEMD5S, NULL, (rpm_data_t *) &fi->fmd5s, NULL); fi->md5s = NULL; if (fi->fmd5s) { @@ -1267,14 +1267,14 @@ if (fi->actions == NULL) } /* XXX TR_REMOVED doesn;t need fmtimes, frdevs, finodes, or fcontexts */ - xx = hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &fi->fmtimes, NULL); - xx = hge(h, RPMTAG_FILERDEVS, NULL, (void **) &fi->frdevs, NULL); - xx = hge(h, RPMTAG_FILEINODES, NULL, (void **) &fi->finodes, NULL); + xx = hge(h, RPMTAG_FILEMTIMES, NULL, (rpm_data_t *) &fi->fmtimes, NULL); + xx = hge(h, RPMTAG_FILERDEVS, NULL, (rpm_data_t *) &fi->frdevs, NULL); + xx = hge(h, RPMTAG_FILEINODES, NULL, (rpm_data_t *) &fi->finodes, NULL); fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes)); - xx = hge(h, RPMTAG_FILEUSERNAME, NULL, (void **) &fi->fuser, NULL); - xx = hge(h, RPMTAG_FILEGROUPNAME, NULL, (void **) &fi->fgroup, NULL); + xx = hge(h, RPMTAG_FILEUSERNAME, NULL, (rpm_data_t *) &fi->fuser, NULL); + xx = hge(h, RPMTAG_FILEGROUPNAME, NULL, (rpm_data_t *) &fi->fgroup, NULL); if (ts != NULL) if (fi != NULL) @@ -1561,14 +1561,14 @@ void rpmfiBuildFNames(Header h, rpm_tag_t tagN, dirIndexesTag = RPMTAG_ORIGDIRINDEXES; } - if (!hge(h, tagN, &bnt, (void **) &baseNames, &count)) { + if (!hge(h, tagN, &bnt, (rpm_data_t *) &baseNames, &count)) { if (fnp) *fnp = NULL; if (fcp) *fcp = 0; return; /* no file list */ } - xx = hge(h, dirNameTag, &dnt, (void **) &dirNames, NULL); - xx = hge(h, dirIndexesTag, NULL, (void **) &dirIndexes, &count); + xx = hge(h, dirNameTag, &dnt, (rpm_data_t *) &dirNames, NULL); + xx = hge(h, dirIndexesTag, NULL, (rpm_data_t *) &dirIndexes, &count); size = sizeof(*fileNames) * count; for (i = 0; i < count; i++) diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 9eea1f8..1e11b41 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -477,7 +477,7 @@ if (fileURL[0] == '=') { rpm_count_t c; if (headerGetEntry(eiu->h, RPMTAG_PREFIXES, &pft, - (void **) &paths, &c) && (c == 1)) + (rpm_data_t *) &paths, &c) && (c == 1)) { eiu->relocations->oldPath = xstrdup(paths[0]); paths = headerFreeData(paths, pft); diff --git a/lib/rpmlib.h b/lib/rpmlib.h index a8a330d..7784060 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -188,7 +188,7 @@ void rpmFreeRpmrc(void); * @return NULL always */ typedef - void * (*HFD_t) (const void * data, rpm_tagtype_t type); + void * (*HFD_t) (rpm_data_t data, rpm_tagtype_t type); /** * Prototype for headerGetEntry() vector. @@ -206,7 +206,7 @@ typedef */ typedef int (*HGE_t) (Header h, rpm_tag_t tag, rpm_tagtype_t * type, - void ** p, + rpm_data_t * p, rpm_count_t * c); /** @@ -225,7 +225,7 @@ typedef int (*HGE_t) (Header h, rpm_tag_t tag, * @return 1 on success, 0 on failure */ typedef int (*HAE_t) (Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c); + rpm_constdata_t p, rpm_count_t c); /** * Prototype for headerModifyEntry() vector. @@ -239,7 +239,7 @@ typedef int (*HAE_t) (Header h, rpm_tag_t tag, rpm_tagtype_t type, * @return 1 on success, 0 on failure */ typedef int (*HME_t) (Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c); + rpm_constdata_t p, rpm_count_t c); /** * Prototype for headerRemoveEntry() vector. diff --git a/lib/rpmte.c b/lib/rpmte.c index 940fe00..e0d94bd 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -96,7 +96,7 @@ static void addTE(rpmts ts, rpmte p, Header h, p->db_instance = 0; arch = NULL; - xx = hge(h, RPMTAG_ARCH, NULL, (void **)&arch, NULL); + xx = hge(h, RPMTAG_ARCH, NULL, (rpm_data_t *)&arch, NULL); if (arch != NULL) { p->arch = xstrdup(arch); p->archScore = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch); @@ -105,7 +105,7 @@ static void addTE(rpmts ts, rpmte p, Header h, p->archScore = 0; } os = NULL; - xx = hge(h, RPMTAG_OS, NULL, (void **)&os, NULL); + xx = hge(h, RPMTAG_OS, NULL, (rpm_data_t *)&os, NULL); if (os != NULL) { p->os = xstrdup(os); p->osScore = rpmMachineScore(RPM_MACHTABLE_INSTOS, os); @@ -130,7 +130,7 @@ static void addTE(rpmts ts, rpmte p, Header h, t = stpcpy( stpcpy( t, "."), p->arch); ep = NULL; - xx = hge(h, RPMTAG_EPOCH, NULL, (void **)&ep, NULL); + xx = hge(h, RPMTAG_EPOCH, NULL, (rpm_data_t *)&ep, NULL); if (ep) { p->epoch = xmalloc(20); sprintf(p->epoch, "%d", *ep); @@ -203,7 +203,7 @@ rpmte rpmteNew(const rpmts ts, Header h, case TR_ADDED: p->u.addedKey = pkgKey; ep = NULL; - xx = headerGetEntry(h, RPMTAG_SIGSIZE, NULL, (void **)&ep, NULL); + xx = headerGetEntry(h, RPMTAG_SIGSIZE, NULL, (rpm_data_t *)&ep, NULL); /* XXX 256 is only an estimate of signature header. */ if (ep != NULL) p->pkgFileSize += 96 + 256 + *ep; diff --git a/lib/rpmts.c b/lib/rpmts.c index 452ec48..9a0d0ef 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -300,7 +300,7 @@ fprintf(stderr, "*** free pkt %p[%d] id %08x %08x\n", ts->pkpkt, ts->pkpktlen, p rpm_tagtype_t pt; rpm_count_t pc; - if (!headerGetEntry(h, RPMTAG_PUBKEYS, &pt, (void **)&pubkeys, &pc)) + if (!headerGetEntry(h, RPMTAG_PUBKEYS, &pt, (rpm_data_t *)&pubkeys, &pc)) continue; hx = rpmdbGetIteratorOffset(mi); ix = rpmdbGetIteratorFileNum(mi); @@ -636,7 +636,7 @@ int rpmtsSolve(rpmts ts, rpmds ds, const void * data) /* XXX Prefer the shortest name if given alternatives. */ hname = NULL; hnamelen = 0; - if (headerGetEntry(h, RPMTAG_NAME, NULL, (void **)&hname, NULL)) { + if (headerGetEntry(h, RPMTAG_NAME, NULL, (rpm_data_t *)&hname, NULL)) { if (hname) hnamelen = strlen(hname); } @@ -645,7 +645,7 @@ int rpmtsSolve(rpmts ts, rpmds ds, const void * data) /* XXX Prefer the newest build if given alternatives. */ htime = 0; - if (headerGetEntry(h, RPMTAG_BUILDTIME, NULL, (void **)&ip, NULL)) + if (headerGetEntry(h, RPMTAG_BUILDTIME, NULL, (rpm_data_t *)&ip, NULL)) htime = (time_t)*ip; if (htime <= bhtime) @@ -1157,9 +1157,9 @@ rpm_tagtype_t rpmtsSigtype(const rpmts ts) return sigtype; } -const void * rpmtsSig(const rpmts ts) +rpm_constdata_t rpmtsSig(const rpmts ts) { - const void * sig = NULL; + rpm_constdata_t sig = NULL; if (ts != NULL) sig = ts->sig; return sig; @@ -1174,7 +1174,7 @@ size_t rpmtsSiglen(const rpmts ts) } int rpmtsSetSig(rpmts ts, rpm_tag_t sigtag, rpm_tagtype_t sigtype, - const void * sig, size_t siglen) + rpm_data_t sig, size_t siglen) { if (ts != NULL) { if (ts->sig && ts->sigtype) diff --git a/lib/rpmts.h b/lib/rpmts.h index cccd1ff..122cd66 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -534,7 +534,7 @@ rpm_tagtype_t rpmtsSigtype(const rpmts ts); * @param ts transaction set * @return signature tag data */ -extern const void * rpmtsSig(const rpmts ts); +rpm_constdata_t rpmtsSig(const rpmts ts); /** \ingroup rpmts * Get signature tag data length, i.e. no. of bytes of data. @@ -554,7 +554,7 @@ size_t rpmtsSiglen(const rpmts ts); */ int rpmtsSetSig(rpmts ts, rpm_tag_t sigtag, rpm_tagtype_t sigtype, - const void * sig, size_t siglen); + rpm_data_t sig, size_t siglen); /** \ingroup rpmts * Get OpenPGP packet parameters, i.e. signature/pubkey constants. diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h index a5fc530..0e0ad6d 100644 --- a/lib/rpmts_internal.h +++ b/lib/rpmts_internal.h @@ -99,7 +99,7 @@ struct rpmts_s { const char * fn; /*!< Current package fn. */ rpm_tag_t sigtag; /*!< Current package signature tag. */ rpm_tagtype_t sigtype; /*!< Current package signature data type. */ - const void * sig; /*!< Current package signature. */ + rpm_data_t sig; /*!< Current package signature. */ size_t siglen; /*!< Current package signature length. */ uint8_t * pkpkt;/*!< Current pubkey packet. */ diff --git a/lib/signature.c b/lib/signature.c index df038aa..853d997 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -280,7 +280,7 @@ rpmRC rpmReadSignature(FD_t fd, Header * sighp, sigType sig_type, char ** msg) } /* Print package component sizes. */ - if (headerGetEntry(sigh, RPMSIGTAG_SIZE, NULL,(void **)&archSize, NULL)) { + if (headerGetEntry(sigh, RPMSIGTAG_SIZE, NULL,(rpm_data_t *)&archSize, NULL)) { rc = printSize(fd, sigSize, pad, *archSize); if (rc != RPMRC_OK) (void) snprintf(buf, sizeof(buf), @@ -924,7 +924,7 @@ static const char * rpmSigString(rpmRC res) static rpmRC verifySizeSignature(const rpmts ts, char * t) { - const void * sig = rpmtsSig(ts); + rpm_constdata_t sig = rpmtsSig(ts); pgpDig dig = rpmtsDig(ts); rpmRC res; size_t size = 0x7fffffff; @@ -959,7 +959,7 @@ static rpmRC verifyMD5Signature(const rpmts ts, char * t, DIGEST_CTX md5ctx) { - const void * sig = rpmtsSig(ts); + rpm_constdata_t sig = rpmtsSig(ts); size_t siglen = rpmtsSiglen(ts); pgpDig dig = rpmtsDig(ts); rpmRC res; @@ -1014,7 +1014,7 @@ static rpmRC verifySHA1Signature(const rpmts ts, char * t, DIGEST_CTX sha1ctx) { - const void * sig = rpmtsSig(ts); + rpm_constdata_t sig = rpmtsSig(ts); #ifdef NOTYET size_t siglen = rpmtsSiglen(ts); #endif @@ -1084,7 +1084,7 @@ static rpmRC verifyRSASignature(rpmts ts, char * t, DIGEST_CTX md5ctx) { - const void * sig = rpmtsSig(ts); + rpm_constdata_t sig = rpmtsSig(ts); #ifdef NOTYET size_t siglen = rpmtsSiglen(ts); #endif @@ -1232,7 +1232,7 @@ static rpmRC verifyDSASignature(rpmts ts, char * t, DIGEST_CTX sha1ctx) { - const void * sig = rpmtsSig(ts); + rpm_constdata_t sig = rpmtsSig(ts); #ifdef NOTYET size_t siglen = rpmtsSiglen(ts); #endif @@ -1323,7 +1323,7 @@ exit: rpmRC rpmVerifySignature(const rpmts ts, char * result) { - const void * sig = rpmtsSig(ts); + rpm_constdata_t sig = rpmtsSig(ts); size_t siglen = rpmtsSiglen(ts); rpm_tag_t sigtag = rpmtsSigtag(ts); pgpDig dig = rpmtsDig(ts); diff --git a/lib/transaction.c b/lib/transaction.c index 1182a85..3cefe50 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -227,7 +227,7 @@ static int handleRmvdInstalledFiles(const rpmts ts, rpmfi fi, return 1; } - xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL); + xx = hge(h, RPMTAG_FILESTATES, NULL, (rpm_data_t *) &otherStates, NULL); for (i = 0; i < sharedCount; i++, shared++) { int otherFileNum, fileNum; @@ -1098,7 +1098,7 @@ static rpmRC getRepackageHeaderFromTE(rpmts ts, rpmte te, * XXX: Should Match NAC! */ rpmlog(RPMLOG_DEBUG, _("\tREMOVETID matched INSTALLTID.\n")); - if (headerGetEntry(rpIDT->h, RPMTAG_NAME, NULL, (void **) &rpname, NULL)) { + if (headerGetEntry(rpIDT->h, RPMTAG_NAME, NULL, (rpm_data_t *) &rpname, NULL)) { rpmlog(RPMLOG_DEBUG, _("\t\tName: %s.\n"), rpname); if (!strcmp(name,rpname)) { /* It matched we have a canidate */ diff --git a/python/header-py.c b/python/header-py.c index 3d1eb42..4905383 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -411,7 +411,7 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) rpm_tagtype_t tagtype, type; rpm_tag_t tag = RPMTAG_NOT_FOUND; rpm_count_t count, i; - void * data; + rpm_data_t data; PyObject * o, * metao; char ** stringArray; int forceArray = 0; @@ -439,7 +439,7 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) /* Retrieve data from extension or header. */ if (ext) { - ext->u.tagFunction(s->h, &type, (const void **) &data, &count, &freeData); + ext->u.tagFunction(s->h, &type, &data, &count, &freeData); } else { if (tag == RPMTAG_NOT_FOUND) { PyErr_SetString(PyExc_KeyError, "unknown header tag"); diff --git a/rpm2cpio.c b/rpm2cpio.c index bc06110..ecf0280 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) char * t; if (!headerGetEntry(h, RPMTAG_PAYLOADCOMPRESSOR, NULL, - (void **) &payload_compressor, NULL)) + (rpm_data_t *) &payload_compressor, NULL)) payload_compressor = "gzip"; rpmio_flags = t = alloca(sizeof("r.gzdio")); *t++ = 'r'; diff --git a/rpmdb/fprint.c b/rpmdb/fprint.c index 46392e5..fc9861d 100644 --- a/rpmdb/fprint.c +++ b/rpmdb/fprint.c @@ -249,11 +249,11 @@ void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList); int fileCount; int xx; - if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount)) + if (!hge(h, RPMTAG_BASENAMES, &bnt, (rpm_data_t *) &baseNames, &fileCount)) return; - xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); - xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); + xx = hge(h, RPMTAG_DIRNAMES, &dnt, (rpm_data_t *) &dirNames, NULL); + xx = hge(h, RPMTAG_DIRINDEXES, NULL, (rpm_data_t *) &dirIndexes, NULL); fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList); dirNames = hfd(dirNames, dnt); baseNames = hfd(baseNames, bnt); diff --git a/rpmdb/hdrNVR.c b/rpmdb/hdrNVR.c index 5a215b4..15aca51 100644 --- a/rpmdb/hdrNVR.c +++ b/rpmdb/hdrNVR.c @@ -12,17 +12,17 @@ int headerNVR(Header h, const char **np, const char **vp, const char **rp) rpm_count_t count; if (np) { - if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count) + if (!(headerGetEntry(h, RPMTAG_NAME, &type, (rpm_data_t *) np, &count) && type == RPM_STRING_TYPE && count == 1)) *np = NULL; } if (vp) { - if (!(headerGetEntry(h, RPMTAG_VERSION, &type, (void **) vp, &count) + if (!(headerGetEntry(h, RPMTAG_VERSION, &type, (rpm_data_t *) vp, &count) && type == RPM_STRING_TYPE && count == 1)) *vp = NULL; } if (rp) { - if (!(headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) rp, &count) + if (!(headerGetEntry(h, RPMTAG_RELEASE, &type, (rpm_data_t *) rp, &count) && type == RPM_STRING_TYPE && count == 1)) *rp = NULL; } @@ -38,7 +38,7 @@ int headerNEVRA(Header h, const char **np, headerNVR(h, np, vp, rp); if (ap) { - if (!(headerGetEntry(h, RPMTAG_ARCH, &type, (void **) ap, &count) + if (!(headerGetEntry(h, RPMTAG_ARCH, &type, (rpm_data_t *) ap, &count) && type == RPM_STRING_TYPE && count == 1)) *ap = NULL; } @@ -69,7 +69,7 @@ char * headerGetNEVRA(Header h, const char ** np) int xx; (void) headerNVR(h, &n, &v, &r); - xx = headerGetEntry(h, RPMTAG_ARCH, NULL, (void **) &a, NULL); + xx = headerGetEntry(h, RPMTAG_ARCH, NULL, (rpm_data_t *) &a, NULL); NVRA = t = xcalloc(1, strlen(n) + strlen(v) + strlen(r) + strlen(a) + sizeof("--.")); t = stpcpy(t, n); t = stpcpy(t, "-"); @@ -93,7 +93,7 @@ uint32_t headerGetColor(Header h) fcolors = NULL; ncolors = 0; - if (hge(h, RPMTAG_FILECOLORS, NULL, (void **)&fcolors, &ncolors) + if (hge(h, RPMTAG_FILECOLORS, NULL, (rpm_data_t *)&fcolors, &ncolors) && fcolors != NULL && ncolors > 0) { for (i = 0; i < ncolors; i++) diff --git a/rpmdb/header.c b/rpmdb/header.c index 24db545..0dc8309 100644 --- a/rpmdb/header.c +++ b/rpmdb/header.c @@ -316,8 +316,8 @@ 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(rpm_tagtype_t type, hPTR_t p, rpm_count_t count, int onDisk, - hPTR_t pend) +static int dataLength(rpm_tagtype_t type, rpm_constdata_t p, rpm_count_t count, + int onDisk, rpm_constdata_t pend) { const unsigned char * s = p; const unsigned char * se = pend; @@ -839,7 +839,7 @@ int _headerRemoveEntry(Header h, rpm_tag_t tag) /* Free data for tags being removed. */ for (first = entry; first < last; first++) { - void * data; + rpm_data_t data; if (first->info.tag != tag) break; data = first->data; @@ -1198,7 +1198,7 @@ int _headerIsEntry(Header h, rpm_tag_t tag) */ static int copyEntry(const indexEntry entry, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c, int minMem) { @@ -1432,7 +1432,7 @@ headerFindI18NString(Header h, indexEntry entry) */ static int intGetEntry(Header h, rpm_tag_t tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_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, - void * data, rpm_tagtype_t type) + rpm_data_t data, rpm_tagtype_t type) { if (data) { if (type == -1 || @@ -1501,10 +1501,10 @@ static void * _headerFreeTag(Header h, static int _headerGetEntry(Header h, rpm_tag_t tag, rpm_tagtype_t * type, - void ** p, + rpm_data_t * p, rpm_count_t * c) { - return intGetEntry(h, tag, type, (hPTR_t *)p, c, 0); + return intGetEntry(h, tag, type, p, c, 0); } /** \ingroup header @@ -1522,13 +1522,13 @@ int _headerGetEntry(Header h, rpm_tag_t tag, static int _headerGetEntryMinMemory(Header h, rpm_tag_t tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c) { - return intGetEntry(h, tag, type, p, c, 1); + return intGetEntry(h, tag, type, (rpm_data_t) p, c, 1); } -int headerGetRawEntry(Header h, rpm_tag_t tag, rpm_tagtype_t * type, hPTR_t * p, +int headerGetRawEntry(Header h, rpm_tag_t tag, rpm_tagtype_t * type, rpm_data_t * p, rpm_count_t * c) { indexEntry entry; @@ -1553,8 +1553,8 @@ int headerGetRawEntry(Header h, rpm_tag_t tag, rpm_tagtype_t * type, hPTR_t * p, /** */ -static void copyData(rpm_tagtype_t type, void * dstPtr, const void * srcPtr, - rpm_count_t cnt, int dataLength) +static void copyData(rpm_tagtype_t type, rpm_data_t dstPtr, + rpm_constdata_t srcPtr, rpm_count_t cnt, int dataLength) { switch (type) { case RPM_STRING_ARRAY_TYPE: @@ -1587,9 +1587,9 @@ static void copyData(rpm_tagtype_t type, void * dstPtr, const void * srcPtr, * @return (malloc'ed) copy of entry data, NULL on error */ static void * -grabData(rpm_tagtype_t type, hPTR_t p, rpm_count_t c, int * lengthPtr) +grabData(rpm_tagtype_t type, rpm_constdata_t p, rpm_count_t c, int * lengthPtr) { - void * data = NULL; + rpm_data_t data = NULL; int length; length = dataLength(type, p, c, 0, NULL); @@ -1618,10 +1618,11 @@ grabData(rpm_tagtype_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, rpm_tagtype_t type, const void * p, rpm_count_t c) +int _headerAddEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, + rpm_constdata_t p, rpm_count_t c) { indexEntry entry; - void * data; + rpm_data_t data; int length; /* Count must always be >= 1 for _headerAddEntry. */ @@ -1676,7 +1677,7 @@ int _headerAddEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, */ static int _headerAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c) + rpm_constdata_t p, rpm_count_t c) { indexEntry entry; int length; @@ -1724,7 +1725,7 @@ int _headerAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, */ static int _headerAddOrAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c) + rpm_constdata_t p, rpm_count_t c) { return (findEntry(h, tag, type) ? _headerAppendEntry(h, tag, type, p, c) @@ -1887,11 +1888,11 @@ int _headerAddI18NString(Header h, rpm_tag_t tag, const char * string, */ static int _headerModifyEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c) + rpm_constdata_t p, rpm_count_t c) { indexEntry entry; - void * oldData; - void * data; + rpm_data_t oldData; + rpm_data_t data; int length; /* First find the tag */ @@ -2033,7 +2034,7 @@ static int _headerNextIterator(HeaderIterator hi, rpm_tag_t * tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c) { Header h = hi->h; @@ -2075,11 +2076,11 @@ Header _headerCopy(Header h) rpm_tagtype_t type; rpm_tag_t tag; rpm_count_t count; - hPTR_t ptr; + rpm_data_t ptr; for (hi = _headerInitIterator(h); _headerNextIterator(hi, &tag, &type, &ptr, &count); - ptr = headerFreeData((void *)ptr, type)) + ptr = headerFreeData(ptr, type)) { if (ptr) (void) _headerAddEntry(nh, tag, type, ptr, count); } @@ -2648,7 +2649,7 @@ static int parseExpression(headerSprintfArgs hsa, sprintfToken token, */ static int getExtension(headerSprintfArgs hsa, headerTagTagFunction fn, rpm_tagtype_t * typeptr, - hPTR_t * data, + rpm_data_t * data, rpm_count_t * countptr, rpmec ec) { @@ -2680,7 +2681,7 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element) char buf[20]; rpm_tagtype_t type; rpm_count_t count; - hPTR_t data; + rpm_data_t data; unsigned int intVal; const char ** strarray; int datafree = 0; @@ -2695,7 +2696,7 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element) data = "(none)"; } } else { - if (!_headerGetEntry(hsa->h, tag->tag, &type, (void **)&data, &count)) { + if (!_headerGetEntry(hsa->h, tag->tag, &type, &data, &count)) { count = 1; type = RPM_STRING_TYPE; data = "(none)"; @@ -3116,7 +3117,7 @@ exit: * @param element (unused) * @return formatted string */ -static char * octalFormat(rpm_tagtype_t type, hPTR_t data, +static char * octalFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding,int element) { char * val; @@ -3141,7 +3142,7 @@ static char * octalFormat(rpm_tagtype_t type, hPTR_t data, * @param element (unused) * @return formatted string */ -static char * hexFormat(rpm_tagtype_t type, hPTR_t data, +static char * hexFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding,int element) { char * val; @@ -3159,7 +3160,7 @@ static char * hexFormat(rpm_tagtype_t type, hPTR_t data, /** */ -static char * realDateFormat(rpm_tagtype_t type, hPTR_t data, +static char * realDateFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding,int element, const char * strftimeFormat) { @@ -3196,7 +3197,7 @@ static char * realDateFormat(rpm_tagtype_t type, hPTR_t data, * @param element (unused) * @return formatted string */ -static char * dateFormat(rpm_tagtype_t type, hPTR_t data, +static char * dateFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { return realDateFormat(type, data, formatPrefix, padding, element, @@ -3212,7 +3213,7 @@ static char * dateFormat(rpm_tagtype_t type, hPTR_t data, * @param element (unused) * @return formatted string */ -static char * dayFormat(rpm_tagtype_t type, hPTR_t data, +static char * dayFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding, int element) { return realDateFormat(type, data, formatPrefix, padding, element, @@ -3228,7 +3229,7 @@ static char * dayFormat(rpm_tagtype_t type, hPTR_t data, * @param element (unused) * @return formatted string */ -static char * shescapeFormat(rpm_tagtype_t type, hPTR_t data, +static char * shescapeFormat(rpm_tagtype_t type, rpm_constdata_t data, char * formatPrefix, int padding,int element) { char * result, * dst, * src, * buf; @@ -3287,15 +3288,15 @@ void _headerCopyTags(Header headerFrom, Header headerTo, rpm_tag_t * tagstocopy) return; for (p = tagstocopy; *p != 0; p++) { - char *s; + rpm_data_t s; rpm_tagtype_t type; rpm_count_t count; if (_headerIsEntry(headerTo, *p)) continue; - if (!_headerGetEntryMinMemory(headerFrom, *p, &type, - (hPTR_t *) &s, &count)) + if (!_headerGetEntryMinMemory(headerFrom, *p, &type, &s, &count)) continue; (void) _headerAddEntry(headerTo, *p, type, s, count); + /* XXXX freeing up *any* data from headerGetEntryMinMemory ?! */ s = headerFreeData(s, type); } } diff --git a/rpmdb/header.h b/rpmdb/header.h index 47a01fb..e436152 100644 --- a/rpmdb/header.h +++ b/rpmdb/header.h @@ -92,12 +92,14 @@ typedef const char * errmsg_t; /** \ingroup header */ -typedef const void * hPTR_t; typedef int32_t rpm_tag_t; typedef uint32_t rpm_tagtype_t; typedef uint32_t rpm_count_t; +typedef void * rpm_data_t; +typedef const void * rpm_constdata_t; + /** \ingroup header */ typedef struct headerToken_s * Header; @@ -142,7 +144,7 @@ enum headerSprintfExtensionType { * @return formatted string */ typedef char * (*headerTagFormatFunction)(rpm_tagtype_t type, - const void * data, char * formatPrefix, + rpm_constdata_t data, char * formatPrefix, int padding, rpm_count_t element); /** \ingroup header @@ -158,7 +160,7 @@ typedef char * (*headerTagFormatFunction)(rpm_tagtype_t type, */ typedef int (*headerTagTagFunction) (Header h, rpm_tagtype_t * type, - hPTR_t * data, + rpm_data_t * data, rpm_count_t * count, int * freeData); @@ -395,7 +397,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, void * data, rpm_tagtype_t type); +void * headerFreeTag(Header h, rpm_data_t data, rpm_tagtype_t type); /** \ingroup header * Retrieve tag value. @@ -412,7 +414,7 @@ void * headerFreeTag(Header h, void * data, rpm_tagtype_t type); */ int headerGetEntry(Header h, rpm_tag_t tag, rpm_tagtype_t * type, - void ** p, + rpm_data_t * p, rpm_count_t * c); /** \ingroup header @@ -429,7 +431,7 @@ int headerGetEntry(Header h, rpm_tag_t tag, */ int headerGetEntryMinMemory(Header h, rpm_tag_t tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c); /** \ingroup header @@ -446,7 +448,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, rpm_tagtype_t type, const void * p, rpm_count_t c); +int headerAddEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, rpm_constdata_t p, rpm_count_t c); /** \ingroup header * Append element to tag array in header. @@ -463,7 +465,7 @@ int headerAddEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, * @return 1 on success, 0 on failure */ int headerAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c); + rpm_constdata_t p, rpm_count_t c); /** \ingroup header * Add or append element to tag array in header. @@ -476,7 +478,7 @@ int headerAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, * @return 1 on success, 0 on failure */ int headerAddOrAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c); + rpm_constdata_t p, rpm_count_t c); /** \ingroup header * Add locale specific tag to header. @@ -512,7 +514,7 @@ int headerAddI18NString(Header h, rpm_tag_t tag, const char * string, * @return 1 on success, 0 on failure */ int headerModifyEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c); + rpm_constdata_t p, rpm_count_t c); /** \ingroup header * Delete tag in header. @@ -575,7 +577,7 @@ HeaderIterator headerInitIterator(Header h); int headerNextIterator(HeaderIterator hi, rpm_tag_t * tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c); @@ -590,14 +592,14 @@ int headerNextIterator(HeaderIterator hi, * @return NULL always */ static inline -void * headerFreeData(const void * data, rpm_tagtype_t type) +void * headerFreeData(rpm_data_t data, rpm_tagtype_t type) { if (data) { if (type == RPM_FORCEFREE_TYPE || type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE || type == RPM_BIN_TYPE) - free((void *)data); /* XXX _constfree() */ + free(data); /* XXX _constfree() */ } return NULL; } diff --git a/rpmdb/header_common.c b/rpmdb/header_common.c index 20ea4dc..5acaf14 100644 --- a/rpmdb/header_common.c +++ b/rpmdb/header_common.c @@ -101,14 +101,14 @@ int headerIsEntry(Header h, rpm_tag_t tag) return (h2hv(h)->hdrisentry) (h, tag); } -void * headerFreeTag(Header h, void * data, rpm_tagtype_t type) +void * headerFreeTag(Header h, rpm_data_t data, rpm_tagtype_t type) { return (h2hv(h)->hdrfreetag) (h, data, type); } int headerGetEntry(Header h, rpm_tag_t tag, rpm_tagtype_t * type, - void ** p, + rpm_data_t * p, rpm_count_t * c) { return (h2hv(h)->hdrget) (h, tag, type, p, c); @@ -116,25 +116,26 @@ int headerGetEntry(Header h, rpm_tag_t tag, int headerGetEntryMinMemory(Header h, rpm_tag_t tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c) { return (h2hv(h)->hdrgetmin) (h, tag, type, p, c); } -int headerAddEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c) +int headerAddEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, + rpm_constdata_t p, rpm_count_t c) { return (h2hv(h)->hdradd) (h, tag, type, p, c); } int headerAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c) + rpm_constdata_t p, rpm_count_t c) { return (h2hv(h)->hdrappend) (h, tag, type, p, c); } int headerAddOrAppendEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c) + rpm_constdata_t p, rpm_count_t c) { return (h2hv(h)->hdraddorappend) (h, tag, type, p, c); } @@ -146,7 +147,7 @@ int headerAddI18NString(Header h, rpm_tag_t tag, const char * string, } int headerModifyEntry(Header h, rpm_tag_t tag, rpm_tagtype_t type, - const void * p, rpm_count_t c) + rpm_constdata_t p, rpm_count_t c) { return (h2hv(h)->hdrmodify) (h, tag, type, p, c); } @@ -184,7 +185,7 @@ HeaderIterator headerInitIterator(Header h) int headerNextIterator(HeaderIterator hi, rpm_tag_t * tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c) { return hdrVec->hdrnextiter(hi, tag, type, p, c); diff --git a/rpmdb/header_internal.c b/rpmdb/header_internal.c index 22a6b30..971f7e1 100644 --- a/rpmdb/header_internal.c +++ b/rpmdb/header_internal.c @@ -14,7 +14,7 @@ char ** headerGetLangs(Header h) rpm_tagtype_t type; rpm_count_t i, count; - if (!headerGetRawEntry(h, HEADER_I18NTABLE, &type, (const void **)&s, &count)) + if (!headerGetRawEntry(h, HEADER_I18NTABLE, &type, (rpm_data_t)&s, &count)) return NULL; /* XXX xcalloc never returns NULL. */ diff --git a/rpmdb/header_internal.h b/rpmdb/header_internal.h index b56831f..ece9853 100644 --- a/rpmdb/header_internal.h +++ b/rpmdb/header_internal.h @@ -42,7 +42,7 @@ struct entryInfo_s { typedef struct indexEntry_s * indexEntry; struct indexEntry_s { struct entryInfo_s info; /*!< Description of tag data. */ - void * data; /*!< Location of tag data. */ + rpm_data_t data; /*!< Location of tag data. */ int length; /*!< No. bytes of data. */ int rdlen; /*!< No. bytes of data in region. */ }; @@ -88,7 +88,7 @@ struct rpmec_s { rpm_count_t count; int avail; int freeit; - const void * data; + rpm_data_t data; }; /** \ingroup header @@ -149,7 +149,7 @@ char ** headerGetLangs(Header h); */ int headerGetRawEntry(Header h, rpm_tag_t tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c); /** \ingroup header diff --git a/rpmdb/header_method.h b/rpmdb/header_method.h index 74a33bf..9f131d3 100644 --- a/rpmdb/header_method.h +++ b/rpmdb/header_method.h @@ -142,7 +142,7 @@ int (*HDRisentry) (Header h, rpm_tag_t tag); * @return NULL always */ typedef -void * (*HDRfreetag) (Header h, void * data, rpm_tagtype_t type); +void * (*HDRfreetag) (Header h, rpm_data_t data, rpm_tagtype_t type); /** \ingroup header * Retrieve tag value. @@ -160,7 +160,7 @@ void * (*HDRfreetag) (Header h, void * data, rpm_tagtype_t type); typedef int (*HDRget) (Header h, rpm_tag_t tag, rpm_tagtype_t * type, - void ** p, + rpm_data_t * p, rpm_count_t * c); /** \ingroup header @@ -178,7 +178,7 @@ int (*HDRget) (Header h, rpm_tag_t tag, typedef int (*HDRgetmin) (Header h, rpm_tag_t tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c); /** \ingroup header @@ -196,7 +196,8 @@ int (*HDRgetmin) (Header h, rpm_tag_t tag, * @return 1 on success, 0 on failure */ typedef -int (*HDRadd) (Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); +int (*HDRadd) (Header h, rpm_tag_t tag, rpm_tagtype_t type, + rpm_constdata_t p, rpm_count_t c); /** \ingroup header * Append element to tag array in header. @@ -213,7 +214,8 @@ int (*HDRadd) (Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_ * @return 1 on success, 0 on failure */ typedef -int (*HDRappend) (Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); +int (*HDRappend) (Header h, rpm_tag_t tag, rpm_tagtype_t type, + rpm_constdata_t p, rpm_count_t c); /** \ingroup header * Add or append element to tag array in header. @@ -226,7 +228,8 @@ int (*HDRappend) (Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, r * @return 1 on success, 0 on failure */ typedef -int (*HDRaddorappend) (Header h, rpm_tag_t tag, rpm_tagtype_t type, const void * p, rpm_count_t c); +int (*HDRaddorappend) (Header h, rpm_tag_t tag, rpm_tagtype_t type, + rpm_constdata_t p, rpm_count_t c); /** \ingroup header * Add locale specific tag to header. @@ -263,7 +266,8 @@ 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, rpm_tagtype_t type, const void * p, rpm_count_t c); +int (*HDRmodify) (Header h, rpm_tag_t tag, rpm_tagtype_t type, + rpm_constdata_t p, rpm_count_t c); /** \ingroup header * Delete tag in header. @@ -332,7 +336,7 @@ typedef int (*HDRnextiter) (HeaderIterator hi, rpm_tag_t * tag, rpm_tagtype_t * type, - hPTR_t * p, + rpm_data_t * p, rpm_count_t * c); /** \ingroup header diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 5122d71..1fcd18e 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -1184,9 +1184,9 @@ if (rc == 0) continue; } - xx = hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL); - xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); - xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); + xx = hge(h, RPMTAG_BASENAMES, &bnt, (rpm_data_t *) &baseNames, NULL); + xx = hge(h, RPMTAG_DIRNAMES, &dnt, (rpm_data_t *) &dirNames, NULL); + xx = hge(h, RPMTAG_DIRINDEXES, NULL, (rpm_data_t *) &dirIndexes, NULL); do { fingerPrint fp2; @@ -1862,7 +1862,7 @@ static int mireSkip (const rpmdbMatchIterator mi) for (i = 0; i < mi->mi_nre; i++, mire++) { int anymatch; - if (!hge(mi->mi_h, mire->tag, &t, (void **)&u, &c)) { + if (!hge(mi->mi_h, mire->tag, &t, (rpm_data_t *)&u, &c)) { if (mire->tag != RPMTAG_EPOCH) { ntags++; continue; @@ -2511,7 +2511,7 @@ if (dbiByteSwapped(dbi) == 1) break; } - if (!hge(h, rpmtag, &rpmtype, (void **) &rpmvals, &rpmcnt)) + if (!hge(h, rpmtag, &rpmtype, (rpm_data_t *) &rpmvals, &rpmcnt)) continue; dbi = dbiOpen(db, rpmtag, 0); @@ -2740,7 +2740,7 @@ memset(data, 0, sizeof(*data)); * being written to the package header database. */ - xx = hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count); + xx = hge(h, RPMTAG_BASENAMES, &bnt, (rpm_data_t *) &baseNames, &count); (void) blockSignals(db, &signalMask); @@ -2885,11 +2885,11 @@ data->size = 0; rpmcnt = count; break; case RPMTAG_REQUIRENAME: - xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt); - xx = hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL); + xx = hge(h, rpmtag, &rpmtype, (rpm_data_t *)&rpmvals, &rpmcnt); + xx = hge(h, RPMTAG_REQUIREFLAGS, NULL, (rpm_data_t *)&requireFlags, NULL); break; default: - xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt); + xx = hge(h, rpmtag, &rpmtype, (rpm_data_t *)&rpmvals, &rpmcnt); break; } @@ -3180,9 +3180,9 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */ num = end - start; /* Compute fingerprints for this installed header's matches */ - xx = hge(h, RPMTAG_BASENAMES, &bnt, (void **) &fullBaseNames, NULL); - xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); - xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fullDirIndexes, NULL); + xx = hge(h, RPMTAG_BASENAMES, &bnt, (rpm_data_t *) &fullBaseNames, NULL); + xx = hge(h, RPMTAG_DIRNAMES, &dnt, (rpm_data_t *) &dirNames, NULL); + xx = hge(h, RPMTAG_DIRINDEXES, NULL, (rpm_data_t *) &fullDirIndexes, NULL); baseNames = xcalloc(num, sizeof(*baseNames)); dirIndexes = xcalloc(num, sizeof(*dirIndexes)); diff --git a/tools/rpmcache.c b/tools/rpmcache.c index 006b5e6..9b51566 100644 --- a/tools/rpmcache.c +++ b/tools/rpmcache.c @@ -127,7 +127,7 @@ static int ftsCacheUpdate(rpmts ts) } /* --- Check that identical package is not already cached. */ - if (!hge(ip->h, RPMTAG_SIGMD5, NULL, (void **) &md5, NULL) + if (!hge(ip->h, RPMTAG_SIGMD5, NULL, (rpm_data_t *) &md5, NULL) || md5 == NULL) { rc = 1; @@ -207,8 +207,8 @@ static int ftsStashLatest(FTSENT * fts, rpmts ts) goto exit; } - if (!headerGetEntry(h, RPMTAG_ARCH, NULL, (void **) &arch, NULL) - || !headerGetEntry(h, RPMTAG_OS, NULL, (void **) &os, NULL)) + if (!headerGetEntry(h, RPMTAG_ARCH, NULL, (rpm_data_t *) &arch, NULL) + || !headerGetEntry(h, RPMTAG_OS, NULL, (rpm_data_t *) &os, NULL)) goto exit; /* Make sure arch and os match this platform. */ diff --git a/tools/rpminject.c b/tools/rpminject.c index fca32fc..1a74458 100644 --- a/tools/rpminject.c +++ b/tools/rpminject.c @@ -119,7 +119,7 @@ static enum cvtaction convertAMD(enum cvtaction ca, rpm_tagtype_t type, } 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, + rpm_data_t valsp, rpm_count_t *countp, void ** nvalsp, rpm_count_t *ncountp, cmd_t *cmds[], int ncmds) { cmd_t *newc = NULL; @@ -195,7 +195,7 @@ Header headerCopyWithConvert(Header h, cmd_t *cmds[], int ncmds) rpm_tag_t tag; rpm_tagtype_t type; rpm_count_t count; - hPTR_t vals; + rpm_data_t vals; HeaderIterator headerIter; Header res = headerNew(); -- 2.7.4