Skip to content

Commit 528cc75

Browse files
committed
Erlang - fix 'h' extension type
The OSC spec says that the 'h' OSC type tag should be "64 bit big-endian two's complement integer". Fix encoding and decoding to match.
1 parent 0c32180 commit 528cc75

File tree

1 file changed

+5
-2
lines changed
  • app/server/erlang/tau/src/osc

1 file changed

+5
-2
lines changed

app/server/erlang/tau/src/osc/osc.erl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
%% To do check endian
2626
%% I've said Int64 are unsigned-little-integers
2727
%% I think they should be big
28+
%% (Edit: Yep, Joe, this hunch was correct for the 'h' type.
29+
%% I've now fixed it. Sam.)
30+
2831

2932
%% The OSC spec is unclear about this point
3033

@@ -96,7 +99,7 @@ encode_arg(X) when is_list(X) -> encode_string(X);
9699
encode_arg(X) when is_atom(X) -> encode_string(atom_to_list(X));
97100
encode_arg(X) when is_integer(X) -> <<X:32>>;
98101
encode_arg(X) when is_float(X) -> <<X:32/float>>; %
99-
encode_arg({int64,X}) -> <<X:64/unsigned-little-integer>>;
102+
encode_arg({int64,X}) -> <<X:64/big-signed-integer>>;
100103
encode_arg(X) when is_binary(X) -> encode_binary(X).
101104

102105
%% bundles
@@ -163,7 +166,7 @@ get_args([$i|T1], <<I:32/signed-integer,T2/binary>>, L) ->
163166
get_args(T1, T2, [I|L]);
164167
get_args([$f|T1], <<F:32/float, T2/binary>>, L) ->
165168
get_args(T1, T2, [F|L]);
166-
get_args([$h|T1], <<I:64/unsigned-little-integer, T2/binary>>, L) ->
169+
get_args([$h|T1], <<I:64/big-signed-integer, T2/binary>>, L) ->
167170
get_args(T1, T2, [{int64,I}|L]);
168171
get_args([$d|T1], <<Double:64/float, T2/binary>>, L) ->
169172
get_args(T1, T2, [Double|L]);

0 commit comments

Comments
 (0)