From 9ce3cfc9309c55cc01018c88c1ca82779fd74431 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 16 Jan 2014 22:19:49 +0100 Subject: correct some style/performance/warnings from cppcheck The most "visible" change is from utime to utimensat/futimens as the first one isn't part of POSIX anymore. Reported-By: cppcheck Git-Dch: Ignore --- apt-private/private-list.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'apt-private/private-list.cc') diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index a02ebf02d..898ee7222 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -61,7 +61,7 @@ class PackageNameMatcher : public Matcher /*{{{*/ public: PackageNameMatcher(const char **patterns) { - for(int i=0; patterns[i] != NULL; i++) + for(int i=0; patterns[i] != NULL; ++i) { std::string pattern = patterns[i]; #ifdef PACKAGE_MATCHER_ABI_COMPAT @@ -79,12 +79,12 @@ class PackageNameMatcher : public Matcher /*{{{*/ } virtual ~PackageNameMatcher() { - for(J=filters.begin(); J != filters.end(); J++) + for(J=filters.begin(); J != filters.end(); ++J) delete *J; } virtual bool operator () (const pkgCache::PkgIterator &P) { - for(J=filters.begin(); J != filters.end(); J++) + for(J=filters.begin(); J != filters.end(); ++J) { APT::CacheFilter::PackageMatcher *cachefilter = *J; if((*cachefilter)(P)) @@ -104,7 +104,7 @@ void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ std::ostream &outs) { for (pkgCache::VerIterator Ver = P.VersionList(); - Ver.end() == false; Ver++) + Ver.end() == false; ++Ver) ListSingleVersion(CacheFile, records, Ver, outs); } /*}}}*/ @@ -142,7 +142,7 @@ bool List(CommandLine &Cmd) Cache->Head().PackageCount, _("Listing")); GetLocalitySortedVersionSet(CacheFile, bag, matcher, progress); - for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); V++) + for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); ++V) { std::stringstream outs; if(_config->FindB("APT::Cmd::All-Versions", false) == true) @@ -159,7 +159,7 @@ bool List(CommandLine &Cmd) // FIXME: SORT! and make sorting flexible (alphabetic, by pkg status) // output the sorted map - for (K = output_map.begin(); K != output_map.end(); K++) + for (K = output_map.begin(); K != output_map.end(); ++K) std::cout << (*K).second << std::endl; -- cgit v1.2.3 From 1410955589dc9f0eaa290907cac070b7ebf93b6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 17 Jan 2014 08:43:14 +0100 Subject: add missing integration test for "apt list" --- apt-private/private-list.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'apt-private/private-list.cc') diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index a02ebf02d..fbb66d204 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -101,11 +101,15 @@ private: /*}}}*/ void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ pkgCache::PkgIterator P, - std::ostream &outs) + std::ostream &outs, + bool include_summary=true) { for (pkgCache::VerIterator Ver = P.VersionList(); Ver.end() == false; Ver++) - ListSingleVersion(CacheFile, records, Ver, outs); + { + ListSingleVersion(CacheFile, records, Ver, outs, include_summary); + outs << "\n"; + } } /*}}}*/ // list - list package based on criteria /*{{{*/ @@ -136,7 +140,7 @@ bool List(CommandLine &Cmd) PackageNameMatcher matcher(patterns); LocalitySortedVersionSet bag; - OpTextProgress progress; + OpTextProgress progress(*_config); progress.OverallProgress(0, Cache->Head().PackageCount, Cache->Head().PackageCount, @@ -147,7 +151,7 @@ bool List(CommandLine &Cmd) std::stringstream outs; if(_config->FindB("APT::Cmd::All-Versions", false) == true) { - ListAllVersions(CacheFile, records, V.ParentPkg(), outs); + ListAllVersions(CacheFile, records, V.ParentPkg(), outs, includeSummary); output_map.insert(std::make_pair( V.ParentPkg().Name(), outs.str())); } else { -- cgit v1.2.3 From c3ccac9232c2684b15f75fa8622a9a290aeca123 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 03:11:54 +0100 Subject: warning: no previous declaration for foobar() [-Wmissing-declarations] Git-Dch: Ignore Reported-By: gcc -Wmissing-declarations --- apt-private/private-list.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-private/private-list.cc') diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index 44a766c84..bc4539aeb 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -99,7 +99,7 @@ private: #undef PackageMatcher }; /*}}}*/ -void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ +static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/ pkgCache::PkgIterator P, std::ostream &outs, bool include_summary=true) -- cgit v1.2.3 From 453b82a388013e522b3a1b9fcd6ed0810dab1f4f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Mar 2014 22:11:25 +0100 Subject: cleanup headers and especially #includes everywhere Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use) --- apt-private/private-list.cc | 43 ++++++++++++++----------------------------- 1 file changed, 14 insertions(+), 29 deletions(-) (limited to 'apt-private/private-list.cc') diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index bc4539aeb..7664ca134 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -1,43 +1,28 @@ // Include Files /*{{{*/ #include -#include #include #include #include -#include -#include -#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "private-cmndline.h" -#include "private-list.h" -#include "private-output.h" -#include "private-cacheset.h" +#include #include /*}}}*/ -- cgit v1.2.3