Skip to content

Commit

Permalink
make sure that the data portion cannot overrun the dot output
Browse files Browse the repository at this point in the history
  • Loading branch information
Cliff Moon committed May 31, 2010
1 parent 354247b commit afc6f5e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/luwak/src/luwak_tree.erl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ visualize_tree(Riak, RootName = <<Prefix:8/binary, _/binary>>, #n{children=Child
end, Children);
visualize_tree(Riak, DataName = <<Prefix:8/binary, _/binary>>, DataNode) ->
Data = luwak_block:data(DataNode),
io_lib:format("\"~s\" [shape=record,label=\"~s | ~s\",regular=1,style=filled,fillcolor=gray ] ;~n", [DataName,Prefix,Data]).
PrefixData = if
byte_size(Data) > 8 ->
<<P:8/binary, _/binary>> = Data,
P;
true -> Data
end,
io_lib:format("\"~s\" [shape=record,label=\"~s | ~s\",regular=1,style=filled,fillcolor=gray ] ;~n", [DataName,Prefix,PrefixData]).

create_tree(Riak, Order, Children) when is_list(Children) ->
?debugFmt("create_tree(Riak, ~p, ~p)~n", [Order, Children]),
Expand Down

0 comments on commit afc6f5e

Please sign in to comment.