Fix off-by-one in log output line length (#6896)

This commit is contained in:
Pedro Gimeno 2018-01-09 19:07:14 +01:00 committed by SmallJoker
parent 6b5e2618fb
commit 127b1fa6f8
1 changed files with 2 additions and 5 deletions

View File

@ -347,13 +347,10 @@ void StringBuffer::push_back(char c)
flush(std::string(buffer, buffer_index));
buffer_index = 0;
} else {
int index = buffer_index;
buffer[index++] = c;
if (index >= BUFFER_LENGTH) {
buffer[buffer_index++] = c;
if (buffer_index >= BUFFER_LENGTH) {
flush(std::string(buffer, buffer_index));
buffer_index = 0;
} else {
buffer_index = index;
}
}
}