From 9f48485b9ccc116e4a2a673fe7ced6694b4f2ce1 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Thu, 19 Sep 2013 11:10:10 +0200 Subject: [PATCH] Strip newline chars from the end of the log line string --- indra/newview/lllogchat.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 954293792..4a67d41ff 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -189,9 +189,11 @@ void LLLogChat::loadHistory(std::string const& filename , void (*callback)(ELogL while (fgets(buffer, LOG_RECALL_BUFSIZ, fptr)) { size_t len = strlen(buffer); - if (buffer[len - 1] == '\n') // In case the log file doesn't end on a new-line (is that even possible?) + int i = len - 1; + while (i >= 0 && (buffer[i] == '\r' || buffer[i] == '\n')) // strip newline chars from the end of the string { - buffer[len - 1] = '\0'; + buffer[i] = '\0'; + i--; } callback(LOG_LINE, buffer, userdata); }