diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-08-23 15:11:20 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-11-14 15:10:03 +0100 |
commit | 1e352b95182da20b1c27360b6270fcdebbe24207 (patch) | |
tree | 975caa3addea4b59ff6ad9ccf2dcc9c6138c8f6e /apt-pkg/acquire.cc | |
parent | 5afa62c02b03161aff2a983647a5894b309ddd6f (diff) |
prevent C++ locale number formatting in text APIs (try 3)
This time it is the formatting of floating numbers in progress
reporting with a radix charater potentially not being dot.
Followup of 7303e11ff28f920a6277c159aa46f80c007350bb. Regression of
b58e2c7c56b1416a343e81f9f80cb1f02c128e25 in so far as it exchanging
very effected with slightly less effected code.
LP: 1611010
(cherry picked from commit 0919f1df552ddf022ce4508cbf40e04eae5ef896)
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r-- | apt-pkg/acquire.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 2bc2287a1..3ce2e0d5a 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1247,8 +1247,11 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner) snprintf(msg,sizeof(msg), _("Retrieving file %li of %li"), i, TotalItems); // build the status str - std::string dlstatus; - strprintf(dlstatus, "dlstatus:%ld:%.4f:%s\n", i, Percent, msg); + std::ostringstream str; + str.imbue(std::locale("C.UTF-8")); + str.precision(4); + str << "dlstatus" << ':' << std::fixed << i << ':' << Percent << ':' << msg << '\n'; + auto const dlstatus = str.str(); FileFd::Write(fd, dlstatus.data(), dlstatus.size()); } |