From 9a863ee551ffc75224113a2095ee5f2468f843ca Mon Sep 17 00:00:00 2001 From: Kevin Clark Date: Tue, 24 Mar 2009 16:04:36 +0000 Subject: [PATCH] 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 --- lib/erl/src/thrift_binary_protocol.erl | 7 ++++--- test/ThriftTest.thrift | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) 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, -- 2.17.1