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 <mk939@ymail.com>2018-06-03 17:32:00 +0200
commit127b1fa6f8c014172f0f8e11de19ace0a6882c24 (patch)
tree11bbf6b19e56d1dc7442a48a8e0f91179f30a973 /src
parent6b5e2618fbb91cbc7e68ef0fe2f6452cc6de3d5f (diff)
downloadminetest-127b1fa6f8c014172f0f8e11de19ace0a6882c24.tar.gz
minetest-127b1fa6f8c014172f0f8e11de19ace0a6882c24.tar.bz2
minetest-127b1fa6f8c014172f0f8e11de19ace0a6882c24.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 589cfd909..0dec7dd70 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;
}
}
}