Przeglądaj źródła

fx: 二进制类型的数据解码的时候 返回正确的 blob 数据类型 tag

master
SisMaker 4 lat temu
rodzic
commit
e4376642d8
1 zmienionych plików z 16 dodań i 16 usunięć
  1. +16
    -16
      src/eVPack.erl

+ 16
- 16
src/eVPack.erl Wyświetl plik

@ -1371,72 +1371,72 @@ decoder(192, RestBin) ->
RefSize = binary:referenced_byte_size(RestBin),
case RefSize / Length > ?VpBinaryCopyRatio of
true ->
{binary:copy(BinStr), LeftBin};
{{?blob, binary:copy(BinStr)}, LeftBin};
_ ->
{BinStr, LeftBin}
{{?blob, BinStr}, LeftBin}
end;
decoder(193, RestBin) ->
<<Length:2/integer-little-unsigned-unit:8, BinStr:Length/binary, LeftBin/bitstring>> = RestBin,
RefSize = binary:referenced_byte_size(RestBin),
case RefSize / Length > ?VpBinaryCopyRatio of
true ->
{binary:copy(BinStr), LeftBin};
{{?blob, binary:copy(BinStr)}, LeftBin};
_ ->
{BinStr, LeftBin}
{{?blob, BinStr}, LeftBin}
end;
decoder(194, RestBin) ->
<<Length:3/integer-little-unsigned-unit:8, BinStr:Length/binary, LeftBin/bitstring>> = RestBin,
RefSize = binary:referenced_byte_size(RestBin),
case RefSize / Length > ?VpBinaryCopyRatio of
true ->
{binary:copy(BinStr), LeftBin};
{{?blob, binary:copy(BinStr)}, LeftBin};
_ ->
{BinStr, LeftBin}
{{?blob, BinStr}, LeftBin}
end;
decoder(195, RestBin) ->
<<Length:4/integer-little-unsigned-unit:8, BinStr:Length/binary, LeftBin/bitstring>> = RestBin,
RefSize = binary:referenced_byte_size(RestBin),
case RefSize / Length > ?VpBinaryCopyRatio of
true ->
{binary:copy(BinStr), LeftBin};
{{?blob, binary:copy(BinStr)}, LeftBin};
_ ->
{BinStr, LeftBin}
{{?blob, BinStr}, LeftBin}
end;
decoder(196, RestBin) ->
<<Length:5/integer-little-unsigned-unit:8, BinStr:Length/binary, LeftBin/bitstring>> = RestBin,
RefSize = binary:referenced_byte_size(RestBin),
case RefSize / Length > ?VpBinaryCopyRatio of
true ->
{binary:copy(BinStr), LeftBin};
{{?blob, binary:copy(BinStr)}, LeftBin};
_ ->
{BinStr, LeftBin}
{{?blob, BinStr}, LeftBin}
end;
decoder(197, RestBin) ->
<<Length:6/integer-little-unsigned-unit:8, BinStr:Length/binary, LeftBin/bitstring>> = RestBin,
RefSize = binary:referenced_byte_size(RestBin),
case RefSize / Length > ?VpBinaryCopyRatio of
true ->
{binary:copy(BinStr), LeftBin};
{{?blob, binary:copy(BinStr)}, LeftBin};
_ ->
{BinStr, LeftBin}
{{?blob, BinStr}, LeftBin}
end;
decoder(198, RestBin) ->
<<Length:7/integer-little-unsigned-unit:8, BinStr:Length/binary, LeftBin/bitstring>> = RestBin,
RefSize = binary:referenced_byte_size(RestBin),
case RefSize / Length > ?VpBinaryCopyRatio of
true ->
{binary:copy(BinStr), LeftBin};
{{?blob, binary:copy(BinStr)}, LeftBin};
_ ->
{BinStr, LeftBin}
{{?blob, BinStr}, LeftBin}
end;
decoder(199, RestBin) ->
<<Length:8/integer-little-unsigned-unit:8, BinStr:Length/binary, LeftBin/bitstring>> = RestBin,
RefSize = binary:referenced_byte_size(RestBin),
case RefSize / Length > ?VpBinaryCopyRatio of
true ->
{binary:copy(BinStr), LeftBin};
{{?blob, binary:copy(BinStr)}, LeftBin};
_ ->
{BinStr, LeftBin}
{{?blob, BinStr}, LeftBin}
end;
decoder(_, _) ->
erlang:throw({error, unexpected_end}).

Ładowanie…
Anuluj
Zapisz