Skip to content

Commit

Permalink
Fix a bug with the calculation of the remaining length
Browse files Browse the repository at this point in the history
If the result of the string format was longer than the remaining length,
the returned remaining length would be negative, which would make very
strange things happen.
  • Loading branch information
Vagabond committed Oct 28, 2011
1 parent 3311702 commit f918156
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lager_format.erl
Expand Up @@ -145,7 +145,7 @@ build([], Acc, MaxLen, _O) ->

build2([{C,As,F,Ad,P,Pad,Enc}|Cs], Count, MaxLen) ->
{S, Len} = control2(C, As, F, Ad, P, Pad, Enc, MaxLen div Count),
[S|build2(Cs, Count - 1, MaxLen - Len)];
[S|build2(Cs, Count - 1, MaxLen - abs(Len))];
build2([C|Cs], Count, MaxLen) ->
[C|build2(Cs, Count, MaxLen)];
build2([], _, _) -> [].
Expand Down

0 comments on commit f918156

Please sign in to comment.