From 55c6402be4297d644de774b1fef70b88f91a73e9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 27 May 2016 18:10:39 +0200 Subject: 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 (cherry picked from commit b58e2c7c56b1416a343e81f9f80cb1f02c128e25) --- ftparchive/writer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ftparchive') diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 90935ff8b..674a8f516 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -623,12 +623,12 @@ SourcesWriter::SourcesWriter(FileFd * const GivenOutput, string const &DB, strin // SourcesWriter::DoPackage - Process a single package /*{{{*/ static std::string getDscHash(unsigned int const DoHashes, Hashes::SupportedHashes const DoIt, pkgTagSection &Tags, char const * const FieldName, - HashString const * const Hash, unsigned long long Size, std::string FileName) + HashString const * const Hash, unsigned long long Size, std::string const &FileName) { if ((DoHashes & DoIt) != DoIt || Tags.Exists(FieldName) == false || Hash == NULL) return ""; std::ostringstream out; - out << "\n " << Hash->HashValue() << " " << Size << " " << FileName + out << "\n " << Hash->HashValue() << " " << std::to_string(Size) << " " << FileName << "\n " << Tags.FindS(FieldName); return out.str(); } @@ -802,7 +802,7 @@ bool SourcesWriter::DoPackage(string FileName) if (Tags.Exists(fieldname) == true) continue; std::ostringstream streamout; - streamout << "\n " << hs->HashValue() << " " << Db.GetFileSize() << " " << ParseJnk; + streamout << "\n " << hs->HashValue() << " " << std::to_string(Db.GetFileSize()) << " " << ParseJnk; out->append(streamout.str()); } -- cgit v1.2.3