summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire-item.cc1
-rw-r--r--apt-pkg/contrib/cmndline.cc3
-rw-r--r--apt-pkg/contrib/hashes.cc5
-rw-r--r--apt-pkg/contrib/strutl.cc9
-rw-r--r--apt-pkg/deb/debmetaindex.cc6
-rw-r--r--apt-private/private-cacheset.cc9
-rw-r--r--apt-private/private-cmndline.cc7
-rw-r--r--apt-private/private-install.cc6
-rw-r--r--apt-private/private-json-hooks.cc2
-rw-r--r--apt-private/private-show.cc2
-rw-r--r--apt-private/private-source.cc4
-rw-r--r--cmdline/apt-cache.cc15
-rw-r--r--cmdline/apt-extracttemplates.cc2
-rw-r--r--cmdline/apt-get.cc7
-rw-r--r--cmdline/apt-helper.cc2
-rw-r--r--cmdline/apt-internal-solver.cc1
-rw-r--r--ftparchive/contents.cc2
-rw-r--r--ftparchive/multicompress.cc6
-rw-r--r--ftparchive/writer.cc5
-rw-r--r--methods/aptmethod.h4
-rw-r--r--methods/basehttp.cc1
-rw-r--r--methods/cdrom.cc4
-rw-r--r--methods/connect.cc2
-rw-r--r--methods/connect.h2
-rw-r--r--methods/file.cc1
-rw-r--r--methods/http.cc6
-rw-r--r--methods/mirror.cc10
-rw-r--r--methods/rsh.cc4
-rw-r--r--methods/rsh.h4
29 files changed, 60 insertions, 72 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index cbfc91007..58bd6475e 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -3382,7 +3382,6 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *const Owner, pkgSourceList *const Sourc
Trusted = false;
StoreFilename.clear();
- std::set<string> targetComponents, targetCodenames, targetSuites;
std::vector<std::unique_ptr<FileFd>> authconfs;
for (auto Vf = Version.FileList(); Vf.end() == false; ++Vf)
{
diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc
index b2a96cadf..3b844edc2 100644
--- a/apt-pkg/contrib/cmndline.cc
+++ b/apt-pkg/contrib/cmndline.cc
@@ -300,7 +300,8 @@ bool CommandLine::HandleOpt(int &I,int argc,const char *argv[],
// Skip the leading dash
const char *J = argv[I];
- for (; *J != 0 && *J == '-'; J++);
+ for (; *J == '-'; J++)
+ ;
const char *JEnd = strchr(J, '-');
if (JEnd != NULL)
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index d03fb6083..366133b02 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -169,10 +169,7 @@ bool HashStringList::usable() const /*{{{*/
if (forcedType.empty() == true)
{
// See if there is at least one usable hash
- for (auto const &hs: list)
- if (hs.usable())
- return true;
- return false;
+ return std::any_of(list.begin(), list.end(), [](auto const &hs) { return hs.usable(); });
}
return find(forcedType) != NULL;
}
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index e02067e13..860e3fe47 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -239,7 +239,8 @@ bool ParseQuoteWord(const char *&String,string &Res)
{
// Skip leading whitespace
const char *C = String;
- for (;*C != 0 && *C == ' '; C++);
+ for (; *C == ' '; C++)
+ ;
if (*C == 0)
return false;
@@ -287,7 +288,8 @@ bool ParseQuoteWord(const char *&String,string &Res)
Res = Buffer;
// Skip ending white space
- for (;*C != 0 && isspace(*C) != 0; C++);
+ for (; isspace(*C) != 0; C++)
+ ;
String = C;
return true;
}
@@ -300,7 +302,8 @@ bool ParseCWord(const char *&String,string &Res)
{
// Skip leading whitespace
const char *C = String;
- for (;*C != 0 && *C == ' '; C++);
+ for (; *C == ' '; C++)
+ ;
if (*C == 0)
return false;
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index 71e047257..a88b19807 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -986,7 +986,7 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/
return std::find(minus.begin(), minus.end(), v) != minus.end();
}), Values.end());
}
- return Values;
+ return std::move(Values);
}
static std::vector<std::string> parsePlusMinusOptions(std::string const &Name,
std::map<std::string, std::string> const &Options, std::vector<std::string> const &defaultValues)
@@ -1095,8 +1095,8 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/
{
std::vector<std::string> ret;
ret.reserve(Options.size());
- for (auto &&O: Options)
- ret.emplace_back(O.first);
+ std::transform(Options.begin(), Options.end(), std::back_inserter(ret),
+ [](auto &&O) { return O.first; });
std::sort(ret.begin(), ret.end());
return ret;
}
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());
}
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 499c9edc9..acf00bdda 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -136,12 +136,12 @@ static bool DumpPackage(CommandLine &CmdL)
/* */
static map_pointer_t PackageNext(pkgCache::Package const * const P) { return P->NextPackage; }
static map_pointer_t GroupNext(pkgCache::Group const * const G) { return G->Next; }
-template<class T>
-static void ShowHashTableStats(std::string Type,
- T *StartP,
- map_pointer_t *Hashtable,
- unsigned long Size,
- map_pointer_t(*Next)(T const * const))
+template <class T>
+static void ShowHashTableStats(char const *const Type,
+ T *StartP,
+ map_pointer_t *Hashtable,
+ unsigned long Size,
+ map_pointer_t (*Next)(T const *const))
{
// hashtable stats for the HashTable
unsigned long NumBuckets = Size;
@@ -201,8 +201,7 @@ static bool Stats(CommandLine &CmdL)
int NVirt = 0;
int DVirt = 0;
int Missing = 0;
- pkgCache::PkgIterator I = Cache->PkgBegin();
- for (;I.end() != true; ++I)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
{
if (I->VersionList != 0 && I->ProvidesList == 0)
{
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index bc8a27dbe..01b5dbb11 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -326,7 +326,7 @@ static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
int main(int argc, const char **argv) /*{{{*/
{
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_EXTRACTTEMPLATES, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
+ ParseCommandLine(CmdL, APT_CMD::APT_EXTRACTTEMPLATES, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
Go(CmdL);
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 7ef07fbf0..5d81c08a4 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -148,8 +148,7 @@ static bool DoDSelectUpgrade(CommandLine &)
pkgDepCache::ActionGroup group(Cache);
// Install everything with the install flag set
- pkgCache::PkgIterator I = Cache->PkgBegin();
- for (;I.end() != true; ++I)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
{
/* Install the package only if it is a new install, the autoupgrader
will deal with the rest */
@@ -159,7 +158,7 @@ static bool DoDSelectUpgrade(CommandLine &)
/* Now install their deps too, if we do this above then order of
the status file is significant for | groups */
- for (I = Cache->PkgBegin();I.end() != true; ++I)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
{
/* Install the package only if it is a new install, the autoupgrader
will deal with the rest */
@@ -168,7 +167,7 @@ static bool DoDSelectUpgrade(CommandLine &)
}
// Apply erasures now, they override everything else.
- for (I = Cache->PkgBegin();I.end() != true; ++I)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
{
// Remove packages
if (I->SelectedState == pkgCache::State::DeInstall ||
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
index 119cbc4c8..e52fba39f 100644
--- a/cmdline/apt-helper.cc
+++ b/cmdline/apt-helper.cc
@@ -133,7 +133,7 @@ static bool DoSrvLookup(CommandLine &CmdL) /*{{{*/
return true;
}
/*}}}*/
-static const APT::Configuration::Compressor *FindCompressor(std::vector<APT::Configuration::Compressor> const & compressors, std::string name) /*{{{*/
+static const APT::Configuration::Compressor *FindCompressor(std::vector<APT::Configuration::Compressor> const &compressors, std::string const &name) /*{{{*/
{
APT::Configuration::Compressor const * compressor = NULL;
for (auto const & c : compressors)
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index 5c9ca5a35..d22eb75b4 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -67,7 +67,6 @@ static bool WriteSolution(pkgDepCache &Cache, FileFd &output) /*{{{*/
bool Okay = output.Failed() == false;
for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false && likely(Okay); ++Pkg)
{
- std::string action;
if (Cache[Pkg].Delete() == true)
Okay &= EDSP::WriteSolutionStanza(output, "Remove", Pkg.CurrentVer());
else if (Cache[Pkg].NewInstall() == true || Cache[Pkg].Upgrade() == true)
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;
}
diff --git a/methods/aptmethod.h b/methods/aptmethod.h
index 02ef04cf9..5d792ceb7 100644
--- a/methods/aptmethod.h
+++ b/methods/aptmethod.h
@@ -502,10 +502,10 @@ class aptAuthConfMethod : public aptMethod
auto const netrcparts = _config->FindDir("Dir::Etc::netrcparts");
if (netrcparts.empty() == false)
{
- for (auto const &netrc : GetListOfFilesInDir(netrcparts, "conf", true, true))
+ for (auto &&netrcpart : GetListOfFilesInDir(netrcparts, "conf", true, true))
{
authconfs.emplace_back(new FileFd());
- authconfs.back()->Open(netrc, FileFd::ReadOnly);
+ authconfs.back()->Open(netrcpart, FileFd::ReadOnly);
}
}
_error->RevertToStack();
diff --git a/methods/basehttp.cc b/methods/basehttp.cc
index fd5934b40..e659da255 100644
--- a/methods/basehttp.cc
+++ b/methods/basehttp.cc
@@ -349,7 +349,6 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
tmpURI.Access = base + '+' + tmpURI.Access;
if (tmpURI.Access == Binary)
{
- std::string tmpAccess = Uri.Access;
std::swap(tmpURI.Access, Uri.Access);
NextURI = tmpURI;
std::swap(tmpURI.Access, Uri.Access);
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index d024d18d1..4ae64c8d3 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -43,7 +43,7 @@ class CDROMMethod : public aptMethod
bool IsCorrectCD(URI want, string MountPath, string& NewID);
bool AutoDetectAndMount(const URI, string &NewID);
virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE;
- string GetID(string Name);
+ std::string GetID(std::string const &Name);
virtual void Exit() APT_OVERRIDE;
virtual bool Configuration(std::string Message) APT_OVERRIDE;
@@ -77,7 +77,7 @@ void CDROMMethod::Exit()
// CDROMMethod::GetID - Search the database for a matching string /*{{{*/
// ---------------------------------------------------------------------
/* */
-string CDROMMethod::GetID(string Name)
+std::string CDROMMethod::GetID(std::string const &Name)
{
// Search for an ID
const Configuration::Item *Top = Database.Tree("CD");
diff --git a/methods/connect.cc b/methods/connect.cc
index 61968efe0..57dfb6299 100644
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -893,7 +893,7 @@ struct TlsFd : public MethodFd
}
};
-ResultState UnwrapTLS(std::string Host, std::unique_ptr<MethodFd> &Fd,
+ResultState UnwrapTLS(std::string const &Host, std::unique_ptr<MethodFd> &Fd,
unsigned long Timeout, aptMethod *Owner)
{
if (_config->FindB("Acquire::AllowTLS", true) == false)
diff --git a/methods/connect.h b/methods/connect.h
index 86f6d529c..bd6507761 100644
--- a/methods/connect.h
+++ b/methods/connect.h
@@ -42,7 +42,7 @@ ResultState Connect(std::string To, int Port, const char *Service, int DefPort,
std::unique_ptr<MethodFd> &Fd, unsigned long TimeOut, aptMethod *Owner);
ResultState UnwrapSocks(std::string To, int Port, URI Proxy, std::unique_ptr<MethodFd> &Fd, unsigned long Timeout, aptMethod *Owner);
-ResultState UnwrapTLS(std::string To, std::unique_ptr<MethodFd> &Fd, unsigned long Timeout, aptMethod *Owner);
+ResultState UnwrapTLS(std::string const &To, std::unique_ptr<MethodFd> &Fd, unsigned long Timeout, aptMethod *Owner);
void RotateDNS();
diff --git a/methods/file.cc b/methods/file.cc
index 9f4e713b8..80e47f1ad 100644
--- a/methods/file.cc
+++ b/methods/file.cc
@@ -57,7 +57,6 @@ bool FileMethod::Fetch(FetchItem *Itm)
{
if (Itm->LastModified == Buf.st_mtime && Itm->LastModified != 0)
{
- HashStringList const hsl = Itm->ExpectedHashes;
if (Itm->ExpectedHashes.VerifyFile(File))
{
Res.Filename = Itm->DestFile;
diff --git a/methods/http.cc b/methods/http.cc
index a4d187189..0a29109fb 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -349,7 +349,7 @@ static ResultState UnwrapHTTPConnect(std::string Host, int Port, URI Proxy, std:
Out.Read(Req.str());
// Writing from proxy
- while (Out.WriteSpace() > 0)
+ while (Out.WriteSpace())
{
if (WaitFd(Fd->Fd(), true, Timeout) == false)
{
@@ -363,7 +363,7 @@ static ResultState UnwrapHTTPConnect(std::string Host, int Port, URI Proxy, std:
}
}
- while (In.ReadSpace() > 0)
+ while (In.ReadSpace())
{
if (WaitFd(Fd->Fd(), false, Timeout) == false)
{
@@ -389,7 +389,7 @@ static ResultState UnwrapHTTPConnect(std::string Host, int Port, URI Proxy, std:
return ResultState::TRANSIENT_ERROR;
}
- if (In.WriteSpace() > 0)
+ if (In.WriteSpace())
{
// Maybe there is actual data already read, if so we need to buffer it
std::unique_ptr<HttpConnectFd> NewFd(new HttpConnectFd());
diff --git a/methods/mirror.cc b/methods/mirror.cc
index dcf4cbd13..3e382e497 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -56,7 +56,7 @@ class MirrorMethod : public aptMethod /*{{{*/
unsigned long priority = std::numeric_limits<decltype(priority)>::max();
decltype(genrng)::result_type seed = 0;
std::unordered_map<std::string, std::vector<std::string>> tags;
- MirrorInfo(std::string const &u, std::vector<std::string> &&ptags = {}) : uri(u)
+ explicit MirrorInfo(std::string const &u, std::vector<std::string> &&ptags = {}) : uri(u)
{
for (auto &&tag : ptags)
{
@@ -222,8 +222,7 @@ bool MirrorMethod::MirrorListFileRecieved(MirrorListInfo &info, FetchItem *const
[&access](char const *const a) { return APT::String::Endswith(access, std::string("+") + a); }) ||
access == "mirror")
{
- for (auto const &a : disallowLocal)
- limitAccess.emplace_back(a);
+ std::copy(std::begin(disallowLocal), std::end(disallowLocal), std::back_inserter(limitAccess));
}
std::string line;
while (mirrorlist.ReadLine(line))
@@ -323,12 +322,9 @@ std::string MirrorMethod::GetMirrorFileURI(std::string const &Message, FetchItem
if (plus < colon)
{
// started as tor+mirror+http we want to get the file via tor+http
- auto access = uristr.substr(0, colon);
- std::string prefixAccess;
+ auto const access = uristr.substr(0, colon);
if (APT::String::Startswith(access, "mirror") == false)
{
- prefixAccess = uristr.substr(0, plus);
- access.erase(0, plus + 1);
uristr.erase(plus, strlen("mirror") + 1);
return uristr;
}
diff --git a/methods/rsh.cc b/methods/rsh.cc
index 5c08959c6..cc42b43e7 100644
--- a/methods/rsh.cc
+++ b/methods/rsh.cc
@@ -90,7 +90,7 @@ bool RSHConn::Open()
// RSHConn::Connect - Fire up rsh and connect /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool RSHConn::Connect(std::string Host, unsigned int Port, std::string User)
+bool RSHConn::Connect(std::string const &Host, unsigned int Port, std::string const &User)
{
char *PortStr = NULL;
if (Port != 0)
@@ -169,7 +169,7 @@ bool RSHConn::Connect(std::string Host, unsigned int Port, std::string User)
return true;
}
-bool RSHConn::Connect(std::string Host, std::string User)
+bool RSHConn::Connect(std::string const &Host, std::string const &User)
{
return Connect(Host, 0, User);
}
diff --git a/methods/rsh.h b/methods/rsh.h
index acdcb64e3..7545d5815 100644
--- a/methods/rsh.h
+++ b/methods/rsh.h
@@ -35,8 +35,8 @@ class RSHConn
// Raw connection IO
bool WriteMsg(std::string &Text,bool Sync,const char *Fmt,...);
- bool Connect(std::string Host, std::string User);
- bool Connect(std::string Host, unsigned int Port, std::string User);
+ bool Connect(std::string const &Host, std::string const &User);
+ bool Connect(std::string const &Host, unsigned int Port, std::string const &User);
bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
// Connection control