fileStatus.nFlags = 0;\r
if (*line == 'D')\r
fileStatus.nFlags |= WGFF_Directory;\r
+ else if (*line != 'F')\r
+ // parse error\r
+ return false;\r
line += 2;\r
\r
// status\r
case 'I': fileStatus.nStatus = WGFS_Ignored; break;\r
case 'U': fileStatus.nStatus = WGFS_Unversioned; break;\r
case 'E': fileStatus.nStatus = WGFS_Empty; break;\r
+ case '?': fileStatus.nStatus = WGFS_Unknown; break;\r
+ default:\r
+ // parse error\r
+ return false;\r
}\r
line += 2;\r
\r
{\r
for (int i=0; i<20; i++)\r
{\r
- sha1[i] = (HexChar(line[0]) << 8) | HexChar(line[1]);\r
+ sha1[i] = (BYTE)((HexChar(line[0]) << 8) | HexChar(line[1]));\r
line += 2;\r
}\r
\r
}\r
\r
// filename\r
- fileStatus.sFileName = line;\r
+ int len = strlen(line);\r
+ if (len && len < 2048)\r
+ {\r
+ WCHAR *buf = (WCHAR*)alloca((len*4+2)*sizeof(WCHAR));\r
+ *buf = 0;\r
+ MultiByteToWideChar(CP_ACP, 0, line, len+1, buf, len*4+1);\r
+ fileStatus.sFileName = buf;\r
\r
- if ( (*m_pEnumCb)(&fileStatus,m_pUserData) )\r
- return false;\r
+ if (*buf && (*m_pEnumCb)(&fileStatus,m_pUserData))\r
+ return false;\r
+ }\r
\r
return true;\r
}\r
stdstring str;\r
if (pFile->sFileName)\r
{\r
- str = CUnicodeUtils::StdGetUnicode(pFile->sFileName);\r
+ str = pFile->sFileName;//CUnicodeUtils::StdGetUnicode(pFile->sFileName);\r
std::replace(str.begin(), str.end(), '/', '\\');\r
//MessageBox(NULL, str.c_str(), _T(""), MB_OK);\r
}\r
\r
struct wgFile_s\r
{\r
- const char *sFileName; // filename or directory relative to project root (using forward slashes)\r
+ LPCTSTR sFileName; // filename or directory relative to project root (using forward slashes)\r
int nStatus; // the WGFILESTATUS of the file\r
int nFlags; // a combination of WGFILEFLAGS\r
\r
m_bIsDirectory = bIsDirectory;\r
}\r
\r
+void CTGitPath::SetFromGit(const TCHAR* pPath, bool bIsDirectory)\r
+{\r
+ Reset();\r
+ if (pPath)\r
+ {\r
+ m_sFwdslashPath = pPath;\r
+ SanitizeRootPath(m_sFwdslashPath, true);\r
+ }\r
+ m_bDirectoryKnown = true;\r
+ m_bIsDirectory = bIsDirectory;\r
+}\r
+\r
void CTGitPath::SetFromGit(const CString& sPath,CString *oldpath)\r
{\r
Reset();\r
*/\r
void SetFromGit(const char* pPath);\r
void SetFromGit(const char* pPath, bool bIsDirectory);\r
+ void SetFromGit(const TCHAR* pPath, bool bIsDirectory);\r
void SetFromGit(const CString& sPath,CString *OldPath=NULL);\r
\r
/**\r
{\r
CCachedDirectory* pThis = (CCachedDirectory*)pUserData;\r
\r
- const char *path = pFile->sFileName;\r
+ const TCHAR *path = pFile->sFileName;\r
\r
if (path == NULL)\r
return FALSE;\r