summaryrefslogtreecommitdiff
path: root/include/m_utils.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-21 22:00:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-21 22:00:16 +0000
commitb81ce648978e75bc7db4cc3b8aa7d1b9fcb9239b (patch)
treede3eb9058f630682a355ac5135b2efb60256b4ca /include/m_utils.h
parentff758bb8a00f34eb77fd385b18afea24388a915f (diff)
MS_UTILS_REPLACEVARS -> Utils_ReplaceVars
git-svn-id: http://svn.miranda-ng.org/main/trunk@14316 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include/m_utils.h')
-rw-r--r--include/m_utils.h58
1 files changed, 14 insertions, 44 deletions
diff --git a/include/m_utils.h b/include/m_utils.h
index 96e7cbe783..02e7d994d3 100644
--- a/include/m_utils.h
+++ b/include/m_utils.h
@@ -356,47 +356,15 @@ EXTERN_C MIR_CORE_DLL(void) Utils_GetRandom(void *pszDest, size_t cbLen);
// %destkop% -> location of the desktop folder in a user's profile.
// %mydocuments% -> location of the "My Documents" shell folder.
-typedef struct
+struct REPLACEVARSARRAY
{
- union
- {
- TCHAR *lptzKey;
- char *lpszKey;
- WCHAR *lpwzKey;
- };
- union
- {
- TCHAR *lptzValue;
- char *lpszValue;
- WCHAR *lpwzValue;
- };
-} REPLACEVARSARRAY;
-
-typedef struct
-{
- int cbSize;
- DWORD dwFlags;
- MCONTACT hContact;
- REPLACEVARSARRAY *variables;
-} REPLACEVARSDATA;
-
-#define RVF_UNICODE 1
-#ifdef _UNICODE
- #define RVF_TCHAR RVF_UNICODE
-#else
- #define RVF_TCHAR 0
-#endif
+ MAllStrings key, value;
+};
-#define MS_UTILS_REPLACEVARS "Utils/ReplaceVars"
+EXTERN_C MIR_APP_DLL(char*) Utils_ReplaceVars(const char *szData, MCONTACT hContact = 0, REPLACEVARSARRAY *vars = NULL);
+EXTERN_C MIR_APP_DLL(wchar_t*) Utils_ReplaceVarsW(const wchar_t *szData, MCONTACT hContact = 0, REPLACEVARSARRAY *vars = NULL);
-__forceinline char* Utils_ReplaceVars(const char *szData) {
- REPLACEVARSDATA dat = { sizeof(dat) };
- return (char*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)szData, (LPARAM)&dat);
-}
-__forceinline TCHAR* Utils_ReplaceVarsT(const TCHAR *szData) {
- REPLACEVARSDATA dat = { sizeof(dat), RVF_TCHAR };
- return (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)szData, (LPARAM)&dat);
-}
+#define Utils_ReplaceVarsT Utils_ReplaceVarsW
#if defined(__cplusplus)
#if !defined(M_SYSTEM_CPP_H__)
@@ -406,16 +374,18 @@ __forceinline TCHAR* Utils_ReplaceVarsT(const TCHAR *szData) {
struct VARS : public ptrA
{
__forceinline VARS(const char *str) :
- ptrA( Utils_ReplaceVars(str))
- {}
+ ptrA(Utils_ReplaceVars(str))
+ {}
};
- struct VARST : public ptrT
+ struct VARSW : public ptrW
{
- __forceinline VARST(const TCHAR *str) :
- ptrT( Utils_ReplaceVarsT(str))
- {}
+ __forceinline VARSW(const wchar_t *str) :
+ ptrW(Utils_ReplaceVarsW(str))
+ {}
};
+
+ typedef VARSW VARST;
#endif
/////////////////////////////////////////////////////////////////////////////////////////