User larger symbol type for arrays
Also support decoding variable sizes for utf8 and symbol. [#156613309]
This commit is contained in:
parent
75832a81bc
commit
f810bd5664
|
|
@ -167,7 +167,7 @@ generate({as_is, TypeCode, Bin}) ->
|
|||
%% that ever happen? If not we really just need to split generate/1
|
||||
%% up into things like these...
|
||||
%% for these constructors map straight-forwardly
|
||||
constructor(symbol) -> <<16#a3>>;
|
||||
constructor(symbol) -> <<16#b3>>;
|
||||
constructor(ubyte) -> <<16#50>>;
|
||||
constructor(ushort) -> <<16#60>>;
|
||||
constructor(short) -> <<16#61>>;
|
||||
|
|
@ -189,7 +189,7 @@ constructor({described, Descriptor, Primitive}) ->
|
|||
[<<16#00>>, generate(Descriptor), constructor(Primitive)].
|
||||
|
||||
% returns io_list
|
||||
generate(symbol, {symbol, V}) -> [<<(size(V)):8>>, V];
|
||||
generate(symbol, {symbol, V}) -> [<<(size(V)):32>>, V];
|
||||
generate(utf8, {utf8, V}) -> [<<(size(V)):32>>, V];
|
||||
generate(boolean, true) -> <<16#01>>;
|
||||
generate(boolean, false) -> <<16#00>>;
|
||||
|
|
|
|||
|
|
@ -153,6 +153,8 @@ parse_array2(Count, Type, Bin, Acc) ->
|
|||
parse_array2(Count - 1, Type, Rest, [Value | Acc]).
|
||||
|
||||
parse_constructor(16#a3) -> symbol;
|
||||
parse_constructor(16#b3) -> symbol;
|
||||
parse_constructor(16#a1) -> utf8;
|
||||
parse_constructor(16#b1) -> utf8;
|
||||
parse_constructor(16#50) -> ubyte;
|
||||
parse_constructor(16#51) -> byte;
|
||||
|
|
@ -165,7 +167,9 @@ parse_constructor(16#81) -> long;
|
|||
parse_constructor(16#40) -> null;
|
||||
parse_constructor(16#56) -> boolean;
|
||||
parse_constructor(16#f0) -> array;
|
||||
parse_constructor(0) -> described.
|
||||
parse_constructor(0) -> described;
|
||||
parse_constructor(X) ->
|
||||
exit({failed_to_parse_constructor, X}).
|
||||
|
||||
mapify([]) ->
|
||||
[];
|
||||
|
|
|
|||
Loading…
Reference in New Issue