diff options
author | Shauren <shauren.trinity@gmail.com> | 2019-06-19 19:58:31 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-06-19 19:58:31 +0200 |
commit | 658a79d94add4f9d639b959b6ac7b57a6a0a30ca (patch) | |
tree | 23ce72f38f46ad8789b8a8e9201caeae15761478 /dep/CascLib/src/common/Common.h | |
parent | d11b9a6992b9e46cc880f4c8b085479009acfaab (diff) |
Dep/CascLib: Update to ladislav-zezula/CascLib@c588b7bf538a010fd3376c90bd3a59f2142f05be
Diffstat (limited to 'dep/CascLib/src/common/Common.h')
-rw-r--r-- | dep/CascLib/src/common/Common.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/dep/CascLib/src/common/Common.h b/dep/CascLib/src/common/Common.h index 705777b7b0b..45a2ec93e6b 100644 --- a/dep/CascLib/src/common/Common.h +++ b/dep/CascLib/src/common/Common.h @@ -271,10 +271,10 @@ size_t CascStrPrintf(wchar_t * buffer, size_t nCount, const wchar_t * format, .. char * CascNewStr(const char * szString, size_t nCharsToReserve = 0); wchar_t * CascNewStr(const wchar_t * szString, size_t nCharsToReserve = 0); -TCHAR * CombinePath(const TCHAR * szPath, const TCHAR * szSubDir); -size_t CombineFilePath(TCHAR * szBuffer, size_t nMaxChars, const TCHAR * szPath, const TCHAR * szSubPath1, const TCHAR * szSubPath2 = NULL); -size_t CombineUrlPath(TCHAR * szBuffer, size_t nMaxChars, const TCHAR * szHost, const TCHAR * szSubPath1, const TCHAR * szSubPath2 = NULL); -TCHAR * GetLastPathPart(TCHAR * szWorkPath); +size_t CombinePath(LPTSTR szBuffer, size_t nMaxChars, char chSeparator, va_list argList); +size_t CombinePath(LPTSTR szBuffer, size_t nMaxChars, char chSeparator, ...); +LPTSTR CombinePath(LPCTSTR szPath, LPCTSTR szSubDir); +LPTSTR GetLastPathPart(LPTSTR szWorkPath); bool CutLastPathPart(TCHAR * szWorkPath); size_t CreateCascSubdirectoryName(TCHAR * szBuffer, size_t nMaxChars, const TCHAR * szSubDir, const TCHAR * szExtension, LPBYTE pbEKey); @@ -383,4 +383,23 @@ int ScanIndexDirectory( void * pvContext ); +//----------------------------------------------------------------------------- +// Argument structure versioning +// Safely retrieves field value from a structure +// intended for cases where users upgrade CascLib by simply dropping in a new .dll without recompiling their app + +template <typename ARG, typename ARG_HOLDER> +bool ExtractVersionedArgument(const ARG_HOLDER * pHolder, size_t ArgOffset, ARG * pArg) +{ + if (pHolder == NULL) + return false; + + // Check input structure size + if (ArgOffset + sizeof(ARG) > pHolder->Size) + return false; + + *pArg = *((ARG *)(((char*)pHolder) + ArgOffset)); + return true; +} + #endif // __COMMON_H__ |