From b649696a7258a8583332c666cee3cece2e9ded76 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Tue, 24 Feb 2015 23:01:14 +0100 Subject: [PATCH] Use CUnicodeUtils::GetUnicode instead of CGit::StringAppend if possible Also StringAppend is a static method, so don't call it on an object. Signed-off-by: Sven Strickroth --- src/Git/Git.cpp | 11 +++-------- src/Git/GitIndex.cpp | 8 ++++---- src/Git/GitRev.cpp | 16 ++++++++-------- src/Git/GitStatusListCtrl.cpp | 2 +- src/Git/TGitPath.cpp | 24 +++++++++++------------- src/TortoiseGitBlame/TortoiseGitBlameDoc.cpp | 4 ++-- src/TortoiseProc/AppUtils.cpp | 2 +- src/TortoiseProc/CheckForUpdatesDlg.cpp | 4 ++-- src/TortoiseProc/GitDiff.cpp | 10 +++++----- src/TortoiseProc/GitLogListBase.cpp | 3 +-- src/TortoiseProc/GitRefCompareList.cpp | 9 ++------- src/TortoiseProc/LogDataVector.cpp | 6 ++---- src/TortoiseProc/Patch.cpp | 12 ++++++------ src/TortoiseProc/ProgressDlg.cpp | 7 +++---- src/TortoiseProc/ProgressDlg.h | 2 +- src/TortoiseProc/RefLogDlg.cpp | 6 ++---- src/TortoiseShell/GITPropertyPage.cpp | 12 +++--------- 17 files changed, 57 insertions(+), 81 deletions(-) diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index 3ace16d2a..268a118d2 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -1323,9 +1323,7 @@ int CGit::GetCommitDiffList(const CString &rev1, const CString &rev2, CTGitPathL int addto_list_each_ref_fn(const char *refname, const unsigned char * /*sha1*/, int /*flags*/, void *cb_data) { STRING_VECTOR *list = (STRING_VECTOR*)cb_data; - CString str; - g_Git.StringAppend(&str, (BYTE*)refname, CP_UTF8); - list->push_back(str); + list->push_back(CUnicodeUtils::GetUnicode(refname)); return 0; } @@ -1806,9 +1804,7 @@ int CGit::DeleteRemoteRefs(const CString& sRemote, const STRING_VECTOR& list) int libgit2_addto_list_each_ref_fn(git_reference *ref, void *payload) { STRING_VECTOR *list = (STRING_VECTOR*)payload; - CString str; - g_Git.StringAppend(&str, (BYTE*)git_reference_name(ref), CP_UTF8); - list->push_back(str); + list->push_back(CUnicodeUtils::GetUnicode(git_reference_name(ref))); return 0; } @@ -1862,8 +1858,7 @@ int libgit2_addto_map_each_ref_fn(git_reference *ref, void *payload) { map_each_ref_payload *payloadContent = (map_each_ref_payload*)payload; - CString str; - g_Git.StringAppend(&str, (BYTE*)git_reference_name(ref), CP_UTF8); + CString str = CUnicodeUtils::GetUnicode(git_reference_name(ref)); CAutoObject gitObject; if (git_revparse_single(gitObject.GetPointer(), payloadContent->repo, git_reference_name(ref))) diff --git a/src/Git/GitIndex.cpp b/src/Git/GitIndex.cpp index 76d4338ff..06e68e2bb 100644 --- a/src/Git/GitIndex.cpp +++ b/src/Git/GitIndex.cpp @@ -108,7 +108,7 @@ int CGitIndexList::ReadIndex(CString dgitdir) const git_index_entry *e = git_index_get_byindex(index, i); this->at(i).m_FileName.Empty(); - g_Git.StringAppend(&this->at(i).m_FileName, (BYTE*)e->path, CP_UTF8); + this->at(i).m_FileName = CUnicodeUtils::GetUnicode(e->path); this->at(i).m_FileName.MakeLower(); this->at(i).m_ModifyTime = e->mtime.seconds; this->at(i).m_Flags = e->flags | e->flags_extended; @@ -556,7 +556,7 @@ int CGitHeadFileList::ReadHeadHash(CString gitdir) return -1; ReadFile(hfile, p, filesize - 4, &size, nullptr); - g_Git.StringAppend(&m_HeadRefFile, p, CP_UTF8, filesize - 4); + CGit::StringAppend(&m_HeadRefFile, p, CP_UTF8, filesize - 4); free(p); CString ref = m_HeadRefFile.Trim(); @@ -697,8 +697,8 @@ int CGitHeadFileList::CallBack(const unsigned char *sha1, const char *base, int p->at(cur).m_Hash = sha1; p->at(cur).m_FileName.Empty(); - g_Git.StringAppend(&p->at(cur).m_FileName, (BYTE*)base, CP_UTF8, baselen); - g_Git.StringAppend(&p->at(cur).m_FileName,(BYTE*)pathname, CP_UTF8); + CGit::StringAppend(&p->at(cur).m_FileName, (BYTE*)base, CP_UTF8, baselen); + CGit::StringAppend(&p->at(cur).m_FileName, (BYTE*)pathname, CP_UTF8); p->at(cur).m_FileName.MakeLower(); diff --git a/src/Git/GitRev.cpp b/src/Git/GitRev.cpp index 147409dae..1ea113f3d 100644 --- a/src/Git/GitRev.cpp +++ b/src/Git/GitRev.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2014 - TortoiseGit +// Copyright (C) 2008-2015 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -303,7 +303,7 @@ int GitRev::ParserFromCommit(GIT_COMMIT *commit) if(commit->m_Encode != 0 && commit->m_EncodeSize != 0) { CString str; - g_Git.StringAppend(&str, (BYTE*)commit->m_Encode, CP_UTF8, commit->m_EncodeSize); + CGit::StringAppend(&str, (BYTE*)commit->m_Encode, CP_UTF8, commit->m_EncodeSize); encode = CUnicodeUtils::GetCPCode(str); } @@ -312,24 +312,24 @@ int GitRev::ParserFromCommit(GIT_COMMIT *commit) this->m_AuthorDate = commit->m_Author.Date; this->m_AuthorEmail.Empty(); - g_Git.StringAppend(&m_AuthorEmail,(BYTE*)commit->m_Author.Email,encode,commit->m_Author.EmailSize); + CGit::StringAppend(&m_AuthorEmail, (BYTE*)commit->m_Author.Email, encode, commit->m_Author.EmailSize); this->m_AuthorName.Empty(); - g_Git.StringAppend(&m_AuthorName,(BYTE*)commit->m_Author.Name,encode,commit->m_Author.NameSize); + CGit::StringAppend(&m_AuthorName, (BYTE*)commit->m_Author.Name, encode, commit->m_Author.NameSize); this->m_Body.Empty(); - g_Git.StringAppend(&m_Body,(BYTE*)commit->m_Body,encode,commit->m_BodySize); + CGit::StringAppend(&m_Body, (BYTE*)commit->m_Body, encode, commit->m_BodySize); this->m_CommitterDate = commit->m_Committer.Date; this->m_CommitterEmail.Empty(); - g_Git.StringAppend(&m_CommitterEmail, (BYTE*)commit->m_Committer.Email,encode, commit->m_Committer.EmailSize); + CGit::StringAppend(&m_CommitterEmail, (BYTE*)commit->m_Committer.Email, encode, commit->m_Committer.EmailSize); this->m_CommitterName.Empty(); - g_Git.StringAppend(&m_CommitterName, (BYTE*)commit->m_Committer.Name,encode, commit->m_Committer.NameSize); + CGit::StringAppend(&m_CommitterName, (BYTE*)commit->m_Committer.Name, encode, commit->m_Committer.NameSize); this->m_Subject.Empty(); - g_Git.StringAppend(&m_Subject, (BYTE*)commit->m_Subject,encode,commit->m_SubjectSize); + CGit::StringAppend(&m_Subject, (BYTE*)commit->m_Subject,encode,commit->m_SubjectSize); return 0; } diff --git a/src/Git/GitStatusListCtrl.cpp b/src/Git/GitStatusListCtrl.cpp index 3bbb03586..792c0bfc4 100644 --- a/src/Git/GitStatusListCtrl.cpp +++ b/src/Git/GitStatusListCtrl.cpp @@ -3738,7 +3738,7 @@ int CGitStatusListCtrl::UpdateFileList(git_revnum_t hash,CTGitPathList *list) { int last = cmdErr.RevertFind(0,-1); CString str; - g_Git.StringAppend(&str, &cmdErr[last + 1], CP_UTF8, (int)cmdErr.size() - last -1); + CGit::StringAppend(&str, &cmdErr[last + 1], CP_UTF8, (int)cmdErr.size() - last -1); CMessageBox::Show(NULL, str, _T("TortoiseGit"), MB_OK|MB_ICONERROR); } diff --git a/src/Git/TGitPath.cpp b/src/Git/TGitPath.cpp index cff33515e..8fd39a54b 100644 --- a/src/Git/TGitPath.cpp +++ b/src/Git/TGitPath.cpp @@ -1001,7 +1001,7 @@ int CTGitPathList::ParserFromLsFile(BYTE_VECTOR &out,bool /*staged*/) one.Empty(); path.Reset(); - g_Git.StringAppend(&one, &out[pos], CP_UTF8); + CGit::StringAppend(&one, &out[pos], CP_UTF8); int tabstart=0; path.m_Action=path.ParserAction(out[pos]); one.Tokenize(_T("\t"),tabstart); @@ -1073,7 +1073,7 @@ int CTGitPathList::FillUnRev(unsigned int action, CTGitPathList *list, CString * if (g_Git.Run(cmd, &out, &errb)) { if (err != nullptr) - g_Git.StringAppend(err, &errb[0], CP_UTF8, (int)errb.size()); + CGit::StringAppend(err, &errb[0], CP_UTF8, (int)errb.size()); return -1; } @@ -1082,7 +1082,7 @@ int CTGitPathList::FillUnRev(unsigned int action, CTGitPathList *list, CString * while (pos >= 0 && pos < (int)out.size()) { one.Empty(); - g_Git.StringAppend(&one, &out[pos], CP_UTF8); + CGit::StringAppend(&one, &out[pos], CP_UTF8); if(!one.IsEmpty()) { //SetFromGit will clear all status @@ -1100,7 +1100,6 @@ int CTGitPathList::FillBasedOnIndexFlags(unsigned short flag, CTGitPathList* lis { Clear(); CTGitPath path; - CString one; CAutoRepository repository(g_Git.GetGitRepository()); if (!repository) @@ -1124,8 +1123,7 @@ int CTGitPathList::FillBasedOnIndexFlags(unsigned short flag, CTGitPathList* lis if (!e || !((e->flags | e->flags_extended) & flag) || !e->path) continue; - one.Empty(); - g_Git.StringAppend(&one, (BYTE*)e->path, CP_UTF8); + CString one = CUnicodeUtils::GetUnicode(e->path); if (!(!list || (*list)[j].GetWinPathString().IsEmpty() || one == (*list)[j].GetGitPathString() || (PathIsDirectory(g_Git.CombinePath((*list)[j].GetWinPathString())) && one.Find((*list)[j].GetGitPathString() + _T("/")) == 0))) continue; @@ -1196,9 +1194,9 @@ int CTGitPathList::ParserFromLog(BYTE_VECTOR &log, bool parseDeletes /*false*/) CString pathname2; if( file1>=0 ) - g_Git.StringAppend(&pathname1, &log[file1], CP_UTF8); + CGit::StringAppend(&pathname1, &log[file1], CP_UTF8); if( file2>=0 ) - g_Git.StringAppend(&pathname2, &log[file2], CP_UTF8); + CGit::StringAppend(&pathname2, &log[file2], CP_UTF8); CTGitPath *GitPath=LookForGitPath(pathname1); @@ -1242,7 +1240,7 @@ int CTGitPathList::ParserFromLog(BYTE_VECTOR &log, bool parseDeletes /*false*/) if(tabstart >=0) { log[tabstart]=0; - g_Git.StringAppend(&StatAdd,&log[pos],CP_UTF8); + CGit::StringAppend(&StatAdd, &log[pos], CP_UTF8); pos=tabstart+1; } @@ -1251,26 +1249,26 @@ int CTGitPathList::ParserFromLog(BYTE_VECTOR &log, bool parseDeletes /*false*/) { log[tabstart]=0; - g_Git.StringAppend(&StatDel,&log[pos],CP_UTF8); + CGit::StringAppend(&StatDel, &log[pos], CP_UTF8); pos=tabstart+1; } if(log[pos] == 0) //rename { ++pos; - g_Git.StringAppend(&file2, &log[pos], CP_UTF8); + CGit::StringAppend(&file2, &log[pos], CP_UTF8); int sec=log.find(0,pos); if(sec>=0) { ++sec; - g_Git.StringAppend(&file1, &log[sec], CP_UTF8); + CGit::StringAppend(&file1, &log[sec], CP_UTF8); } pos=sec; } else { - g_Git.StringAppend(&file1, &log[pos], CP_UTF8); + CGit::StringAppend(&file1, &log[pos], CP_UTF8); } path.SetFromGit(file1,&file2); diff --git a/src/TortoiseGitBlame/TortoiseGitBlameDoc.cpp b/src/TortoiseGitBlame/TortoiseGitBlameDoc.cpp index 18efdd6f8..a886c5715 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlameDoc.cpp +++ b/src/TortoiseGitBlame/TortoiseGitBlameDoc.cpp @@ -190,9 +190,9 @@ BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName,CString Rev) { CString str; if (!m_BlameData.empty()) - g_Git.StringAppend(&str, &m_BlameData[0], CP_UTF8); + CGit::StringAppend(&str, &m_BlameData[0], CP_UTF8); if (!err.empty()) - g_Git.StringAppend(&str, &err[0], CP_UTF8); + CGit::StringAppend(&str, &err[0], CP_UTF8); MessageBox(NULL, CString(MAKEINTRESOURCE(IDS_BLAMEERROR)) + _T("\n\n") + str, _T("TortoiseGitBlame"), MB_OK); return FALSE; diff --git a/src/TortoiseProc/AppUtils.cpp b/src/TortoiseProc/AppUtils.cpp index 854a6f9ad..fea669d31 100644 --- a/src/TortoiseProc/AppUtils.cpp +++ b/src/TortoiseProc/AppUtils.cpp @@ -1636,7 +1636,7 @@ bool ParseHashesFromLsFile(const BYTE_VECTOR& out, CString& hash1, CString& hash { one.Empty(); - g_Git.StringAppend(&one, &out[pos], CP_UTF8); + CGit::StringAppend(&one, &out[pos], CP_UTF8); int tabstart = 0; one.Tokenize(_T("\t"), tabstart); diff --git a/src/TortoiseProc/CheckForUpdatesDlg.cpp b/src/TortoiseProc/CheckForUpdatesDlg.cpp index 41e4b01dd..5ee3a333c 100644 --- a/src/TortoiseProc/CheckForUpdatesDlg.cpp +++ b/src/TortoiseProc/CheckForUpdatesDlg.cpp @@ -1,7 +1,7 @@ // TortoiseGit - a Windows shell extension for easy version control // Copyright (C) 2003-2008 - TortoiseSVN -// Copyright (C) 2008-2014 - TortoiseGit +// Copyright (C) 2008-2015 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -541,7 +541,7 @@ void CCheckForUpdatesDlg::FillChangelog(CAutoConfig& versioncheck, bool official std::unique_ptr buf(new BYTE[(UINT)file.GetLength()]); UINT read = file.Read(buf.get(), (UINT)file.GetLength()); bool skipBom = read >= 3 && buf[0] == 0xEF && buf[1] == 0xBB && buf[2] == 0xBF; - g_Git.StringAppend(&temp, buf.get() + (skipBom ? 3 : 0), CP_UTF8, read - (skipBom ? 3 : 0)); + CGit::StringAppend(&temp, buf.get() + (skipBom ? 3 : 0), CP_UTF8, read - (skipBom ? 3 : 0)); } else temp = _T("Could not open downloaded changelog file."); diff --git a/src/TortoiseProc/GitDiff.cpp b/src/TortoiseProc/GitDiff.cpp index 4b3c28eab..2e9e74f16 100644 --- a/src/TortoiseProc/GitDiff.cpp +++ b/src/TortoiseProc/GitDiff.cpp @@ -1,7 +1,7 @@ // TortoiseGit - a Windows shell extension for easy version control // Copyright (C) 2003-2008 - TortoiseSVN -// Copyright (C) 2008-2014 - TortoiseGit +// Copyright (C) 2008-2015 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -259,18 +259,18 @@ int CGitDiff::SubmoduleDiff(const CTGitPath * pPath, const CTGitPath * /*pPath2* if(g_Git.Run(cmd, &bytes, &errBytes)) { CString err; - g_Git.StringAppend(&err, &errBytes[0], CP_UTF8); + CGit::StringAppend(&err, &errBytes[0], CP_UTF8); CMessageBox::Show(NULL,err,_T("TortoiseGit"),MB_OK|MB_ICONERROR); return -1; } - if (bytes.size() < 15 + 41 + 40) + if (bytes.size() < 15 + 2 * GIT_HASH_SIZE + 1 + 2 * GIT_HASH_SIZE) { CMessageBox::Show(NULL, _T("git diff-tree gives invalid output"), _T("TortoiseGit"), MB_OK | MB_ICONERROR); return -1; } - g_Git.StringAppend(&oldhash, &bytes[15], CP_UTF8, 40); - g_Git.StringAppend(&newhash, &bytes[15+41], CP_UTF8, 40); + CGit::StringAppend(&oldhash, &bytes[15], CP_UTF8, 2 * GIT_HASH_SIZE); + CGit::StringAppend(&newhash, &bytes[15 + 2 * GIT_HASH_SIZE + 1], CP_UTF8, 2 * GIT_HASH_SIZE); } diff --git a/src/TortoiseProc/GitLogListBase.cpp b/src/TortoiseProc/GitLogListBase.cpp index 65c270079..c70556eba 100644 --- a/src/TortoiseProc/GitLogListBase.cpp +++ b/src/TortoiseProc/GitLogListBase.cpp @@ -2967,8 +2967,7 @@ UINT CGitLogListBase::LogThread() if(note) { - pRev->m_Notes.Empty(); - g_Git.StringAppend(&pRev->m_Notes,(BYTE*)note); + pRev->m_Notes = CUnicodeUtils::GetUnicode(note); free(note); note = nullptr; } diff --git a/src/TortoiseProc/GitRefCompareList.cpp b/src/TortoiseProc/GitRefCompareList.cpp index c4e926560..16040b670 100644 --- a/src/TortoiseProc/GitRefCompareList.cpp +++ b/src/TortoiseProc/GitRefCompareList.cpp @@ -303,14 +303,9 @@ CString CGitRefCompareList::GetCommitMessage(git_commit *commit) int encode = CP_UTF8; const char *encodingString = git_commit_message_encoding(commit); if (encodingString != nullptr) - { - CString str; - g_Git.StringAppend(&str, (BYTE*)encodingString, CP_UTF8); - encode = CUnicodeUtils::GetCPCode(str); - } + encode = CUnicodeUtils::GetCPCode(CUnicodeUtils::GetUnicode(encodingString)); - CString message; - g_Git.StringAppend(&message, (BYTE*)git_commit_message(commit), encode); + CString message = CUnicodeUtils::GetUnicode(git_commit_message(commit), encode); int start = 0; message = message.Tokenize(_T("\n"), start); return message; diff --git a/src/TortoiseProc/LogDataVector.cpp b/src/TortoiseProc/LogDataVector.cpp index ea62f023f..0ca4eb3d5 100644 --- a/src/TortoiseProc/LogDataVector.cpp +++ b/src/TortoiseProc/LogDataVector.cpp @@ -142,8 +142,7 @@ int CLogDataVector::ParserFromLog(CTGitPath *path, int count, int infomask, CStr } if (pNote) { - pRev->m_Notes.Empty(); - g_Git.StringAppend(&pRev->m_Notes,(BYTE*)pNote); + pRev->m_Notes = CUnicodeUtils::GetUnicode(pNote); free(pNote); pNote = nullptr; } @@ -263,8 +262,7 @@ int AddTolist(unsigned char * /*osha1*/, unsigned char *nsha1, const char * /*na GitRev rev; rev.m_CommitHash = (char*)nsha1; - CString one; - g_Git.StringAppend(&one, (BYTE *)msg); + CString one = CUnicodeUtils::GetUnicode(msg); int message = one.Find(_T(":"), 0); if (message > 0) diff --git a/src/TortoiseProc/Patch.cpp b/src/TortoiseProc/Patch.cpp index 8c324f3e9..c6e5a687a 100644 --- a/src/TortoiseProc/Patch.cpp +++ b/src/TortoiseProc/Patch.cpp @@ -76,7 +76,7 @@ int CSendMailPatch::SendAsCombinedMail(CTGitPathList &list, CGitProgressList * i { try { - g_Git.StringAppend(&body, (BYTE*)patch.m_Body.GetBuffer(), CP_UTF8, patch.m_Body.GetLength()); + CGit::StringAppend(&body, (BYTE*)patch.m_Body.GetBuffer(), CP_UTF8, patch.m_Body.GetLength()); } catch (CMemoryException *) { @@ -121,29 +121,29 @@ int CPatch::Parse(CString &pathfile) return -1; one=m_Body.Tokenize("\n",start); if(one.GetLength()>6) - g_Git.StringAppend(&m_Author, (BYTE*)one.GetBuffer() + 6, CP_UTF8, one.GetLength() - 6); + CGit::StringAppend(&m_Author, (BYTE*)one.GetBuffer() + 6, CP_UTF8, one.GetLength() - 6); if (start == -1) return -1; one=m_Body.Tokenize("\n",start); if(one.GetLength()>6) - g_Git.StringAppend(&m_Date, (BYTE*)one.GetBuffer() + 6, CP_UTF8, one.GetLength() - 6); + CGit::StringAppend(&m_Date, (BYTE*)one.GetBuffer() + 6, CP_UTF8, one.GetLength() - 6); if (start == -1) return -1; one=m_Body.Tokenize("\n",start); if(one.GetLength()>9) { - g_Git.StringAppend(&m_Subject, (BYTE*)one.GetBuffer() + 9, CP_UTF8, one.GetLength() - 9); + CGit::StringAppend(&m_Subject, (BYTE*)one.GetBuffer() + 9, CP_UTF8, one.GetLength() - 9); while (m_Body.GetLength() > start && m_Body.GetAt(start) == _T(' ')) { one = m_Body.Tokenize("\n", start); - g_Git.StringAppend(&m_Subject, (BYTE*)one.GetBuffer(), CP_UTF8, one.GetLength()); + CGit::StringAppend(&m_Subject, (BYTE*)one.GetBuffer(), CP_UTF8, one.GetLength()); } } if (start + 1 < m_Body.GetLength()) - g_Git.StringAppend(&m_strBody, (BYTE*)m_Body.GetBuffer() + start + 1, CP_UTF8, m_Body.GetLength() - start - 1); + CGit::StringAppend(&m_strBody, (BYTE*)m_Body.GetBuffer() + start + 1, CP_UTF8, m_Body.GetLength() - start - 1); } catch (CException *) { diff --git a/src/TortoiseProc/ProgressDlg.cpp b/src/TortoiseProc/ProgressDlg.cpp index cf1245aa7..626000d37 100644 --- a/src/TortoiseProc/ProgressDlg.cpp +++ b/src/TortoiseProc/ProgressDlg.cpp @@ -528,13 +528,12 @@ void CProgressDlg::ParserCmdOutput(CRichEditCtrl &log,CProgressCtrl &progressctr //TRACE(_T("%c"),ch); if( ch == ('\r') || ch == ('\n')) { - CString str; + CString str = CUnicodeUtils::GetUnicode(oneline); // TRACE(_T("End Char %s \r\n"),ch==_T('\r')?_T("lf"):_T("")); // TRACE(_T("End Char %s \r\n"),ch==_T('\n')?_T("cr"):_T("")); int lines = log.GetLineCount(); - g_Git.StringAppend(&str, (BYTE*)oneline.GetBuffer(), CP_UTF8); str.Trim(); // TRACE(_T("%s"), str); @@ -751,8 +750,8 @@ CString CCommitProgressDlg::Convert2UnionCode(char *buff, int size) } CString str; - g_Git.StringAppend(&str, (BYTE*)buff, g_Git.m_LogEncode, start); - g_Git.StringAppend(&str, (BYTE*)buff + start, CP_UTF8, size - start); + CGit::StringAppend(&str, (BYTE*)buff, g_Git.m_LogEncode, start); + CGit::StringAppend(&str, (BYTE*)buff + start, CP_UTF8, size - start); ClearESC(str); diff --git a/src/TortoiseProc/ProgressDlg.h b/src/TortoiseProc/ProgressDlg.h index 5a452c97b..fd38394da 100644 --- a/src/TortoiseProc/ProgressDlg.h +++ b/src/TortoiseProc/ProgressDlg.h @@ -144,7 +144,7 @@ private: virtual CString Convert2UnionCode(char *buff, int size=-1) { CString str; - g_Git.StringAppend(&str, (BYTE*)buff, CP_UTF8, size); + CGit::StringAppend(&str, (BYTE*)buff, CP_UTF8, size); return str; } diff --git a/src/TortoiseProc/RefLogDlg.cpp b/src/TortoiseProc/RefLogDlg.cpp index d044152af..71427af03 100644 --- a/src/TortoiseProc/RefLogDlg.cpp +++ b/src/TortoiseProc/RefLogDlg.cpp @@ -141,8 +141,7 @@ int AddToRefLoglist(unsigned char * /*osha1*/, unsigned char *nsha1, const char rev.m_CommitHash = (char *)nsha1; rev.GetCommitterDate() = CTime(time); - CString one; - g_Git.StringAppend(&one, (BYTE *)msg); + CString one = CUnicodeUtils::GetUnicode(msg); int message = one.Find(_T(":"), 0); if (message > 0) @@ -187,8 +186,7 @@ int ParserFromRefLog(CString ref, std::vector &refloglist) rev.GetCommitterDate() = CTime(git_reflog_entry_committer(entry)->when.time); if (git_reflog_entry_message(entry) != nullptr) { - CString one; - g_Git.StringAppend(&one, (BYTE *)git_reflog_entry_message(entry)); + CString one = CUnicodeUtils::GetUnicode(git_reflog_entry_message(entry)); int message = one.Find(_T(":"), 0); if (message > 0) { diff --git a/src/TortoiseShell/GITPropertyPage.cpp b/src/TortoiseShell/GITPropertyPage.cpp index b748e01de..9bc31e125 100644 --- a/src/TortoiseShell/GITPropertyPage.cpp +++ b/src/TortoiseShell/GITPropertyPage.cpp @@ -472,18 +472,12 @@ void CGitPropertyPage::DisplayCommit(const git_commit* commit, UINT hashLabel, U int encode = CP_UTF8; const char * encodingString = git_commit_message_encoding(commit); if (encodingString != NULL) - { - CString str; - g_Git.StringAppend(&str, (BYTE*)encodingString, CP_UTF8); - encode = CUnicodeUtils::GetCPCode(str); - } + encode = CUnicodeUtils::GetCPCode(CUnicodeUtils::GetUnicode(encodingString)); const git_signature * author = git_commit_author(commit); - CString authorName; - g_Git.StringAppend(&authorName, (BYTE*)author->name, encode); + CString authorName = CUnicodeUtils::GetUnicode(author->name, encode); - CString message; - g_Git.StringAppend(&message, (BYTE*)git_commit_message(commit), encode); + CString message = CUnicodeUtils::GetUnicode(git_commit_message(commit), encode); int start = 0; message = message.Tokenize(L"\n", start); -- 2.11.4.GIT