diff options
Diffstat (limited to 'apt-private')
-rw-r--r-- | apt-private/private-cacheset.cc | 9 | ||||
-rw-r--r-- | apt-private/private-cmndline.cc | 7 | ||||
-rw-r--r-- | apt-private/private-install.cc | 6 | ||||
-rw-r--r-- | apt-private/private-json-hooks.cc | 2 | ||||
-rw-r--r-- | apt-private/private-show.cc | 2 | ||||
-rw-r--r-- | apt-private/private-source.cc | 4 |
6 files changed, 15 insertions, 15 deletions
diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index 98b842adb..2a5afac7b 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -254,11 +254,12 @@ bool CacheSetHelperAPTGet::showVirtualPackageErrors(pkgCacheFile &Cache) pkgCache::PrvIterator I = Pkg.ProvidesList(); unsigned short provider = 0; for (; I.end() == false; ++I) { - pkgCache::PkgIterator Pkg = I.OwnerPkg(); + pkgCache::PkgIterator const OPkg = I.OwnerPkg(); - if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer()) { - c1out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr(); - if (Cache[Pkg].Install() == true && Cache[Pkg].NewInstall() == false) + if (Cache[OPkg].CandidateVerIter(Cache) == I.OwnerVer()) + { + c1out << " " << OPkg.FullName(true) << " " << I.OwnerVer().VerStr(); + if (Cache[OPkg].Install() == true && Cache[OPkg].NewInstall() == false) c1out << _(" [Installed]"); c1out << std::endl; ++provider; diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 3f43d6eb1..5944e530d 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -16,6 +16,7 @@ #include <stdlib.h> #include <string.h> +#include <algorithm> #include <iomanip> #include <vector> @@ -508,15 +509,15 @@ std::vector<CommandLine::Dispatch> ParseCommandLine(CommandLine &CmdL, APT_CMD c if (likely(argc != 0 && argv[0] != NULL)) BinarySpecificConfiguration(argv[0]); - std::vector<aptDispatchWithHelp> const CmdsWithHelp = GetCommands(); std::vector<CommandLine::Dispatch> Cmds; + std::vector<aptDispatchWithHelp> const CmdsWithHelp = GetCommands(); if (CmdsWithHelp.empty() == false) { CommandLine::Dispatch const help = { "help", [](CommandLine &){return false;} }; Cmds.push_back(std::move(help)); } - for (auto const& cmd : CmdsWithHelp) - Cmds.push_back({cmd.Match, cmd.Handler}); + std::transform(CmdsWithHelp.begin(), CmdsWithHelp.end(), std::back_inserter(Cmds), + [](auto &&cmd) { return CommandLine::Dispatch{cmd.Match, cmd.Handler}; }); char const * CmdCalled = nullptr; if (Cmds.empty() == false && Cmds[0].Handler != nullptr) diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index a5a88c99d..af6697d7f 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -727,8 +727,7 @@ bool AddVolatileSourceFile(pkgSourceList *const SL, PseudoPkg &&pkg, std::vector return false; std::vector<std::string> files; SL->AddVolatileFile(pkg.name, &files); - for (auto &&f: files) - VolatileCmdL.emplace_back(std::move(f), pkg.arch, pkg.release, pkg.index); + std::transform(files.begin(), files.end(), std::back_inserter(VolatileCmdL), [&](auto &&f) { return PseudoPkg{std::move(f), pkg.arch, pkg.release, pkg.index}; }); return true; } @@ -740,8 +739,7 @@ bool AddVolatileBinaryFile(pkgSourceList *const SL, PseudoPkg &&pkg, std::vector return false; std::vector<std::string> files; SL->AddVolatileFile(pkg.name, &files); - for (auto &&f: files) - VolatileCmdL.emplace_back(std::move(f), pkg.arch, pkg.release, pkg.index); + std::transform(files.begin(), files.end(), std::back_inserter(VolatileCmdL), [&](auto &&f) { return PseudoPkg{std::move(f), pkg.arch, pkg.release, pkg.index}; }); return true; } /*}}}*/ diff --git a/apt-private/private-json-hooks.cc b/apt-private/private-json-hooks.cc index 480c4f732..0b765a4ed 100644 --- a/apt-private/private-json-hooks.cc +++ b/apt-private/private-json-hooks.cc @@ -81,7 +81,7 @@ class APT_HIDDEN JsonWriter } public: - explicit JsonWriter(std::ostream &os) : os(os) { old_locale = os.imbue(std::locale::classic()); } + explicit JsonWriter(std::ostream &os) : os(os), old_locale{os.imbue(std::locale::classic())} {} ~JsonWriter() { os.imbue(old_locale); } JsonWriter &beginArray() { diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index b69008ec9..9ebbe6ac0 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -89,7 +89,7 @@ static APT_PURE char const *skipColonSpaces(char const *Buffer, size_t const Len ++Buffer; for (; isspace(*Buffer) != 0 && Length - (Buffer - Start) > 0; ++Buffer) ; - if (Length - (Buffer - Start) <= 0) + if (Length < static_cast<size_t>(Buffer - Start)) return nullptr; return Buffer; } diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc index bbb14b1d8..3964ca48e 100644 --- a/apt-private/private-source.cc +++ b/apt-private/private-source.cc @@ -340,10 +340,10 @@ bool DoSource(CommandLine &CmdL) // Load the requestd sources into the fetcher aptAcquireWithTextStatus Fetcher; std::vector<std::string> UntrustedList; - for (const char **I = CmdL.FileList + 1; *I != 0; I++) + for (const char **cmdl = CmdL.FileList + 1; *cmdl != 0; ++cmdl) { std::string Src; - pkgSrcRecords::Parser *Last = FindSrc(*I,SrcRecs,Src,Cache); + pkgSrcRecords::Parser *Last = FindSrc(*cmdl, SrcRecs, Src, Cache); if (Last == 0) { return _error->Error(_("Unable to find a source package for %s"),Src.c_str()); } |