From: David Reiss Date: Wed, 11 Jun 2008 00:58:48 +0000 (+0000) Subject: allow writing binaries in thrift_binary_protocol X-Git-Tag: 0.2.0~737 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=225db732c2195e183bcf95ed6b496d09054b0eba;p=common%2Fthrift.git allow writing binaries in thrift_binary_protocol 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 --- diff --git a/lib/alterl/src/thrift_binary_protocol.erl b/lib/alterl/src/thrift_binary_protocol.erl index 0605dc1e..05256218 100644 --- a/lib/alterl/src/thrift_binary_protocol.erl +++ b/lib/alterl/src/thrift_binary_protocol.erl @@ -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; %%