aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPedro Gimeno <4267396+pgimeno@users.noreply.github.com>2018-01-09 19:07:14 +0100
committerSmallJoker <SmallJoker@users.noreply.github.com>2018-01-09 19:07:14 +0100
commitf77f19a9412c9ae9f6b54a8794af219861a5e2e2 (patch)
treeb0627ed428e4cf66055717abd0ebe196c6255abf /src
parent63f4ee21b05266f926ed883ba86f3411b1499933 (diff)
downloadminetest-f77f19a9412c9ae9f6b54a8794af219861a5e2e2.tar.gz
minetest-f77f19a9412c9ae9f6b54a8794af219861a5e2e2.tar.bz2
minetest-f77f19a9412c9ae9f6b54a8794af219861a5e2e2.zip
Fix off-by-one in log output line length (#6896)
Diffstat (limited to 'src')
-rw-r--r--src/log.cpp7
1 files changed, 2 insertions, 5 deletions
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;
}
}
}