diff --git a/build/files.c b/build/files.c index d41a08acd9..b93a8b7084 100644 --- a/build/files.c +++ b/build/files.c @@ -2647,6 +2647,7 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, goto exit; #ifdef HAVE_LIBDW +{ /* Check build-ids and add build-ids links for files to package list. */ const char *arch = headerGetString(pkg->header, RPMTAG_ARCH); if (!rstreq(arch, "noarch")) { @@ -2668,6 +2669,7 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, if (fl.processingFailed) goto exit; } +} #endif /* Verify that file attributes scope over hardlinks correctly. */ diff --git a/build/speclua.c b/build/speclua.c index 33755169c9..75ffc7ee96 100644 --- a/build/speclua.c +++ b/build/speclua.c @@ -1,8 +1,6 @@ #include "system.h" -#include - #include "rpmlua.h" #include "rpmbuild_internal.h" diff --git a/include/rpm/rpmtag.h b/include/rpm/rpmtag.h index 7560db8ad7..81538d31fe 100644 --- a/include/rpm/rpmtag.h +++ b/include/rpm/rpmtag.h @@ -459,7 +459,7 @@ typedef enum rpmSigTag_e { /** \ingroup header * The basic types of data in tags from headers. */ -typedef enum rpmTagType_e { +enum rpmTagType_e { #define RPM_MIN_TYPE 1 RPM_NULL_TYPE = 0, RPM_CHAR_TYPE = 1, @@ -474,7 +474,8 @@ typedef enum rpmTagType_e { #define RPM_MAX_TYPE 9 #define RPM_FORCEFREE_TYPE 0xff #define RPM_MASK_TYPE 0x0000ffff -} rpmTagType; +}; +typedef rpmFlags rpmTagType; /** \ingroup rpmtag * The classes of data in tags from headers. diff --git a/lib/backend/ndb/glue.c b/lib/backend/ndb/glue.c index 0c833b6687..949d7ffa30 100644 --- a/lib/backend/ndb/glue.c +++ b/lib/backend/ndb/glue.c @@ -313,7 +313,7 @@ static rpmRC ndb_pkgdbPut(dbiIndex dbi, dbiCursor dbc, unsigned int *hdrNum, un { struct ndbEnv_s *ndbenv = dbc->dbi->dbi_rpmdb->db_dbenv; unsigned int hnum = *hdrNum; - int rc = RPMRC_OK; + rpmRC rc = RPMRC_OK; if (hnum == 0) { rc = rpmpkgNextPkgIdx(dbc->dbi->dbi_db, &hnum); @@ -345,7 +345,7 @@ static rpmRC ndb_pkgdbDel(dbiIndex dbi, dbiCursor dbc, unsigned int hdrNum) /* iterate over all packages */ static rpmRC ndb_pkgdbIter(dbiIndex dbi, dbiCursor dbc, unsigned char **hdrBlob, unsigned int *hdrLen) { - int rc; + rpmRC rc; unsigned int hdrNum; if (!dbc->list) { @@ -376,7 +376,7 @@ static rpmRC ndb_pkgdbIter(dbiIndex dbi, dbiCursor dbc, unsigned char **hdrBlob, static rpmRC ndb_pkgdbGet(dbiIndex dbi, dbiCursor dbc, unsigned int hdrNum, unsigned char **hdrBlob, unsigned int *hdrLen) { - int rc; + rpmRC rc; struct ndbEnv_s *ndbenv = dbc->dbi->dbi_rpmdb->db_dbenv; if (!hdrNum) @@ -422,7 +422,7 @@ static void addtoset(dbiIndexSet *set, unsigned int *pkglist, unsigned int pkgli /* Iterate over all index entries */ static rpmRC ndb_idxdbIter(dbiIndex dbi, dbiCursor dbc, dbiIndexSet *set) { - int rc; + rpmRC rc; if (!dbc->list) { /* setup iteration list on first call */ rc = rpmidxList(dbc->dbi->dbi_db, &dbc->list, &dbc->nlist, &dbc->listdata); @@ -469,7 +469,7 @@ static rpmRC ndb_idxdbIter(dbiIndex dbi, dbiCursor dbc, dbiIndexSet *set) static rpmRC ndb_idxdbGet(dbiIndex dbi, dbiCursor dbc, const char *keyp, size_t keylen, dbiIndexSet *set, int searchType) { - int rc; + rpmRC rc; unsigned int *pkglist = 0, pkglistn = 0; if (!keyp) @@ -478,7 +478,7 @@ static rpmRC ndb_idxdbGet(dbiIndex dbi, dbiCursor dbc, const char *keyp, size_t if (searchType == DBC_PREFIX_SEARCH) { unsigned int *list = 0, nlist = 0, i = 0; unsigned char *listdata = 0; - int rrc = RPMRC_NOTFOUND; + rpmRC rrc = RPMRC_NOTFOUND; rc = rpmidxList(dbc->dbi->dbi_db, &list, &nlist, &listdata); if (rc) return rc; @@ -489,7 +489,7 @@ static rpmRC ndb_idxdbGet(dbiIndex dbi, dbiCursor dbc, const char *keyp, size_t continue; rc = ndb_idxdbGet(dbi, dbc, (char *)k, kl, set, DBC_NORMAL_SEARCH); if (rc == RPMRC_NOTFOUND) - rc = 0; + rc = RPMRC_OK; else rrc = rc; } diff --git a/lib/backend/ndb/rpmidx.c b/lib/backend/ndb/rpmidx.c index 403afd12e0..5b2b7b3b07 100644 --- a/lib/backend/ndb/rpmidx.c +++ b/lib/backend/ndb/rpmidx.c @@ -26,10 +26,6 @@ #include "rpmidx.h" #include "rpmxdb.h" -#define RPMRC_OK 0 -#define RPMRC_NOTFOUND 1 -#define RPMRC_FAIL 2 - /* Index database * * @@ -956,7 +952,7 @@ void rpmidxClose(rpmidxdb idxdb) free(idxdb); } -int rpmidxPut(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int pkgidx, unsigned int datidx) +rpmRC rpmidxPut(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int pkgidx, unsigned int datidx) { int rc; if (!pkgidx || datidx >= 0x80000000) { @@ -969,7 +965,7 @@ int rpmidxPut(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsig return rc; } -int rpmidxDel(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int pkgidx, unsigned int datidx) +rpmRC rpmidxDel(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int pkgidx, unsigned int datidx) { int rc; if (!pkgidx || datidx >= 0x80000000) { @@ -982,7 +978,7 @@ int rpmidxDel(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsig return rc; } -int rpmidxGet(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int **pkgidxlistp, unsigned int *pkgidxnump) +rpmRC rpmidxGet(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int **pkgidxlistp, unsigned int *pkgidxnump) { int rc; *pkgidxlistp = 0; @@ -994,7 +990,7 @@ int rpmidxGet(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsig return rc; } -int rpmidxList(rpmidxdb idxdb, unsigned int **keylistp, unsigned int *nkeylistp, unsigned char **datap) +rpmRC rpmidxList(rpmidxdb idxdb, unsigned int **keylistp, unsigned int *nkeylistp, unsigned char **datap) { int rc; *keylistp = 0; diff --git a/lib/backend/ndb/rpmidx.h b/lib/backend/ndb/rpmidx.h index 9b01fb9af8..f089b028a0 100644 --- a/lib/backend/ndb/rpmidx.h +++ b/lib/backend/ndb/rpmidx.h @@ -4,15 +4,22 @@ struct rpmidxdb_s; typedef struct rpmidxdb_s *rpmidxdb; +#ifdef __cplusplus +extern "C" { +#endif + int rpmidxOpen(rpmidxdb *idxdbp, rpmpkgdb pkgdb, const char *filename, int flags, int mode); int rpmidxOpenXdb(rpmidxdb *idxdbp, rpmpkgdb pkgdb, rpmxdb xdb, unsigned int xdbtag, int flags); int rpmidxDelXdb(rpmpkgdb pkgdb, rpmxdb xdb, unsigned int xdbtag); void rpmidxClose(rpmidxdb idxdbp); -int rpmidxGet(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int **pkgidxlist, unsigned int *pkgidxnum); -int rpmidxPut(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int pkgidx, unsigned int datidx); -int rpmidxDel(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int pkgidx, unsigned int datidx); -int rpmidxList(rpmidxdb idxdb, unsigned int **keylistp, unsigned int *nkeylistp, unsigned char **datap); +rpmRC rpmidxGet(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int **pkgidxlist, unsigned int *pkgidxnum); +rpmRC rpmidxPut(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int pkgidx, unsigned int datidx); +rpmRC rpmidxDel(rpmidxdb idxdb, const unsigned char *key, unsigned int keyl, unsigned int pkgidx, unsigned int datidx); +rpmRC rpmidxList(rpmidxdb idxdb, unsigned int **keylistp, unsigned int *nkeylistp, unsigned char **datap); int rpmidxStats(rpmidxdb idxdb); +#ifdef __cplusplus +} +#endif diff --git a/lib/backend/ndb/rpmpkg.c b/lib/backend/ndb/rpmpkg.c index 0a041e4c08..37dd9f4c1e 100644 --- a/lib/backend/ndb/rpmpkg.c +++ b/lib/backend/ndb/rpmpkg.c @@ -15,11 +15,6 @@ #include "rpmpkg.h" -#define RPMRC_FAIL 2 -#define RPMRC_NOTFOUND 1 -#define RPMRC_OK 0 - - static int rpmpkgVerifyblob(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned int blkoff, unsigned int blkcnt); typedef struct pkgslot_s { @@ -1062,7 +1057,7 @@ void rpmpkgSetFsync(rpmpkgdb pkgdb, int dofsync) } -static int rpmpkgGetInternal(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char **blobp, unsigned int *bloblp) +static rpmRC rpmpkgGetInternal(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char **blobp, unsigned int *bloblp) { pkgslot *slot; unsigned char *blob; @@ -1264,7 +1259,7 @@ static int rpmpkgVerifyInternal(rpmpkgdb pkgdb) return RPMRC_OK; } -int rpmpkgGet(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char **blobp, unsigned int *bloblp) +rpmRC rpmpkgGet(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char **blobp, unsigned int *bloblp) { int rc; @@ -1279,7 +1274,7 @@ int rpmpkgGet(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char **blobp, unsign return rc; } -int rpmpkgPut(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char *blob, unsigned int blobl) +rpmRC rpmpkgPut(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char *blob, unsigned int blobl) { int rc; @@ -1293,7 +1288,7 @@ int rpmpkgPut(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char *blob, unsigned return rc; } -int rpmpkgDel(rpmpkgdb pkgdb, unsigned int pkgidx) +rpmRC rpmpkgDel(rpmpkgdb pkgdb, unsigned int pkgidx) { int rc; @@ -1307,7 +1302,7 @@ int rpmpkgDel(rpmpkgdb pkgdb, unsigned int pkgidx) return rc; } -int rpmpkgList(rpmpkgdb pkgdb, unsigned int **pkgidxlistp, unsigned int *npkgidxlistp) +rpmRC rpmpkgList(rpmpkgdb pkgdb, unsigned int **pkgidxlistp, unsigned int *npkgidxlistp) { int rc; if (pkgidxlistp) @@ -1320,7 +1315,7 @@ int rpmpkgList(rpmpkgdb pkgdb, unsigned int **pkgidxlistp, unsigned int *npkgidx return rc; } -int rpmpkgVerify(rpmpkgdb pkgdb) +rpmRC rpmpkgVerify(rpmpkgdb pkgdb) { int rc; if (rpmpkgLockReadHeader(pkgdb, 0)) @@ -1330,7 +1325,7 @@ int rpmpkgVerify(rpmpkgdb pkgdb) return rc; } -int rpmpkgNextPkgIdx(rpmpkgdb pkgdb, unsigned int *pkgidxp) +rpmRC rpmpkgNextPkgIdx(rpmpkgdb pkgdb, unsigned int *pkgidxp) { if (rpmpkgLockReadHeader(pkgdb, 1) || !pkgdb->nextpkgidx) return RPMRC_FAIL; diff --git a/lib/backend/ndb/rpmpkg.h b/lib/backend/ndb/rpmpkg.h index 6466818bb8..ab324999f0 100644 --- a/lib/backend/ndb/rpmpkg.h +++ b/lib/backend/ndb/rpmpkg.h @@ -1,6 +1,12 @@ +#include + struct rpmpkgdb_s; typedef struct rpmpkgdb_s *rpmpkgdb; +#ifdef __cplusplus +extern "C" { +#endif + int rpmpkgOpen(rpmpkgdb *pkgdbp, const char *filename, int flags, int mode); int rpmpkgSalvage(rpmpkgdb *pkgdbp, const char *filename); void rpmpkgClose(rpmpkgdb pkgdbp); @@ -9,14 +15,17 @@ void rpmpkgSetFsync(rpmpkgdb pkgdbp, int dofsync); int rpmpkgLock(rpmpkgdb pkgdb, int excl); int rpmpkgUnlock(rpmpkgdb pkgdb, int excl); -int rpmpkgGet(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char **blobp, unsigned int *bloblp); -int rpmpkgPut(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char *blob, unsigned int blobl); -int rpmpkgDel(rpmpkgdb pkgdb, unsigned int pkgidx); -int rpmpkgList(rpmpkgdb pkgdb, unsigned int **pkgidxlistp, unsigned int *npkgidxlistp); -int rpmpkgVerify(rpmpkgdb pkgdb); +rpmRC rpmpkgGet(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char **blobp, unsigned int *bloblp); +rpmRC rpmpkgPut(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char *blob, unsigned int blobl); +rpmRC rpmpkgDel(rpmpkgdb pkgdb, unsigned int pkgidx); +rpmRC rpmpkgList(rpmpkgdb pkgdb, unsigned int **pkgidxlistp, unsigned int *npkgidxlistp); +rpmRC rpmpkgVerify(rpmpkgdb pkgdb); -int rpmpkgNextPkgIdx(rpmpkgdb pkgdb, unsigned int *pkgidxp); +rpmRC rpmpkgNextPkgIdx(rpmpkgdb pkgdb, unsigned int *pkgidxp); int rpmpkgGeneration(rpmpkgdb pkgdb, unsigned int *generationp); int rpmpkgStats(rpmpkgdb pkgdb); +#ifdef __cplusplus +} +#endif diff --git a/lib/backend/ndb/rpmxdb.c b/lib/backend/ndb/rpmxdb.c index d9c373cb06..e9c72336ef 100644 --- a/lib/backend/ndb/rpmxdb.c +++ b/lib/backend/ndb/rpmxdb.c @@ -25,10 +25,6 @@ #include "rpmxdb.h" -#define RPMRC_OK 0 -#define RPMRC_NOTFOUND 1 -#define RPMRC_FAIL 2 - typedef struct rpmxdb_s { rpmpkgdb pkgdb; /* main database */ char *filename; diff --git a/lib/backend/ndb/rpmxdb.h b/lib/backend/ndb/rpmxdb.h index ddf02c1bc1..ebf70a7889 100644 --- a/lib/backend/ndb/rpmxdb.h +++ b/lib/backend/ndb/rpmxdb.h @@ -3,6 +3,10 @@ struct rpmxdb_s; typedef struct rpmxdb_s *rpmxdb; +#ifdef __cplusplus +extern "C" { +#endif + int rpmxdbOpen(rpmxdb *xdbp, rpmpkgdb pkgdb, const char *filename, int flags, int mode); void rpmxdbClose(rpmxdb xdb); void rpmxdbSetFsync(rpmxdb xdb, int dofsync); @@ -27,3 +31,6 @@ int rpmxdbGetUserGeneration(rpmxdb xdb, unsigned int *usergenerationp); int rpmxdbStats(rpmxdb xdb); +#ifdef __cplusplus +} +#endif diff --git a/lib/formats.c b/lib/formats.c index 4a80f9e329..4e84f40d4b 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -21,8 +21,6 @@ #include "debug.h" -#define RPM_ANY_CLASS 255 - typedef char * (*headerTagFormatFunction) (rpmtd td, char **emsg); /** \ingroup header @@ -32,7 +30,7 @@ typedef char * (*headerTagFormatFunction) (rpmtd td, char **emsg); struct headerFmt_s { rpmtdFormats fmt; /*!< Value of extension */ const char *name; /*!< Name of extension. */ - rpmTagClass tclass; /*!< Class of source data (RPM_ANY_CLASS for any) */ + rpmTagClass tclass; /*!< Class of source data (RPM_NULL_CLASS for any) */ headerTagFormatFunction func; /*!< Pointer to formatter function. */ }; @@ -571,9 +569,9 @@ static char *tagnumFormat(rpmtd td, char **emsg) static const struct headerFmt_s rpmHeaderFormats[] = { { RPMTD_FORMAT_STRING, "string", - RPM_ANY_CLASS, stringFormat }, + RPM_NULL_CLASS, stringFormat }, { RPMTD_FORMAT_ARMOR, "armor", - RPM_ANY_CLASS, armorFormat }, + RPM_NULL_CLASS, armorFormat }, { RPMTD_FORMAT_BASE64, "base64", RPM_BINARY_CLASS, base64Format }, { RPMTD_FORMAT_PGPSIG, "pgpsig", @@ -591,7 +589,7 @@ static const struct headerFmt_s rpmHeaderFormats[] = { { RPMTD_FORMAT_TRIGGERTYPE, "triggertype", RPM_NUMERIC_CLASS, triggertypeFormat }, { RPMTD_FORMAT_XML, "xml", - RPM_ANY_CLASS, xmlFormat }, + RPM_NULL_CLASS, xmlFormat }, { RPMTD_FORMAT_OCTAL, "octal", RPM_NUMERIC_CLASS, octalFormat }, { RPMTD_FORMAT_HEX, "hex", @@ -601,9 +599,9 @@ static const struct headerFmt_s rpmHeaderFormats[] = { { RPMTD_FORMAT_DAY, "day", RPM_NUMERIC_CLASS, dayFormat }, { RPMTD_FORMAT_SHESCAPE, "shescape", - RPM_ANY_CLASS, shescapeFormat }, + RPM_NULL_CLASS, shescapeFormat }, { RPMTD_FORMAT_ARRAYSIZE, "arraysize", - RPM_ANY_CLASS, arraysizeFormat }, + RPM_NULL_CLASS, arraysizeFormat }, { RPMTD_FORMAT_FSTATE, "fstate", RPM_NUMERIC_CLASS, fstateFormat }, { RPMTD_FORMAT_VFLAGS, "vflags", @@ -617,12 +615,12 @@ static const struct headerFmt_s rpmHeaderFormats[] = { { RPMTD_FORMAT_HUMANIEC, "humaniec", RPM_NUMERIC_CLASS, humaniecFormat }, { RPMTD_FORMAT_TAGNAME, "tagname", - RPM_ANY_CLASS, tagnameFormat }, + RPM_NULL_CLASS, tagnameFormat }, { RPMTD_FORMAT_TAGNUM, "tagnum", - RPM_ANY_CLASS, tagnumFormat }, + RPM_NULL_CLASS, tagnumFormat }, { RPMTD_FORMAT_JSON, "json", - RPM_ANY_CLASS, jsonFormat }, - { -1, NULL, 0, NULL } + RPM_NULL_CLASS, jsonFormat }, + { RPMTD_FORMAT_STRING, NULL, RPM_NULL_CLASS, NULL } }; headerFmt rpmHeaderFormatByName(const char *fmt) @@ -652,7 +650,7 @@ char *rpmHeaderFormatCall(headerFmt fmt, rpmtd td) char *ret = NULL; char *err = NULL; - if (fmt->tclass != RPM_ANY_CLASS && rpmtdClass(td) != fmt->tclass) + if (fmt->tclass != RPM_NULL_CLASS && rpmtdClass(td) != fmt->tclass) err = xstrdup(classEr(fmt->tclass)); else ret = fmt->func(td, &err); diff --git a/lib/rpmscript.c b/lib/rpmscript.c index 3f6313278b..35f9841b42 100644 --- a/lib/rpmscript.c +++ b/lib/rpmscript.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include diff --git a/rpmio/lposix.c b/rpmio/lposix.c index b31c6825ea..6ea7d92fd1 100644 --- a/rpmio/lposix.c +++ b/rpmio/lposix.c @@ -27,16 +27,14 @@ #include #include #include -#include #include "rpmio_internal.h" +#include "rpmlua.h" #define MYNAME "posix" #define MYVERSION MYNAME " library for " LUA_VERSION " / Nov 2003" -#include "lauxlib.h" #include "lposix.h" - #ifndef MYBUFSIZ #define MYBUFSIZ 512 #endif diff --git a/rpmio/macro.c b/rpmio/macro.c index 5769992d45..2813d7c6dc 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -572,6 +572,7 @@ doShellEscape(rpmMacroBuf mb, const char * cmd, size_t clen) char *buf = NULL; FILE *shf; int c; + size_t tpos; if (expandThis(mb, cmd, clen, &buf, NULL)) goto exit; @@ -582,7 +583,7 @@ doShellEscape(rpmMacroBuf mb, const char * cmd, size_t clen) goto exit; } - size_t tpos = mb->tpos; + tpos = mb->tpos; while ((c = fgetc(shf)) != EOF) { rpmMacroBufAppend(mb, c); } diff --git a/rpmio/rpmlog.c b/rpmio/rpmlog.c index 2bb5ab0e34..3ccbe26926 100644 --- a/rpmio/rpmlog.c +++ b/rpmio/rpmlog.c @@ -382,7 +382,7 @@ static void dolog(struct rpmlogRec_s *rec, int saverec) int cbrc = RPMLOG_DEFAULT; int needexit = 0; FILE *clog = NULL; - rpmlogCallbackData *cbdata = NULL; + rpmlogCallbackData cbdata = NULL; rpmlogCallback cbfunc = NULL; rpmlogCtx ctx = rpmlogCtxAcquire(saverec); diff --git a/rpmio/rpmlua.c b/rpmio/rpmlua.c index 6d943a72c5..fa5136a14e 100644 --- a/rpmio/rpmlua.c +++ b/rpmio/rpmlua.c @@ -1,10 +1,5 @@ #include "system.h" -#include -#include -#include -#include "lposix.h" - #ifndef LUA_LOADED_TABLE /* feature introduced in Lua 5.3.4 */ #define LUA_LOADED_TABLE "_LOADED" @@ -31,6 +26,7 @@ #include "rpmlua.h" #include "rpmio_internal.h" #include "rpmmacro_internal.h" +#include "lposix.h" #include "debug.h" @@ -258,6 +254,7 @@ int rpmluaRunScript(rpmlua lua, const char *script, const char *name, lua_State *L = lua->L; int ret = -1; int oind = 0; + int nret = 0; static const char *lualocal = "local opt, arg = ...;"; int otop = lua_gettop(L); /* this can recurse through macros */ @@ -305,7 +302,7 @@ int rpmluaRunScript(rpmlua lua, const char *script, const char *name, goto exit; } - int nret = lua_gettop(L) - otop; + nret = lua_gettop(L) - otop; if (nret > 0 && lua->printbuf) { lua_getglobal(L, "print"); lua_insert(L, -(nret + 1)); @@ -357,7 +354,7 @@ static char *lamereadline(const char *prompt) } /* From lua.c */ -static int rpmluaReadline(lua_State *L, char *prompt, rpmluarl rlcb) +static int rpmluaReadline(lua_State *L, const char *prompt, rpmluarl rlcb) { char *line = rlcb(prompt); if (line) { diff --git a/rpmio/rpmlua.h b/rpmio/rpmlua.h index f8f92216d9..4fee655abd 100644 --- a/rpmio/rpmlua.h +++ b/rpmio/rpmlua.h @@ -6,12 +6,17 @@ typedef struct rpmlua_s * rpmlua; struct rpmhookArgs_s; -typedef char * (*rpmluarl)(const char *); - #ifdef __cplusplus extern "C" { #endif +/* Upstream Lua headers lack C++ protection, include them all centrally */ +#include +#include +#include + +typedef char * (*rpmluarl)(const char *); + rpmlua rpmluaNew(void); rpmlua rpmluaFree(rpmlua lua); rpmlua rpmluaGetGlobalState(void); diff --git a/rpmio/rpmmacro_internal.h b/rpmio/rpmmacro_internal.h index 254c362366..719f833c71 100644 --- a/rpmio/rpmmacro_internal.h +++ b/rpmio/rpmmacro_internal.h @@ -1,6 +1,9 @@ #ifndef _H_MACRO_INTERNAL #define _H_MACRO_INTERNAL +#include +#include + /** \ingroup rpmio * \file rpmmacro_internal.h * diff --git a/tools/elfdeps.c b/tools/elfdeps.c index 40060360e9..2313207947 100644 --- a/tools/elfdeps.c +++ b/tools/elfdeps.c @@ -282,6 +282,7 @@ static int processFile(const char *fn, int dtype) struct stat st; GElf_Ehdr *ehdr, ehdr_mem; elfInfo *ei = rcalloc(1, sizeof(*ei)); + ARGV_t dep = NULL; fdno = open(fn, O_RDONLY); if (fdno < 0 || fstat(fdno, &st) < 0) @@ -333,7 +334,7 @@ static int processFile(const char *fn, int dtype) rc = 0; /* dump the requested dependencies for this file */ - ARGV_t dep = dtype ? ei->requires : ei->provides; + dep = dtype ? ei->requires : ei->provides; if (dep && *dep) { if (multifile) fprintf(stdout, ";%s\n", fn); diff --git a/tools/rpmdump.c b/tools/rpmdump.c index d39fd7573c..f628203d05 100644 --- a/tools/rpmdump.c +++ b/tools/rpmdump.c @@ -156,6 +156,7 @@ static int readhdr(int fd, int sighdr, const char *msg) } } +{ entry = (struct entryInfo *) (blob + 2); uint32_t tag = htonl(entry->tag); struct entryInfo _trailer, *trailer = &_trailer; @@ -191,6 +192,7 @@ static int readhdr(int fd, int sighdr, const char *msg) dumptag(trailer, sighdr, "\t\t"); } } +} printf("\n"); rc = 0; diff --git a/tools/rpmkeys.c b/tools/rpmkeys.c index adb65735c6..c9fa7c3b82 100644 --- a/tools/rpmkeys.c +++ b/tools/rpmkeys.c @@ -88,12 +88,15 @@ int main(int argc, char *argv[]) ec = rpmcliImportPubkeys(ts, args); break; case MODE_DELKEY: + { struct rpmInstallArguments_s * ia = &rpmIArgs; ARGV_t gpgargs = gpgkeyargs(args); ec = rpmErase(ts, ia, gpgargs); argvFree(gpgargs); break; + } case MODE_LISTKEY: + { ARGV_t query = NULL; if (args != NULL) { query = gpgkeyargs(args); @@ -105,6 +108,7 @@ int main(int argc, char *argv[]) ec = rpmcliQuery(ts, &rpmQVKArgs, (ARGV_const_t) query); query = argvFree(query); break; + } default: argerror(_("only one major mode may be specified")); } diff --git a/tools/rpmsign.c b/tools/rpmsign.c index dfd63c1bbb..ec307413f5 100644 --- a/tools/rpmsign.c +++ b/tools/rpmsign.c @@ -28,7 +28,7 @@ static char * fileSigningCert = NULL; static char * verityAlgorithm = NULL; #endif -static struct rpmSignArgs sargs = {NULL, 0, 0}; +static struct rpmSignArgs sargs; static struct poptOption signOptsTable[] = { { "addsign", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR), &mode, MODE_ADDSIGN, diff --git a/tools/rpmuncompress.c b/tools/rpmuncompress.c index c4832332c6..a2163b6601 100644 --- a/tools/rpmuncompress.c +++ b/tools/rpmuncompress.c @@ -202,6 +202,7 @@ int main(int argc, char *argv[]) int ec = EXIT_FAILURE; poptContext optCon = NULL; const char *arg = NULL; + char *cmd = NULL; optCon = rpmcliInit(argc, argv, optionsTable); @@ -210,7 +211,7 @@ int main(int argc, char *argv[]) goto exit; } - char *cmd = extract ? doUntar(arg) : doUncompress(arg); + cmd = extract ? doUntar(arg) : doUncompress(arg); if (cmd) { FILE *inp = NULL;