diff --git a/src/FileUtils.cpp b/src/FileUtils.cpp index 92218f3a..f0a92a92 100644 --- a/src/FileUtils.cpp +++ b/src/FileUtils.cpp @@ -533,9 +533,7 @@ CString CDir::ChangeDir(const CString& sPath, const CString& sAdd, const CString sAddDir += "/"; CString sCurDir; - if (sRet.Right(1) == "/") { - sRet.RightChomp(); - } + sRet.TrimSuffix("/"); for (unsigned int a = 0; a < sAddDir.size(); a++) { switch (sAddDir[a]) { diff --git a/src/User.cpp b/src/User.cpp index 580b52d0..f179ac70 100644 --- a/src/User.cpp +++ b/src/User.cpp @@ -269,10 +269,8 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) { // Pass = ### // 'Salted hash' means hash of 'password' + 'salt' // Possible hashes are md5 and sha256 - if (sValue.Right(1) == "-") { - sValue.RightChomp(); - sValue.Trim(); - SetPass(sValue, CUser::HASH_MD5); + if (sValue.TrimSuffix("-")) { + SetPass(sValue.Trim_n(), CUser::HASH_MD5); } else { CString sMethod = sValue.Token(0, false, "#"); CString sPass = sValue.Token(1, true, "#"); diff --git a/src/Utils.cpp b/src/Utils.cpp index ecb3c935..4cd6b2c1 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -277,9 +277,7 @@ bool CUtils::GetInput(const CString& sPrompt, CString& sRet, const CString& sDef } sInput = szBuf; - if (sInput.Right(1) == "\n") { - sInput.RightChomp(); - } + sInput.TrimSuffix("\n"); if (sInput.empty()) { sRet = sDefault;