diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-08-23 15:11:20 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-08-24 10:08:17 +0200 |
commit | d6398180871a5f56fd926c77cfbb04e037dab7ff (patch) | |
tree | 3bbc1afc40edf3e8f9cd5a9afb1fb5ab0e9255bd /apt-pkg/acquire.cc | |
parent | 084562e7a59b356c98254c56679d6c3038b159e8 (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 29362fb40..1efb772b4 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1258,8 +1258,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()); } |