summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2019-07-08 15:48:59 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2019-07-08 15:51:17 +0200
commit2b734a7ec429825c7007c1093883229e069d36c7 (patch)
treeb67360f3201634c82f5a9e7dd84f47b28fa63acb /ftparchive
parentcbe90ee516d7f747f981e423f164f99eb767240b (diff)
Apply various suggestions by cppcheck
Reported-By: cppcheck
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/contents.cc2
-rw-r--r--ftparchive/multicompress.cc6
-rw-r--r--ftparchive/writer.cc5
3 files changed, 5 insertions, 8 deletions
diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc
index a743283b0..8a7adfd8e 100644
--- a/ftparchive/contents.cc
+++ b/ftparchive/contents.cc
@@ -204,7 +204,7 @@ void GenContents::Add(const char *Dir,const char *Package)
Node *Root = &this->Root;
// Drop leading slashes
- while (*Dir == '/' && *Dir != 0)
+ while (*Dir == '/')
Dir++;
// Run over the string and grab out each bit up to and including a /
diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc
index 19e6563e0..f5fe14164 100644
--- a/ftparchive/multicompress.cc
+++ b/ftparchive/multicompress.cc
@@ -56,12 +56,10 @@ static std::vector<APT::Configuration::Compressor>::const_iterator findMatchingC
// MultiCompress::MultiCompress - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* Setup the file outputs, compression modes and fork the writer child */
-MultiCompress::MultiCompress(string const &Output,string const &Compress,
- mode_t const &Permissions,bool const &Write) :
- Permissions(Permissions)
+MultiCompress::MultiCompress(string const &Output, string const &Compress,
+ mode_t const &Permissions, bool const &Write) : Outputter{-1}, Permissions(Permissions)
{
Outputs = 0;
- Outputter = -1;
UpdateMTime = 0;
auto const Compressors = APT::Configuration::getCompressors();
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index dbc097af6..078638c41 100644
--- a/ftparchive/writer.cc
+++ b/ftparchive/writer.cc
@@ -216,9 +216,8 @@ bool FTWScanner::RecursiveScan(string const &Dir)
std::sort(FilesToProcess.begin(), FilesToProcess.end(), [](PairType a, PairType b) {
return a.first < b.first;
});
- for (PairType it : FilesToProcess)
- if (ProcessFile(it.first.c_str(), it.second) != 0)
- return false;
+ if (not std::all_of(FilesToProcess.cbegin(), FilesToProcess.cend(), [](auto &&it) { return ProcessFile(it.first.c_str(), it.second) == 0; }))
+ return false;
FilesToProcess.clear();
return true;
}