summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-08-23 15:11:20 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-08-23 15:11:20 +0200
commit0919f1df552ddf022ce4508cbf40e04eae5ef896 (patch)
tree4f3c27f6ecbe9e5216b5dffe090800a65ebb53f4 /apt-pkg/acquire.cc
parentfb51ce3295929947555f4883054f210a53d9fbdf (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
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r--apt-pkg/acquire.cc7
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());
}