Difference Between Revision 6 and Kolab:16 / erlang-eimap

use_iolist_to_binary.patch Added
x
 
1
@@ -0,0 +1,22 @@
2
+Instead of converting the values from zlib:deflate to binary by hand we can use 
3
+the iolist_to_binary() function from erlang; this allows us to convert
4
+also nested iolists.
5
+diff -rupN eimap-0.4.0.ori/src/eimap.erl eimap-0.4.0/src/eimap.erl
6
+--- eimap-0.4.0.ori/src/eimap.erl  2016-11-11 15:49:11.000000000 +0100
7
++++ eimap-0.4.0/src/eimap.erl  2020-03-21 20:36:12.850230642 +0100
8
+@@ -478,13 +478,10 @@ reenque_command(Command, State) ->
9
+     State#state { command_queue = queue:in_r(Command, State#state.command_queue) }.
10
+ 
11
+ inflated(Data, #state{ inflator = undefined }) -> Data;
12
+-inflated(Data, #state{ inflator = Inflator }) ->  joined(zlib:inflate(Inflator, Data), <<>>).
13
++inflated(Data, #state{ inflator = Inflator }) ->  iolist_to_binary(zlib:inflate(Inflator, Data)).
14
+ 
15
+ deflated(Data, #state{ deflator = undefined }) -> Data;
16
+-deflated(Data, #state{ deflator = Deflator }) ->  joined(zlib:deflate(Deflator, Data, sync), <<>>).
17
+-
18
+-joined([], Binary) -> Binary;
19
+-joined([H|Rest], Binary) -> joined(Rest, <<Binary/binary, H/binary>>).
20
++deflated(Data, #state{ deflator = Deflator }) ->  iolist_to_binary(zlib:deflate(Deflator, Data, sync)).
21
+ 
22
+ reset_timeout(#state{ command_timeout = Timeout } = State) ->
23
+     cancel_timeout(State),
24