diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /external/libodfgen/0001-tdf-101077-make-double-string-conversion-locale-agno.patch.1 | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 + |