diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-05-27 18:10:39 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-05-27 19:14:38 +0200 |
commit | b58e2c7c56b1416a343e81f9f80cb1f02c128e25 (patch) | |
tree | dbd92b2a460c2dd5d2a4a9ccc5d80657b24b32c1 /apt-pkg/acquire.cc | |
parent | 124e6916b7b02984803ff8217e8163947aae2882 (diff) |
prevent C++ locale number formatting in text APIs
Setting the C++ locale via std::locale::global(std::locale("")); which
would otherwise default to the default C locale (aka: unaffected by
setlocale) effects the formatting of numeric types in IO streams, which
for output for humans is perfectly sensible, but breaks our many text
interfaces used and parsed by us and others without expecting the
numbers to be formatted.
Closes: #825396
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r-- | apt-pkg/acquire.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index ff41246b8..29362fb40 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1258,13 +1258,9 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner) snprintf(msg,sizeof(msg), _("Retrieving file %li of %li"), i, TotalItems); // build the status str - status << "dlstatus:" << i - << ":" << std::setprecision(3) << Percent - << ":" << msg - << endl; - - std::string const dlstatus = status.str(); - FileFd::Write(fd, dlstatus.c_str(), dlstatus.size()); + std::string dlstatus; + strprintf(dlstatus, "dlstatus:%ld:%.4f:%s\n", i, Percent, msg); + FileFd::Write(fd, dlstatus.data(), dlstatus.size()); } return true; |