diff options
author | Zezula Ladislav <ladislav.zezula@avast.com> | 2017-11-08 15:31:45 +0100 |
---|---|---|
committer | Zezula Ladislav <ladislav.zezula@avast.com> | 2017-11-08 15:31:45 +0100 |
commit | dae0b690f796bd421ab69a0219cb1b46095b9f27 (patch) | |
tree | 3bb720145fdfe104b8ddecfe1e46f3419c38e8c0 /src/StormCommon.h | |
parent | 0ff84d5aed22bb5e3246cb0561592826afeb5f4a (diff) |
+ SFileAddListFile and SFileCompactArchive now take "const TCHAR *" instead of "const char *"
+ Fixed some bugs
Diffstat (limited to 'src/StormCommon.h')
-rw-r--r-- | src/StormCommon.h | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/StormCommon.h b/src/StormCommon.h index 868f1c1..95b72a3 100644 --- a/src/StormCommon.h +++ b/src/StormCommon.h @@ -133,11 +133,15 @@ extern unsigned char AsciiToUpperTable[256]; //-----------------------------------------------------------------------------
// Safe string functions
-void StringCopyA(char * dest, const char * src, size_t nMaxChars);
-void StringCatA(char * dest, const char * src, size_t nMaxChars);
-
-void StringCopyT(TCHAR * dest, const TCHAR * src, size_t nMaxChars);
-void StringCatT(TCHAR * dest, const TCHAR * src, size_t nMaxChars);
+void StringCopy(char * szTarget, size_t cchTarget, const char * szSource);
+void StringCat(char * szTarget, size_t cchTargetMax, const char * szSource);
+
+#ifdef _UNICODE
+void StringCopy(TCHAR * szTarget, size_t cchTarget, const char * szSource);
+void StringCopy(char * szTarget, size_t cchTarget, const TCHAR * szSource);
+void StringCopy(TCHAR * szTarget, size_t cchTarget, const TCHAR * szSource);
+void StringCat(TCHAR * szTarget, size_t cchTargetMax, const TCHAR * szSource);
+#endif
//-----------------------------------------------------------------------------
// Encryption and decryption functions
@@ -296,11 +300,20 @@ void Patch_Finalize(TMPQPatcher * pPatcher); bool CheckWildCard(const char * szString, const char * szWildCard);
bool IsInternalMpqFileName(const char * szFileName);
-const TCHAR * GetPlainFileName(const TCHAR * szFileName);
-const char * GetPlainFileName(const char * szFileName);
+template <typename XCHAR>
+const XCHAR * GetPlainFileName(const XCHAR * szFileName)
+{
+ const XCHAR * szPlainName = szFileName;
+
+ while(*szFileName != 0)
+ {
+ if(*szFileName == '\\' || *szFileName == '/')
+ szPlainName = szFileName + 1;
+ szFileName++;
+ }
-void CopyFileName(TCHAR * szTarget, const char * szSource, size_t cchLength);
-void CopyFileName(char * szTarget, const TCHAR * szSource, size_t cchLength);
+ return szPlainName;
+}
//-----------------------------------------------------------------------------
// Internal support for MPQ modifications
|