From 5f68e67d61e0c0ffa6aacd80eda9e0e5c531cc7a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 22 Oct 2024 19:57:38 +0300 Subject: even more accurate form of check --- src/mir_app/src/srmm_log_rtf.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp index e3b016de14..a639264ab7 100644 --- a/src/mir_app/src/srmm_log_rtf.cpp +++ b/src/mir_app/src/srmm_log_rtf.cpp @@ -525,9 +525,12 @@ INT_PTR CRtfLogWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam) if (wchar_t *p = wcschr(pszWord, '\r')) *p = 0; - size_t iLen = mir_wstrlen(pszWord) - 1; - for (; iLen && wcschr(szTrimString, pszWord[iLen]); iLen--) - pszWord[iLen] = '\0'; + int iLen = (int)mir_wstrlen(pszWord) - 1; + while (iLen >= 0) { + if (!wcschr(szTrimString, pszWord[iLen])) + break; + pszWord[iLen--] = '\0'; + } if (iLen) { CMStringW wszText(FORMAT, TranslateT("Look up '%s"), pszWord); -- cgit v1.2.3