From ba324489a6a04cee83c3e7e19f046c5fc6b54728 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 13 Oct 2018 21:26:34 +0200 Subject: [PATCH] Make CGitHash "operator const unsigned char*" explicit In order to prevent conversions to CString. Signed-off-by: Sven Strickroth --- src/Git/GitHash.h | 2 +- src/Git/GitRev.cpp | 4 ++-- src/Git/GitRevLoglist.cpp | 6 +++--- src/Git/GitStatusListCtrl.cpp | 4 ++-- src/TortoiseProc/LogDataVector.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Git/GitHash.h b/src/Git/GitHash.h index 1b1fc7af7..693af17e8 100644 --- a/src/Git/GitHash.h +++ b/src/Git/GitHash.h @@ -155,7 +155,7 @@ public: return (const git_oid*)m_hash; } - operator const unsigned char*() const + explicit operator const unsigned char*() const { return m_hash; } diff --git a/src/Git/GitRev.cpp b/src/Git/GitRev.cpp index ba0251245..14d38f569 100644 --- a/src/Git/GitRev.cpp +++ b/src/Git/GitRev.cpp @@ -192,7 +192,7 @@ int GitRev::GetParentFromHash(const CGitHash& hash) { g_Git.CheckAndInitDll(); - if (git_get_commit_from_hash(&commit, hash)) + if (git_get_commit_from_hash(&commit, static_cast(hash))) { m_sErr = L"git_get_commit_from_hash failed for " + hash.ToString(); return -1; @@ -226,7 +226,7 @@ int GitRev::GetCommitFromHash_withoutLock(const CGitHash& hash) GIT_COMMIT commit; try { - if (git_get_commit_from_hash(&commit, hash)) + if (git_get_commit_from_hash(&commit, static_cast(hash))) { m_sErr = L"git_get_commit_from_hash failed for " + hash.ToString(); return -1; diff --git a/src/Git/GitRevLoglist.cpp b/src/Git/GitRevLoglist.cpp index 900056a2e..fbaa2ee37 100644 --- a/src/Git/GitRevLoglist.cpp +++ b/src/Git/GitRevLoglist.cpp @@ -126,7 +126,7 @@ int GitRevLoglist::SafeGetSimpleList(CGit* git) try { - if (git_get_commit_from_hash(&commit, m_CommitHash)) + if (git_get_commit_from_hash(&commit, static_cast(m_CommitHash))) return -1; } catch (char *) @@ -310,7 +310,7 @@ int GitRevLoglist::SafeFetchFullInfo(CGit* git) try { - if (git_get_commit_from_hash(&commit, m_CommitHash)) + if (git_get_commit_from_hash(&commit, static_cast(m_CommitHash))) return -1; } catch (char *) @@ -330,7 +330,7 @@ int GitRevLoglist::SafeFetchFullInfo(CGit* git) try { if (isRoot) - git_root_diff(git->GetGitDiff(), m_CommitHash, &file, &count, 1); + git_root_diff(git->GetGitDiff(), static_cast(m_CommitHash), &file, &count, 1); else git_do_diff(git->GetGitDiff(), parent, commit.m_hash, &file, &count, 1); } diff --git a/src/Git/GitStatusListCtrl.cpp b/src/Git/GitStatusListCtrl.cpp index 272710437..af8fe24d1 100644 --- a/src/Git/GitStatusListCtrl.cpp +++ b/src/Git/GitStatusListCtrl.cpp @@ -1915,7 +1915,7 @@ void CGitStatusListCtrl::OnContextMenuList(CWnd * pWnd, CPoint point) case IDGITLC_PREPAREDIFF: m_sMarkForDiffFilename = filepath->GetGitPathString(); - m_sMarkForDiffVersion = m_CurrentVersion; + m_sMarkForDiffVersion = m_CurrentVersion.ToString(); break; case IDGITLC_PREPAREDIFF_COMPARE: @@ -4119,7 +4119,7 @@ int CGitStatusListCtrl::RevertSelectedItemToVersion(bool parent) version = hash.ToString(); } else - version = m_CurrentVersion; + version = m_CurrentVersion.ToString(); CString filename = fentry->GetGitPathString(); if (!fentry->GetGitOldPathString().IsEmpty()) diff --git a/src/TortoiseProc/LogDataVector.cpp b/src/TortoiseProc/LogDataVector.cpp index bf441ff12..ff152120e 100644 --- a/src/TortoiseProc/LogDataVector.cpp +++ b/src/TortoiseProc/LogDataVector.cpp @@ -220,7 +220,7 @@ int CLogDataVector::Fill(std::unordered_set& hashes) try { CAutoLocker lock(g_Git.m_critGitDllSec); - if (git_get_commit_from_hash(&commit, hash)) + if (git_get_commit_from_hash(&commit, static_cast(hash))) return -1; } catch (char * msg) -- 2.11.4.GIT