From: Pedro Gimeno <4267396+pgimeno@users.noreply.github.com> Date: Tue, 9 Jan 2018 18:07:14 +0000 (+0100) Subject: Fix off-by-one in log output line length (#6896) X-Git-Tag: 5.0.0~639 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f77f19a9412c9ae9f6b54a8794af219861a5e2e2;p=oweals%2Fminetest.git Fix off-by-one in log output line length (#6896) --- diff --git a/src/log.cpp b/src/log.cpp index 28118066f..3e9229e38 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -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; } } }