OSDN Git Service

changed EnumFiles path/file params to unicode strings
authorMyagi <snowcoder@gmail.com>
Thu, 26 Feb 2009 01:32:25 +0000 (02:32 +0100)
committerFrank Li <lznuaa@gmail.com>
Thu, 26 Feb 2009 01:57:24 +0000 (09:57 +0800)
src/Git/Git.cpp
src/Git/Git.h
src/Git/GitFolderStatus.cpp
src/Git/GitStatus.cpp
src/TGitCache/CachedDirectory.cpp

index 3508193..2d00110 100644 (file)
@@ -808,7 +808,7 @@ BOOL CGit::CheckMsysGitDir()
 class CGitCall_EnumFiles : public CGitCall\r
 {\r
 public:\r
-       CGitCall_EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData)\r
+       CGitCall_EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData)\r
        :       m_pszProjectPath(pszProjectPath),\r
                m_pszSubPath(pszSubPath),\r
                m_nFlags(nFlags),\r
@@ -819,8 +819,8 @@ public:
 \r
        typedef std::map<CStringA,char> TStrCharMap;\r
 \r
-       const char *    m_pszProjectPath;\r
-       const char *    m_pszSubPath;\r
+       const TCHAR *   m_pszProjectPath;\r
+       const TCHAR *   m_pszSubPath;\r
        unsigned int    m_nFlags;\r
        WGENUMFILECB *  m_pEnumCb;\r
        void *                  m_pUserData;\r
@@ -926,7 +926,7 @@ public:
        }\r
 };\r
 \r
-BOOL CGit::EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData)\r
+BOOL CGit::EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData)\r
 {\r
        if(!pszProjectPath || *pszProjectPath=='\0')\r
                return FALSE;\r
@@ -942,7 +942,7 @@ BOOL CGit::EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigne
        SetCurrentDirectoryA(W_szToDir);\r
        GetCurrentDirectoryA(sizeof(W_szToDir)-1,W_szToDir);\r
 */\r
-       SetCurrentDir(CUnicodeUtils::GetUnicode(pszProjectPath));\r
+       SetCurrentDir(pszProjectPath);\r
 \r
        CString sMode;\r
        if (nFlags)\r
@@ -960,9 +960,9 @@ BOOL CGit::EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigne
        }\r
 \r
        if (pszSubPath)\r
-               cmd.Format(_T("igit.exe \"%s\" status %s \"%s\""), CUnicodeUtils::GetUnicode(pszProjectPath), sMode, CUnicodeUtils::GetUnicode(pszSubPath));\r
+               cmd.Format(_T("igit.exe \"%s\" status %s \"%s\""), pszProjectPath, sMode, pszSubPath);\r
        else\r
-               cmd.Format(_T("igit.exe \"%s\" status %s"), CUnicodeUtils::GetUnicode(pszProjectPath), sMode);\r
+               cmd.Format(_T("igit.exe \"%s\" status %s"), pszProjectPath, sMode);\r
 \r
        W_GitCall.SetCmd(cmd);\r
        // NOTE: should igit get added as a part of msysgit then use below line instead of the above one\r
index 487c854..232ac02 100644 (file)
@@ -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,\r
                                                                CString *from=NULL,CString *to=NULL);\r
 \r
-       BOOL EnumFiles(const char *pszProjectPath, const char *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData);\r
+       BOOL EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData);\r
 \r
        git_revnum_t GetHash(CString &friendname);\r
 \r
@@ -112,4 +112,4 @@ extern CString GetTempFile();
 \r
 extern CGit g_Git;\r
 \r
-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); }\r
+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); }\r
index 16bde65..b9a4342 100644 (file)
@@ -251,18 +251,18 @@ const FileStatusCacheEntry * GitFolderStatus::BuildCache(const CTGitPath& filepa
                {\r
                        // extract the sub-path (relative to project root)\r
 //MessageBox(NULL, filepath.GetDirectory().GetWinPathString(), sProjectRoot, MB_OK);\r
-                       LPCSTR lpszSubPath = NULL;\r
-                       CStringA sSubPath;\r
+                       LPCTSTR lpszSubPath = NULL;\r
+                       CString sSubPath;\r
                        CString s = filepath.GetDirectory().GetWinPathString();\r
                        if (s.GetLength() > sProjectRoot.GetLength())\r
                        {\r
-                               sSubPath = CStringA(s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/));\r
+                               sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/);\r
                                lpszSubPath = sSubPath;\r
                        }\r
 \r
 //if (lpszSubPath) MessageBoxA(NULL, lpszSubPath, "BuildCache", MB_OK);\r
 //MessageBoxA(NULL, CStringA(sProjectRoot), sSubPath, MB_OK);\r
