[prev in list] [next in list] [prev in thread] [next in thread]
List: rpm-cvs
Subject: [CVS] RPM: rpm-5_4: rpm/tools/ dbconvert.c hashtab.h rpmgrep.c
From: "Jeff Johnson" <jbj () rpm5 ! org>
Date: 2014-09-29 18:36:46
Message-ID: 20140929183646.D58267B715 () rpm5 ! org
[Download RAW message or body]
RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 29-Sep-2014 20:36:46
Branch: rpm-5_4 Handle: 2014092918364600
Modified files: (Branch: rpm-5_4)
rpm/tools dbconvert.c hashtab.h rpmgrep.c
Log:
- gcc: warnings.
Summary:
Revision Changes Path
2.1.2.19 +26 -31 rpm/tools/dbconvert.c
2.1.22.2 +9 -0 rpm/tools/hashtab.h
2.5.4.2 +1 -2 rpm/tools/rpmgrep.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/tools/dbconvert.c
============================================================================
$ cvs diff -u -r2.1.2.18 -r2.1.2.19 dbconvert.c
--- rpm/tools/dbconvert.c 22 Sep 2014 18:23:33 -0000 2.1.2.18
+++ rpm/tools/dbconvert.c 29 Sep 2014 18:36:46 -0000 2.1.2.19
@@ -68,16 +68,18 @@
int ret = 0;
char **list = NULL;
/* Reset log sequence numbers to allow for moving to new environment */
- if(!(ret = dbenv->log_archive(dbenv, &list, DB_ARCH_DATA|DB_ARCH_ABS))) {
+ if (!(ret = dbenv->log_archive(dbenv, &list, DB_ARCH_DATA|DB_ARCH_ABS))) {
char **p = list;
for(; *p; p++)
- if(!ret)
+ if (!ret)
ret = dbenv->lsn_reset(dbenv, *p, 0);
_free(list);
}
return ret;
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wswitch"
static int
rpmdb_convert(const char *prefix, int dbtype, int swap, int rebuild) {
rpmts tsCur = NULL;
@@ -110,8 +112,8 @@
tsCur = rpmtsCreate();
rpmtsSetRootDir(tsCur, prefix && prefix[0] ? prefix : NULL);
- if(!rpmtsOpenDB(tsCur, O_RDONLY)) {
- if(dbtype == 1) {
+ if (!rpmtsOpenDB(tsCur, O_RDONLY)) {
+ if (dbtype == 1) {
addMacro(NULL, "_dbi_tags", NULL, \
"Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Dirnam \
es:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filedigests:Depends:Pubkeys", \
-1); addMacro(NULL, "_dbi_config", NULL, "%{_dbi_htconfig}", -1);
addMacro(NULL, "_dbi_config_Packages", NULL, "%{_dbi_htconfig} lockdbfd", \
-1); @@ -127,7 +129,7 @@
fn = _free(fn);
addMacro(NULL, "_dbpath", NULL, tmppath, -1);
rpmtsSetRootDir(tsNew, prefix && prefix[0] ? prefix : NULL);
- if(!rpmtsOpenDB(tsNew, O_RDWR)) {
+ if (!rpmtsOpenDB(tsNew, O_RDWR)) {
DBC *dbcpCur = NULL, *dbcpNew = NULL;
rdbNew = rpmtsGetRdb(tsNew);
dbenvNew = rdbNew->db_dbenv;
@@ -135,7 +137,7 @@
dbiIndex dbiNew = dbiOpen(rdbNew, RPMDBI_PACKAGES, 0);
DB_TXN *txnidNew = dbiTxnid(dbiNew);
- if(!(xx = dbiCopen(dbiCur, NULL, NULL, 0)) && !(xx = dbiCopen(dbiNew, \
txnidNew, &dbcpNew, DB_WRITECURSOR))) { + if (!(xx = dbiCopen(dbiCur, NULL, \
NULL, 0)) && !(xx = dbiCopen(dbiNew, txnidNew, &dbcpNew, DB_WRITECURSOR))) { DB * \
_dbN = (DB *) dbiNew->dbi_db; DB * _dbO = (DB *) dbiCur->dbi_db;
DBT key, data;
@@ -150,7 +152,7 @@
_dbO->err(_dbO, xx, "DB->cursor");
}
- if(!(xx = _dbO->stat(_dbO, txnidCur, &dbiCur->dbi_stats, 0))) {
+ if (!(xx = _dbO->stat(_dbO, txnidCur, &dbiCur->dbi_stats, 0))) {
switch(_dbO->type) {
case DB_BTREE:
@@ -179,7 +181,7 @@
}
- if(!xx) {
+ if (!xx) {
uint32_t i = 0;
int doswap = -1;
float pct = 0;
@@ -199,28 +201,28 @@
tmp = pct;
pct = (100*(float)++i/nkeys) + 0.5;
/* TODO: callbacks for status output? */
- if(tmp < (int)(pct+0.5)) {
+ if (tmp < (int)(pct+0.5)) {
fprintf(stderr, "\rconverting %s%s/Packages: %u/%u %d%%", prefix && prefix[0] ? \
prefix : "", tmppath, i, nkeys, (int)pct); }
fflush(stdout);
- if(i == 1 && !*(uint32_t*)key.data)
+ if (i == 1 && !*(uint32_t*)key.data)
continue;
- if(doswap < 0) {
- if((htole32(*(uint32_t*)key.data) > 10000000 && swap < 0) ||
+ if (doswap < 0) {
+ if ((htole32(*(uint32_t*)key.data) > 10000000 && swap < 0) ||
(htole32(*(uint32_t*)key.data) < 10000000 && swap > 0))
doswap = 1;
else
doswap = 0;
}
- if(doswap) {
- if(swap)
+ if (doswap) {
+ if (swap)
*(uint32_t*)key.data = bswap32(*(uint32_t*)key.data);
}
xx = _dbN->put(_dbN, NULL, &key, &data, 0);
}
fprintf(stderr, "\n");
- if(!(xx = dbiCclose(dbiNew, dbcpNew, 0)) && !(xx = dbiCclose(dbiCur, dbcpCur, \
0)) && + if (!(xx = dbiCclose(dbiNew, dbcpNew, 0)) && !(xx = dbiCclose(dbiCur, \
dbcpCur, 0)) && rebuild) {
xx = rpmtsCloseDB(tsCur);
@@ -245,10 +247,6 @@
rpmtsSetVSFlags(tsNew, vsflags);
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wswitch"
-#endif
{
size_t dbix;
fprintf(stderr, "rebuilding rpmdb:\n");
@@ -310,30 +308,27 @@
fn = _free(fn);
/* Remove no longer required transaction logs */
- if(!(xx = bdb_log_archive(dbenvNew, NULL, DB_ARCH_REMOVE)))
+ if (!(xx = bdb_log_archive(dbenvNew, NULL, DB_ARCH_REMOVE)))
xx = bdb_log_lsn_reset(dbenvNew);
xx = rpmtsCloseDB(tsNew);
}
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
}
}
}
}
- if(!xx) {
+ if (!xx) {
const char *dest = NULL;
size_t dbix;
- if(!rpmtsOpenDB(tsNew, O_RDONLY)) {
+ if (!rpmtsOpenDB(tsNew, O_RDONLY)) {
rdbNew = rpmtsGetRdb(tsNew);
for (dbix = 0; dbix < rdbNew->db_ndbi; dbix++) {
tagStore_t dbiTags = &rdbNew->db_tags[dbix];
fn = rpmGetPath(rdbNew->db_root, rdbNew->db_home, "/", dbiTags->str, NULL);
dest = rpmGetPath(rdbNew->db_root, dbpath, "/", dbiTags->str, NULL);
- if(!Stat(dest, &sb))
+ if (!Stat(dest, &sb))
xx = Unlink(dest);
- if(!Stat(fn, &sb)) {
+ if (!Stat(fn, &sb)) {
xx = Rename(fn, dest);
}
fn = _free(fn);
@@ -373,11 +368,11 @@
/* remove indices no longer used */
fn = rpmGetPath(dest, dbpath, "Provideversion", NULL);
- if(!Stat(fn, &sb))
+ if (!Stat(fn, &sb))
xx = Unlink(fn);
fn = _free(fn);
fn = rpmGetPath(dest, dbpath, "Requireversion", NULL);
- if(!Stat(fn, &sb))
+ if (!Stat(fn, &sb))
xx = Unlink(fn);
fn = _free(fn);
@@ -414,6 +409,7 @@
_free(tmppath);
return xx;
}
+#pragma GCC diagnostic pop
char *rootPath = NULL;
int dbType = 0;
@@ -454,11 +450,10 @@
av = poptGetArgs(optCon);
ac = argvCount(av);
- if(ac) {
+ if (ac) {
poptPrintUsage(optCon, stderr, 0);
return 2;
}
-
rc = rpmReadConfigFiles(NULL, NULL);
@@ .
patch -p0 <<'@@ .'
Index: rpm/tools/hashtab.h
============================================================================
$ cvs diff -u -r2.1.22.1 -r2.1.22.2 hashtab.h
--- rpm/tools/hashtab.h 24 Sep 2014 16:19:07 -0000 2.1.22.1
+++ rpm/tools/hashtab.h 29 Sep 2014 18:36:46 -0000 2.1.22.2
@@ -108,6 +108,15 @@
enum insert_option {NO_INSERT, INSERT};
/* The prototypes of the package functions. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#define RPM_GNUC_PURE \
+ __attribute__((__pure__))
+#define RPM_GNUC_MALLOC \
+ __attribute__((__malloc__))
+#else
+#define RPM_GNUC_PURE
+#define RPM_GNUC_MALLOC
+#endif
/* This function is like htab_create, but may return NULL if memory
allocation fails, and also signals that htab_find_slot_with_hash and
@@ .
patch -p0 <<'@@ .'
Index: rpm/tools/rpmgrep.c
============================================================================
$ cvs diff -u -r2.5.4.1 -r2.5.4.2 rpmgrep.c
--- rpm/tools/rpmgrep.c 24 Sep 2014 16:19:07 -0000 2.5.4.1
+++ rpm/tools/rpmgrep.c 29 Sep 2014 18:36:46 -0000 2.5.4.2
@@ -497,10 +497,9 @@
* will be in the middle third most of the time, so the bottom third is
* available for "before" context printing.
*
- * @param handle the fopen'd FILE stream for a normal file
+ * @param fd the Fopen'd FILE stream for a normal file
* the gzFile pointer when reading is via libz
* the BZFILE pointer when reading is via libbz2
- * @param frtype FR_PLAIN, FR_LIBZ, or FR_LIBBZ2
* @param printname the file name if it is to be printed for each match
* or NULL if the file name is not to be printed
* it cannot be NULL if filenames[_nomatch]_only is set
@@ .
______________________________________________________________________
RPM Package Manager http://rpm5.org
CVS Sources Repository rpm-cvs@rpm5.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic