[packages/crnlib] - added types patch (fixes build on LP64 systems)

qboosh qboosh at pld-linux.org
Sat May 24 07:05:38 CEST 2014


commit b5d2702a6df07441ee2515426921b0eae46940bd
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat May 24 07:08:37 2014 +0200

    - added types patch (fixes build on LP64 systems)

 crnlib-types.patch | 25 +++++++++++++++++++++++++
 crnlib.spec        |  2 ++
 2 files changed, 27 insertions(+)
---
diff --git a/crnlib.spec b/crnlib.spec
index 269f600..3c958fc 100644
--- a/crnlib.spec
+++ b/crnlib.spec
@@ -14,6 +14,7 @@ Group:		Libraries
 Source0:	crunch-104.tar.xz
 # Source0-md5:	f92837bba95abf27d6bd9ae0b2b04863
 Patch0:		%{name}-c++.patch
+Patch1:		%{name}-types.patch
 URL:		http://code.google.com/p/crunch/
 BuildRequires:	libstdc++-devel
 BuildRequires:	libtool
@@ -57,6 +58,7 @@ Statyczna biblioteka crnlib.
 %prep
 %setup -q -n crunch
 %patch0 -p1
+%patch1 -p1
 
 %{__sed} -i -e '/g++.*COMPILE_OPTIONS/s/g++/$(CXX)/' crnlib/Makefile
 %{__sed} -i -e '/g++.*LINKER_OPTIONS/s/g++/$(CXXLINK)/' crnlib/Makefile
diff --git a/crnlib-types.patch b/crnlib-types.patch
new file mode 100644
index 0000000..90655e6
--- /dev/null
+++ b/crnlib-types.patch
@@ -0,0 +1,25 @@
+--- crunch/crnlib/crn_vector.cpp.orig	2014-05-14 19:48:46.000000000 +0200
++++ crunch/crnlib/crn_vector.cpp	2014-05-24 06:48:23.591922481 +0200
+@@ -22,8 +22,9 @@ namespace crnlib
+          return true;
+ 
+       size_t new_capacity = min_new_capacity;
+-      if ((grow_hint) && (!math::is_power_of_2(new_capacity)))
+-         new_capacity = math::next_pow2(new_capacity);
++      // avoid overload ambiguity (size_t vs uint32=unsigned int or uint64=unsigned long long) by casting to matching type, that will fit size_t
++      if ((grow_hint) && (!math::is_power_of_2(static_cast<ptr_bits_t>(new_capacity))))
++         new_capacity = math::next_pow2(static_cast<ptr_bits_t>(new_capacity));
+ 
+       CRNLIB_ASSERT(new_capacity && (new_capacity > m_capacity));
+ 
+--- crunch/inc/crn_decomp.h.orig	2014-05-14 19:48:47.000000000 +0200
++++ crunch/inc/crn_decomp.h	2014-05-22 20:49:43.321075804 +0200
+@@ -374,7 +374,7 @@ namespace crnd
+ 
+    const uint32 cIntBits = 32U;
+ 
+-#ifdef _WIN64
++#if defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__)
+    typedef uint64 ptr_bits;
+ #else
+    typedef uint32 ptr_bits;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/crnlib.git/commitdiff/b5d2702a6df07441ee2515426921b0eae46940bd



More information about the pld-cvs-commit mailing list