From 121606af141b54fd357d9491e22f7e7995dbf02d Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sun, 9 Jun 2019 07:31:45 -0400 Subject: [PATCH] dont remove null terminator in remove repetition --- GUI/host/util.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GUI/host/util.cpp b/GUI/host/util.cpp index 3c4a6ab..fb9ee2b 100644 --- a/GUI/host/util.cpp +++ b/GUI/host/util.cpp @@ -312,9 +312,9 @@ namespace Util bool RemoveRepetition(std::wstring& text) { wchar_t* end = text.data() + text.size(); - for (int len = text.size() / 3; len > 6; --len) - if (wcsncmp(end - len * 3, end - len * 2, len) == 0 && wcsncmp(end - len * 3, end - len * 1, len) == 0) - return RemoveRepetition(text = end - len), true; + for (int length = text.size() / 3; length > 6; --length) + if (wcsncmp(end - length * 3, end - length * 2, length) == 0 && wcsncmp(end - length * 3, end - length * 1, length) == 0) + return RemoveRepetition(text = std::wstring(end - length, length)), true; return false; }