From 788b83bff344aca86191588e8b239c05589f9784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Sat, 18 Apr 2020 19:15:49 -0400 Subject: [PATCH] Woops, thanks for catching this, Shyotl! --- indra/newview/lllogchat.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index d261518c4..9c71bba46 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -263,15 +263,10 @@ void LLLogChat::loadHistory(const std::string& name, const LLUUID& id, std::func // Read lines from the file one by one until we reach the end of the file. while (fgets(buffer, LOG_RECALL_BUFSIZ, fptr)) { - size_t len = strlen(buffer); - int i = len - 1; - auto& ch = buffer[i]; - while (i >= 0 && (ch == '\r' || ch == '\n')) // strip newline chars from the end of the string - { - ch = '\0'; - --i; - } - callback(LOG_LINE, buffer); + // strip newline chars from the end of the string + for (S32 i = strlen(buffer) - 1; i >= 0 && (buffer[i] == '\r' || buffer[i] == '\n'); --i) + buffer[i] = '\0'; + callback(LOG_LINE, buffer); } fclose(fptr);