ipe-7.0.11: new version of prec patch
authorStefan Huber <shuber2@gmail.com>
Thu, 18 Nov 2010 12:26:35 +0000 (13:26 +0100)
committerStefan Huber <shuber2@gmail.com>
Thu, 18 Nov 2010 12:26:35 +0000 (13:26 +0100)
media-gfx/ipe/Manifest
media-gfx/ipe/files/ipe-outputprecision.patch

index 01a7df715807ec76b300bc484eb8138d2ee0d0a4..814c07347a0d3c36009bd7ef1e0bf8e6d4112dcb 100644 (file)
@@ -1,5 +1,5 @@
 AUX ipe-beamer-install.patch 491 RMD160 729b8246faef227bde2742bcb47cf398f67dd7f7 SHA1 cd7f728ea8bde9abc31b8d723273d64e3de50a90 SHA256 70fc9f8526146893c33326e09677da564b26afa3d05f3860ed3c5e6ee07139a6
-AUX ipe-outputprecision.patch 1600 RMD160 f3ed51b6678975130529ecce2681a248194a8d14 SHA1 ec21c9fbdd65bc816764445b4f1f5173e379f98b SHA256 ee1187f15edc7759305ba9bc994ed79da4ceb93c7660f0738f175609ad7051b2
+AUX ipe-outputprecision.patch 2504 RMD160 e7bb13a68aa0b04798127aa4bbd05f0c6e7620a5 SHA1 faf5d9f6fded765904a6045eb52170b8a1403ce8 SHA256 142f967987a84d2c45d0ca90d3a4b72360dd720f8d1cfa17d6f66c4500ee7e35
 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
index eb257021c34cecb5055360e76db0e705d56a0909..62346a366d610611cdf32274319dbd453099d086 100644 (file)
@@ -1,8 +1,8 @@
 diff --git a/src/ipelib/ipebase.cpp b/src/ipelib/ipebase.cpp
-index 63de035..f4f102e 100644
+index 63de035..19226ad 100644
 --- a/src/ipelib/ipebase.cpp
 +++ b/src/ipelib/ipebase.cpp
-@@ -557,55 +557,9 @@ Stream &Stream::operator<<(int i)
+@@ -557,55 +557,50 @@ Stream &Stream::operator<<(int i)
  //! Output double.
  Stream &Stream::operator<<(double d)
  {
@@ -10,7 +10,19 @@ index 63de035..f4f102e 100644
 -  if (d < 0.0) {
 -    putChar('-');
 -    d = -d;
--  }
++  // Maximum number of digits in total
++  const unsigned maxdigits=14;
++
++  const unsigned bufsize=511;
++  char buf[bufsize+1];
++
++  // The number of digits left of '.'
++  int intpartsize = 0;
++  if( fabs(d)>=1.0 )
++  {
++    snprintf(buf, bufsize, "%.0f", fabs(d));
++    intpartsize = strlen(buf);
+   }
 -  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.
@@ -53,10 +65,36 @@ index 63de035..f4f102e 100644
 -      putChar('0' + v / mask);
 -      v = (10 * v) % factor;
 -      }
--    }
--  }
-+  char buf[101];
-+  std::snprintf(buf, 100, "%.20g", d);
++
++  // The nubmer of digits right of '.'
++  int respartsize = maxdigits-intpartsize;
++  if( respartsize < 0 )
++    respartsize = 0;
++
++  // Building the format string and get the string conversion of d
++  char fmt[256];
++  snprintf(fmt, 255, "%%%d.%df", intpartsize, respartsize);
++  snprintf(buf, bufsize, fmt, d);
++
++
++  // Truncate redundant zeros and '.' from the right
++  for(int i = strlen(buf)-1; i>=intpartsize; i--)
++  {
++    // Truncate all zeros from right-hand
++    if( buf[i] == '0' )
++    {
++      buf[i] = '\0';
++      continue;
+     }
++
++    // Remove decimal dot without decimal digits
++    if( buf[i] == '.' )
++      buf[i] = '\0';
++
++    break;
+   }
++
++
 +  putCString(buf);
    return *this;
  }