From c941ca354618ece70d9135e9206b85b8bb427418 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Tue, 16 Nov 2010 13:25:33 +0100 Subject: [PATCH] ipe-7.0.11: add prec patch --- media-gfx/ipe/Manifest | 3 +- media-gfx/ipe/files/ipe-outputprecision.patch | 63 +++++++++++++++++++ media-gfx/ipe/ipe-7.0.11.ebuild | 1 + 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 media-gfx/ipe/files/ipe-outputprecision.patch diff --git a/media-gfx/ipe/Manifest b/media-gfx/ipe/Manifest index 40813af..01a7df7 100644 --- a/media-gfx/ipe/Manifest +++ b/media-gfx/ipe/Manifest @@ -1,5 +1,6 @@ AUX ipe-beamer-install.patch 491 RMD160 729b8246faef227bde2742bcb47cf398f67dd7f7 SHA1 cd7f728ea8bde9abc31b8d723273d64e3de50a90 SHA256 70fc9f8526146893c33326e09677da564b26afa3d05f3860ed3c5e6ee07139a6 +AUX ipe-outputprecision.patch 1600 RMD160 f3ed51b6678975130529ecce2681a248194a8d14 SHA1 ec21c9fbdd65bc816764445b4f1f5173e379f98b SHA256 ee1187f15edc7759305ba9bc994ed79da4ceb93c7660f0738f175609ad7051b2 DIST ipe-7.0.10-src.tar.gz 1158532 RMD160 1d57d362de66a5e718baf80ef79a6681ee48e046 SHA1 dc18230bb669b759b132c66440d99596b52fb833 SHA256 f343493d9e4d2390a9fdd5403162d187dd6ec1b204e7c026baec76657f40cd9c DIST ipe-7.0.11-src.tar.gz 1164684 RMD160 472396a1835151d12ca8ae68991223147693d448 SHA1 fba0a36b9c3c6989847d1a41a98c9798dc56ebce SHA256 c82f4dc539919d901d6d628bd606fc3803c57833ecf89b97a0829d46f62eb296 EBUILD ipe-7.0.10.ebuild 2056 RMD160 c5ad5b0002cf557670353aec0bb9566253e35de2 SHA1 ce30d826bab989f4b6129cbe41a90a9cfddd376d SHA256 e0a1207c5f471cdded798cbeadc748f19805ce57adf9c3a6766785457a71e0ac -EBUILD ipe-7.0.11.ebuild 2151 RMD160 efa0572614c976afd540d2d8bff86b6f9caf61b8 SHA1 318bd43ec5e166bc1bf62a88f2f9f0c0fc36beff SHA256 363cfc1759dedbeb1c49eb27e4fcf9aa0a6e6e3cc2258e85ff7f9dfa5fd51204 +EBUILD ipe-7.0.11.ebuild 2201 RMD160 4871a3bfb8ad9c4d0e1b033248128e03fb0f1581 SHA1 6a23ab4cb1089b95c41bb05e0c76b4b3dd82966d SHA256 8a28618f7dfac10de45267bd3f7220a6f65415da51148fb1a9f2608f9a6bba06 diff --git a/media-gfx/ipe/files/ipe-outputprecision.patch b/media-gfx/ipe/files/ipe-outputprecision.patch new file mode 100644 index 0000000..eb25702 --- /dev/null +++ b/media-gfx/ipe/files/ipe-outputprecision.patch @@ -0,0 +1,63 @@ +diff --git a/src/ipelib/ipebase.cpp b/src/ipelib/ipebase.cpp +index 63de035..f4f102e 100644 +--- a/src/ipelib/ipebase.cpp ++++ b/src/ipelib/ipebase.cpp +@@ -557,55 +557,9 @@ Stream &Stream::operator<<(int i) + //! Output double. + Stream &Stream::operator<<(double d) + { +- char buf[30]; +- if (d < 0.0) { +- putChar('-'); +- d = -d; +- } +- if (d >= 1e9) { +- // PDF will not be able to read this, but we have to write something. +- // Such large numbers should only happen if something is wrong. +- std::sprintf(buf, "%g", d); +- putCString(buf); +- } else if (d < 1e-8) { +- putChar('0'); +- } else { +- // Print six significant digits, but omit trailing zeros. +- // Probably I'll want to have adjustable precision later. +- int factor; +- if (d > 1000.0) +- factor = 100L; +- else if (d > 100.0) +- factor = 1000L; +- else if (d > 10.0) +- factor = 10000L; +- else if (d > 1.0) +- factor = 100000L; +- else if (d > 0.1) +- factor = 1000000L; +- else if (d > 0.01) +- factor = 10000000L; +- else +- factor = 100000000L; +- double dd = trunc(d); +- int intpart = int(dd + 0.5); +- // 10^9 < 2^31 +- int v = int(factor * (d - dd) + 0.5); +- if (v >= factor) { +- ++intpart; +- v -= factor; +- } +- std::sprintf(buf, "%d", intpart); +- putCString(buf); +- int mask = factor / 10; +- if (v != 0) { +- putChar('.'); +- while (v != 0) { +- putChar('0' + v / mask); +- v = (10 * v) % factor; +- } +- } +- } ++ char buf[101]; ++ std::snprintf(buf, 100, "%.20g", d); ++ putCString(buf); + return *this; + } + diff --git a/media-gfx/ipe/ipe-7.0.11.ebuild b/media-gfx/ipe/ipe-7.0.11.ebuild index 913105d..a26a9c3 100644 --- a/media-gfx/ipe/ipe-7.0.11.ebuild +++ b/media-gfx/ipe/ipe-7.0.11.ebuild @@ -49,6 +49,7 @@ search_urw_fonts() { src_prepare() { epatch "${FILESDIR}"/${PN}-beamer-install.patch + epatch "${FILESDIR}"/${PN}-outputprecision.patch } pkg_setup() { -- 2.39.5