allow writing binaries in thrift_binary_protocol
authorDavid Reiss <dreiss@apache.org>
Wed, 11 Jun 2008 00:58:48 +0000 (00:58 +0000)
committerDavid Reiss <dreiss@apache.org>
Wed, 11 Jun 2008 00:58:48 +0000 (00:58 +0000)
Summary: they come packed in {string, Bin} so pull them out

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666424 13f79535-47bb-0310-9956-ffa450edef68

lib/alterl/src/thrift_binary_protocol.erl

index 0605dc1..0525621 100644 (file)
@@ -115,6 +115,10 @@ write(This, {string, Str}) when is_list(Str) ->
     write(This, {i32, length(Str)}),
     write(This, list_to_binary(Str));
 
+write(This, {string, Bin}) when is_binary(Bin) ->
+    write(This, {i32, size(Bin)}),
+    write(This, Bin);
+
 write(This, Binary) when is_binary(Binary) ->
     thrift_transport:write(This#binary_protocol.transport, Binary).
 
@@ -176,7 +180,7 @@ read(This, set_end) -> ok;
 
 read(This, field_stop) ->
     {ok, ?tType_STOP} =  read(This, byte),
-    ok;    
+    ok;
 
 %%