diff options
Diffstat (limited to 'external/libodfgen/0001-tdf-101077-make-double-string-conversion-locale-agno.patch.1')
-rw-r--r-- | external/libodfgen/0001-tdf-101077-make-double-string-conversion-locale-agno.patch.1 | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/external/libodfgen/0001-tdf-101077-make-double-string-conversion-locale-agno.patch.1 b/external/libodfgen/0001-tdf-101077-make-double-string-conversion-locale-agno.patch.1 new file mode 100644 index 000000000..1fc4e6b9d --- /dev/null +++ b/external/libodfgen/0001-tdf-101077-make-double-string-conversion-locale-agno.patch.1 @@ -0,0 +1,58 @@ +From 68e0c8e4c834df57bc9a0e8da72151f69ff5e7a6 Mon Sep 17 00:00:00 2001 +From: David Tardon <dtardon@redhat.com> +Date: Fri, 12 Aug 2016 12:50:39 +0200 +Subject: [PATCH] tdf#101077 make double->string conversion locale-agnostic + +--- + src/OdsGenerator.cxx | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/src/OdsGenerator.cxx b/src/OdsGenerator.cxx +index 52e135e..8cb7203 100644 +--- a/src/OdsGenerator.cxx ++++ b/src/OdsGenerator.cxx +@@ -26,6 +26,8 @@ + + #include <librevenge/librevenge.h> + ++#include <iomanip> ++#include <locale> + #include <map> + #include <stack> + #include <sstream> +@@ -46,6 +48,19 @@ + #include "OdcGenerator.hxx" + #include "OdfGenerator.hxx" + ++namespace ++{ ++ ++librevenge::RVNGString makePreciseStr(const double value) ++{ ++ std::ostringstream os; ++ os.imbue(std::locale::classic()); ++ os << std::fixed << std::setprecision(8) << value; ++ return os.str().c_str(); ++} ++ ++} ++ + class OdsGeneratorPrivate : public OdfGenerator + { + public: +@@ -968,10 +983,10 @@ void OdsGenerator::openSheetCell(const librevenge::RVNGPropertyList &propList) + // we need the maximum precision here, so we must avoid getStr() when possible + librevenge::RVNGString value; + if (propList["librevenge:value"]->getUnit()==librevenge::RVNG_GENERIC) +- value.sprintf("%.8f", propList["librevenge:value"]->getDouble()); ++ value = makePreciseStr(propList["librevenge:value"]->getDouble()); + else if (propList["librevenge:value"]->getUnit()==librevenge::RVNG_PERCENT) + { +- value.sprintf("%.8f", propList["librevenge:value"]->getDouble()*100.); ++ value = makePreciseStr(propList["librevenge:value"]->getDouble()*100.); + value.append('%'); + } + else +-- +2.7.4 + |