From 9ad6a316265c9f9af41efb65b3f9585fcae2e40e Mon Sep 17 00:00:00 2001 From: David Reiss Date: Wed, 11 Jun 2008 01:12:45 +0000 Subject: [PATCH] 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 --- lib/alterl/src/thrift_binary_protocol.erl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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}; -- 2.17.1