-                       err = !wgEnumFiles(CStringA(sProjectRoot), lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath|WGEFF_DirStatusAll, &fillstatusmap, this);\r
+                       err = !wgEnumFiles(sProjectRoot, lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath|WGEFF_DirStatusAll, &fillstatusmap, this);\r
 \r
                        /*err = svn_client_status4 (&youngest,\r
                                filepath.GetDirectory().GetSVNApiPath(pool),\r
index c2032a8..ff344e8 100644 (file)
@@ -241,12 +241,12 @@ git_wc_status_kind GitStatus::GetAllStatus(const CTGitPath& path, git_depth_t de
        }\r
        else\r
        {\r
-               LPCSTR lpszSubPath = NULL;\r
-               CStringA sSubPath;\r
+               LPCTSTR lpszSubPath = NULL;\r
+               CString sSubPath;\r
                CString s = path.GetWinPathString();\r
                if (s.GetLength() > sProjectRoot.GetLength())\r
                {\r
-                       sSubPath = CStringA(s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/));\r
+                       sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/);\r
                        lpszSubPath = sSubPath;\r
                }\r
 \r
@@ -265,7 +265,7 @@ git_wc_status_kind GitStatus::GetAllStatus(const CTGitPath& path, git_depth_t de
                        nFlags |= WGEFF_NoRecurse;\r
 #endif\r
 \r
-               err = !wgEnumFiles(CStringA(sProjectRoot), lpszSubPath, nFlags, &getallstatus, &statuskind);\r
+               err = !wgEnumFiles(sProjectRoot, lpszSubPath, nFlags, &getallstatus, &statuskind);\r
 \r
                /*err = git_client_status4 (&youngest,\r
                                                        path.GetSVNApiPath(pool),\r
@@ -392,12 +392,12 @@ git_revnum_t GitStatus::GetStatus(const CTGitPath& path, bool update /* = false
        }\r
        else\r
        {\r
-               LPCSTR lpszSubPath = NULL;\r
-               CStringA sSubPath;\r
+               LPCTSTR lpszSubPath = NULL;\r
+               CString sSubPath;\r
                CString s = path.GetWinPathString();\r
                if (s.GetLength() > sProjectRoot.GetLength())\r
                {\r
-                       sSubPath = CStringA(s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/));\r
+                       sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/);\r
                        lpszSubPath = sSubPath;\r
                }\r
 \r
@@ -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;\r
 \r
                // NOTE: currently wgEnumFiles will not enumerate file if it isn't versioned (so status will be git_wc_status_none)\r
-               m_err = !wgEnumFiles(CStringA(sProjectRoot), lpszSubPath, nFlags, &getstatus, &m_status);\r
+               m_err = !wgEnumFiles(sProjectRoot, lpszSubPath, nFlags, &getstatus, &m_status);\r
 \r
                /*m_err = git_client_status4 (&youngest,\r
                                                        path.GetGitApiPath(m_pool),\r
index ed81ef3..2b2cb3b 100644 (file)
@@ -404,17 +404,17 @@ CStatusCacheEntry CCachedDirectory::GetStatusForMember(const CTGitPath& path, bo
                        m_directoryPath.HasAdminDir(&sProjectRoot);\r
                        ATLASSERT( !m_directoryPath.IsEmpty() );\r
 \r
-                       LPCSTR lpszSubPath = NULL;\r
-                       CStringA sSubPath;\r
+                       LPCTSTR lpszSubPath = NULL;\r
+                       CString sSubPath;\r
                        CString s = m_directoryPath.GetDirectory().GetWinPathString();\r
                        if (s.GetLength() > sProjectRoot.GetLength())\r
                        {\r
-                               sSubPath = CStringA(s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/));\r
+                               sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/);\r
                                lpszSubPath = sSubPath;\r
                        }\r
 //MessageBoxA(NULL, CStringA(sProjectRoot), sSubPath, MB_OK);\r
 //OutputDebugStringA("###");OutputDebugStringW(sProjectRoot);OutputDebugStringA(" - ");OutputDebugStringA(sSubPath);OutputDebugStringA("\r\n");\r
-                       BOOL pErr = !wgEnumFiles(CStringA(sProjectRoot), lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath, &GetStatusCallback, this);\r
+                       BOOL pErr = !wgEnumFiles(sProjectRoot, lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath, &GetStatusCallback, this);\r
 \r
                        /*git_error_t* pErr = svn_client_status4 (\r
                                NULL,\r