Commit da295330 authored by Sven Strickroth's avatar Sven Strickroth

Use IsEmpty()/empty() where possible

Signed-off-by: Sven Strickroth's avatarSven Strickroth <[email protected]>
parent 43badbe9
......@@ -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);
......
......@@ -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)
......
......@@ -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)
......
......@@ -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';
......
......@@ -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);
......
......@@ -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;
......
......@@ -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('\"');
......
......@@ -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));
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment