RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 11-May-2015 23:10:20 Branch: rpm-5_4 Handle: 2015051121101603 Modified files: (Branch: rpm-5_4) rpm Makefile.am rpm/build .cppcheck.supp Makefile.am expression.c files.c pack.c parsePrep.c rpm/lib .cppcheck.supp Makefile.am psm.c query.c rpmds.c rpmps.c rpmrc.c transaction.c rpm/misc .cppcheck.supp Makefile.am rpm/rpmdb .cppcheck.supp Makefile.am fprint.c header.c package.c pkgio.c rpmdb.c rpmrepo.c rpm/rpmio .cppcheck.supp Makefile.am blake2b.c blake2s.c bson.c fnmatch_loop.c groestl.c lane.c lookup3.c macro.c md6.c mongoc.c rpmdav.c rpmdir.c rpmgit.c rpmhkp.c rpmnix.h rpmodbc.c rpmrpc.c rpmsed.c rpmsql.c rpmssl.c rpm/tools .cppcheck.supp Makefile.am roto.c rpmcache.c rpmfind.c rpmspecdump.c Log: - cppcheck: remove warnings. Summary: Revision Changes Path 2.263.2.38 +0 -2 rpm/Makefile.am 1.1.2.2 +0 -2 rpm/build/.cppcheck.supp 2.80.2.7 +2 -4 rpm/build/Makefile.am 2.35.6.8 +1 -0 rpm/build/expression.c 1.369.2.10 +1 -0 rpm/build/files.c 2.324.2.14 +1 -1 rpm/build/pack.c 2.132.2.10 +3 -3 rpm/build/parsePrep.c 1.1.2.2 +0 -4 rpm/lib/.cppcheck.supp 2.203.2.12 +17 -19 rpm/lib/Makefile.am 2.399.2.20 +2 -2 rpm/lib/psm.c 2.216.2.14 +2 -2 rpm/lib/query.c 2.170.2.31 +5 -4 rpm/lib/rpmds.c 2.35.4.2 +1 -1 rpm/lib/rpmps.c 2.289.4.7 +1 -1 rpm/lib/rpmrc.c 1.429.2.16 +1 -1 rpm/lib/transaction.c 1.1.2.2 +1 -0 rpm/misc/.cppcheck.supp 1.56.2.11 +2 -5 rpm/misc/Makefile.am 1.1.2.2 +0 -7 rpm/rpmdb/.cppcheck.supp 1.134.2.14 +2 -2 rpm/rpmdb/Makefile.am 1.40.4.5 +1 -1 rpm/rpmdb/fprint.c 1.198.2.17 +1 -0 rpm/rpmdb/header.c 1.2.2.9 +1 -0 rpm/rpmdb/package.c 1.121.2.16 +1 -1 rpm/rpmdb/pkgio.c 1.392.2.29 +3 -2 rpm/rpmdb/rpmdb.c 1.4.2.5 +1 -1 rpm/rpmdb/rpmrepo.c 1.1.2.2 +0 -14 rpm/rpmio/.cppcheck.supp 1.293.2.50 +4 -4 rpm/rpmio/Makefile.am 1.1.2.5 +1 -0 rpm/rpmio/blake2b.c 1.1.2.5 +1 -0 rpm/rpmio/blake2s.c 2.4.4.12 +2 -2 rpm/rpmio/bson.c 2.2.8.1 +8 -8 rpm/rpmio/fnmatch_loop.c 2.2.4.2 +1 -1 rpm/rpmio/groestl.c 2.7.2.1 +1 -1 rpm/rpmio/lane.c 1.6.6.7 +3 -3 rpm/rpmio/lookup3.c 2.249.2.28 +1 -1 rpm/rpmio/macro.c 1.3.4.6 +1 -0 rpm/rpmio/md6.c 1.1.2.5 +1 -1 rpm/rpmio/mongoc.c 2.119.2.18 +7 -0 rpm/rpmio/rpmdav.c 2.12.2.10 +4 -4 rpm/rpmio/rpmdir.c 2.1.2.54 +4 -7 rpm/rpmio/rpmgit.c 2.20.2.11 +6 -6 rpm/rpmio/rpmhkp.c 1.20.2.1 +1 -0 rpm/rpmio/rpmnix.h 1.1.2.18 +4 -0 rpm/rpmio/rpmodbc.c 2.99.2.5 +2 -2 rpm/rpmio/rpmrpc.c 1.1.2.5 +1 -1 rpm/rpmio/rpmsed.c 2.59.2.15 +2 -2 rpm/rpmio/rpmsql.c 2.42.2.16 +2 -1 rpm/rpmio/rpmssl.c 1.1.2.2 +0 -5 rpm/tools/.cppcheck.supp 2.170.2.15 +2 -4 rpm/tools/Makefile.am 1.1.2.8 +5 -4 rpm/tools/roto.c 2.41.4.3 +1 -0 rpm/tools/rpmcache.c 2.15.2.6 +5 -5 rpm/tools/rpmfind.c 2.7.8.1 +2 -2 rpm/tools/rpmspecdump.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/Makefile.am ============================================================================ $ cvs diff -u -r2.263.2.37 -r2.263.2.38 Makefile.am --- rpm/Makefile.am 11 May 2015 17:53:26 -0000 2.263.2.37 +++ rpm/Makefile.am 11 May 2015 21:10:16 -0000 2.263.2.38 @@ -219,9 +219,7 @@ syntastic: .syntastic_c_config for SYNDIR in $(SYNDIRS); do make -C $$SYNDIR $> ; done -# --std=posix # --template="{file},{line},{severity},{id},{message}" -# --suppress=obsoleteFunctionsalloca # --template=gcc CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 8 \ --template="{file},{line},{severity},{id},{message}" \ @@ . patch -p0 <<'@@ .' Index: rpm/build/.cppcheck.supp ============================================================================ $ cvs diff -u -r1.1.2.1 -r1.1.2.2 .cppcheck.supp --- rpm/build/.cppcheck.supp 11 May 2015 17:53:26 -0000 1.1.2.1 +++ rpm/build/.cppcheck.supp 11 May 2015 21:10:16 -0000 1.1.2.2 @@ -1,5 +1,4 @@ ConfigurationNotChecked -invalidPrintfArgType_sint invalidscanf_libc memleakOnRealloc nullPointer @@ -7,6 +6,5 @@ redundantAssignment unreadVariable unsignedPositive -uselessAssignmentPtrArg varFuncNullUB variableScope @@ . patch -p0 <<'@@ .' Index: rpm/build/Makefile.am ============================================================================ $ cvs diff -u -r2.80.2.6 -r2.80.2.7 Makefile.am --- rpm/build/Makefile.am 11 May 2015 17:53:27 -0000 2.80.2.6 +++ rpm/build/Makefile.am 11 May 2015 21:10:16 -0000 2.80.2.7 @@ -89,11 +89,9 @@ .syntastic_c_config: Makefile @echo $(COMPILE) | tr ' ' '\n' | sed -e '1d' > $@ -# --std=posix # --template="{file},{line},{severity},{id},{message}" -# --suppress=obsoleteFunctionsalloca # --template=gcc -CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 4 \ +CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 8 \ --template="{file},{line},{severity},{id},{message}" \ --suppressions-list=.cppcheck.supp \ --report-progress \ @@ -102,7 +100,7 @@ -URPM_VENDOR_MANDRIVA \ -URPM_VENDOR_WINDRIVER \ -DHAVE_CONFIG_H \ - --enable=warning,style,performance,portability,information,unusedFunction,missingInclude + --enable=warning,style,performance,portability,information,missingInclude .PHONY: cppcheck cppcheck: @@ . patch -p0 <<'@@ .' Index: rpm/build/expression.c ============================================================================ $ cvs diff -u -r2.35.6.7 -r2.35.6.8 expression.c --- rpm/build/expression.c 1 May 2015 14:37:53 -0000 2.35.6.7 +++ rpm/build/expression.c 11 May 2015 21:10:16 -0000 2.35.6.8 @@ -75,6 +75,7 @@ if (v) { if (v->type == VALUE_TYPE_STRING) v->data.s = _free(v->data.s); + // cppcheck-suppress uselessAssignmentPtrArg v = _free(v); } } @@ . patch -p0 <<'@@ .' Index: rpm/build/files.c ============================================================================ $ cvs diff -u -r1.369.2.9 -r1.369.2.10 files.c --- rpm/build/files.c 27 Sep 2014 15:54:19 -0000 1.369.2.9 +++ rpm/build/files.c 11 May 2015 21:10:16 -0000 1.369.2.10 @@ -1813,6 +1813,7 @@ fileList[count].fileURL = _free(fileList[count].fileURL); fileList[count].langs = _free(fileList[count].langs); } + // cppcheck-suppress uselessAssignmentPtrArg fileList = _free(fileList); return NULL; } @@ . patch -p0 <<'@@ .' Index: rpm/build/pack.c ============================================================================ $ cvs diff -u -r2.324.2.13 -r2.324.2.14 pack.c --- rpm/build/pack.c 17 Sep 2014 03:36:20 -0000 2.324.2.13 +++ rpm/build/pack.c 11 May 2015 21:10:16 -0000 2.324.2.14 @@ -496,7 +496,7 @@ E = (he->p.ui32p ? he->p.ui32p[0] : 0); he->p.ptr = _free(he->p.ptr); if (gotE) { - sprintf(p, "%d:", E); + sprintf(p, "%u:", E); p += strlen(p); } p = stpcpy( stpcpy( stpcpy(p, V) , "-") , R); @@ . patch -p0 <<'@@ .' Index: rpm/build/parsePrep.c ============================================================================ $ cvs diff -u -r2.132.2.9 -r2.132.2.10 parsePrep.c --- rpm/build/parsePrep.c 26 Jul 2013 08:19:37 -0000 2.132.2.9 +++ rpm/build/parsePrep.c 11 May 2015 21:10:16 -0000 2.132.2.10 @@ -177,7 +177,7 @@ zipper = rpmGetPath(zipper, NULL); sprintf(buf, - "echo \"Patch #%d (%s):\"\n" + "echo \"Patch #%u (%s):\"\n" "%s -d < '%s' | %s -p%d %s %s\n" "STATUS=$?\n" "if [ $STATUS -ne 0 ]; then\n" @@ -192,7 +192,7 @@ zipper = _free(zipper); } else { sprintf(buf, - "echo \"Patch #%d (%s):\"\n" + "echo \"Patch #%u (%s):\"\n" "%s -p%d %s %s < '%s'", c, /*@-moduncon@*/ (const char *) basename((char *)fn), @@ -729,7 +729,7 @@ buf_len = 2*80; if ((buf = (char *)malloc(buf_len)) == NULL) return; - xx = snprintf(buf, buf_len, "%s%d:", (sp->flags & RPMFILE_SOURCE) ? "Source" : "Patch", sp->num); + xx = snprintf(buf, buf_len, "%s%u:", (sp->flags & RPMFILE_SOURCE) ? "Source" : "Patch", sp->num); for (i = (int)strlen(buf); i <= 11; i++) buf[i] = ' '; xx = snprintf(buf+i, buf_len-i, "%-52.52s", sp->source); @@ . patch -p0 <<'@@ .' Index: rpm/lib/.cppcheck.supp ============================================================================ $ cvs diff -u -r1.1.2.1 -r1.1.2.2 .cppcheck.supp --- rpm/lib/.cppcheck.supp 11 May 2015 17:53:27 -0000 1.1.2.1 +++ rpm/lib/.cppcheck.supp 11 May 2015 21:10:16 -0000 1.1.2.2 @@ -1,16 +1,12 @@ comparisonError ConfigurationNotChecked duplicateBreak -invalidPrintfArgType_uint memleakOnRealloc nullPointer obsoleteFunctionsalloca oppositeInnerCondition redundantAssignment -unassignedVariable -uninitvar unreadVariable -unusedVariable uselessAssignmentPtrArg varFuncNullUB variableScope @@ . patch -p0 <<'@@ .' Index: rpm/lib/Makefile.am ============================================================================ $ cvs diff -u -r2.203.2.11 -r2.203.2.12 Makefile.am --- rpm/lib/Makefile.am 11 May 2015 17:53:27 -0000 2.203.2.11 +++ rpm/lib/Makefile.am 11 May 2015 21:10:16 -0000 2.203.2.12 @@ -151,6 +151,23 @@ .syntastic_c_config: Makefile @echo $(COMPILE) | tr ' ' '\n' | sed -e '1d' > $@ +# --template="{file},{line},{severity},{id},{message}" +# --template=gcc +CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 8 \ + --template="{file},{line},{severity},{id},{message}" \ + --suppressions-list=.cppcheck.supp \ + --report-progress \ + -UNOTYET -UNOTNOW -UNOTNEEDED -UDYING -UDEAD -UREFERENCE \ + -U__cplusplus -U__LCLINT__ -USWIG \ + -URPM_VENDOR_MANDRIVA \ + -URPM_VENDOR_WINDRIVER \ + -DHAVE_CONFIG_H \ + --enable=warning,style,performance,portability,information,missingInclude + +.PHONY: cppcheck +cppcheck: + $(CPPCHECK) $(AM_CPPFLAGS) $(librpm_la_SOURCES) + .PHONY: sources sources: @echo $(librpm_la_SOURCES:%=lib/%) @@ -192,25 +209,6 @@ #lcov-upload: lcov # rsync -rvz -e ssh --delete lcov/* ??? -# --std=posix -# --template="{file},{line},{severity},{id},{message}" -# --suppress=obsoleteFunctionsalloca -# --template=gcc -CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 4 \ - --template="{file},{line},{severity},{id},{message}" \ - --suppressions-list=.cppcheck.supp \ - --report-progress \ - -UNOTYET -UNOTNOW -UNOTNEEDED -UDYING -UDEAD -UREFERENCE \ - -U__cplusplus -U__LCLINT__ -USWIG \ - -URPM_VENDOR_MANDRIVA \ - -URPM_VENDOR_WINDRIVER \ - -DHAVE_CONFIG_H \ - --enable=warning,style,performance,portability,information,unusedFunction,missingInclude - -.PHONY: cppcheck -cppcheck: - $(CPPCHECK) $(AM_CPPFLAGS) $(librpm_la_SOURCES) - tevr_SOURCES = tevr.c tevr_DEPENDENCIES = librpm.la tevr_LDADD = $(RPM_LDADD_COMMON) @@ . patch -p0 <<'@@ .' Index: rpm/lib/psm.c ============================================================================ $ cvs diff -u -r2.399.2.19 -r2.399.2.20 psm.c --- rpm/lib/psm.c 12 Oct 2014 21:20:54 -0000 2.399.2.19 +++ rpm/lib/psm.c 11 May 2015 21:10:16 -0000 2.399.2.20 @@ -2081,7 +2081,7 @@ rpmuint32_t tecolor = rpmteColor(te); rpmuint32_t * uip; rpmuint32_t installTime[2]; - rpmuint32_t originTime[2]; + rpmuint32_t originTime[2] = {}; rpmuint32_t originTid[2]; int xx = 1; @@ -2397,7 +2397,7 @@ const char * pkgbn; char * pkgdn_buf; - xx = snprintf(tiddn, sizeof(tiddn), "%d", rpmtsGetTid(ts)); + xx = snprintf(tiddn, sizeof(tiddn), "%u", rpmtsGetTid(ts)); bfmt = rpmGetPath(tiddn, "/", "%{_repackage_name_fmt}", NULL); pkgbn = headerSprintf(fi->h, bfmt, NULL, rpmHeaderFormats, NULL); @@ . patch -p0 <<'@@ .' Index: rpm/lib/query.c ============================================================================ $ cvs diff -u -r2.216.2.13 -r2.216.2.14 query.c --- rpm/lib/query.c 27 Sep 2014 15:53:43 -0000 2.216.2.13 +++ rpm/lib/query.c 11 May 2015 21:10:16 -0000 2.216.2.14 @@ -370,8 +370,8 @@ } if (QVA_ISSET(qva->qva_flags, FOR_DUMPFILES)) { - sprintf(te, "%s %d %d %s 0%o ", - fn, (int)fsize, fmtime, fdigest, fmode); + sprintf(te, "%s %llu %u %s 0%o ", + fn,(unsigned long long)fsize, fmtime, fdigest, fmode); te += strlen(te); if (fuser && fgroup) { @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmds.c ============================================================================ $ cvs diff -u -r2.170.2.30 -r2.170.2.31 rpmds.c --- rpm/lib/rpmds.c 23 Feb 2015 10:47:08 -0000 2.170.2.30 +++ rpm/lib/rpmds.c 11 May 2015 21:10:16 -0000 2.170.2.31 @@ -410,7 +410,7 @@ /*@-modfilesys@*/ if (_rpmds_debug < 0) -fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count); +fprintf(stderr, "*** ds %p\t%s[%u]\n", ds, ds->Type, ds->Count); /*@=modfilesys@*/ } @@ -572,7 +572,7 @@ t += sizeof(*EVR); *t = '\0'; EVR[0] = t; - sprintf(t, "%d:", E); + sprintf(t, "%u:", E); t += strlen(t); t = stpcpy( stpcpy( stpcpy( t, V), "-"), R); #if defined(RPM_VENDOR_MANDRIVA) @@ -2725,7 +2725,6 @@ /*@modifies _getconf_path @*/ { const struct _conf_s *c; - size_t clen; long int value; const char * NS = "getconf"; const char *N; @@ -2779,6 +2778,7 @@ /*@switchbreak@*/ break; case CONFSTR: #ifndef __CYGWIN__ + { size_t clen; clen = confstr(c->call_name, (char *) NULL, 0); EVR = (char *) xmalloc(clen+1); *EVR = '\0'; @@ -2787,6 +2787,7 @@ exit (EXIT_FAILURE); } EVR[clen] = '\0'; + } #endif /*@switchbreak@*/ break; } @@ -4332,7 +4333,7 @@ pkgEVR = t = (char *) alloca(nb); *t = '\0'; if (gotE) { - sprintf(t, "%d:", E); + sprintf(t, "%u:", E); t += strlen(t); } t = stpcpy( stpcpy( stpcpy(t, V) , "-") , R); @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmps.c ============================================================================ $ cvs diff -u -r2.35.4.1 -r2.35.4.2 rpmps.c --- rpm/lib/rpmps.c 15 Apr 2012 21:20:58 -0000 2.35.4.1 +++ rpm/lib/rpmps.c 11 May 2015 21:10:16 -0000 2.35.4.2 @@ -48,7 +48,7 @@ /*@globals _rpmpsPool, fileSystem, internalState @*/ /*@modifies pool, _rpmpsPool, fileSystem, internalState @*/ { - rpmps ps; + rpmps ps = NULL; if (_rpmpsPool == NULL) { _rpmpsPool = rpmioNewPool("ps", sizeof(*ps), -1, _rpmps_debug, @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmrc.c ============================================================================ $ cvs diff -u -r2.289.4.6 -r2.289.4.7 rpmrc.c --- rpm/lib/rpmrc.c 27 Sep 2014 15:53:43 -0000 2.289.4.6 +++ rpm/lib/rpmrc.c 11 May 2015 21:10:16 -0000 2.289.4.7 @@ -752,7 +752,7 @@ cp = rpmExpand("%{?__platform}", NULL); if (cp == NULL || cp[0] == '\0') cp = _platform; - if (rpmPlatform(cp) == RPMRC_OK) { + if (rpmPlatform(cp) == RPMRC_OK) #elif defined(WITH_CPUINFO) && defined(WITH_SYCK) if (rpmPlatform(_platform) == RPMRC_OK || rpmCpuinfo() == RPMRC_OK) #else @@ . patch -p0 <<'@@ .' Index: rpm/lib/transaction.c ============================================================================ $ cvs diff -u -r1.429.2.15 -r1.429.2.16 transaction.c --- rpm/lib/transaction.c 24 Sep 2014 14:51:51 -0000 1.429.2.15 +++ rpm/lib/transaction.c 11 May 2015 21:10:17 -0000 1.429.2.16 @@ -2213,7 +2213,7 @@ FPSDEBUG(0, (stderr, "--> %s(%p,%p,0x%x)\n", __FUNCTION__, ts, okProbs, ignoreSet)); if (_rpmts_debug) -fprintf(stderr, "--> %s(%p,%p,0x%x) tsflags 0x%x NElements %u\n", __FUNCTION__, ts, okProbs, (unsigned) ignoreSet, tsflags, rpmtsNElements(ts)); +fprintf(stderr, "--> %s(%p,%p,0x%x) tsflags 0x%x NElements %u\n", __FUNCTION__, ts, okProbs, (unsigned) ignoreSet, tsflags, (unsigned) rpmtsNElements(ts)); /* XXX programmer error segfault avoidance. */ if (rpmtsNElements(ts) <= 0) { @@ . patch -p0 <<'@@ .' Index: rpm/misc/.cppcheck.supp ============================================================================ $ cvs diff -u -r1.1.2.1 -r1.1.2.2 .cppcheck.supp --- rpm/misc/.cppcheck.supp 11 May 2015 17:53:27 -0000 1.1.2.1 +++ rpm/misc/.cppcheck.supp 11 May 2015 21:10:17 -0000 1.1.2.2 @@ -0,0 +1 @@ +ConfigurationNotChecked @@ . patch -p0 <<'@@ .' Index: rpm/misc/Makefile.am ============================================================================ $ cvs diff -u -r1.56.2.10 -r1.56.2.11 Makefile.am --- rpm/misc/Makefile.am 11 May 2015 17:53:27 -0000 1.56.2.10 +++ rpm/misc/Makefile.am 11 May 2015 21:10:17 -0000 1.56.2.11 @@ -98,11 +98,9 @@ .syntastic_c_config: Makefile @echo $(COMPILE) | tr ' ' '\n' | sed -e '1d' > $@ -# --std=posix # --template="{file},{line},{severity},{id},{message}" -# --suppress=obsoleteFunctionsalloca # --template=gcc -CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 4 \ +CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 8 \ --template="{file},{line},{severity},{id},{message}" \ --suppressions-list=.cppcheck.supp \ --report-progress \ @@ -111,8 +109,7 @@ -URPM_VENDOR_MANDRIVA \ -URPM_VENDOR_WINDRIVER \ -DHAVE_CONFIG_H \ - -Dconst \ - --enable=warning,style,performance,portability,information,unusedFunction,missingInclude + --enable=warning,style,performance,portability,information,missingInclude .PHONY: cppcheck cppcheck: @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/.cppcheck.supp ============================================================================ $ cvs diff -u -r1.1.2.1 -r1.1.2.2 .cppcheck.supp --- rpm/rpmdb/.cppcheck.supp 11 May 2015 17:53:28 -0000 1.1.2.1 +++ rpm/rpmdb/.cppcheck.supp 11 May 2015 21:10:17 -0000 1.1.2.2 @@ -1,16 +1,9 @@ arrayIndexOutOfBounds -clarifyCondition ConfigurationNotChecked -invalidPrintfArgType_sint -invalidPrintfArgType_uint -memleak -memleakOnRealloc nullPointer obsoleteFunctionsalloca redundantAssignment unassignedVariable -uninitStructMember -uninitvar unreadVariable unusedStructMember uselessAssignmentPtrArg @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/Makefile.am ============================================================================ $ cvs diff -u -r1.134.2.13 -r1.134.2.14 Makefile.am --- rpm/rpmdb/Makefile.am 11 May 2015 17:53:28 -0000 1.134.2.13 +++ rpm/rpmdb/Makefile.am 11 May 2015 21:10:17 -0000 1.134.2.14 @@ -232,7 +232,7 @@ # --template="{file},{line},{severity},{id},{message}" # --suppress=obsoleteFunctionsalloca # --template=gcc -CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 4 \ +CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 8 \ --template="{file},{line},{severity},{id},{message}" \ --suppressions-list=.cppcheck.supp \ --report-progress \ @@ -241,7 +241,7 @@ -URPM_VENDOR_MANDRIVA \ -URPM_VENDOR_WINDRIVER \ -DHAVE_CONFIG_H \ - --enable=warning,style,performance,portability,information,unusedFunction,missingInclude + --enable=warning,style,performance,portability,information,missingInclude .PHONY: cppcheck cppcheck: @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/fprint.c ============================================================================ $ cvs diff -u -r1.40.4.4 -r1.40.4.5 fprint.c --- rpm/rpmdb/fprint.c 27 Sep 2014 15:52:33 -0000 1.40.4.4 +++ rpm/rpmdb/fprint.c 11 May 2015 21:10:17 -0000 1.40.4.5 @@ -46,7 +46,7 @@ const char * dirName) /*@*/ { - const void ** data; + const void ** data = NULL; if (htGetEntry(cache->ht, dirName, &data, NULL, NULL)) return NULL; @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/header.c ============================================================================ $ cvs diff -u -r1.198.2.16 -r1.198.2.17 header.c --- rpm/rpmdb/header.c 27 Sep 2014 15:52:33 -0000 1.198.2.16 +++ rpm/rpmdb/header.c 11 May 2015 21:10:17 -0000 1.198.2.17 @@ -2202,6 +2202,7 @@ Header nh = headerNew(); HeaderIterator hi; + // cppcheck-suppress memleak for (hi = headerInit(h); headerNext(hi, he, 0); he->p.ptr = _free(he->p.ptr)) @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/package.c ============================================================================ $ cvs diff -u -r1.2.2.8 -r1.2.2.9 package.c --- rpm/rpmdb/package.c 19 Feb 2015 22:05:53 -0000 1.2.2.8 +++ rpm/rpmdb/package.c 11 May 2015 21:10:17 -0000 1.2.2.9 @@ -68,6 +68,7 @@ if (nkeyids < nkeyids_max) { nkeyids++; + // cppcheck-suppress memleakOnRealloc keyids = (unsigned int *) xrealloc(keyids, nkeyids * sizeof(*keyids)); } if (keyids) /* XXX can't happen */ @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/pkgio.c ============================================================================ $ cvs diff -u -r1.121.2.15 -r1.121.2.16 pkgio.c --- rpm/rpmdb/pkgio.c 27 Sep 2014 15:52:34 -0000 1.121.2.15 +++ rpm/rpmdb/pkgio.c 11 May 2015 21:10:17 -0000 1.121.2.16 @@ -509,7 +509,7 @@ /*@globals fileSystem @*/ /*@modifies fd, fileSystem @*/ { - struct rpmlead l; + struct rpmlead l = {}; if (_pkgio_debug) fprintf(stderr, "--> wrLead(%p, %p, %p)\n", fd, ptr, msg); @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmdb.c ============================================================================ $ cvs diff -u -r1.392.2.28 -r1.392.2.29 rpmdb.c --- rpm/rpmdb/rpmdb.c 9 Oct 2014 02:57:33 -0000 1.392.2.28 +++ rpm/rpmdb/rpmdb.c 11 May 2015 21:10:17 -0000 1.392.2.29 @@ -149,6 +149,7 @@ if (bingo) continue; + // cppcheck-suppress memleakOnRealloc dbiTags = (tagStore_t) xrealloc(dbiTags, (dbiNTags + 1) * sizeof(*dbiTags)); dbiTags[dbiNTags].str = xstrdup(o); dbiTags[dbiNTags].tag = tag; @@ -279,7 +280,7 @@ /*@-modfilesys@*/ if (_rpmdb_debug) -fprintf(stderr, "<== dbiOpen(%p, %s(%u), 0x%x) dbi %p = %p[%u:%u]\n", db, tagName(tag), tag, flags, dbi, db->_dbi, (unsigned)dbix, (unsigned)db->db_ndbi); +fprintf(stderr, "<== dbiOpen(%p, %s(%u), 0x%x) dbi %p = %p[%u:%u]\n", db, tagName(tag), (unsigned)tag, flags, dbi, db->_dbi, (unsigned)dbix, (unsigned)db->db_ndbi); /*@=modfilesys@*/ /*@-compdef -nullstate@*/ /* FIX: db->_dbi may be NULL */ @@ -1783,7 +1784,7 @@ int initDbc; /* XXX Secondary db associated with Packages needs cursor record count */ - if (mi && mi->mi_primary && ((initDbc = mi->mi_dbc == NULL) || mi->mi_count == 0)) { + if (mi && mi->mi_primary && ((initDbc = mi->mi_dbc) == NULL || mi->mi_count == 0)) { dbiIndex dbi = dbiOpen(mi->mi_db, mi->mi_rpmtag, 0); DBT k = DBT_INIT; DBT v = DBT_INIT; @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmrepo.c ============================================================================ $ cvs diff -u -r1.4.2.4 -r1.4.2.5 rpmrepo.c --- rpm/rpmdb/rpmrepo.c 23 Sep 2014 18:31:39 -0000 1.4.2.4 +++ rpm/rpmdb/rpmrepo.c 11 May 2015 21:10:17 -0000 1.4.2.5 @@ -804,7 +804,7 @@ if (tail != NULL) { char buf[64]; - size_t tnb = snprintf(buf, sizeof(buf), " packages=\"%d\">\n", + size_t tnb = snprintf(buf, sizeof(buf), " packages=\"%u\">\n", repo->pkgcount); nspew += tnb; nb += Fwrite(buf, 1, tnb, rfile->fd); @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/.cppcheck.supp ============================================================================ $ cvs diff -u -r1.1.2.1 -r1.1.2.2 .cppcheck.supp --- rpm/rpmio/.cppcheck.supp 11 May 2015 17:53:28 -0000 1.1.2.1 +++ rpm/rpmio/.cppcheck.supp 11 May 2015 21:10:17 -0000 1.1.2.2 @@ -1,31 +1,17 @@ arrayIndexOutOfBounds assignIfError bufferAccessOutOfBounds -clarifyCalculation ConfigurationNotChecked -constStatement duplicateBreak -duplicateExpression -incorrectLogicOperator -invalidPrintfArgType_sint -invalidPrintfArgType_uint -invalidScanfArgType_int invalidscanf_libc memleakOnRealloc -multiCondition nullPointer obsoleteFunctionsalloca obsoleteFunctionsgets redundantAssignment -redundantCondition redundantCopy -sizeofDivisionMemfunc -syntaxError unassignedVariable -unhandledCharacters -uninitvar unreadVariable -unsignedPositive unusedStructMember unusedVariable uselessAssignmentArg @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/Makefile.am ============================================================================ $ cvs diff -u -r1.293.2.49 -r1.293.2.50 Makefile.am --- rpm/rpmio/Makefile.am 11 May 2015 17:53:28 -0000 1.293.2.49 +++ rpm/rpmio/Makefile.am 11 May 2015 21:10:18 -0000 1.293.2.50 @@ -381,11 +381,9 @@ #lcov-upload: lcov # rsync -rvz -e ssh --delete lcov/* ??? -# --std=posix # --template="{file},{line},{severity},{id},{message}" -# --suppress=obsoleteFunctionsalloca # --template=gcc -CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 4 \ +CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 8 \ --template="{file},{line},{severity},{id},{message}" \ --suppressions-list=.cppcheck.supp \ --report-progress \ @@ -393,8 +391,10 @@ -U__cplusplus -U__LCLINT__ -USWIG \ -URPM_VENDOR_MANDRIVA \ -URPM_VENDOR_WINDRIVER \ + -U_JLU3_SELFTEST \ + -UDEBUG_MACROS \ -DHAVE_CONFIG_H \ - --enable=warning,style,performance,portability,information,unusedFunction,missingInclude + --enable=warning,style,performance,portability,information,missingInclude .PHONY: cppcheck cppcheck: @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/blake2b.c ============================================================================ $ cvs diff -u -r1.1.2.4 -r1.1.2.5 blake2b.c --- rpm/rpmio/blake2b.c 19 Apr 2015 18:34:40 -0000 1.1.2.4 +++ rpm/rpmio/blake2b.c 11 May 2015 21:10:18 -0000 1.1.2.5 @@ -1103,6 +1103,7 @@ memcpy(S->buf + left, in, inlen); S->buflen += inlen; // Be lazy, do not compress in += inlen; + // cppcheck-suppress duplicateExpression inlen -= inlen; } } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/blake2s.c ============================================================================ $ cvs diff -u -r1.1.2.4 -r1.1.2.5 blake2s.c --- rpm/rpmio/blake2s.c 19 Apr 2015 18:34:40 -0000 1.1.2.4 +++ rpm/rpmio/blake2s.c 11 May 2015 21:10:18 -0000 1.1.2.5 @@ -1008,6 +1008,7 @@ memcpy(S->buf + left, in, inlen); S->buflen += inlen; // Be lazy, do not compress in += inlen; + // cppcheck-suppress duplicateExpression inlen -= inlen; } } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/bson.c ============================================================================ $ cvs diff -u -r2.4.4.11 -r2.4.4.12 bson.c --- rpm/rpmio/bson.c 6 Oct 2014 19:43:57 -0000 2.4.4.11 +++ rpm/rpmio/bson.c 11 May 2015 21:10:18 -0000 2.4.4.12 @@ -6169,7 +6169,7 @@ const bson_t *other) { uint32_t len; - int ret; + int ret = 0; if (bson->len != other->len) { len = MIN (bson->len, other->len); @@ -11180,7 +11180,7 @@ gh...@aladdin.com */ -/* $Id: bson.c,v 2.4.4.11 2014/10/06 19:43:57 jbj Exp $ */ +/* $Id: bson.c,v 2.4.4.12 2015/05/11 21:10:18 jbj Exp $ */ /* Independent implementation of MD5 (RFC 1321). @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/fnmatch_loop.c ============================================================================ $ cvs diff -u -r2.2 -r2.2.8.1 fnmatch_loop.c --- rpm/rpmio/fnmatch_loop.c 27 Sep 2008 13:00:14 -0000 2.2 +++ rpm/rpmio/fnmatch_loop.c 11 May 2015 21:10:18 -0000 2.2.8.1 @@ -1142,7 +1142,7 @@ /* First match the prefix with the current pattern with the current pattern. */ if (FCT (list->str, string, rs, no_leading_period, - flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, + (flags & FNM_FILE_NAME) ? flags : (flags & ~FNM_PERIOD), NULL) == 0 /* This was successful. Now match the rest with the rest of the pattern. */ @@ -1150,8 +1150,8 @@ rs == string ? no_leading_period : rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0, - flags & FNM_FILE_NAME - ? flags : flags & ~FNM_PERIOD, NULL) == 0 + (flags & FNM_FILE_NAME) + ? flags : (flags & ~FNM_PERIOD), NULL) == 0 /* This didn't work. Try the whole pattern. */ || (rs != string && FCT (pattern - 1, rs, string_end, @@ -1159,8 +1159,8 @@ ? no_leading_period : (rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0), - flags & FNM_FILE_NAME - ? flags : flags & ~FNM_PERIOD, NULL) == 0))) + (flags & FNM_FILE_NAME) + ? flags : (flags & ~FNM_PERIOD), NULL) == 0))) /* It worked. Signal success. */ return 0; } @@ -1182,7 +1182,7 @@ pattern list. */ if (FCT (STRCAT (list->str, p), string, string_end, no_leading_period, - flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, + (flags & FNM_FILE_NAME) ? flags : (flags & ~FNM_PERIOD), NULL) == 0) /* It worked. Signal success. */ return 0; @@ -1198,7 +1198,7 @@ for (runp = list; runp != NULL; runp = runp->next) if (FCT (runp->str, string, rs, no_leading_period, - flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, + (flags & FNM_FILE_NAME) ? flags : (flags & ~FNM_PERIOD), NULL) == 0) break; @@ -1208,7 +1208,7 @@ rs == string ? no_leading_period : rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0, - flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, + (flags & FNM_FILE_NAME) ? flags : (flags & ~FNM_PERIOD), NULL) == 0)) /* This is successful. */ return 0; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/groestl.c ============================================================================ $ cvs diff -u -r2.2.4.1 -r2.2.4.2 groestl.c --- rpm/rpmio/groestl.c 8 Jul 2013 20:21:21 -0000 2.2.4.1 +++ rpm/rpmio/groestl.c 11 May 2015 21:10:18 -0000 2.2.4.2 @@ -17,7 +17,7 @@ typedef enum { P512 = 0, Q512 = 1, P1024 = 2, Q1024 = 3 } Variant; #define mul1(b) ((u8)(b)) -#define mul2(b) ((u8)((b)>>7?((b)<<1)^0x1b:((b)<<1))) +#define mul2(b) ((u8)(((b)>>7)?((b)<<1)^0x1b:((b)<<1))) #define mul3(b) (mul2(b)^mul1(b)) #define mul4(b) mul2(mul2(b)) #define mul5(b) (mul4(b)^mul1(b)) @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/lane.c ============================================================================ $ cvs diff -u -r2.7 -r2.7.2.1 lane.c --- rpm/rpmio/lane.c 18 Oct 2010 07:56:13 -0000 2.7 +++ rpm/rpmio/lane.c 11 May 2015 21:10:18 -0000 2.7.2.1 @@ -2899,7 +2899,7 @@ /* And finally, save the last, incomplete message block */ if (bytes || (databitlen & 0x7)) { - memcpy(sp->buffer, data, databitlen & 0x7 ? bytes+1 : bytes); /* also copy partial byte */ + memcpy(sp->buffer, data, (databitlen & 0x7) ? bytes+1 : bytes); /* also copy partial byte */ sp->ctr += (bytes << 3) + (databitlen & 0x7); } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/lookup3.c ============================================================================ $ cvs diff -u -r1.6.6.6 -r1.6.6.7 lookup3.c --- rpm/rpmio/lookup3.c 27 Sep 2014 15:51:21 -0000 1.6.6.6 +++ rpm/rpmio/lookup3.c 11 May 2015 21:10:18 -0000 1.6.6.7 @@ -852,7 +852,7 @@ printf("Some bit didn't change: "); printf("%.8x %.8x %.8x %.8x %.8x %.8x ", e[0],f[0],g[0],h[0],x[0],y[0]); - printf("i %d j %d m %d len %d\n", i, j, m, hlen); + printf("i %u j %u m %u len %d\n", i, j, m, hlen); } if (z == MAXPAIR) goto done; } @@ -860,7 +860,7 @@ } done: if (z < MAXPAIR) { - printf("Mix success %2d bytes %2d initvals ",i,m); + printf("Mix success %2u bytes %2u initvals ",i,m); printf("required %d trials\n", z/2); } } @@ -936,7 +936,7 @@ x = jlu32l(m, b, len); y = jlu32l(m, b, len); if ((ref != x) || (ref != y)) - printf("alignment error: %.8x %.8x %.8x %d %d\n",ref,x,y, h, i); + printf("alignment error: %.8x %.8x %.8x %u %u\n",ref,x,y, h, i); } } } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/macro.c ============================================================================ $ cvs diff -u -r2.249.2.27 -r2.249.2.28 macro.c --- rpm/rpmio/macro.c 25 Oct 2014 18:12:00 -0000 2.249.2.27 +++ rpm/rpmio/macro.c 11 May 2015 21:10:18 -0000 2.249.2.28 @@ -2989,7 +2989,7 @@ { size_t bufn = _macro_BUFSIZ; char *buf = (char *) alloca(bufn); - int lineno = 0; + unsigned lineno = 0; int rc = -1; FD_t fd; int xx; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/md6.c ============================================================================ $ cvs diff -u -r1.3.4.5 -r1.3.4.6 md6.c --- rpm/rpmio/md6.c 30 Sep 2014 22:31:43 -0000 1.3.4.5 +++ rpm/rpmio/md6.c 11 May 2015 21:10:18 -0000 1.3.4.6 @@ -884,6 +884,7 @@ if (st == NULL) return MD6_NULLSTATE; if ( (key != NULL) && ((keylen < 0) || (keylen > k*(w/8))) ) return MD6_BADKEYLEN; + // cppcheck-suppress redundantCondition if ( d < 1 || d > 512 || d > w*c/2 ) return MD6_BADHASHLEN; md6_detect_byte_order(); @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/mongoc.c ============================================================================ $ cvs diff -u -r1.1.2.4 -r1.1.2.5 mongoc.c --- rpm/rpmio/mongoc.c 6 Oct 2014 19:43:58 -0000 1.1.2.4 +++ rpm/rpmio/mongoc.c 11 May 2015 21:10:18 -0000 1.1.2.5 @@ -301,7 +301,7 @@ bson_return_val_if_fail(buffer, false); bson_return_val_if_fail(stream, false); -#ifdef ALWAYS_TRUE +#ifdef DYING bson_return_val_if_fail(min_bytes >= 0, false); #endif @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmdav.c ============================================================================ $ cvs diff -u -r2.119.2.17 -r2.119.2.18 rpmdav.c --- rpm/rpmio/rpmdav.c 11 Oct 2014 12:56:38 -0000 2.119.2.17 +++ rpm/rpmio/rpmdav.c 11 May 2015 21:10:18 -0000 2.119.2.18 @@ -100,6 +100,7 @@ static FD_t ud2fd(void * userdata, const char * value, const char * tag) { assert(userdata != NULL); +// cppcheck-suppress incorrectLogicOperator assert(value == NULL || value != NULL); assert(tag != NULL); FD_t ctrl = (FD_t) userdata; @@ -119,6 +120,7 @@ { if (userdata == NULL) fprintf(stderr, "?!? %s -> %s\n", label, __FUNCTION__); assert(userdata != NULL); +// cppcheck-suppress incorrectLogicOperator assert(value == NULL || value != NULL); assert(tag != NULL); FD_t ctrl = (FD_t) userdata; @@ -478,6 +480,7 @@ ne_session * sess = req2sess(req, userdata, __FUNCTION__); FD_t fd = (FD_t) ne_get_request_private(req, req_fd_id); +// cppcheck-suppress incorrectLogicOperator assert(fd == NULL || fd != NULL); /* Hack: fd == NULL for OPTIONS */ DAVDEBUG(1, (stderr, "-> %s\n", buf->data)); /* XXX for wget debugging */ @@ -490,6 +493,7 @@ ne_session * sess = req2sess(req, userdata, __FUNCTION__); FD_t fd = (FD_t) ne_get_request_private(req, req_fd_id); +// cppcheck-suppress incorrectLogicOperator assert(fd == NULL || fd != NULL); /* Hack: fd == NULL for OPTIONS */ HOOKDEBUG(-1, (stderr, "<-- %s(%p,%p,%p) sess %p fd %p %s\n", __FUNCTION__, req, userdata, status, sess, fd, ne_get_error(sess))); @@ -502,6 +506,7 @@ FD_t fd = (FD_t) ne_get_request_private(req, req_fd_id); int rc = NE_OK; +// cppcheck-suppress incorrectLogicOperator assert(fd == NULL || fd != NULL); /* Hack: fd == NULL for OPTIONS */ /* HACK: davConnect() -> ne_options2() breaks DAV callbacks. */ @@ -540,6 +545,7 @@ ne_session * sess = req2sess(req, userdata, __FUNCTION__); FD_t fd = (FD_t) ne_get_request_private(req, req_fd_id); +// cppcheck-suppress incorrectLogicOperator assert(fd == NULL || fd != NULL); /* Hack: fd == NULL for OPTIONS */ /* HACK: davConnect() -> ne_options2() needs fd->req unregistered. */ @@ -789,6 +795,7 @@ if (u->url != NULL && u->sess == NULL) switch (u->ut) { default: + // cppcheck-suppress duplicateExpression assert(u->ut != u->ut); break; case URL_IS_HTTPS: @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmdir.c ============================================================================ $ cvs diff -u -r2.12.2.9 -r2.12.2.10 rpmdir.c --- rpm/rpmio/rpmdir.c 25 Oct 2014 17:33:29 -0000 2.12.2.9 +++ rpm/rpmio/rpmdir.c 11 May 2015 21:10:18 -0000 2.12.2.10 @@ -385,18 +385,18 @@ { AVDIR avdir = (AVDIR)dir; off_t offset = -1; - struct dirent * dp; - const char ** av; - int ac; + const char ** av = NULL; + int ac = 0; if (avdir != NULL && ISAVMAGIC(avdir) && avdir->data != NULL) { + struct dirent * dp; dp = (struct dirent *) avdir->data; av = (const char **) (dp + 1); ac = (int)avdir->size; offset = avdir->offset; } - if (offset < 0 || offset >= ac || av[offset] == NULL) + if (offset < 0 || offset >= ac || av == NULL || av[offset] == NULL) errno = EBADF; return offset; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmgit.c ============================================================================ $ cvs diff -u -r2.1.2.53 -r2.1.2.54 rpmgit.c --- rpm/rpmio/rpmgit.c 16 Feb 2015 21:34:06 -0000 2.1.2.53 +++ rpm/rpmio/rpmgit.c 11 May 2015 21:10:18 -0000 2.1.2.54 @@ -1252,7 +1252,7 @@ directory, recursively. -n, --dry-run - Donât actually add the file(s), just show if they exist. + Dont actually add the file(s), just show if they exist. -v, --verbose Be verbose. @@ -1263,7 +1263,7 @@ -i, --interactive Add modified contents in the working tree interactively to the index. Optional path arguments may be supplied to limit operation - to a subset of the working tree. See âInteractive modeâ for + to a subset of the working tree. See "Interactive mode" for details. -p, --patch @@ -1273,7 +1273,7 @@ This effectively runs add --interactive, but bypasses the initial command menu and directly jumps to the patch subcommand. See - âInteractive modeâ for details. + "Interactive mode" for details. -e, --edit Open the diff vs. the index in an editor and let the user edit it. @@ -1308,7 +1308,7 @@ with git diff and committing them with git commit -a. --refresh - Donât add the file(s), but only refresh their stat() information in + Dont add the file(s), but only refresh their stat() information in the index. --ignore-errors @@ -1871,9 +1871,6 @@ git_diff_tree_to_index(&diff, git->R, t1, NULL, &o.diffopts)); } else if (t1) - xx = chkgit(git, "git_diff_tree_to_index", - git_diff_tree_to_index(&diff, git->R, t1, NULL, &o.diffopts)); - else if (t1) xx = chkgit(git, "git_diff_tree_to_workdir_with_index", git_diff_tree_to_workdir_with_index(&diff, git->R, t1, &o.diffopts)); else @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmhkp.c ============================================================================ $ cvs diff -u -r2.20.2.10 -r2.20.2.11 rpmhkp.c --- rpm/rpmio/rpmhkp.c 16 Feb 2015 21:44:27 -0000 2.20.2.10 +++ rpm/rpmio/rpmhkp.c 11 May 2015 21:10:19 -0000 2.20.2.11 @@ -585,7 +585,7 @@ rpmhkpUpdate(ctx, hkp->goop, 3); rpmhkpUpdate(ctx, pp->u.h, pp->hlen); -HKPDEBUG((stderr, "<-- %s(%p,%d,%u) ctx %p\n", __FUNCTION__, hkp, ix, dalgo, ctx)); +HKPDEBUG((stderr, "<-- %s(%p,%d,%u) ctx %p\n", __FUNCTION__, hkp, ix, (unsigned) dalgo, ctx)); return ctx; } @@ -610,7 +610,7 @@ rpmhkpUpdate(ctx, hkp->goop, 5); rpmhkpUpdate(ctx, pp->u.h, pp->hlen); -HKPDEBUG((stderr, "<-- %s(%p,%d,%u) ctx %p\n", __FUNCTION__, hkp, ix, dalgo, ctx)); +HKPDEBUG((stderr, "<-- %s(%p,%d,%u) ctx %p\n", __FUNCTION__, hkp, ix, (unsigned) dalgo, ctx)); return ctx; } @@ -633,7 +633,7 @@ rpmhkpUpdate(ctx, hkp->goop, 3); rpmhkpUpdate(ctx, pp->u.h, pp->hlen); -HKPDEBUG((stderr, "<-- %s(%p,%d,%u) ctx %p\n", __FUNCTION__, hkp, ix, dalgo, ctx)); +HKPDEBUG((stderr, "<-- %s(%p,%d,%u) ctx %p\n", __FUNCTION__, hkp, ix, (unsigned) dalgo, ctx)); return ctx; } @@ -643,7 +643,7 @@ { DIGEST_CTX ctx = NULL; -HKPDEBUG((stderr, "--> %s(%p,%d,%u,%u)\n", __FUNCTION__, hkp, keyx, sigtype, dalgo)); +HKPDEBUG((stderr, "--> %s(%p,%d,%u,%u)\n", __FUNCTION__, hkp, keyx, (unsigned) sigtype, (unsigned) dalgo)); switch (sigtype) { case PGPSIGTYPE_BINARY: @@ -687,7 +687,7 @@ break; } -HKPDEBUG((stderr, "<-- %s(%p,%d,%u,%u) ctx %p\n", __FUNCTION__, hkp, keyx, sigtype, dalgo, ctx)); +HKPDEBUG((stderr, "<-- %s(%p,%d,%u,%u) ctx %p\n", __FUNCTION__, hkp, keyx, (unsigned) sigtype, (unsigned) dalgo, ctx)); return ctx; } @@ -1177,7 +1177,7 @@ fprintf(fp, "\t vsflags: 0x%08x\n", dig->vsflags); fprintf(fp, "\t findPubkey: %p\n", dig->findPubkey); fprintf(fp, "\t _ts: %p\n", dig->_ts); - fprintf(fp, "\t ppkts: %p[%u]\n", dig->ppkts, dig->npkts); + fprintf(fp, "\t ppkts: %p[%u]\n", dig->ppkts, (unsigned) dig->npkts); fprintf(fp, "\t nbytes: 0x%08x\n", (unsigned) dig->nbytes); fprintf(fp, "\t hsha: %p\n", dig->hsha); @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmnix.h ============================================================================ $ cvs diff -u -r1.20 -r1.20.2.1 rpmnix.h --- rpm/rpmio/rpmnix.h 7 Apr 2010 03:20:06 -0000 1.20 +++ rpm/rpmio/rpmnix.h 11 May 2015 21:10:19 -0000 1.20.2.1 @@ -234,6 +234,7 @@ /*@*/ { NIXDBG((stderr, "\t%s\n", cmd)); + // cppcheck-suppress uselessAssignmentPtrArg cmd = _free(cmd); return NULL; } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmodbc.c ============================================================================ $ cvs diff -u -r1.1.2.17 -r1.1.2.18 rpmodbc.c --- rpm/rpmio/rpmodbc.c 19 Apr 2015 18:34:40 -0000 1.1.2.17 +++ rpm/rpmio/rpmodbc.c 11 May 2015 21:10:19 -0000 1.1.2.18 @@ -846,6 +846,8 @@ (void)dsn_ret; (void)desc_ret; + dsn[0] = '\0'; + desc[0] = '\0'; while (SQL_SUCCEEDED((xx = CHECK(odbc, SQL_HANDLE_ENV, "SQLDataSources", SQLDataSources(env, direction, dsn, sizeof(dsn), &dsn_ret, @@ -879,6 +881,8 @@ (void)driver_ret; (void)attr_ret; + driver[0] = '\0'; + attr[0] = '\0'; while (SQL_SUCCEEDED((xx = CHECK(odbc, SQL_HANDLE_ENV, "SQLDrivers", SQLDrivers(env, direction, driver, sizeof(driver), &driver_ret, @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmrpc.c ============================================================================ $ cvs diff -u -r2.99.2.4 -r2.99.2.5 rpmrpc.c --- rpm/rpmio/rpmrpc.c 23 Sep 2014 18:32:12 -0000 2.99.2.4 +++ rpm/rpmio/rpmrpc.c 11 May 2015 21:10:19 -0000 2.99.2.5 @@ -857,10 +857,10 @@ if (S_ISCHR (st->st_mode) || S_ISBLK (st->st_mode)){ unsigned maj, min; - if (!is_num (idx2) || sscanf(columns [idx2], " %d,", &maj) != 1) + if (!is_num (idx2) || sscanf(columns [idx2], " %u,", &maj) != 1) goto error; - if (!is_num (++idx2) || sscanf(columns [idx2], " %d", &min) != 1) + if (!is_num (++idx2) || sscanf(columns [idx2], " %u", &min) != 1) goto error; #ifdef HAVE_ST_RDEV @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmsed.c ============================================================================ $ cvs diff -u -r1.1.2.4 -r1.1.2.5 rpmsed.c --- rpm/rpmio/rpmsed.c 22 Sep 2014 18:24:27 -0000 1.1.2.4 +++ rpm/rpmio/rpmsed.c 11 May 2015 21:10:19 -0000 1.1.2.5 @@ -91,7 +91,7 @@ nob = 0; err = pcrs_execute(job, sed->ib, nib, &sed->ob, &nob); if (err < 0) { - fprintf(stderr, "%s error: subcmd[%d]=\"%s\": %s(%d) at input line %d\n", + fprintf(stderr, "%s error: subcmd[%d]=\"%s\": %s(%d) at input line %u\n", __FUNCTION__, i, sed->subcmds[i], pcrs_strerror(err), err, ilinenum); goto exit; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmsql.c ============================================================================ $ cvs diff -u -r2.59.2.14 -r2.59.2.15 rpmsql.c --- rpm/rpmio/rpmsql.c 29 Sep 2014 18:26:48 -0000 2.59.2.14 +++ rpm/rpmio/rpmsql.c 11 May 2015 21:10:19 -0000 2.59.2.15 @@ -459,7 +459,7 @@ switch (vtype) { case SQLITE_INTEGER: ll = (unsigned long long) sqlite3_value_int64(v); - snprintf(b, nb, " INT %lld", ll); + snprintf(b, nb, " INT %llu", ll); break; case SQLITE_FLOAT: d = sqlite3_value_double(v); @@ -4337,7 +4337,7 @@ */ sql->mode = RPMSQL_MODE_EXPLAIN; sql->flags |= RPMSQL_FLAGS_SHOWHDR; - memset(sql->colWidth, 0, ArraySize(sql->colWidth)); + memset(sql->colWidth, 0, sizeof(sql->colWidth)); sql->colWidth[0] = 4; /* addr */ sql->colWidth[1] = 13; /* opcode */ sql->colWidth[2] = 4; /* P1 */ @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmssl.c ============================================================================ $ cvs diff -u -r2.42.2.15 -r2.42.2.16 rpmssl.c --- rpm/rpmio/rpmssl.c 24 Sep 2014 13:03:04 -0000 2.42.2.15 +++ rpm/rpmio/rpmssl.c 11 May 2015 21:10:19 -0000 2.42.2.16 @@ -820,11 +820,12 @@ ssl->pkey = EVP_PKEY_new(); xx = EVP_PKEY_assign_EC_KEY(ssl->pkey, ec); assert(xx); + } #else fprintf(stderr, " Q[%4u]: %s\n", mbits, pgpHexStr(p+2, nb-2)); rc = 1; #endif /* !OPENSSL_NO_ECDSA */ - } break; + break; } /*@=moduncon@*/ return rc; @@ . patch -p0 <<'@@ .' Index: rpm/tools/.cppcheck.supp ============================================================================ $ cvs diff -u -r1.1.2.1 -r1.1.2.2 .cppcheck.supp --- rpm/tools/.cppcheck.supp 11 May 2015 17:53:28 -0000 1.1.2.1 +++ rpm/tools/.cppcheck.supp 11 May 2015 21:10:19 -0000 1.1.2.2 @@ -1,16 +1,11 @@ -clarifyCalculation ConfigurationNotChecked -invalidPrintfArgType_sint -invalidPrintfArgType_uint invalidscanf invalidscanf_libc memleakOnRealloc nullPointer obsoleteFunctionsalloca redundantAssignment -selfAssignment unreadVariable unusedVariable -uselessAssignmentPtrArg varFuncNullUB variableScope @@ . patch -p0 <<'@@ .' Index: rpm/tools/Makefile.am ============================================================================ $ cvs diff -u -r2.170.2.14 -r2.170.2.15 Makefile.am --- rpm/tools/Makefile.am 11 May 2015 17:53:28 -0000 2.170.2.14 +++ rpm/tools/Makefile.am 11 May 2015 21:10:19 -0000 2.170.2.15 @@ -378,11 +378,9 @@ .syntastic_c_config: Makefile @echo $(COMPILE) | tr ' ' '\n' | sed -e '1d' > $@ -# --std=posix # --template="{file},{line},{severity},{id},{message}" -# --suppress=obsoleteFunctionsalloca # --template=gcc -CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 4 \ +CPPCHECK = @__CPPCHECK@ -q --force --inline-suppr -j 8 \ --template="{file},{line},{severity},{id},{message}" \ --suppressions-list=.cppcheck.supp \ --report-progress \ @@ -391,7 +389,7 @@ -URPM_VENDOR_MANDRIVA \ -URPM_VENDOR_WINDRIVER \ -DHAVE_CONFIG_H \ - --enable=warning,style,performance,portability,information,unusedFunction,missingInclude + --enable=warning,style,performance,portability,information,missingInclude .PHONY: cppcheck cppcheck: @@ . patch -p0 <<'@@ .' Index: rpm/tools/roto.c ============================================================================ $ cvs diff -u -r1.1.2.7 -r1.1.2.8 roto.c --- rpm/tools/roto.c 16 Aug 2013 19:29:48 -0000 1.1.2.7 +++ rpm/tools/roto.c 11 May 2015 21:10:19 -0000 1.1.2.8 @@ -1298,6 +1298,7 @@ xp->personality = _free(xp->personality); xp->chrootPath = _free(xp->chrootPath); xp->cwd = _free(xp->cwd); + // cppcheck-suppress uselessAssignmentPtrArg xp = _free(xp); } return NULL; @@ -1331,7 +1332,7 @@ pid_t pid = setsid(); int rc = 0; int xx; -pid = pid; +(void)pid; xx = execPersonality(xp); xx = execChroot(xp); @@ -3094,7 +3095,7 @@ const char * dest = rpmGetPath(roto->_rootdir, roto->builddir, "/originals", NULL); int xx = shutilCopy2(srpm, dest); char * fn = rpmGetPath(roto->builddir, "/originals/", srpmFilename, NULL); -xx = xx; +(void)xx; dest = _free(dest); ROTODBG((stderr, "<-- %s() fn %s\n", __FUNCTION__, fn)); return fn; @@ -4021,8 +4022,8 @@ static int oneshot = 0; if (!oneshot) { - fn = fn; - typ = typ; + (void)fn; + (void)typ; oneshot++; } @@ . patch -p0 <<'@@ .' Index: rpm/tools/rpmcache.c ============================================================================ $ cvs diff -u -r2.41.4.2 -r2.41.4.3 rpmcache.c --- rpm/tools/rpmcache.c 26 Apr 2012 17:46:51 -0000 2.41.4.2 +++ rpm/tools/rpmcache.c 11 May 2015 21:10:19 -0000 2.41.4.3 @@ -87,6 +87,7 @@ item->this = NULL; (void)headerFree(item->h); item->h = NULL; + // cppcheck-suppress uselessAssignmentPtrArg item = _free(item); } return NULL; @@ . patch -p0 <<'@@ .' Index: rpm/tools/rpmfind.c ============================================================================ $ cvs diff -u -r2.15.2.5 -r2.15.2.6 rpmfind.c --- rpm/tools/rpmfind.c 17 Feb 2015 18:05:04 -0000 2.15.2.5 +++ rpm/tools/rpmfind.c 11 May 2015 21:10:19 -0000 2.15.2.6 @@ -2152,7 +2152,7 @@ } else name = entry->fts_name; return !fnmatch(plan->c_data, name, - plan->flags & F_IGNCASE ? FNM_CASEFOLD : 0); + (plan->flags & F_IGNCASE) ? FNM_CASEFOLD : 0); } static PLAN * @@ -2262,7 +2262,7 @@ f_path(PLAN *plan, FTSENT *entry) { return !fnmatch(plan->c_data, entry->fts_path, - plan->flags & F_IGNCASE ? FNM_CASEFOLD : 0); + (plan->flags & F_IGNCASE) ? FNM_CASEFOLD : 0); } /* c_path is the same as c_name */ @@ -2387,7 +2387,7 @@ char errbuf[LINE_MAX]; regerror(errcode, pre, errbuf, sizeof errbuf); errx(1, "%s: %s", - plan->flags & F_IGNCASE ? "-iregex" : "-regex", errbuf); + (plan->flags & F_IGNCASE) ? "-iregex" : "-regex", errbuf); } if (errcode == 0 && pmatch.rm_so == 0 && pmatch.rm_eo == len) @@ -2405,12 +2405,12 @@ int errcode; if ((errcode = regcomp(pre, pattern, - regexp_flags | (option->flags & F_IGNCASE ? REG_ICASE : 0))) != 0) + regexp_flags | ((option->flags & F_IGNCASE) ? REG_ICASE : 0))) != 0) { char errbuf[LINE_MAX]; regerror(errcode, pre, errbuf, sizeof errbuf); errx(1, "%s: %s: %s", - option->flags & F_IGNCASE ? "-iregex" : "-regex", + (option->flags & F_IGNCASE) ? "-iregex" : "-regex", pattern, errbuf); } @@ . patch -p0 <<'@@ .' Index: rpm/tools/rpmspecdump.c ============================================================================ $ cvs diff -u -r2.7 -r2.7.8.1 rpmspecdump.c --- rpm/tools/rpmspecdump.c 25 Dec 2008 02:27:16 -0000 2.7 +++ rpm/tools/rpmspecdump.c 11 May 2015 21:10:19 -0000 2.7.8.1 @@ -318,9 +318,9 @@ struct Source *ps = s->sources; while (ps) { const char *type = (ps->flags & RPMFILE_SOURCE) ? "SOURCE" : "PATCH"; - printf("s %sURL%d %s\n", type, ps->num, ps->fullSource); + printf("s %sURL%u %s\n", type, ps->num, ps->fullSource); if (ps->flags & RPMFILE_GHOST) { - printf("s nosource %d\n", ps->num); + printf("s nosource %u\n", ps->num); } ps = ps->next; } @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org