From 35012abf30ec1cfc9b5ee29647d4b1e25d98e99f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 13 Sep 2019 12:01:47 +0200 Subject: Fix some style warnings from cppcheck Unused variable, std::algorithms instead of raw for-loops. There should be no observeable difference in behaviour. Reported-By: cppcheck Gbp-Dch: Ignore --- apt-pkg/contrib/configuration.cc | 9 +++++---- apt-pkg/contrib/fileutl.cc | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 997ef7423..931df9f6c 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1149,10 +1150,10 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool const &AsSectio bool ReadConfigDir(Configuration &Conf,const string &Dir, bool const &AsSectional, unsigned const &Depth) { - bool good = true; - for (auto const &I : GetListOfFilesInDir(Dir, "conf", true, true)) - good = ReadConfigFile(Conf, I, AsSectional, Depth) && good; - return good; + auto const files = GetListOfFilesInDir(Dir, "conf", true, true); + return std::accumulate(files.cbegin(), files.cend(), true, [&](bool good, auto const &file) { + return ReadConfigFile(Conf, file, AsSectional, Depth) && good; + }); } /*}}}*/ // MatchAgainstConfig Constructor /*{{{*/ diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 336f979d6..b83a4bad7 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1781,7 +1781,7 @@ class APT_HIDDEN ZstdFileFdPrivate : public FileFdPrivate #ifdef HAVE_ZSTD ZSTD_DStream *dctx; ZSTD_CStream *cctx; - size_t res; + size_t res = 0; FileFd backend; simple_buffer zstd_buffer; // Count of bytes that the decompressor expects to read next, or buffer size. -- cgit v1.2.3-70-g09d2