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 2008/06/11 03:12:46 UTC

svn commit: r666468 - /incubator/thrift/trunk/lib/alterl/src/thrift_binary_protocol.erl

Author: dreiss
Date: Tue Jun 10 18:12:45 2008
New Revision: 666468

URL: http://svn.apache.org/viewvc?rev=666468&view=rev
Log:
Fix thrift_binary_protocol to be hipe-compatible

Modified:
    incubator/thrift/trunk/lib/alterl/src/thrift_binary_protocol.erl

Modified: incubator/thrift/trunk/lib/alterl/src/thrift_binary_protocol.erl
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/alterl/src/thrift_binary_protocol.erl?rev=666468&r1=666467&r2=666468&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/alterl/src/thrift_binary_protocol.erl (original)
+++ incubator/thrift/trunk/lib/alterl/src/thrift_binary_protocol.erl Tue Jun 10 18:12:45 2008
@@ -152,7 +152,7 @@
 %%
 
 read(This, message_begin) ->
-    case read(This, i32) of
+    case read(This, ui32) of
         {ok, Sz} when Sz band ?VERSION_MASK =:= ?VERSION_1 ->
             %% we're at version 1
             {ok, Name}  = read(This, string),
@@ -253,6 +253,15 @@
         Else -> Else
     end;
 
+%% unsigned ints aren't used by thrift itself, but it's used for the parsing
+%% of the packet version header. Without this special function BEAM works fine
+%% but hipe thinks it received a bad version header.
+read(This, ui32) ->
+    case read(This, 4) of
+        {ok, <<Val:32/integer-unsigned-big, _/binary>>} -> {ok, Val};
+        Else -> Else
+    end;
+
 read(This, i64) ->
     case read(This, 8) of
         {ok, <<Val:64/integer-signed-big, _/binary>>} -> {ok, Val};