diff options
author | David Kalnischkies <david@kalnischkies.de> | 2017-12-13 23:54:38 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2017-12-13 23:54:38 +0100 |
commit | 99813a2eaa7c0cce1d7d8c811827733ed66458de (patch) | |
tree | 61fe422eeca8c5bd5cb2de6060f11e71343d4602 /apt-pkg/indexcopy.cc | |
parent | d30b30ad1e1ce434df84e15e2573c43ac152f9e3 (diff) | |
parent | 0b5e329a8ba2461ccb7017d3adfc972f9dccd830 (diff) |
Merge branch 'feature/happy-gcc'
Fixing various real and imagined bugs reported by gcc warnings
Diffstat (limited to 'apt-pkg/indexcopy.cc')
-rw-r--r-- | apt-pkg/indexcopy.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index d4cab1a04..cb23a860f 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -58,15 +58,14 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List, // Prepare the progress indicator off_t TotalSize = 0; std::vector<APT::Configuration::Compressor> const compressor = APT::Configuration::getCompressors(); - for (vector<string>::iterator I = List.begin(); I != List.end(); ++I) + for (auto const &F : List) { struct stat Buf; bool found = false; - std::string file = std::string(*I).append(GetFileName()); - for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin(); - c != compressor.end(); ++c) + auto const file = F + GetFileName(); + for (auto const &ext: APT::Configuration::getCompressorExtensions()) { - if (stat((file + c->Extension).c_str(), &Buf) != 0) + if (stat((file + ext).c_str(), &Buf) != 0) continue; found = true; break; @@ -82,9 +81,9 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List, unsigned int WrongSize = 0; unsigned int Packages = 0; for (vector<string>::iterator I = List.begin(); I != List.end(); ++I) - { - string OrigPath = string(*I,CDROM.length()); - + { + std::string OrigPath(*I,CDROM.length()); + // Open the package file FileFd Pkg(*I + GetFileName(), FileFd::ReadOnly, FileFd::Auto); off_t const FileSize = Pkg.Size(); |