class CFPropertyList::Binary
def read_binary_int(fname,fd,length)
def read_binary_int(fname,fd,length) if length > 4 raise CFFormatError.new("Integer greater than 16 bytes: #{length}") end nbytes = 1 << length buff = fd.read(nbytes) CFInteger.new( case length when 0 then buff.unpack("C")[0] when 1 then buff.unpack("n")[0] when 2 then buff.unpack("N")[0] # 8 byte integers are always signed when 3 then buff.unpack("q>")[0] # 16 byte integers are used to represent unsigned 8 byte integers # where the unsigned value is stored in the lower 8 bytes and the # upper 8 bytes are unused. when 4 then buff.unpack("Q>Q>")[1] end ) end