[Compass Core] Fix a ruby 1.9 bug in the image_size helper functions for jpeg images.
This commit is contained in:
parent
f7b729fa60
commit
7f008f4ea0
@ -68,19 +68,19 @@ private
|
|||||||
|
|
||||||
private
|
private
|
||||||
def examine(io)
|
def examine(io)
|
||||||
raise 'malformed JPEG' unless io.getc == 0xFF && io.getc == 0xD8 # SOI
|
|
||||||
|
|
||||||
class << io
|
class << io
|
||||||
def readint; (readchar << 8) + readchar; end
|
def readint; (readbyte << 8) + readbyte; end
|
||||||
def readframe; read(readint - 2); 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
|
def next
|
||||||
c = readchar while c != 0xFF
|
c = readbyte while c != 0xFF
|
||||||
c = readchar while c == 0xFF
|
c = readbyte while c == 0xFF
|
||||||
c
|
c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
raise 'malformed JPEG!' unless io.readbyte == 0xFF && io.readbyte == 0xD8 # SOI
|
||||||
|
|
||||||
while marker = io.next
|
while marker = io.next
|
||||||
case marker
|
case marker
|
||||||
when 0xC0..0xC3, 0xC5..0xC7, 0xC9..0xCB, 0xCD..0xCF # SOF markers
|
when 0xC0..0xC3, 0xC5..0xC7, 0xC9..0xCB, 0xCD..0xCF # SOF markers
|
||||||
|
Loading…
Reference in New Issue
Block a user