From cbc6d08b200953d37cef56f9cfa17cee3bdc360e Mon Sep 17 00:00:00 2001 From: Myagi Date: Thu, 26 Feb 2009 02:32:25 +0100 Subject: [PATCH] changed EnumFiles path/file params to unicode strings --- src/Git/Git.cpp | 14 +++++++------- src/Git/Git.h | 4 ++-- src/Git/GitFolderStatus.cpp | 8 ++++---- src/Git/GitStatus.cpp | 16 ++++++++-------- src/TGitCache/CachedDirectory.cpp | 8 ++++---- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index 3508193..2d00110 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -808,7 +808,7 @@ BOOL CGit::CheckMsysGitDir() class CGitCall_EnumFiles : public CGitCall { public: - CGitCall_EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData) + CGitCall_EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData) : m_pszProjectPath(pszProjectPath), m_pszSubPath(pszSubPath), m_nFlags(nFlags), @@ -819,8 +819,8 @@ public: typedef std::map TStrCharMap; - const char * m_pszProjectPath; - const char * m_pszSubPath; + const TCHAR * m_pszProjectPath; + const TCHAR * m_pszSubPath; unsigned int m_nFlags; WGENUMFILECB * m_pEnumCb; void * m_pUserData; @@ -926,7 +926,7 @@ public: } }; -BOOL CGit::EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData) +BOOL CGit::EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData) { if(!pszProjectPath || *pszProjectPath=='\0') return FALSE; @@ -942,7 +942,7 @@ BOOL CGit::EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigne SetCurrentDirectoryA(W_szToDir); GetCurrentDirectoryA(sizeof(W_szToDir)-1,W_szToDir); */ - SetCurrentDir(CUnicodeUtils::GetUnicode(pszProjectPath)); + SetCurrentDir(pszProjectPath); CString sMode; if (nFlags) @@ -960,9 +960,9 @@ BOOL CGit::EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigne } if (pszSubPath) - cmd.Format(_T("igit.exe \"%s\" status %s \"%s\""), CUnicodeUtils::GetUnicode(pszProjectPath), sMode, CUnicodeUtils::GetUnicode(pszSubPath)); + cmd.Format(_T("igit.exe \"%s\" status %s \"%s\""), pszProjectPath, sMode, pszSubPath); else - cmd.Format(_T("igit.exe \"%s\" status %s"), CUnicodeUtils::GetUnicode(pszProjectPath), sMode); + cmd.Format(_T("igit.exe \"%s\" status %s"), pszProjectPath, sMode); W_GitCall.SetCmd(cmd); // NOTE: should igit get added as a part of msysgit then use below line instead of the above one diff --git a/src/Git/Git.h b/src/Git/Git.h index 487c854..232ac02 100644 --- a/src/Git/Git.h +++ b/src/Git/Git.h @@ -94,7 +94,7 @@ public: int GetLog(BYTE_VECTOR& logOut,CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY|LOG_INFO_DETECT_COPYRENAME, CString *from=NULL,CString *to=NULL); - BOOL EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData); + BOOL EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData); git_revnum_t GetHash(CString &friendname); @@ -112,4 +112,4 @@ extern CString GetTempFile(); extern CGit g_Git; -inline static BOOL wgEnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData) { return g_Git.EnumFiles(pszProjectPath, pszSubPath, nFlags, pEnumCb, pUserData); } +inline static BOOL wgEnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData) { return g_Git.EnumFiles(pszProjectPath, pszSubPath, nFlags, pEnumCb, pUserData); } diff --git a/src/Git/GitFolderStatus.cpp b/src/Git/GitFolderStatus.cpp index 16bde65..b9a4342 100644 --- a/src/Git/GitFolderStatus.cpp +++ b/src/Git/GitFolderStatus.cpp @@ -251,18 +251,18 @@ const FileStatusCacheEntry * GitFolderStatus::BuildCache(const CTGitPath& filepa { // extract the sub-path (relative to project root) //MessageBox(NULL, filepath.GetDirectory().GetWinPathString(), sProjectRoot, MB_OK); - LPCSTR lpszSubPath = NULL; - CStringA sSubPath; + LPCTSTR lpszSubPath = NULL; + CString sSubPath; CString s = filepath.GetDirectory().GetWinPathString(); if (s.GetLength() > sProjectRoot.GetLength()) { - sSubPath = CStringA(s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/)); + sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/); lpszSubPath = sSubPath; } //if (lpszSubPath) MessageBoxA(NULL, lpszSubPath, "BuildCache", MB_OK); //MessageBoxA(NULL, CStringA(sProjectRoot), sSubPath, MB_OK); - err = !wgEnumFiles(CStringA(sProjectRoot), lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath|WGEFF_DirStatusAll, &fillstatusmap, this); + err = !wgEnumFiles(sProjectRoot, lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath|WGEFF_DirStatusAll, &fillstatusmap, this); /*err = svn_client_status4 (&youngest, filepath.GetDirectory().GetSVNApiPath(pool), diff --git a/src/Git/GitStatus.cpp b/src/Git/GitStatus.cpp index c2032a8..ff344e8 100644 --- a/src/Git/GitStatus.cpp +++ b/src/Git/GitStatus.cpp @@ -241,12 +241,12 @@ git_wc_status_kind GitStatus::GetAllStatus(const CTGitPath& path, git_depth_t de } else { - LPCSTR lpszSubPath = NULL; - CStringA sSubPath; + LPCTSTR lpszSubPath = NULL; + CString sSubPath; CString s = path.GetWinPathString(); if (s.GetLength() > sProjectRoot.GetLength()) { - sSubPath = CStringA(s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/)); + sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/); lpszSubPath = sSubPath; } @@ -265,7 +265,7 @@ git_wc_status_kind GitStatus::GetAllStatus(const CTGitPath& path, git_depth_t de nFlags |= WGEFF_NoRecurse; #endif - err = !wgEnumFiles(CStringA(sProjectRoot), lpszSubPath, nFlags, &getallstatus, &statuskind); + err = !wgEnumFiles(sProjectRoot, lpszSubPath, nFlags, &getallstatus, &statuskind); /*err = git_client_status4 (&youngest, path.GetSVNApiPath(pool), @@ -392,12 +392,12 @@ git_revnum_t GitStatus::GetStatus(const CTGitPath& path, bool update /* = false } else { - LPCSTR lpszSubPath = NULL; - CStringA sSubPath; + LPCTSTR lpszSubPath = NULL; + CString sSubPath; CString s = path.GetWinPathString(); if (s.GetLength() > sProjectRoot.GetLength()) { - sSubPath = CStringA(s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/)); + sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/); lpszSubPath = sSubPath; } @@ -410,7 +410,7 @@ git_revnum_t GitStatus::GetStatus(const CTGitPath& path, bool update /* = false m_status.prop_status = m_status.text_status = git_wc_status_none; // NOTE: currently wgEnumFiles will not enumerate file if it isn't versioned (so status will be git_wc_status_none) - m_err = !wgEnumFiles(CStringA(sProjectRoot), lpszSubPath, nFlags, &getstatus, &m_status); + m_err = !wgEnumFiles(sProjectRoot, lpszSubPath, nFlags, &getstatus, &m_status); /*m_err = git_client_status4 (&youngest, path.GetGitApiPath(m_pool), diff --git a/src/TGitCache/CachedDirectory.cpp b/src/TGitCache/CachedDirectory.cpp index ed81ef3..2b2cb3b 100644 --- a/src/TGitCache/CachedDirectory.cpp +++ b/src/TGitCache/CachedDirectory.cpp @@ -404,17 +404,17 @@ CStatusCacheEntry CCachedDirectory::GetStatusForMember(const CTGitPath& path, bo m_directoryPath.HasAdminDir(&sProjectRoot); ATLASSERT( !m_directoryPath.IsEmpty() ); - LPCSTR lpszSubPath = NULL; - CStringA sSubPath; + LPCTSTR lpszSubPath = NULL; + CString sSubPath; CString s = m_directoryPath.GetDirectory().GetWinPathString(); if (s.GetLength() > sProjectRoot.GetLength()) { - sSubPath = CStringA(s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/)); + sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/); lpszSubPath = sSubPath; } //MessageBoxA(NULL, CStringA(sProjectRoot), sSubPath, MB_OK); //OutputDebugStringA("###");OutputDebugStringW(sProjectRoot);OutputDebugStringA(" - ");OutputDebugStringA(sSubPath);OutputDebugStringA("\r\n"); - BOOL pErr = !wgEnumFiles(CStringA(sProjectRoot), lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath, &GetStatusCallback, this); + BOOL pErr = !wgEnumFiles(sProjectRoot, lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath, &GetStatusCallback, this); /*git_error_t* pErr = svn_client_status4 ( NULL, -- 2.11.0