Fix dumb errors

This commit is contained in:
Kresten Krab Thorup 2012-04-23 13:24:01 +02:00
parent a1c8bb40bd
commit 8796575053
2 changed files with 3 additions and 3 deletions

View file

@ -62,7 +62,7 @@ encode_index_node(KVList, Compress) ->
OutData = [?SNAPPY_COMPRESSION|Snappied]
end;
gzip ->
GZipData = zlib:gzip(TermData);
GZipData = zlib:gzip(TermData),
if byte_size(GZipData) > byte_size(TermData) ->
OutData = [?NO_COMPRESSION|TermData];
true ->

View file

@ -190,9 +190,9 @@ close_node(#state{nodes=[#node{ level=Level, members=NodeMembers }|RestNodes], c
{ok, BlockData} = hanoi_util:encode_index_node(OrderedMembers, Compress),
NodePos = State#state.index_file_pos,
BlockSize = byte_size(BlockData),
BlockSize = erlang:iolist_size(BlockData),
Data = [ <<(BlockSize+2):32/unsigned, Level:16/unsigned>> | BlockData ],
DataSize = BlockData + 6,
DataSize = BlockSize + 6,
ok = file:write(State#state.index_file, Data),