#include <string>
#include <vector>
-#include <apti18n.h>
/*}}}*/
namespace APT {
// setDefaultConfigurationForCompressors /*{{{*/
}
// 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");
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);
}
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);
}
// 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);
#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));