Fix off-by-one in log output line length (#6896)
authorPedro Gimeno <4267396+pgimeno@users.noreply.github.com>
Tue, 9 Jan 2018 18:07:14 +0000 (19:07 +0100)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Tue, 9 Jan 2018 18:07:14 +0000 (19:07 +0100)
src/log.cpp

index 28118066f4cc79d44c3f36ba7081b8439ae07e37..3e9229e38799485c58300082c72190ef45755b8b 100644 (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;
                }
        }
 }