From: Kevin Clark Date: Tue, 24 Mar 2009 16:04:36 +0000 (+0000) Subject: THRIFT-192. erl: Fix handling of booleans X-Git-Tag: 0.2.0~230 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=9a863ee551ffc75224113a2095ee5f2468f843ca;p=common%2Fthrift.git THRIFT-192. erl: Fix handling of booleans git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757870 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/erl/src/thrift_binary_protocol.erl b/lib/erl/src/thrift_binary_protocol.erl index e53f5ef7..c6dde336 100644 --- a/lib/erl/src/thrift_binary_protocol.erl +++ b/lib/erl/src/thrift_binary_protocol.erl @@ -231,9 +231,10 @@ read(This, field_stop) -> %% read(This, bool) -> - Byte = read(This, byte), - {ok, (Byte /= 0)}; - + case read(This, byte) of + {ok, Byte} -> {ok, Byte /= 0}; + Else -> Else + end; read(This, byte) -> case read(This, 1) of diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift index a042d7ef..e7152c40 100644 --- a/test/ThriftTest.thrift +++ b/test/ThriftTest.thrift @@ -22,6 +22,11 @@ struct Bonk 2: i32 type } +struct Bools { + 1: bool im_true, + 2: bool im_false, +} + struct Xtruct { 1: string string_thing,