Skip to content

Commit f77f19a

Browse files
Pedro GimenoSmallJoker
Pedro Gimeno
authored andcommittedJan 9, 2018
Fix off-by-one in log output line length (#6896)
1 parent 63f4ee2 commit f77f19a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
 

Diff for: ‎src/log.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,10 @@ void StringBuffer::push_back(char c)
347347
flush(std::string(buffer, buffer_index));
348348
buffer_index = 0;
349349
} else {
350-
int index = buffer_index;
351-
buffer[index++] = c;
352-
if (index >= BUFFER_LENGTH) {
350+
buffer[buffer_index++] = c;
351+
if (buffer_index >= BUFFER_LENGTH) {
353352
flush(std::string(buffer, buffer_index));
354353
buffer_index = 0;
355-
} else {
356-
buffer_index = index;
357354
}
358355
}
359356
}

0 commit comments

Comments
 (0)
Please sign in to comment.