Read and write of structs, lists, maps, and sets


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666375 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/alterl/src/thrift_binary_protocol.erl b/lib/alterl/src/thrift_binary_protocol.erl
index 1593f0b..6df9fdb 100644
--- a/lib/alterl/src/thrift_binary_protocol.erl
+++ b/lib/alterl/src/thrift_binary_protocol.erl
@@ -85,7 +85,7 @@
 
 write(This, set_end) -> ok;
 
-write(This, struct_begin) -> ok;
+write(This, #protocol_struct_begin{}) -> ok;
 write(This, struct_end) -> ok;
 
 
@@ -126,7 +126,8 @@
             #protocol_message_begin{name = Name,
                                     type = Type,
                                     seqid = SeqId};
-        Err = {error, closed} -> Err
+        Err = {error, closed} -> Err;
+        Err = {error, ebadf}  -> Err
     end;
 
 read(This, message_end) -> ok;
@@ -140,7 +141,7 @@
             #protocol_field_begin{type = Type,
                                   id = 0}; % TODO(todd) 0 or undefined?
         {ok, Type} ->
-            Id = read(This, i16),
+            {ok, Id} = read(This, i16),
             #protocol_field_begin{type = Type,
                                   id = Id}
     end;