diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/m_system_cpp.h | 2 | ||||
-rw-r--r-- | include/m_utils.h | 28 |
2 files changed, 25 insertions, 5 deletions
diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h index 67b5a243d5..2cb5a5af5e 100644 --- a/include/m_system_cpp.h +++ b/include/m_system_cpp.h @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_SYSTEM_CPP_H__
#define M_SYSTEM_CPP_H__ 1
+#include <stdlib.h>
+
#include "m_system.h"
#if defined(_UNICODE)
diff --git a/include/m_utils.h b/include/m_utils.h index 64d0e2a2e3..bd9f21d887 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -414,16 +414,34 @@ typedef struct #define MS_UTILS_REPLACEVARS "Utils/ReplaceVars"
__forceinline char* Utils_ReplaceVars(const char *szData) {
- REPLACEVARSDATA dat = {0};
- dat.cbSize = sizeof(dat);
+ REPLACEVARSDATA dat = { sizeof(dat) };
return (char*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)szData, (LPARAM)&dat);
}
__forceinline TCHAR* Utils_ReplaceVarsT(const TCHAR *szData) {
- REPLACEVARSDATA dat = {0};
- dat.cbSize = sizeof(dat);
- dat.dwFlags = RVF_TCHAR;
+ REPLACEVARSDATA dat = { sizeof(dat), RVF_TCHAR };
return (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)szData, (LPARAM)&dat);
}
+
+#if defined(__cplusplus)
+ #if !defined(M_SYSTEM_CPP_H__)
+ #include "m_system_cpp.h"
+ #endif
+
+ struct VARS : public mir_ptr<char>
+ {
+ __forceinline VARS(const char *str) :
+ mir_ptr<char>( Utils_ReplaceVars(str))
+ {}
+ };
+
+ struct VARST : public mir_ptr<TCHAR>
+ {
+ __forceinline VARST(const TCHAR *str) :
+ mir_ptr<TCHAR>( Utils_ReplaceVarsT(str))
+ {}
+ };
+#endif
+
#ifdef _UNICODE
#define MS_UTILS_PATHTORELATIVEW "Utils/PathToRelativeW"
#define MS_UTILS_PATHTOABSOLUTEW "Utils/PathToAbsoluteW"
|