From 355032d4f9600eea3684cab3166375053fbd9d8b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 19 Oct 2010 08:12:04 +0000 Subject: SWORD25: Fix cppcheck warnings in BS_Log::LogPrefix The LogPrefix method isn't currently used, but I'm fixing it just in case it's ever used again svn-id: r53602 --- engines/sword25/kernel/log.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/sword25/kernel/log.cpp b/engines/sword25/kernel/log.cpp index dd8b073422..95691e6b48 100644 --- a/engines/sword25/kernel/log.cpp +++ b/engines/sword25/kernel/log.cpp @@ -100,19 +100,20 @@ void BS_Log::LogPrefix(const char *Prefix, const char *Format, ...) { // If the issue has ceased at the beginning of a new line, the new issue to begin with the prefix ExtFormat[0] = 0; if (_LineBegin) { - snprintf(ExtFormat, sizeof(ExtFormat), "%s%s: ", ExtFormat, Prefix); + snprintf(ExtFormat, sizeof(ExtFormat), "%s: ", Prefix); _LineBegin = false; } // Format String pass line by line and each line with the initial prefix for (;;) { const char *NextLine = strstr(Format, "\n"); if (!NextLine || *(NextLine + strlen("\n")) == 0) { - snprintf(ExtFormat, sizeof(ExtFormat), "%s%s", ExtFormat, Format); + Common::strlcat(ExtFormat, Format, sizeof(ExtFormat)); if (NextLine) _LineBegin = true; break; } else { strncat(ExtFormat, Format, (NextLine - Format) + strlen("\n")); - snprintf(ExtFormat, sizeof(ExtFormat), "%s%s: ", ExtFormat, Prefix); + Common::strlcat(ExtFormat, Prefix, sizeof(ExtFormat)); + Common::strlcat(ExtFormat, ": ", sizeof(ExtFormat)); } Format = NextLine + strlen("\n"); -- cgit v1.2.3