Fix bytes decoding
parent
ed19ece346
commit
9a7ec44b66
|
@ -56,8 +56,8 @@ describe CBOR::Lexer do
|
|||
# { %(23(h'01020304')), "d7 44 01 02 03 04"},
|
||||
# { %(24(h'6449455446')), "d8 18 45 64 49 45 54 46"},
|
||||
# { %(32("http://www.example.com")), "d8 20 76 68 74 74 70 3a 2f 2f 77 77 77 2e 65 78 61 6d 70 6c 65 2e 63 6f 6d" },
|
||||
# { %(h''), "40" },
|
||||
# { %(h'01020304'), "44 01 02 03 04" },
|
||||
{ %(h''), "40" },
|
||||
{ %(h'01020304'), "44 01 02 03 04" },
|
||||
# { %(""), "60" },
|
||||
# { %("a"), "61 61" },
|
||||
# { %("IETF"), "64 49 45 54 46" },
|
||||
|
|
|
@ -71,8 +71,8 @@ class CBOR::Lexer
|
|||
when 0x3b
|
||||
consume_int(to_negative_int(read(UInt64)))
|
||||
when 0x40..0x57
|
||||
# Reads a single byte which is offset by 0x40
|
||||
Token::BytesT.new(@current_byte_number, value: Bytes[current_byte - 0x40])
|
||||
# read current_byte - 0x40 bytes ahead
|
||||
consume_binary(current_byte - 0x40)
|
||||
when 0x58
|
||||
consume_binary(read(UInt8))
|
||||
when 0x59
|
||||
|
|
Loading…
Reference in New Issue