From: David Reiss Date: Wed, 11 Jun 2008 01:12:45 +0000 (+0000) Subject: Fix thrift_binary_protocol to be hipe-compatible X-Git-Tag: 0.2.0~694 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=9ad6a316265c9f9af41efb65b3f9585fcae2e40e;p=common%2Fthrift.git Fix thrift_binary_protocol to be hipe-compatible git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666468 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/alterl/src/thrift_binary_protocol.erl b/lib/alterl/src/thrift_binary_protocol.erl index 4bb58807..fce6c423 100644 --- a/lib/alterl/src/thrift_binary_protocol.erl +++ b/lib/alterl/src/thrift_binary_protocol.erl @@ -152,7 +152,7 @@ write(This, Data) -> %% 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 @@ read(This, i32) -> 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, <>} -> {ok, Val}; + Else -> Else + end; + read(This, i64) -> case read(This, 8) of {ok, <>} -> {ok, Val};