]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/aptconfiguration.cc
remove incorrect optimization branches
[apt.git] / apt-pkg / aptconfiguration.cc
index 01b85a74e94db869d2763b61d0a753b3cbc1cced..69f6f6f8d39d02642c3b7f33f36ae50156bf32ae 100644 (file)
@@ -29,7 +29,6 @@
 #include <string>
 #include <vector>
 
 #include <string>
 #include <vector>
 
-#include <apti18n.h>
                                                                        /*}}}*/
 namespace APT {
 // setDefaultConfigurationForCompressors                               /*{{{*/
                                                                        /*}}}*/
 namespace APT {
 // setDefaultConfigurationForCompressors                               /*{{{*/
@@ -75,8 +74,8 @@ const Configuration::getCompressionTypes(bool const &Cached) {
        }
 
        // setup the defaults for the compressiontypes => method mapping
        }
 
        // setup the defaults for the compressiontypes => method mapping
-       _config->CndSet("Acquire::CompressionTypes::bz2","bzip2");
        _config->CndSet("Acquire::CompressionTypes::xz","xz");
        _config->CndSet("Acquire::CompressionTypes::xz","xz");
+       _config->CndSet("Acquire::CompressionTypes::bz2","bzip2");
        _config->CndSet("Acquire::CompressionTypes::lzma","lzma");
        _config->CndSet("Acquire::CompressionTypes::gz","gzip");
 
        _config->CndSet("Acquire::CompressionTypes::lzma","lzma");
        _config->CndSet("Acquire::CompressionTypes::gz","gzip");
 
@@ -95,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);
                        continue;
                // ignore types we have no app ready to use
                std::string const app = _config->Find(method);
-               std::vector<APT::Configuration::Compressor>::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);
        }
                        continue;
                types.push_back(*o);
        }
@@ -116,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
                if (std::find(types.begin(),types.end(),Types->Tag) != types.end())
                        continue;
                // ignore types we have no app ready to use
-               std::vector<APT::Configuration::Compressor>::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);
        }
                        continue;
                types.push_back(Types->Tag);
        }
@@ -222,7 +217,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
        // get the environment language codes: LC_MESSAGES (and later LANGUAGE)
        // we extract both, a long and a short code and then we will
        // check if we actually need both (rare) or if the short is enough
        // get the environment language codes: LC_MESSAGES (and later LANGUAGE)
        // we extract both, a long and a short code and then we will
        // check if we actually need both (rare) or if the short is enough
-       string const envMsg = string(Locale == 0 ? std::setlocale(LC_MESSAGES, NULL) : *Locale);
+       string const envMsg = string(Locale == 0 ? ::setlocale(LC_MESSAGES, NULL) : *Locale);
        size_t const lenShort = (envMsg.find('_') != string::npos) ? envMsg.find('_') : 2;
        size_t const lenLong = (envMsg.find_first_of(".@") != string::npos) ? envMsg.find_first_of(".@") : (lenShort + 3);
 
        size_t const lenShort = (envMsg.find('_') != string::npos) ? envMsg.find('_') : 2;
        size_t const lenLong = (envMsg.find_first_of(".@") != string::npos) ? envMsg.find_first_of(".@") : (lenShort + 3);
 
@@ -453,18 +448,18 @@ const Configuration::getCompressors(bool const Cached) {
 #ifdef HAVE_ZLIB
        else
                compressors.push_back(Compressor("gzip",".gz","false", NULL, NULL, 2));
 #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)
 #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
 #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));
 #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));