X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/b53c9cea2902572822bbbece5bac236c1bbf846e..8fec289ad8a2c42350c24d5c97b0f104fbbea176:/apt-pkg/aptconfiguration.cc?ds=sidebyside diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index f5bc18394..69f6f6f8d 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -74,8 +74,8 @@ const Configuration::getCompressionTypes(bool const &Cached) { } // setup the defaults for the compressiontypes => method mapping - _config->CndSet("Acquire::CompressionTypes::bz2","bzip2"); _config->CndSet("Acquire::CompressionTypes::xz","xz"); + _config->CndSet("Acquire::CompressionTypes::bz2","bzip2"); _config->CndSet("Acquire::CompressionTypes::lzma","lzma"); _config->CndSet("Acquire::CompressionTypes::gz","gzip"); @@ -94,11 +94,9 @@ const Configuration::getCompressionTypes(bool const &Cached) { continue; // ignore types we have no app ready to use std::string const app = _config->Find(method); - std::vector::const_iterator c = compressors.begin(); - for (; c != compressors.end(); ++c) - if (c->Name == app) - break; - if (c == compressors.end()) + if (std::find_if(compressors.begin(), compressors.end(), [&app](APT::Configuration::Compressor const &c) { + return c.Name == app; + }) == compressors.end()) continue; types.push_back(*o); } @@ -115,11 +113,9 @@ const Configuration::getCompressionTypes(bool const &Cached) { if (std::find(types.begin(),types.end(),Types->Tag) != types.end()) continue; // ignore types we have no app ready to use - std::vector::const_iterator c = compressors.begin(); - for (; c != compressors.end(); ++c) - if (c->Name == Types->Value) - break; - if (c == compressors.end()) + if (std::find_if(compressors.begin(), compressors.end(), [&Types](APT::Configuration::Compressor const &c) { + return c.Name == Types->Value; + }) == compressors.end()) continue; types.push_back(Types->Tag); } @@ -452,18 +448,18 @@ const Configuration::getCompressors(bool const Cached) { #ifdef HAVE_ZLIB else compressors.push_back(Compressor("gzip",".gz","false", NULL, NULL, 2)); -#endif - if (_config->Exists("Dir::Bin::bzip2") == false || FileExists(_config->FindFile("Dir::Bin::bzip2")) == true) - compressors.push_back(Compressor("bzip2",".bz2","bzip2","-9","-d",3)); -#ifdef HAVE_BZ2 - else - compressors.push_back(Compressor("bzip2",".bz2","false", NULL, NULL, 3)); #endif if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->FindFile("Dir::Bin::xz")) == true) - compressors.push_back(Compressor("xz",".xz","xz","-6","-d",4)); + compressors.push_back(Compressor("xz",".xz","xz","-6","-d",3)); #ifdef HAVE_LZMA else - compressors.push_back(Compressor("xz",".xz","false", NULL, NULL, 4)); + compressors.push_back(Compressor("xz",".xz","false", NULL, NULL, 3)); +#endif + if (_config->Exists("Dir::Bin::bzip2") == false || FileExists(_config->FindFile("Dir::Bin::bzip2")) == true) + compressors.push_back(Compressor("bzip2",".bz2","bzip2","-9","-d",4)); +#ifdef HAVE_BZ2 + else + compressors.push_back(Compressor("bzip2",".bz2","false", NULL, NULL, 4)); #endif if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true) compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",5));