[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - external/libodfgen
David Tardon
dtardon at redhat.com
Thu Aug 18 19:59:22 UTC 2016
external/libodfgen/0001-tdf-101077-make-double-string-conversion-locale-agno.patch.1 | 58 ++++++++++
external/libodfgen/UnpackedTarball_libodfgen.mk | 3
2 files changed, 61 insertions(+)
New commits:
commit f28ca7a3c0e846b1e516b31a981e814e3768a7d9
Author: David Tardon <dtardon at redhat.com>
Date: Fri Aug 12 13:11:38 2016 +0200
tdf#101077 make double->str conv. locale-agnostic
Change-Id: Ibb87f4a14fda6957149ca52083387760ff6e60a3
(cherry picked from commit 8d26a169794083f047a57e5c8d3f5da0aaab2583)
Reviewed-on: https://gerrit.libreoffice.org/28080
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins <ci at libreoffice.org>
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 0000000..1fc4e6b
--- /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 at 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
+
diff --git a/external/libodfgen/UnpackedTarball_libodfgen.mk b/external/libodfgen/UnpackedTarball_libodfgen.mk
index 3cbeb55..f6695d9 100644
--- a/external/libodfgen/UnpackedTarball_libodfgen.mk
+++ b/external/libodfgen/UnpackedTarball_libodfgen.mk
@@ -35,5 +35,8 @@ $(eval $(call gb_UnpackedTarball_add_patches,libodfgen, \
endif
endif
+$(eval $(call gb_UnpackedTarball_add_patches,libodfgen, \
+ external/libodfgen/0001-tdf-101077-make-double-string-conversion-locale-agno.patch.1 \
+))
# vim: set noet sw=4 ts=4:
More information about the Libreoffice-commits
mailing list