aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorWill Glynn2013-04-18 15:52:52 -0500
committerJack Nagel2013-04-26 18:56:09 -0500
commite55d574c02dd1471310f17e1fb55383a01849fec (patch)
tree3ec59b630fcc47c59de6e0577758a3197cdc6377 /Library/Formula
parente9cffaabdf4e922d6799b318fd246b891c29e830 (diff)
downloadhomebrew-e55d574c02dd1471310f17e1fb55383a01849fec.tar.bz2
zbar: add JPEG-related patch
This patch was applied upstream, but has not yet made it into any official release. Without this patch, libjpeg is unable to seek within a JPEG datastream, resulting in hard-to-diagnose failures. Closes #19291. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/zbar.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/Library/Formula/zbar.rb b/Library/Formula/zbar.rb
index 3ec07872a..b3b447aa0 100644
--- a/Library/Formula/zbar.rb
+++ b/Library/Formula/zbar.rb
@@ -11,6 +11,13 @@ class Zbar < Formula
depends_on 'imagemagick'
depends_on 'ufraw'
+ def patches
+ # fix JPEG handling using patch from
+ # http://sourceforge.net/p/zbar/discussion/664596/thread/58b8d79b#8f67
+ # already applied upstream but not present in the 0.10 release
+ DATA
+ end
+
def install
args = %W[
--disable-dependency-tracking
@@ -31,3 +38,27 @@ class Zbar < Formula
system "make install"
end
end
+
+__END__
+diff --git a/zbar/jpeg.c b/zbar/jpeg.c
+index fb566f4..d1c1fb2 100644
+--- a/zbar/jpeg.c
++++ b/zbar/jpeg.c
+@@ -79,8 +79,15 @@ int fill_input_buffer (j_decompress_ptr cinfo)
+ void skip_input_data (j_decompress_ptr cinfo,
+ long num_bytes)
+ {
+- cinfo->src->next_input_byte = NULL;
+- cinfo->src->bytes_in_buffer = 0;
++ if (num_bytes > 0) {
++ if (num_bytes < cinfo->src->bytes_in_buffer) {
++ cinfo->src->next_input_byte += num_bytes;
++ cinfo->src->bytes_in_buffer -= num_bytes;
++ }
++ else {
++ fill_input_buffer(cinfo);
++ }
++ }
+ }
+
+ void term_source (j_decompress_ptr cinfo)