summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-11-30 13:03:10 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-11-30 13:03:10 +0000
commit46789bd14d5fc7448dbd1b68138a8b08964353bc (patch)
tree27851079c9870206fe7ccb9e2248dff8ff550af2
parent1f91ea192b7cbc5265e9bca4c69fcbc157402cfa (diff)
safe lstr* replacements: mir_strlen, mir_wstrlen, mir_strcpy, mir_wstrcpy,
mir_strncpy, mir_wstrncpy, mir_strcat, mir_wstrcat, mir_strncat, mir_wstrncat git-svn-id: http://svn.miranda-ng.org/main/trunk@11171 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_core.libbin59750 -> 61770 bytes
-rw-r--r--bin10/lib/mir_core64.libbin54678 -> 56488 bytes
-rw-r--r--bin12/lib/mir_core.libbin59750 -> 61770 bytes
-rw-r--r--bin12/lib/mir_core64.libbin54678 -> 56488 bytes
-rw-r--r--include/delphi/m_core.inc21
-rw-r--r--include/m_core.h135
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonheaders.h1
-rw-r--r--plugins/Clist_modern/src/modern_clcopts.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_gdiplus.cpp1
-rw-r--r--plugins/Clist_modern/src/modern_skinselector.cpp16
-rw-r--r--plugins/Clist_modern/src/modern_utils.cpp6
-rw-r--r--plugins/MirandaG15/src/CContactList.cpp2
-rw-r--r--plugins/StatusPlugins/KeepStatus/keepstatus.cpp7
-rw-r--r--plugins/UserInfoEx/src/classPsTreeItem.cpp8
-rw-r--r--plugins/UserInfoEx/src/ctrl_contact.cpp12
-rw-r--r--plugins/UserInfoEx/src/ctrl_edit.cpp8
-rw-r--r--plugins/UserInfoEx/src/ctrl_tzcombo.cpp2
-rw-r--r--plugins/UserInfoEx/src/dlg_msgbox.cpp4
-rw-r--r--plugins/UserInfoEx/src/dlg_propsheet.cpp18
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp2
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp6
-rw-r--r--plugins/UserInfoEx/src/mir_string.cpp36
-rw-r--r--plugins/UserInfoEx/src/mir_string.h46
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp6
-rw-r--r--plugins/UserInfoEx/src/svc_contactinfo.cpp8
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp14
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp18
-rw-r--r--plugins/UserInfoEx/src/svc_timezone_old.cpp4
-rw-r--r--src/mir_core/mir_core.def10
-rw-r--r--src/mir_core/utils.cpp136
33 files changed, 311 insertions, 224 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index c9e220b219..8a92d1aa58 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index 4611781acd..b992670550 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib
index fc6813f7bd..b7d00a7c7e 100644
--- a/bin12/lib/mir_core.lib
+++ b/bin12/lib/mir_core.lib
Binary files differ
diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib
index cdfc4a28cd..39288c011f 100644
--- a/bin12/lib/mir_core64.lib
+++ b/bin12/lib/mir_core64.lib
Binary files differ
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc
index ffb00ae3e8..622c7caf6c 100644
--- a/include/delphi/m_core.inc
+++ b/include/delphi/m_core.inc
@@ -630,7 +630,26 @@ function mir_strndup(const src:PAnsiChar; len:size_t):PAnsiChar; stdcall;
external CoreDLL name 'mir_strndup';
function mir_wstrndup(const src:PWideChar; len:size_t):PWideChar; stdcall;
external CoreDLL name 'mir_wstrndup';
-
+function mir_strlen(const src:PAnsiChar):size_t; stdcall;
+ external CoreDLL name 'mir_strlen';
+function mir_wstrlen(const src:PWideChar):size_t; stdcall;
+ external CoreDLL name 'mir_wstrlen';
+function mir_strcpy(dst:PAnsiChar; const src:PAnsiChar):PAnsiChar; stdcall;
+ external CoreDLL name 'mir_strcpy';
+function mir_wstrcpy(dst:PWideChar; const src:PWideChar):PWideChar; stdcall;
+ external CoreDLL name 'mir_wstrcpy';
+function mir_strncpy(dst:PAnsiChar; const src:PAnsiChar; len:size_t):PAnsiChar; stdcall;
+ external CoreDLL name 'mir_strncpy';
+function mir_wstrncpy(dst:PWideChar; const src:PWideChar; len:size_t):PWideChar; stdcall;
+ external CoreDLL name 'mir_wstrncpy';
+function mir_strcat(dst:PAnsiChar; const src:PAnsiChar):PAnsiChar; stdcall;
+ external CoreDLL name 'mir_strcat';
+function mir_wstrcat(dst:PWideChar; const src:PWideChar):PWideChar; stdcall;
+ external CoreDLL name 'mir_wstrcat';
+function mir_strncat(dst:PAnsiChar; const src:PAnsiChar; len:size_t):PAnsiChar; stdcall;
+ external CoreDLL name 'mir_strncat';
+function mir_wstrncat(dst:PWideChar; const src:PWideChar; len:size_t):PWideChar; stdcall;
+ external CoreDLL name 'mir_wstrncat';
///////////////////////////////////////////////////////////////////////////////
// modules
diff --git a/include/m_core.h b/include/m_core.h
index e627040b1d..57bffb68ff 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -82,7 +82,7 @@ typedef struct
union {
char *pszVal;
TCHAR *ptszVal;
- WCHAR *pwszVal;
+ wchar_t *pwszVal;
};
WORD cchVal; //only used for db/contact/getsettingstatic
};
@@ -296,16 +296,16 @@ MIR_CORE_DLL(HANDLE) db_event_prev(MCONTACT hContact, HANDLE hDbEvent);
* DATABASE SETTINGS
*/
-MIR_CORE_DLL(INT_PTR) db_get(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
-MIR_CORE_DLL(int) db_get_b(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue);
-MIR_CORE_DLL(int) db_get_w(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue);
-MIR_CORE_DLL(DWORD) db_get_dw(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD errorValue);
-MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
-MIR_CORE_DLL(WCHAR*) db_get_wsa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
+MIR_CORE_DLL(INT_PTR) db_get(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
+MIR_CORE_DLL(int) db_get_b(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue);
+MIR_CORE_DLL(int) db_get_w(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue);
+MIR_CORE_DLL(DWORD) db_get_dw(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD errorValue);
+MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
+MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
-MIR_CORE_DLL(int) db_get_static(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest);
-MIR_CORE_DLL(int) db_get_static_utf(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest);
-MIR_CORE_DLL(int) db_get_wstatic(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, WCHAR *pDest, int cbDest);
+MIR_CORE_DLL(int) db_get_static(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest);
+MIR_CORE_DLL(int) db_get_static_utf(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest);
+MIR_CORE_DLL(int) db_get_wstatic(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, wchar_t *pDest, int cbDest);
#if defined(__cplusplus)
MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, const int nType=DBVT_ASCIIZ);
@@ -313,14 +313,14 @@ MIR_CORE_DLL(int) db_get_wstatic(MCONTACT hContact, LPCSTR szModule, LPCSTR szSe
MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, const int nType);
#endif
-MIR_CORE_DLL(INT_PTR) db_set(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
-MIR_CORE_DLL(INT_PTR) db_set_b(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, BYTE val);
-MIR_CORE_DLL(INT_PTR) db_set_w(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, WORD val);
-MIR_CORE_DLL(INT_PTR) db_set_dw(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD val);
-MIR_CORE_DLL(INT_PTR) db_set_s(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val);
-MIR_CORE_DLL(INT_PTR) db_set_ws(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCWSTR val);
-MIR_CORE_DLL(INT_PTR) db_set_utf(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val);
-MIR_CORE_DLL(INT_PTR) db_set_blob(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, void *val, unsigned len);
+MIR_CORE_DLL(INT_PTR) db_set(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
+MIR_CORE_DLL(INT_PTR) db_set_b(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, BYTE val);
+MIR_CORE_DLL(INT_PTR) db_set_w(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, WORD val);
+MIR_CORE_DLL(INT_PTR) db_set_dw(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD val);
+MIR_CORE_DLL(INT_PTR) db_set_s(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val);
+MIR_CORE_DLL(INT_PTR) db_set_ws(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCWSTR val);
+MIR_CORE_DLL(INT_PTR) db_set_utf(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val);
+MIR_CORE_DLL(INT_PTR) db_set_blob(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, void *val, unsigned len);
MIR_CORE_DLL(INT_PTR) db_unset(MCONTACT hContact, LPCSTR szModule, LPCSTR szSetting);
@@ -452,19 +452,19 @@ MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const TCHAR* szSection, IconI
#define LANG_UNICODE 0x1000
-MIR_CORE_DLL(void) Langpack_SortDuplicates(void);
-MIR_CORE_DLL(int) Langpack_GetDefaultCodePage( void );
-MIR_CORE_DLL(int) Langpack_GetDefaultLocale(void);
-MIR_CORE_DLL(TCHAR*) Langpack_PcharToTchar(const char* pszStr);
+MIR_CORE_DLL(void) Langpack_SortDuplicates(void);
+MIR_CORE_DLL(int) Langpack_GetDefaultCodePage( void );
+MIR_CORE_DLL(int) Langpack_GetDefaultLocale(void);
+MIR_CORE_DLL(TCHAR*) Langpack_PcharToTchar(const char* pszStr);
-MIR_CORE_DLL(int) LoadLangPackModule(void);
-MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack);
-MIR_CORE_DLL(void) ReloadLangpack(TCHAR *pszStr);
+MIR_CORE_DLL(int) LoadLangPackModule(void);
+MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack);
+MIR_CORE_DLL(void) ReloadLangpack(TCHAR *pszStr);
-MIR_CORE_DLL(char*) TranslateA_LP(const char* str, int hLang);
-MIR_CORE_DLL(WCHAR*) TranslateW_LP(const WCHAR* str, int hLang);
-MIR_CORE_DLL(void) TranslateMenu_LP(HMENU, int hLang);
-MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int hLang);
+MIR_CORE_DLL(char*) TranslateA_LP(const char* str, int hLang);
+MIR_CORE_DLL(wchar_t*) TranslateW_LP(const wchar_t* str, int hLang);
+MIR_CORE_DLL(void) TranslateMenu_LP(HMENU, int hLang);
+MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int hLang);
#define Translate(s) TranslateA_LP(s, hLangpack)
#define TranslateW(s) TranslateW_LP(s, hLangpack)
@@ -546,10 +546,10 @@ MIR_CORE_DLL(HANDLE) mir_createLog(const char *pszName, const TCHAR *ptszDescr,
MIR_CORE_DLL(void) mir_closeLog(HANDLE hLogger);
MIR_C_CORE_DLL(int) mir_writeLogA(HANDLE hLogger, const char *format, ...);
-MIR_C_CORE_DLL(int) mir_writeLogW(HANDLE hLogger, const WCHAR *format, ...);
+MIR_C_CORE_DLL(int) mir_writeLogW(HANDLE hLogger, const wchar_t *format, ...);
-MIR_CORE_DLL(int) mir_writeLogVA(HANDLE hLogger, const char *format, va_list args);
-MIR_CORE_DLL(int) mir_writeLogVW(HANDLE hLogger, const WCHAR *format, va_list args);
+MIR_CORE_DLL(int) mir_writeLogVA(HANDLE hLogger, const char *format, va_list args);
+MIR_CORE_DLL(int) mir_writeLogVW(HANDLE hLogger, const wchar_t *format, va_list args);
///////////////////////////////////////////////////////////////////////////////
// md5 functions
@@ -573,11 +573,26 @@ MIR_C_CORE_DLL(void*) mir_calloc(size_t);
MIR_C_CORE_DLL(void*) mir_realloc(void* ptr, size_t);
MIR_C_CORE_DLL(void) mir_free(void* ptr);
-MIR_CORE_DLL(char*) mir_strdup(const char* str);
-MIR_CORE_DLL(WCHAR*) mir_wstrdup(const WCHAR* str);
+MIR_CORE_DLL(size_t) mir_strlen(const char *p);
+MIR_CORE_DLL(size_t) mir_wstrlen(const wchar_t *p);
-MIR_CORE_DLL(char*) mir_strndup(const char* str, size_t len);
-MIR_CORE_DLL(WCHAR*) mir_wstrndup(const WCHAR *str, size_t len);
+MIR_CORE_DLL(char*) mir_strcpy(char *dest, const char *src);
+MIR_CORE_DLL(wchar_t*) mir_wstrcpy(wchar_t *dest, const wchar_t *src);
+
+MIR_CORE_DLL(char*) mir_strncpy(char *dest, const char *src, size_t len);
+MIR_CORE_DLL(wchar_t*) mir_wstrncpy(wchar_t *dest, const wchar_t *src, size_t len);
+
+MIR_CORE_DLL(char*) mir_strcat(char *dest, const char *src);
+MIR_CORE_DLL(wchar_t*) mir_wstrcat(wchar_t *dest, const wchar_t *src);
+
+MIR_CORE_DLL(char*) mir_strncat(char *dest, const char *src, size_t len);
+MIR_CORE_DLL(wchar_t*) mir_wstrncat(wchar_t *dest, const wchar_t *src, size_t len);
+
+MIR_CORE_DLL(char*) mir_strdup(const char* str);
+MIR_CORE_DLL(wchar_t*) mir_wstrdup(const wchar_t* str);
+
+MIR_CORE_DLL(char*) mir_strndup(const char* str, size_t len);
+MIR_CORE_DLL(wchar_t*) mir_wstrndup(const wchar_t *str, size_t len);
///////////////////////////////////////////////////////////////////////////////
// modules
@@ -594,22 +609,22 @@ MIR_CORE_DLL(void) CreatePathToFile(char* wszFilePath);
MIR_CORE_DLL(int) CreateDirectoryTree(const char* szDir);
MIR_CORE_DLL(int) PathIsAbsolute(const char *pSrc);
-MIR_CORE_DLL(void) CreatePathToFileW(WCHAR* wszFilePath);
-MIR_CORE_DLL(int) CreateDirectoryTreeW(const WCHAR* szDir);
-MIR_CORE_DLL(int) PathIsAbsoluteW(const WCHAR *pSrc);
+MIR_CORE_DLL(void) CreatePathToFileW(wchar_t* wszFilePath);
+MIR_CORE_DLL(int) CreateDirectoryTreeW(const wchar_t* szDir);
+MIR_CORE_DLL(int) PathIsAbsoluteW(const wchar_t *pSrc);
#if defined( __cplusplus )
MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, const char* base=0);
- MIR_CORE_DLL(int) PathToAbsoluteW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR* base = 0);
+ MIR_CORE_DLL(int) PathToAbsoluteW(const wchar_t *pSrc, wchar_t *pOut, const wchar_t* base = 0);
MIR_CORE_DLL(int) PathToRelative(const char *pSrc, char *pOut, const char* base = 0);
- MIR_CORE_DLL(int) PathToRelativeW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR* base = 0);
+ MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pSrc, wchar_t *pOut, const wchar_t* base = 0);
#else
MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, const char* base);
- MIR_CORE_DLL(int) PathToAbsoluteW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR* base);
+ MIR_CORE_DLL(int) PathToAbsoluteW(const wchar_t *pSrc, wchar_t *pOut, const wchar_t* base);
MIR_CORE_DLL(int) PathToRelative(const char *pSrc, char *pOut, const char* base);
- MIR_CORE_DLL(int) PathToRelativeW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR* base);
+ MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pSrc, wchar_t *pOut, const wchar_t* base);
#endif
#define CreatePathToFileT CreatePathToFileW
@@ -622,9 +637,9 @@ MIR_CORE_DLL(int) PathIsAbsoluteW(const WCHAR *pSrc);
// print functions
MIR_CORE_DLL(int) mir_snprintf(char *buffer, size_t count, const char* fmt, ...);
-MIR_CORE_DLL(int) mir_snwprintf(WCHAR *buffer, size_t count, const WCHAR* fmt, ...);
+MIR_CORE_DLL(int) mir_snwprintf(wchar_t *buffer, size_t count, const wchar_t* fmt, ...);
MIR_CORE_DLL(int) mir_vsnprintf(char *buffer, size_t count, const char* fmt, va_list va);
-MIR_CORE_DLL(int) mir_vsnwprintf(WCHAR *buffer, size_t count, const WCHAR* fmt, va_list va);
+MIR_CORE_DLL(int) mir_vsnwprintf(wchar_t *buffer, size_t count, const wchar_t* fmt, va_list va);
///////////////////////////////////////////////////////////////////////////////
// protocol functions
@@ -709,32 +724,32 @@ __forceinline unsigned mir_base64_encode_bufsize(unsigned inputLen)
}
MIR_CORE_DLL(char*) rtrim(char *str);
-MIR_CORE_DLL(WCHAR*) rtrimw(WCHAR *str);
+MIR_CORE_DLL(wchar_t*) rtrimw(wchar_t *str);
MIR_CORE_DLL(char*) ltrim(char *str); // returns pointer to the beginning of string
-MIR_CORE_DLL(WCHAR*) ltrimw(WCHAR *str);
+MIR_CORE_DLL(wchar_t*) ltrimw(wchar_t *str);
MIR_CORE_DLL(char*) ltrimp(char *str); // returns pointer to the trimmed portion of string
-MIR_CORE_DLL(WCHAR*) ltrimpw(WCHAR *str);
+MIR_CORE_DLL(wchar_t*) ltrimpw(wchar_t *str);
MIR_CORE_DLL(int) wildcmp(const char *name, const char *mask);
-MIR_CORE_DLL(int) wildcmpw(const WCHAR *name, const WCHAR *mask);
+MIR_CORE_DLL(int) wildcmpw(const wchar_t *name, const wchar_t *mask);
MIR_CORE_DLL(int) wildcmpi(const char *name, const char *mask);
-MIR_CORE_DLL(int) wildcmpiw(const WCHAR *name, const WCHAR *mask);
+MIR_CORE_DLL(int) wildcmpiw(const wchar_t *name, const wchar_t *mask);
MIR_CORE_DLL(char*) bin2hex(const void *pData, size_t len, char *dest);
-MIR_CORE_DLL(WCHAR*) bin2hexW(const void *pData, size_t len, WCHAR *dest);
+MIR_CORE_DLL(wchar_t*) bin2hexW(const void *pData, size_t len, wchar_t *dest);
__forceinline char* lrtrim(char *str) { return ltrim(rtrim(str)); };
__forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); };
#if defined( __cplusplus )
MIR_CORE_DLL(char*) replaceStr(char* &dest, const char *src);
- MIR_CORE_DLL(WCHAR*) replaceStrW(WCHAR* &dest, const WCHAR *src);
+ MIR_CORE_DLL(wchar_t*) replaceStrW(wchar_t* &dest, const wchar_t *src);
#else
MIR_CORE_DLL(char*) replaceStr(char **dest, const char *src);
- MIR_CORE_DLL(WCHAR*) replaceStrW(WCHAR **dest, const WCHAR *src);
+ MIR_CORE_DLL(wchar_t*) replaceStrW(wchar_t **dest, const wchar_t *src);
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -751,6 +766,11 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); };
#define mir_t2u_cp(s,c) mir_wstrdup(s)
#define mir_u2t_cp(s,c) mir_wstrdup(s)
+ #define mir_tstrlen mir_wstrlen
+ #define mir_tstrcpy mir_wstrcpy
+ #define mir_tstrncpy mir_wstrncpy
+ #define mir_tstrcat mir_wstrcat
+ #define mir_tstrncat mir_wstrncat
#define mir_tstrdup mir_wstrdup
#define mir_tstrndup mir_wstrndup
@@ -780,6 +800,11 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); };
#define mir_t2u_cp(s,c) mir_a2u_cp(s,c)
#define mir_u2t_cp(s,c) mir_u2a_cp(s,c)
+ #define mir_tstrlen mir_strlen
+ #define mir_tstrcpy mir_strcpy
+ #define mir_tstrncpy mir_strncpy
+ #define mir_tstrcat mir_strcat
+ #define mir_tstrncat mir_strncat
#define mir_tstrdup mir_strdup
#define mir_tstrndup mir_strndup
@@ -800,8 +825,8 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); };
#define mir_writeLogVT mir_writeLogVA
#endif
-MIR_CORE_DLL(WCHAR*) mir_a2u_cp(const char* src, int codepage);
-MIR_CORE_DLL(WCHAR*) mir_a2u(const char* src);
+MIR_CORE_DLL(wchar_t*) mir_a2u_cp(const char* src, int codepage);
+MIR_CORE_DLL(wchar_t*) mir_a2u(const char* src);
MIR_CORE_DLL(char*) mir_u2a_cp(const wchar_t* src, int codepage);
MIR_CORE_DLL(char*) mir_u2a(const wchar_t* src);
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h
index 006c5541b0..7447002bbd 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h
@@ -144,7 +144,6 @@ extern TCHAR SkinsFolder[MAX_PATH];
char* __cdecl strstri( char *a, const char *b);
BOOL __cdecl mir_bool_strcmpi(const char *a, const char *b);
int __cdecl mir_strcmp (const char *a, const char *b);
-int __cdecl mir_strlen (const char *a);
int __cdecl mir_strcmpi(const char *a, const char *b);
int __cdecl mir_tstrcmpi(const TCHAR *a, const TCHAR *b);
BOOL __cdecl mir_bool_tstrcmpi(const TCHAR *a, const TCHAR *b);
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp
index f09e5b17de..0c18063a46 100644
--- a/plugins/Clist_modern/src/modern_clcopts.cpp
+++ b/plugins/Clist_modern/src/modern_clcopts.cpp
@@ -1574,7 +1574,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
static INT_PTR BkgrCfg_Register(WPARAM wParam, LPARAM lParam)
{
char *szSetting = (char*)wParam;
- int len = strlen(szSetting) + 1;
+ size_t len = strlen(szSetting) + 1;
char *value = (char *)mir_alloc(len + 4); // add room for flags (DWORD)
memcpy(value, szSetting, len);
diff --git a/plugins/Clist_modern/src/modern_gdiplus.cpp b/plugins/Clist_modern/src/modern_gdiplus.cpp
index c406c9383e..3110ea362e 100644
--- a/plugins/Clist_modern/src/modern_gdiplus.cpp
+++ b/plugins/Clist_modern/src/modern_gdiplus.cpp
@@ -12,7 +12,6 @@
using namespace Gdiplus;
-int mir_strlen(const char *a);
HBITMAP ske_CreateDIB32(int cx, int cy);
BYTE saved_alpha;
diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp
index ee7d62a203..804f7bab41 100644
--- a/plugins/Clist_modern/src/modern_skinselector.cpp
+++ b/plugins/Clist_modern/src/modern_skinselector.cpp
@@ -131,22 +131,6 @@ lph_top: //only 4 of 9 instructions in here don't use AL, so optimal pipe use i
#endif
}
-/*
-DWORD mod_CalcHash(const char * a)
-{
- DWORD Val = 0;
- BYTE N;
- DWORD k = mir_strlen(a);
- if (k < 23) N = (BYTE)k; else N = 23;
- while (N>0)
- {
- Val = Val << 1;
- Val ^= ((DWORD)*a++)-31;
- N--;
- }
- return Val;
-}
-*/
int AddModernMaskToList(MODERNMASK *mm, LISTMODERNMASK * mmTemplateList)
{
if (!mmTemplateList || !mm) return -1;
diff --git a/plugins/Clist_modern/src/modern_utils.cpp b/plugins/Clist_modern/src/modern_utils.cpp
index ff5825e67e..50856ca11f 100644
--- a/plugins/Clist_modern/src/modern_utils.cpp
+++ b/plugins/Clist_modern/src/modern_utils.cpp
@@ -60,12 +60,6 @@ int __cdecl mir_strcmp (const char *a, const char *b)
return (strcmp(a,b));
};
-int mir_strlen (const char *a)
-{
- if (a == NULL) return 0;
- return (int)(strlen(a));
-};
-
#define strlen(a) mir_strlen(a)
#define strcmp(a,b) mir_strcmp(a,b)
diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp
index 3f951be342..cf16976481 100644
--- a/plugins/MirandaG15/src/CContactList.cpp
+++ b/plugins/MirandaG15/src/CContactList.cpp
@@ -875,8 +875,6 @@ void CContactList::OnContactGroupChanged(MCONTACT hContact,tstring strGroup)
iter = pGroup->begin();
if((*iter)->GetType() == ITEM)
OnContactGroupChanged(GetContactData(*iter)->hHandle,_T(""));
- bool b = pGroup->empty();
- int i = pGroup->size();
Sleep(1);
}
}
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
index 6b3876988b..d1b2192697 100644
--- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
@@ -934,13 +934,12 @@ static int ProcessPopup(int reason, LPARAM lParam)
if (!db_get_b(NULL, MODULENAME, SETTING_PUCONNRETRY, TRUE))
return -1;
if (lParam) {
- int i;
PROTOCOLSETTINGEX **ps = (PROTOCOLSETTINGEX **)lParam;
TCHAR protoInfoLine[512], protoInfo[MAX_SECONDLINE];
memset(protoInfoLine, '\0', sizeof(protoInfoLine));
memset(protoInfo, '\0', sizeof(protoInfo));
_tcscpy(protoInfo, _T("\r\n"));
- for (i = 0; i < connectionSettings.getCount(); i++) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
if (_tcslen(ps[i]->tszAccName) > 0 && strlen(ps[i]->szName) > 0) {
if ( db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)) {
mir_sntprintf(protoInfoLine, SIZEOF(protoInfoLine), TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->tszAccName, pcli->pfnGetStatusModeDescription(ps[i]->status, GSMDF_TCHAR));
@@ -948,11 +947,9 @@ static int ProcessPopup(int reason, LPARAM lParam)
}
}
}
- i = _tcslen(protoInfo);
- if (i > 0) /* cut the last end of line (this may also be the first one ;)) */
- protoInfo[i - 2] = '\0';
hIcon = LoadSkinnedProtoIcon(ps[0]->szName, SKINICON_STATUS_OFFLINE);
+ rtrimt(protoInfo);
if (retryCount == (maxRetries - 1))
mir_sntprintf(text, SIZEOF(text), TranslateT("Resetting status... (last try (%d))%s"), retryCount + 1, protoInfo);
else
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp
index 602557707a..2969b61fd5 100644
--- a/plugins/UserInfoEx/src/classPsTreeItem.cpp
+++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp
@@ -215,7 +215,7 @@ BYTE CPsTreeItem::HasName(const LPCSTR pszName) const
void CPsTreeItem::Rename(const LPTSTR pszLabel)
{
if (pszLabel && *pszLabel) {
- LPTSTR pszDup = mir_tcsdup(pszLabel);
+ LPTSTR pszDup = mir_tstrdup(pszLabel);
if (pszDup) {
replaceStrT(_ptszLabel, pszDup);
// convert disallowed characters
@@ -257,7 +257,7 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue)
LPTSTR ptszLabel = mir_utf8decodeT(pszName);
if (ptszLabel) {
- _ptszLabel = mir_tcsdup(TranslateTS(ptszLabel));
+ _ptszLabel = mir_tstrdup(TranslateTS(ptszLabel));
mir_free(ptszLabel);
}
}
@@ -279,7 +279,7 @@ HICON CPsTreeItem::ProtoIcon()
if (!CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&ProtoCount, (LPARAM)&pa)) {
if (_pszName) {
for (int i = 0; i < ProtoCount; i++) {
- if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tcslen(pa[i]->tszAccountName))) {
+ if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tstrlen(pa[i]->tszAccountName))) {
CHAR szIconID[MAX_PATH];
mir_snprintf(szIconID, SIZEOF(szIconID), "core_status_%s1", pa[i]->szModuleName);
HICON hIco = Skin_GetIcon(szIconID);
@@ -416,7 +416,7 @@ int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp)
if (_dwFlags & ODPF_USERINFOTAB)
mir_sntprintf(szTitle, SIZEOF(szTitle), _T("%s\\%s"), odp->ptszTitle, odp->ptszTab);
else
- mir_tcscpy(szTitle, odp->ptszTitle);
+ mir_tstrcpy(szTitle, odp->ptszTitle);
}
// set the unique utf8 encoded name for the item
if (err = Name(szTitle, (_dwFlags & ODPF_UNICODE) == ODPF_UNICODE))
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp
index 9c527acf06..1bf0f67b00 100644
--- a/plugins/UserInfoEx/src/ctrl_contact.cpp
+++ b/plugins/UserInfoEx/src/ctrl_contact.cpp
@@ -942,7 +942,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
cbex->pItems[cbex->numItems].dwID = (pItem->wMask & CBEXIM_ID) ? pItem->dwID : 0;
// set category string
- if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tcsncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) {
+ if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tstrncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) {
mir_sntprintf(cbex->pItems[cbex->numItems].szCat, MAX_CAT, _T("%s %d"), TranslateT("Other"), ++cbex->numOther);
}
@@ -982,7 +982,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
// set new category string
if (pItem->wMask & CBEXIM_CAT) {
// set category string
- if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tcsncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, SIZEOF(cbex->pItems[pItem->iItem].szCat)))
+ if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tstrncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, SIZEOF(cbex->pItems[pItem->iItem].szCat)))
mir_sntprintf(cbex->pItems[pItem->iItem].szCat, MAX_CAT, _T("%s %d\0"), TranslateT("Other"), ++cbex->numOther);
if (pItem->iItem == cbex->iSelectedItem)
SetWindowText(cbex->hBtnEdit, cbex->pItems[pItem->iItem].szCat);
@@ -1046,14 +1046,14 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
// return category string
if ((pItem->wMask & CBEXIM_CAT) && pItem->pszCat) {
if (*cbex->pItems[pItem->iItem].szCat != 0)
- mir_tcsncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1);
+ mir_tstrncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1);
else
*pItem->pszCat = 0;
}
// return value string
if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal) {
if (cbex->pItems[pItem->iItem].pszVal)
- mir_tcsncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1);
+ mir_tstrncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1);
else
*pItem->pszVal = 0;
}
@@ -1428,7 +1428,7 @@ int CtrlContactWriteItemToDB(
db_unset(hContact, pszModule, pszSetting);
else {
if (cbi.wFlags & CBEXIF_SMS)
- mir_tcsncat(szVal, _T(" SMS"), SIZEOF(szVal));
+ mir_tstrncat(szVal, _T(" SMS"), SIZEOF(szVal));
if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1;
}
@@ -1478,7 +1478,7 @@ int CtrlContactWriteMyItemsToDB(
while (CtrlContactWndProc(hCtrl, CBEXM_GETITEM, NULL, (LPARAM)&cbi) && cbi.iItem < 50) {
if (!(cbi.wFlags & CBEXIF_DELETED) && *szVal) {
if (cbi.wFlags & CBEXIF_SMS) {
- mir_tcsncat(szVal, _T(" SMS"), SIZEOF(szVal));
+ mir_tstrncat(szVal, _T(" SMS"), SIZEOF(szVal));
}
mir_snprintf(pszSetting, MAXSETTING, szFormatCat, i);
if (*szCat && _tcsncmp(szCat, pszOther, ccOther)) {
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp
index 71e5f5e0de..cf9511b7f1 100644
--- a/plugins/UserInfoEx/src/ctrl_edit.cpp
+++ b/plugins/UserInfoEx/src/ctrl_edit.cpp
@@ -124,19 +124,19 @@ BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto)
case DBVT_BYTE:
_itot_s(dbv.bVal, szText, SIZEOF(szText), 10);
SetWindowText(_hwnd, szText);
- _pszValue = mir_tcsdup(szText);
+ _pszValue = mir_tstrdup(szText);
break;
case DBVT_WORD:
_itot_s(dbv.wVal, szText, SIZEOF(szText), 10);
SetWindowText(_hwnd, szText);
- _pszValue = mir_tcsdup(szText);
+ _pszValue = mir_tstrdup(szText);
break;
case DBVT_DWORD:
_itot_s(dbv.dVal, szText, SIZEOF(szText), 10);
SetWindowText(_hwnd, szText);
- _pszValue = mir_tcsdup(szText);
+ _pszValue = mir_tstrdup(szText);
break;
case DBVT_TCHAR:
@@ -250,7 +250,7 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg)
{
const int cch = GetWindowTextLength(_hwnd);
- _Flags.B.hasChanged = mir_tcslen(_pszValue) != cch;
+ _Flags.B.hasChanged = mir_tstrlen(_pszValue) != cch;
_Flags.B.hasCustom = (cch > 0);
if (!_Flags.B.hasChanged && _Flags.B.hasCustom) {
diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp
index 9b4ffac422..ab1fc0064c 100644
--- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp
+++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp
@@ -290,6 +290,6 @@ void CTzCombo::GetTime(LPTSTR szTime, WORD cchTime)
now.UTCToTzSpecificLocal(&tzi);
now.TimeFormat(szTime, cchTime);
}
- else mir_tcscpy(szTime, _T("--:--"));
+ else mir_tstrcpy(szTime, _T("--:--"));
}
}
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp
index 9635a2cb70..feb3ff0beb 100644
--- a/plugins/UserInfoEx/src/dlg_msgbox.cpp
+++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp
@@ -476,8 +476,8 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
pd.lchContact = NULL; //(HANDLE)wParam;
// icon
pd.lchIcon = MsgLoadIcon(pMsgBox);
- mir_tcsncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
- mir_tcsncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
+ mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
+ mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
// CALLBAC Proc
pd.PluginWindowProc = PopupProc;
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp
index 6eccd83b4e..326d610276 100644
--- a/plugins/UserInfoEx/src/dlg_propsheet.cpp
+++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp
@@ -443,56 +443,56 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt
odp.position = 0x8000000;
odp.pfnDlgProc = PSPProcGeneral;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_GENERAL);
- mir_tcsncpy(szTitle + ofs, LPGENT("General"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS);
odp.position = 0x8000001;
odp.pfnDlgProc = PSPProcContactHome;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS);
- mir_tcsncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Contact (private)"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Contact (private)"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ORIGIN);
odp.position = 0x8000002;
odp.pfnDlgProc = PSPProcOrigin;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADVANCED);
- mir_tcsncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Origin"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Origin"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ANNIVERSARY);
odp.position = 0x8000003;
odp.pfnDlgProc = PSPProcAnniversary;
odp.hIcon = (HICON)ICONINDEX(IDI_BIRTHDAY);
- mir_tcsncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Anniversaries"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Anniversaries"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COMPANY);
odp.position = 0x8000004;
odp.pfnDlgProc = PSPProcCompany;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_COMPANY);
- mir_tcsncpy(szTitle + ofs, LPGENT("Work"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("Work"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS);
odp.position = 0x8000005;
odp.pfnDlgProc = PSPProcContactWork;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS);
- mir_tcsncpy(szTitle + ofs, LPGENT("Work") _T("\\") LPGENT("Contact (work)"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("Work") _T("\\") LPGENT("Contact (work)"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT);
odp.position = 0x8000006;
odp.pfnDlgProc = PSPProcAbout;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ABOUT);
- mir_tcsncpy(szTitle + ofs, LPGENT("About"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("About"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_PROFILE);
odp.position = 0x8000007;
odp.pfnDlgProc = PSPProcContactProfile;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_PROFILE);
- mir_tcsncpy(szTitle + ofs, LPGENT("About") _T("\\") LPGENT("Profile"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("About") _T("\\") LPGENT("Profile"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
return 0;
}
@@ -745,7 +745,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
GetObject(hNormalFont, sizeof(lf), &lf);
lf.lfHeight = 22;
- mir_tcscpy(lf.lfFaceName, _T("Segoe UI"));
+ mir_tstrcpy(lf.lfFaceName, _T("Segoe UI"));
pPs->hCaptionFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)pPs->hCaptionFont, 0);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index f26e726efe..0e294afdfe 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -306,7 +306,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
case EXIM_GROUP:
break;
case EXIM_SUBGROUP:
- if (mir_tcsncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tcslen(pDat->ExImContact->ptszName))) {
+ if (mir_tcsncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(pDat->ExImContact->ptszName))) {
continue;
}
break;
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
index 0d59af26ec..3b52fc4062 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp
@@ -116,7 +116,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara
case 41063:
ZeroMemory(szBtnText, sizeof(szBtnText));
- mir_tcsncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText));
+ mir_tstrncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText));
iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)szBtnText);
if (iString != -1) tbb->iString = iString;
// set tooltip
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
index 0f27390c84..d2d946001e 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
@@ -159,7 +159,7 @@ size_t CLineBuffer::operator + (const CHAR *szVal)
size_t CLineBuffer::operator + (const WCHAR *wszVal)
{
if (wszVal) {
- size_t cbLength = mir_wcslen(wszVal);
+ size_t cbLength = mir_wstrlen(wszVal);
CHAR* szVal = mir_u2a(wszVal);
if (szVal) {
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
index ed8c032472..12cfcf2a1f 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
@@ -168,7 +168,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)
// dont export meta subcontacts by default and
// export only contact with selectet group name
if (!db_mc_isSub(hContact) &&
- mir_tcsncmp(ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tcslen(ExImContact->ptszName))== 0)
+ mir_tcsncmp(ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(ExImContact->ptszName))== 0)
{
if (vContact.fromDB(hContact)) {
vContact.Export(xmlfile, &Modules);
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index f91969d216..e0a577d7b8 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -525,19 +525,19 @@ BYTE dbv2String(DBVARIANT* dbv, const BYTE destType)
// source value is of type "byte"
case DBVT_BYTE:
_ultow(dbv->bVal, buf, 10);
- dbv->pwszVal = mir_wcsdup(buf);
+ dbv->pwszVal = mir_wstrdup(buf);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
break;
// source value is of type "word"
case DBVT_WORD:
_ultow(dbv->wVal, buf, 10);
- dbv->pwszVal = mir_wcsdup(buf);
+ dbv->pwszVal = mir_wstrdup(buf);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
break;
// source value is of type "dword"
case DBVT_DWORD:
_ultow(dbv->dVal, buf, 10);
- dbv->pwszVal = mir_wcsdup(buf);
+ dbv->pwszVal = mir_wstrdup(buf);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
break;
// source value is of any string type
diff --git a/plugins/UserInfoEx/src/mir_string.cpp b/plugins/UserInfoEx/src/mir_string.cpp
index 778165cbc3..0bfa1925d6 100644
--- a/plugins/UserInfoEx/src/mir_string.cpp
+++ b/plugins/UserInfoEx/src/mir_string.cpp
@@ -21,42 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "commonheaders.h"
-char *mir_strncpy(char *pszDest, const char *pszSrc, const size_t cchDest)
-{
- if (!pszDest || !pszSrc || !cchDest)
- return NULL;
- pszDest = strncpy(pszDest, pszSrc, cchDest-1);
- pszDest[cchDest-1] = 0;
- return pszDest;
-}
-
-wchar_t *mir_wcsncpy(wchar_t *pszDest, const wchar_t *pszSrc, const size_t cchDest)
-{
- if (!pszDest || !pszSrc || !cchDest)
- return NULL;
- pszDest = wcsncpy(pszDest, pszSrc, cchDest-1);
- pszDest[cchDest-1] = 0;
- return pszDest;
-}
-
-char *mir_strncat(char *pszDest, const char *pszSrc, const size_t cchDest)
-{
- if (!pszDest || !pszSrc || !cchDest)
- return NULL;
- strncat(pszDest, pszSrc, cchDest-1);
- pszDest[cchDest-1] = 0;
- return pszDest;
-}
-
-wchar_t *mir_wcsncat(wchar_t *pszDest, const wchar_t *pszSrc, const size_t cchDest)
-{
- if (!pszDest || !pszSrc || !cchDest)
- return NULL;
- pszDest = wcsncat(pszDest, pszSrc, cchDest-1);
- pszDest[cchDest-1] = 0;
- return pszDest;
-}
-
char *mir_strncat_c(char *pszDest, const char cSrc)
{
char *pszRet;
diff --git a/plugins/UserInfoEx/src/mir_string.h b/plugins/UserInfoEx/src/mir_string.h
index 3282e767e2..9e075820be 100644
--- a/plugins/UserInfoEx/src/mir_string.h
+++ b/plugins/UserInfoEx/src/mir_string.h
@@ -22,27 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _MIR_STRING_H_INCLUDED_
#define _MIR_STRING_H_INCLUDED_
-#define mir_wcsdup mir_wstrdup
+#define mir_tcscmp mir_wcscmp
+#define mir_tcsncmp mir_wcsncmp
+#define mir_tcsicmp mir_wcsicmp
+#define mir_tcsnicmp mir_wcsnicmp
+#define mir_tcschr mir_wcschr
+#define mir_tcsrchr mir_wcsrchr
+#define mir_tcsncat_c mir_wcsncat_c
+#define mir_IsEmpty mir_IsEmptyW
-
- #define mir_tcslen mir_wcslen
- #define mir_tcscpy mir_wcscpy
- #define mir_tcsncpy mir_wcsncpy
- #define mir_tcsncat mir_wcsncat
- #define mir_tcsdup mir_wcsdup
- #define mir_tcscmp mir_wcscmp
- #define mir_tcsncmp mir_wcsncmp
- #define mir_tcsicmp mir_wcsicmp
- #define mir_tcsnicmp mir_wcsnicmp
- #define mir_tcschr mir_wcschr
- #define mir_tcsrchr mir_wcsrchr
- #define mir_tcsncat_c mir_wcsncat_c
- #define mir_IsEmpty mir_IsEmptyW
-
-
-
-#define mir_strlen(s) (((s)!=0)?strlen(s):0)
-#define mir_strcpy(d,s) (((s)!=0&&(d)!=0)?strcpy(d,s):0)
#define mir_strcmp(s1,s2) ((s1)==0||(s2)==0||strcmp((s1),(s2)))
#define mir_strncmp(s1,s2,n) ((s1)==0||(s2)==0||strncmp((s1),(s2),(n)))
#define mir_stricmp(s1,s2) ((s1)==0||(s2)==0||_stricmp((s1),(s2)))
@@ -50,8 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define mir_strchr(s,c) (((s)!=0)?strchr((s),(c)):0)
#define mir_strrchr(s,c) (((s)!=0)?strrchr((s),(c)):0)
-#define mir_wcslen(s) (((s)!=0)?wcslen(s):0)
-#define mir_wcscpy(d,s) (((s)!=0&&(d)!=0)?wcscpy(d,s):0)
#define mir_wcscmp(s1,s2) ((s1)==0||(s2)==0||wcscmp((s1),(s2)))
#define mir_wcsncmp(s1,s2,n) ((s1)==0||(s2)==0||wcsncmp((s1),(s2),(n)))
#define mir_wcsicmp(s1,s2) ((s1)==0||(s2)==0||_wcsicmp((s1),(s2)))
@@ -59,18 +45,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define mir_wcschr(s,c) (((s)!=0)?wcschr((s),(c)):0)
#define mir_wcsrchr(s,c) (((s)!=0)?wcsrchr((s),(c)):0)
-char * mir_strncpy(char *pszDest, const char *pszSrc, const size_t cchDest);
-wchar_t * mir_wcsncpy(wchar_t *pszDest, const wchar_t *pszSrc, const size_t cchDest);
-
-char * mir_strncat(char *pszDest, const char *pszSrc, const size_t cchDest);
-wchar_t * mir_wcsncat(wchar_t *pszDest, const wchar_t *pszSrc, const size_t cchDest);
-
-char * mir_strncat_c(char *pszDest, const char cSrc);
-char * mir_wcsncat_c(char *pszDest, const char cSrc);
+char* mir_strncat_c(char *pszDest, const char cSrc);
+char* mir_wcsncat_c(char *pszDest, const char cSrc);
-char * mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo);
+char* mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo);
-int mir_IsEmptyA(char *str);
-int mir_IsEmptyW(wchar_t *str);
+int mir_IsEmptyA(char *str);
+int mir_IsEmptyW(wchar_t *str);
#endif /* _MIR_STRING_H_INCLUDED_ */ \ No newline at end of file
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index 10c1bb257d..f779891127 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -893,10 +893,10 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
{
POPUPDATAT ppd = { 0 };
ppd.iSeconds = (int)db_get_b(NULL, MODNAME, SET_POPUP_DELAY, 0);
- mir_tcsncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
// Birthday
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
ppd.lchIcon = Skin_GetIcon(ICO_RMD_DTB0);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -909,7 +909,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
PUAddPopupT(&ppd);
// Anniversary
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
ppd.lchIcon = Skin_GetIcon(ICO_RMD_DTAX);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp
index 92ccdf4050..f0faf6faaa 100644
--- a/plugins/UserInfoEx/src/svc_contactinfo.cpp
+++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp
@@ -233,8 +233,8 @@ static FORCEINLINE INT_PTR GCIFirstLast(CONTACTINFO *ci)
if (type == DBVT_WCHAR) {
// both firstname and lastname are valid
if (dbvf.type == DBVT_WCHAR && dbvl.type == DBVT_WCHAR) {
- cbf = mir_wcslen(dbvf.pwszVal);
- cbl = mir_wcslen(dbvl.pwszVal);
+ cbf = mir_wstrlen(dbvf.pwszVal);
+ cbl = mir_wstrlen(dbvl.pwszVal);
ci->pszVal = (LPTSTR) mir_alloc((cbf + cbl + 2) * sizeof(WCHAR));
if (ci->pszVal)
@@ -549,7 +549,7 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam)
if (ci->dwFlag & CNF_UNICODE) {
WCHAR wszDate[80];
if (GetDateFormatW(LOCALE_USER_DEFAULT, wParam == 1 ? DATE_LONGDATE : DATE_SHORTDATE, &st, NULL, wszDate, SIZEOF(wszDate)))
- ci->pszVal = (LPTSTR)mir_wcsdup(wszDate);
+ ci->pszVal = (LPTSTR)mir_wstrdup(wszDate);
}
else {
CHAR szDate[80];
@@ -674,7 +674,7 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam)
default: // unknown contact
if (ci->dwFlag & CNF_UNICODE)
- ci->pszVal = (LPTSTR)mir_wcsdup(TranslateW(L"'(Unknown Contact)'"));
+ ci->pszVal = (LPTSTR)mir_wstrdup(TranslateW(L"'(Unknown Contact)'"));
else
ci->pszVal = (LPTSTR)mir_strdup(Translate("'(Unknown Contact)'"));
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp
index 3fbbd3d2f9..dd3246d2b7 100644
--- a/plugins/UserInfoEx/src/svc_refreshci.cpp
+++ b/plugins/UserInfoEx/src/svc_refreshci.cpp
@@ -143,7 +143,7 @@ public:
{
if (szText)
{
- INT_PTR cch = mir_tcslen(szText);
+ INT_PTR cch = mir_tstrlen(szText);
LPTSTR fmt = (LPTSTR) mir_alloc((cch + 1) * sizeof(TCHAR));
if (fmt)
@@ -352,12 +352,12 @@ class CPopupUpdProgress : public CUpdProgress
{
if (_szText)
{
- INT_PTR cb = mir_tcslen(_szText) + 8;
+ INT_PTR cb = mir_tstrlen(_szText) + 8;
LPTSTR pb = (LPTSTR) mir_alloc(cb * sizeof(TCHAR));
if (pb)
{
- mir_tcscpy(pb, _szText);
+ mir_tstrcpy(pb, _szText);
SendMessage(_hWnd, UM_CHANGEPOPUP, CPT_TITLET, (LPARAM) pb);
}
@@ -431,8 +431,8 @@ public:
pd.lpActions = _popupButtons;
// dummy text
- _szText = mir_tcsdup(szTitle);
- mir_tcscpy(pd.lptzContactName, _szText);
+ _szText = mir_tstrdup(szTitle);
+ mir_tstrcpy(pd.lptzContactName, _szText);
_tcscpy(pd.lptzText, _T(" "));
@@ -462,7 +462,7 @@ public:
virtual void SetTitle(LPCTSTR szText)
{
MIR_FREE(_szText);
- _szText = mir_tcsdup(szText);
+ _szText = mir_tstrdup(szText);
UpdateText();
}
@@ -472,7 +472,7 @@ public:
**/
virtual void SetText(LPCTSTR szText)
{
- SendMessage(_hWnd, UM_CHANGEPOPUP, CPT_TEXTT, (LPARAM) mir_tcsdup(szText));
+ SendMessage(_hWnd, UM_CHANGEPOPUP, CPT_TEXTT, (LPARAM) mir_tstrdup(szText));
}
};
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index 59420bba5c..6e0acf4ff6 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -258,9 +258,9 @@ static int NotifyWithPopup(MCONTACT hContact, CEvent::EType eventType, int DaysT
mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName),
_T("%s - %s"), TranslateTS(pszDesc), DB::Contact::DisplayName(hContact));
}
- else mir_tcsncpy(ppd.lptzContactName, TranslateT("Reminder"), SIZEOF(ppd.lptzContactName));
+ else mir_tstrncpy(ppd.lptzContactName, TranslateT("Reminder"), SIZEOF(ppd.lptzContactName));
- mir_tcsncpy(ppd.lptzText, pszMsg, MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzText, pszMsg, MAX_SECONDLINE);
ppd.lchIcon = GetAnnivIcon(CEvent(eventType, DaysToAnniv));
@@ -412,7 +412,7 @@ static BYTE CheckAnniversaries(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE
mir_sntprintf(szAnniv, MAX_PATH,
TranslateT("%s has the following anniversaries:\0"),
ContactGender(hContact));
- mir_tcsncpy(strMsg, szAnniv, mir_tcslen(szAnniv));
+ mir_tstrncpy(strMsg, szAnniv, mir_tstrlen(szAnniv));
}
switch (Diff) {
@@ -426,19 +426,19 @@ static BYTE CheckAnniversaries(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE
mir_sntprintf(szAnniv, MAX_PATH, TranslateT("%d. %s in %d days\0"), mta.Age() + 1, mta.Description(), Diff);
}
- if (mir_tcslen(szAnniv) >= MAX_SECONDLINE - mir_tcslen(strMsg)) {
+ if (mir_tstrlen(szAnniv) >= MAX_SECONDLINE - mir_tstrlen(strMsg)) {
if (strMsg)
- mir_tcsncat(strMsg, _T("\n...\0"), SIZEOF(strMsg));
+ mir_tstrncat(strMsg, _T("\n...\0"), SIZEOF(strMsg));
else
- mir_tcsncpy(strMsg, _T("\n...\0"), mir_tcslen(_T("\n...\0")));
+ mir_tstrncpy(strMsg, _T("\n...\0"), mir_tstrlen(_T("\n...\0")));
bOverflow = TRUE;
}
else {
if (strMsg)
- mir_tcsncat(strMsg, _T("\n- \0"), SIZEOF(strMsg));
+ mir_tstrncat(strMsg, _T("\n- \0"), SIZEOF(strMsg));
else
- mir_tcsncpy(strMsg, _T("\n- \0"), mir_tcslen(_T("\n- \0")));
- mir_tcsncat(strMsg, szAnniv, SIZEOF(strMsg));
+ mir_tstrncpy(strMsg, _T("\n- \0"), mir_tstrlen(_T("\n- \0")));
+ mir_tstrncat(strMsg, szAnniv, SIZEOF(strMsg));
}
}
}
diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp
index 6eb85542aa..a5052f2b3d 100644
--- a/plugins/UserInfoEx/src/svc_timezone_old.cpp
+++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp
@@ -201,8 +201,8 @@ public:
pTimeZone->dwIndex = TZINDEX_UNSPECIFIED;
if (result == ERROR_SUCCESS) {
- pTimeZone->ptszName = mir_tcsdup(szName);
- pTimeZone->ptszDisplay = mir_tcsdup(szDisplay);
+ pTimeZone->ptszName = mir_tstrdup(szName);
+ pTimeZone->ptszDisplay = mir_tstrdup(szDisplay);
result = (insert(pTimeZone) == ERROR_SUCCESS);
}
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index cf18d01709..b0b369f320 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -266,3 +266,13 @@ PathIsAbsolute @263
PathIsAbsoluteW @264
db_mc_notifyDefChange @265
db_mc_tryMeta @266
+mir_strlen @267
+mir_wstrlen @268
+mir_strcpy @269
+mir_wstrcpy @270
+mir_strncpy @271
+mir_wstrncpy @272
+mir_strcat @273
+mir_wstrcat @274
+mir_strncat @275
+mir_wstrncat @276
diff --git a/src/mir_core/utils.cpp b/src/mir_core/utils.cpp
index 69ad5de18e..28d48f7f33 100644
--- a/src/mir_core/utils.cpp
+++ b/src/mir_core/utils.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "commonheaders.h"
-MIR_CORE_DLL(char*) replaceStr( char* &dest, const char *src)
+MIR_CORE_DLL(char*) replaceStr(char* &dest, const char *src)
{
if (dest != NULL)
mir_free(dest);
@@ -32,7 +32,7 @@ MIR_CORE_DLL(char*) replaceStr( char* &dest, const char *src)
return dest = (src != NULL) ? mir_strdup(src) : NULL;
}
-MIR_CORE_DLL(WCHAR*) replaceStrW( WCHAR* &dest, const WCHAR *src)
+MIR_CORE_DLL(WCHAR*) replaceStrW(WCHAR* &dest, const WCHAR *src)
{
if (dest != NULL)
mir_free(dest);
@@ -175,7 +175,7 @@ MIR_CORE_DLL(int) wildcmpw(const WCHAR *name, const WCHAR *mask)
}
if (*mask != '*') return FALSE;
for (;; mask++, name++) {
- while(*mask == '*') {
+ while (*mask == '*') {
last = mask++;
if (*mask == '\0') return ((BOOL)!*mask); /* true */
}
@@ -198,12 +198,12 @@ MIR_CORE_DLL(int) wildcmpi(const char *name, const char *mask)
}
if (*mask != '*') return FALSE;
for (;; mask++, name++) {
- while(*mask == '*') {
+ while (*mask == '*') {
last = mask++;
if (*mask == '\0') return ((BOOL)!*mask); /* true */
}
if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */
- if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last;
+ if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last;
}
}
@@ -219,12 +219,12 @@ MIR_CORE_DLL(int) wildcmpiw(const WCHAR *name, const WCHAR *mask)
}
if (*mask != '*') return FALSE;
for (;; mask++, name++) {
- while(*mask == '*') {
+ while (*mask == '*') {
last = mask++;
if (*mask == '\0') return ((BOOL)!*mask); /* true */
}
if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */
- if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last;
+ if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last;
}
}
@@ -237,7 +237,7 @@ MIR_CORE_DLL(char*) bin2hex(const void *pData, size_t len, char *dest)
const BYTE *p = (const BYTE*)pData;
char *d = dest;
- for (size_t i=0; i < len; i++, p++) {
+ for (size_t i = 0; i < len; i++, p++) {
*d++ = szHexTable[*p >> 4];
*d++ = szHexTable[*p & 0x0F];
}
@@ -251,7 +251,7 @@ MIR_CORE_DLL(WCHAR*) bin2hexW(const void *pData, size_t len, WCHAR *dest)
const BYTE *p = (const BYTE*)pData;
WCHAR *d = dest;
- for (size_t i=0; i < len; i++, p++) {
+ for (size_t i = 0; i < len; i++, p++) {
*d++ = szHexTable[*p >> 4];
*d++ = szHexTable[*p & 0x0F];
}
@@ -259,3 +259,121 @@ MIR_CORE_DLL(WCHAR*) bin2hexW(const void *pData, size_t len, WCHAR *dest)
return dest;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+#pragma intrinsic(strlen, strcpy, strcat, wcslen, wcscpy, wcscat)
+
+MIR_CORE_DLL(size_t) mir_strlen(const char *p)
+{
+ return (p) ? strlen(p) : 0;
+}
+
+MIR_CORE_DLL(size_t) mir_wstrlen(const wchar_t *p)
+{
+ return (p) ? wcslen(p) : 0;
+}
+
+MIR_CORE_DLL(char*) mir_strcpy(char *dest, const char *src)
+{
+ if (dest == NULL)
+ return NULL;
+
+ if (src == NULL) {
+ *dest = 0;
+ return dest;
+ }
+
+ return strcpy(dest, src);
+}
+
+MIR_CORE_DLL(wchar_t*) mir_wstrcpy(wchar_t *dest, const wchar_t *src)
+{
+ if (dest == NULL)
+ return NULL;
+
+ if (src == NULL) {
+ *dest = 0;
+ return dest;
+ }
+
+ return wcscpy(dest, src);
+}
+
+MIR_CORE_DLL(char*) mir_strncpy(char *dest, const char *src, size_t len)
+{
+ if (dest == NULL)
+ return NULL;
+
+ if (src == NULL) {
+ *dest = 0;
+ return dest;
+ }
+
+ return strncpy(dest, src, len);
+}
+
+MIR_CORE_DLL(wchar_t*) mir_wstrncpy(wchar_t *dest, const wchar_t *src, size_t len)
+{
+ if (dest == NULL)
+ return NULL;
+
+ if (src == NULL) {
+ *dest = 0;
+ return dest;
+ }
+
+ return wcsncpy(dest, src, len);
+}
+
+MIR_CORE_DLL(char*) mir_strcat(char *dest, const char *src)
+{
+ if (dest == NULL)
+ return NULL;
+
+ if (src == NULL) {
+ *dest = 0;
+ return dest;
+ }
+
+ return strcat(dest, src);
+}
+
+MIR_CORE_DLL(wchar_t*) mir_wstrcat(wchar_t *dest, const wchar_t *src)
+{
+ if (dest == NULL)
+ return NULL;
+
+ if (src == NULL) {
+ *dest = 0;
+ return dest;
+ }
+
+ return wcscat(dest, src);
+}
+
+MIR_CORE_DLL(char*) mir_strncat(char *dest, const char *src, size_t len)
+{
+ if (dest == NULL)
+ return NULL;
+
+ if (src == NULL) {
+ *dest = 0;
+ return dest;
+ }
+
+ return strncat(dest, src, len);
+}
+
+MIR_CORE_DLL(wchar_t*) mir_wstrncat(wchar_t *dest, const wchar_t *src, size_t len)
+{
+ if (dest == NULL)
+ return NULL;
+
+ if (src == NULL) {
+ *dest = 0;
+ return dest;
+ }
+
+ return wcsncat(dest, src, len);
+}