diff --git a/src/Git/GitIndex.cpp b/src/Git/GitIndex.cpp index abbfb48b41821d6daf8944819716b7e2112f43f6..076079420a164e8f8e740d6358f4f75d501be2fa 100644 --- a/src/Git/GitIndex.cpp +++ b/src/Git/GitIndex.cpp @@ -1095,9 +1095,8 @@ bool CGitIgnoreList::IsIgnore(CString str, const CString& projectroot, bool isDi { str.Replace(_T('\\'),_T('/')); - if (str.GetLength()>0) - if (str[str.GetLength()-1] == _T('/')) - str = str.Left(str.GetLength() - 1); + if (!str.IsEmpty() && str[str.GetLength() - 1] == _T('/')) + str = str.Left(str.GetLength() - 1); int ret; ret = CheckIgnore(str, projectroot, isDir); diff --git a/src/Git/GitStatus.cpp b/src/Git/GitStatus.cpp index 335c9c48690e0ebe11914e252e05dc598d7c56c6..7fe7dfe16df4615230f70a0a6734ea4922f7ba3b 100644 --- a/src/Git/GitStatus.cpp +++ b/src/Git/GitStatus.cpp @@ -362,7 +362,7 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_ casepath += it->m_CaseFileName; bool bIsDir = false; - if (it->m_FileName.GetLength() > 0 && it->m_FileName[it->m_FileName.GetLength() - 1] == _T('/')) + if (!it->m_FileName.IsEmpty() && it->m_FileName[it->m_FileName.GetLength() - 1] == _T('/')) bIsDir = true; if (IsIgnore) diff --git a/src/TortoiseGitBlame/TortoiseGitBlameData.cpp b/src/TortoiseGitBlame/TortoiseGitBlameData.cpp index 82d997a5c631b4279e71fa8baa63df3d8c2a0668..9c3495539ef6d2b83491a8da00ac22f573512218 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlameData.cpp +++ b/src/TortoiseGitBlame/TortoiseGitBlameData.cpp @@ -352,7 +352,7 @@ int CTortoiseGitBlameData::FindNextLine(CGitHash& CommitHash, int line, bool bUp static int FindAsciiLower(const CStringA &str, const CStringA &find) { - if (find.GetLength() == 0) + if (find.IsEmpty()) return 0; for (int i = 0; i < str.GetLength(); ++i) diff --git a/src/TortoiseProc/AboutDlg.cpp b/src/TortoiseProc/AboutDlg.cpp index 1322604a1164347ffd89c418e4fa8eb8917d2669..02018c6eed4278d52372b79d52558633896391c7 100644 --- a/src/TortoiseProc/AboutDlg.cpp +++ b/src/TortoiseProc/AboutDlg.cpp @@ -53,7 +53,7 @@ END_MESSAGE_MAP() static CString Lf2Crlf(const CString& text) { CString s; - if (text.GetLength() == 0) + if (text.IsEmpty()) return s; TCHAR c = '\0'; diff --git a/src/TortoiseProc/AppUtils.cpp b/src/TortoiseProc/AppUtils.cpp index 6b11aec85d5a7eb5b093a59ab0b9e2710bfed3e1..58044c5d6a27f3397231f96a3efb97767c1b39af 100644 --- a/src/TortoiseProc/AppUtils.cpp +++ b/src/TortoiseProc/AppUtils.cpp @@ -2356,7 +2356,7 @@ int CAppUtils::SaveCommitUnicodeFile(const CString& filename, CString &message) line = line.Left(start - oldStart); ++start; // move forward so we don't find the same char again } - if (stripComments && (line.GetLength() >= 1 && line.GetAt(0) == '#') || (start < 0 && line.IsEmpty())) + if (stripComments && (!line.IsEmpty() && line.GetAt(0) == '#') || (start < 0 && line.IsEmpty())) continue; line.TrimRight(L" \r"); CStringA lineA = CUnicodeUtils::GetMulti(line + L"\n", cp); diff --git a/src/TortoiseProc/CloneDlg.cpp b/src/TortoiseProc/CloneDlg.cpp index 18b425143077fbf2d754b7ca5bd3eff1ba3e4964..37bd30dae92ab8198e6504405fcdc970a99ed995 100644 --- a/src/TortoiseProc/CloneDlg.cpp +++ b/src/TortoiseProc/CloneDlg.cpp @@ -233,7 +233,7 @@ void CCloneDlg::OnOK() return; } - if (m_bOrigin && m_strOrigin.GetLength() == 0 && !m_bSVN) + if (m_bOrigin && m_strOrigin.IsEmpty() && !m_bSVN) { ShowEditBalloon(IDC_EDIT_ORIGIN, IDS_B_T_NOTEMPTY, IDS_ERR_ERROR, TTI_ERROR); m_bSaving = false; diff --git a/src/TortoiseProc/Commands/DropCopyCommand.cpp b/src/TortoiseProc/Commands/DropCopyCommand.cpp index 05e7288ee961d5f2fd9c0dd2585cb82e222785e0..90ce1c435b174c65f5888b19d53addd62476c406 100644 --- a/src/TortoiseProc/Commands/DropCopyCommand.cpp +++ b/src/TortoiseProc/Commands/DropCopyCommand.cpp @@ -105,9 +105,8 @@ bool DropCopyCommand::Execute() CString path; path=fullDropPath.GetGitPathString().Mid(ProjectTopDir.GetLength()); - if(path.GetLength()>0) - if(path[0]==_T('\\') || path[0]==_T('/')) - path=path.Mid(1); + if (!path.IsEmpty() && (path[0] == _T('\\') || path[0] == _T('/'))) + path = path.Mid(1); cmd += path; cmd +=_T('\"'); diff --git a/src/TortoiseProc/CommitDlg.cpp b/src/TortoiseProc/CommitDlg.cpp index 413884eb3f83139d410ff488e49131ae486b320a..c85cccefe937b86665d118bbd1c8d5f6b9d928ff 100644 --- a/src/TortoiseProc/CommitDlg.cpp +++ b/src/TortoiseProc/CommitDlg.cpp @@ -2171,7 +2171,7 @@ LRESULT CCommitDlg::OnUpdateOKButton(WPARAM, LPARAM) if (m_bBlock) return 0; - bool bValidLogSize = m_cLogMessage.GetText().GetLength() >= m_ProjectProperties.nMinLogSize && m_cLogMessage.GetText().GetLength() > 0; + bool bValidLogSize = !m_cLogMessage.GetText().IsEmpty() && m_cLogMessage.GetText().GetLength() >= m_ProjectProperties.nMinLogSize; bool bAmendOrSelectFilesOrMerge = m_ListCtrl.GetSelected() > 0 || (m_bCommitAmend && m_bAmendDiffToLastCommit) || CTGitPath(g_Git.m_CurrentDir).IsMergeActive(); DialogEnableWindow(IDOK, bValidLogSize && (m_bCommitMessageOnly || bAmendOrSelectFilesOrMerge)); diff --git a/src/TortoiseProc/LogDlg.cpp b/src/TortoiseProc/LogDlg.cpp index 083ef56bc4edefcc2e70e89a20a37c51291e1b65..121917805934335dae017db1c2bb845e6bdaf6ab 100644 --- a/src/TortoiseProc/LogDlg.cpp +++ b/src/TortoiseProc/LogDlg.cpp @@ -2455,7 +2455,7 @@ void CLogDlg::OnBnClickedJumpUp() found = data->ParentsCount() > 1; else if (jumpType == JumpType_Parent1) { - if (data->m_ParentHash.size() > 0) + if (!data->m_ParentHash.empty()) found = data->m_ParentHash[0] == hashValue; } else if (jumpType == JumpType_Parent2) @@ -2533,7 +2533,7 @@ void CLogDlg::OnBnClickedJumpDown() strValue = data->GetCommitterEmail(); else if (jumpType == JumpType_Parent1) { - if (data->m_ParentHash.size() > 0) + if (!data->m_ParentHash.empty()) hashValue = data->m_ParentHash.at(0); else return;