pil: fix crash in 64-bit mode

Closes Homebrew/homebrew#15563.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
Germán M. Bravo 2012-10-20 08:43:57 -05:00 committed by Adam Vandenberg
parent b2f4a4821f
commit 860f3ef788

View file

@ -1,15 +1,21 @@
require 'formula'
class Pil < Formula
url 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz'
homepage 'http://www.pythonware.com/products/pil/'
url 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz'
sha1 '76c37504251171fda8da8e63ecb8bc42a69a5c81'
option 'with-little-cms', 'Compile with little-cms support.'
depends_on :freetype
depends_on 'jpeg' => :recommended
depends_on 'little-cms' unless build.include? 'with-little-cms' # => :optional
depends_on 'little-cms'=> :optional unless build.include? 'with-little-cms'
# The patch is to fix a core dump in Bug in PIL's quantize() with 64 bit architectures.
# http://mail.python.org/pipermail/image-sig/2012-June/007047.html
def patches
DATA
end
def install
# Find the arch for the Python we are building against.
@ -51,3 +57,16 @@ class Pil < Formula
EOS
end
end
__END__
--- a/libImaging/Quant.c
+++ b/libImaging/Quant.c
@@ -914,7 +914,7 @@
unsigned long bestdist,bestmatch,dist;
unsigned long initialdist;
HashTable h2;
- int pixelVal;
+ unsigned long pixelVal;
h2=hashtable_new(unshifted_pixel_hash,unshifted_pixel_cmp);
for (i=0;i<nPixels;i++) {