From 7f008f4ea0363ea9ce1e5a8b143111f96a8ea557 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 6 Mar 2010 15:47:54 -0800 Subject: [PATCH] [Compass Core] Fix a ruby 1.9 bug in the image_size helper functions for jpeg images. --- lib/compass/sass_extensions/functions/image_size.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/compass/sass_extensions/functions/image_size.rb b/lib/compass/sass_extensions/functions/image_size.rb index 48af6dfd..02a07539 100644 --- a/lib/compass/sass_extensions/functions/image_size.rb +++ b/lib/compass/sass_extensions/functions/image_size.rb @@ -68,19 +68,19 @@ private private def examine(io) - raise 'malformed JPEG' unless io.getc == 0xFF && io.getc == 0xD8 # SOI - class << io - def readint; (readchar << 8) + readchar; end + def readint; (readbyte << 8) + readbyte; end def readframe; read(readint - 2); end - def readsof; [readint, readchar, readint, readint, readchar]; end + def readsof; [readint, readbyte, readint, readint, readbyte]; end def next - c = readchar while c != 0xFF - c = readchar while c == 0xFF + c = readbyte while c != 0xFF + c = readbyte while c == 0xFF c end end + raise 'malformed JPEG!' unless io.readbyte == 0xFF && io.readbyte == 0xD8 # SOI + while marker = io.next case marker when 0xC0..0xC3, 0xC5..0xC7, 0xC9..0xCB, 0xCD..0xCF # SOF markers