Procházet zdrojové kódy

imbue .diff/Index parsing with C.UTF-8 as well

In 3bdff17c894d0c3d0f813d358fc45d7a263f3552 we did it for the datetime
parsing, but we use the same style in the parsing for pdiff (where the
size of the file is in the middle of the three fields) so imbueing here
as well is a good idea.
David Kalnischkies před 10 roky
rodič
revize
1136a707b7
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. 5 0
      apt-pkg/acquire-item.cc

+ 5 - 0
apt-pkg/acquire-item.cc

@@ -2000,6 +2000,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile)	/*{{{*/
    HashStringList ServerHashes;
    HashStringList ServerHashes;
    unsigned long long ServerSize = 0;
    unsigned long long ServerSize = 0;
 
 
+   auto const &posix = std::locale("C.UTF-8");
    for (char const * const * type = HashString::SupportedHashes(); *type != NULL; ++type)
    for (char const * const * type = HashString::SupportedHashes(); *type != NULL; ++type)
    {
    {
       std::string tagname = *type;
       std::string tagname = *type;
@@ -2011,6 +2012,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile)	/*{{{*/
       string hash;
       string hash;
       unsigned long long size;
       unsigned long long size;
       std::stringstream ss(tmp);
       std::stringstream ss(tmp);
+      ss.imbue(posix);
       ss >> hash >> size;
       ss >> hash >> size;
       if (unlikely(hash.empty() == true))
       if (unlikely(hash.empty() == true))
 	 continue;
 	 continue;
@@ -2089,6 +2091,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile)	/*{{{*/
       string hash, filename;
       string hash, filename;
       unsigned long long size;
       unsigned long long size;
       std::stringstream ss(tmp);
       std::stringstream ss(tmp);
+      ss.imbue(posix);
 
 
       while (ss >> hash >> size >> filename)
       while (ss >> hash >> size >> filename)
       {
       {
@@ -2147,6 +2150,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile)	/*{{{*/
       string hash, filename;
       string hash, filename;
       unsigned long long size;
       unsigned long long size;
       std::stringstream ss(tmp);
       std::stringstream ss(tmp);
+      ss.imbue(posix);
 
 
       while (ss >> hash >> size >> filename)
       while (ss >> hash >> size >> filename)
       {
       {
@@ -2184,6 +2188,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile)	/*{{{*/
       string hash, filename;
       string hash, filename;
       unsigned long long size;
       unsigned long long size;
       std::stringstream ss(tmp);
       std::stringstream ss(tmp);
+      ss.imbue(posix);
 
 
       // FIXME: all of pdiff supports only .gz compressed patches
       // FIXME: all of pdiff supports only .gz compressed patches
       while (ss >> hash >> size >> filename)
       while (ss >> hash >> size >> filename)