You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2010/08/31 00:05:26 UTC

svn commit: r990977 - in /incubator/thrift/trunk/lib/erl: include/thrift_protocol_impl.hrl src/thrift_protocol.erl

Author: dreiss
Date: Mon Aug 30 22:05:26 2010
New Revision: 990977

URL: http://svn.apache.org/viewvc?rev=990977&view=rev
Log:
erlang: Separate out thrift_protocol:read_specific

By giving a different name to the function that reads from the
protocol implementation, we can get a slightly more enforcible spec.

Modified:
    incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl
    incubator/thrift/trunk/lib/erl/src/thrift_protocol.erl

Modified: incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl?rev=990977&r1=990976&r2=990977&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl (original)
+++ incubator/thrift/trunk/lib/erl/include/thrift_protocol_impl.hrl Mon Aug 30 22:05:26 2010
@@ -27,7 +27,7 @@
 
 -spec write(state(), term()) -> ok | {error, _Reason}.
 
-%% NOTE: Keep this in sync with thrift_protocol:read.
+%% NOTE: Keep this in sync with thrift_protocol:read and read_specific.
 -spec read
         (state(), tprot_empty_tag()) ->   ok                | {error, _Reason};
         (state(), tprot_header_tag()) -> tprot_header_val() | {error, _Reason};

Modified: incubator/thrift/trunk/lib/erl/src/thrift_protocol.erl
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/erl/src/thrift_protocol.erl?rev=990977&r1=990976&r2=990977&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/erl/src/thrift_protocol.erl (original)
+++ incubator/thrift/trunk/lib/erl/src/thrift_protocol.erl Mon Aug 30 22:05:26 2010
@@ -158,8 +158,16 @@ read(IProto, {set, Type}) ->
     ok = read(IProto, set_end),
     {ok, sets:from_list(List)};
 
-read(#protocol{module = Module,
-               data = ModuleData}, ProtocolType) ->
+read(Protocol, ProtocolType) ->
+    read_specific(Protocol, ProtocolType).
+
+%% NOTE: Keep this in sync with thrift_protocol_impl:read
+-spec read_specific
+        (#protocol{}, tprot_empty_tag()) ->   ok                | {error, _Reason};
+        (#protocol{}, tprot_header_tag()) -> tprot_header_val() | {error, _Reason};
+        (#protocol{}, tprot_data_tag()) ->   {ok, term()}       | {error, _Reason}.
+read_specific(#protocol{module = Module,
+                        data = ModuleData}, ProtocolType) ->
     Module:read(ModuleData, ProtocolType).
 
 read_struct_loop(IProto, SDict, RTuple) ->