diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/m_core.h | 20 | ||||
-rw-r--r-- | include/m_string.h | 20 |
2 files changed, 22 insertions, 18 deletions
diff --git a/include/m_core.h b/include/m_core.h index 65a24c3eab..b75cd0c700 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -25,6 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_CORE_H__
#define M_CORE_H__ 1
+#ifdef _MSC_VER
+ #include <sal.h>
+#endif
+
#include <stdint.h>
#include <stdlib.h>
@@ -300,10 +304,10 @@ MIR_CORE_DLL(wchar_t*) mir_wstrndup(const wchar_t *str, size_t len); ///////////////////////////////////////////////////////////////////////////////
// print functions
-MIR_CORE_DLL(int) mir_snprintf(char *buffer, size_t count, const char* 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_t *buffer, size_t count, const wchar_t* fmt, va_list va);
+MIR_CORE_DLL(int) mir_snprintf(char *buffer, size_t count, _Printf_format_string_ const char* fmt, ...);
+MIR_CORE_DLL(int) mir_snwprintf(wchar_t *buffer, size_t count, _Printf_format_string_ const wchar_t* fmt, ...);
+MIR_CORE_DLL(int) mir_vsnprintf(char *buffer, size_t count, _Printf_format_string_ const char* fmt, va_list va);
+MIR_CORE_DLL(int) mir_vsnwprintf(wchar_t *buffer, size_t count, _Printf_format_string_ const wchar_t* fmt, va_list va);
///////////////////////////////////////////////////////////////////////////////
// protocol functions
@@ -531,7 +535,7 @@ HANDLE mir_forkThread(void(__cdecl *pFunc)(T* param), T *arg) }
template <size_t _Size>
-inline int mir_snprintf(char(&buffer)[_Size], const char* fmt, ...)
+inline int mir_snprintf(char(&buffer)[_Size], _Printf_format_string_ const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -541,7 +545,7 @@ inline int mir_snprintf(char(&buffer)[_Size], const char* fmt, ...) }
template <size_t _Size>
-inline int mir_snwprintf(wchar_t(&buffer)[_Size], const wchar_t* fmt, ...)
+inline int mir_snwprintf(wchar_t(&buffer)[_Size], _Printf_format_string_ const wchar_t* fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -551,13 +555,13 @@ inline int mir_snwprintf(wchar_t(&buffer)[_Size], const wchar_t* fmt, ...) }
template <size_t _Size>
-inline int mir_vsnprintf(char(&buffer)[_Size], const char* fmt, va_list va)
+inline int mir_vsnprintf(char(&buffer)[_Size], _Printf_format_string_ const char* fmt, va_list va)
{
return mir_vsnprintf(buffer, _Size, fmt, va);
}
template <size_t _Size>
-inline int mir_vsnwprintf(wchar_t(&buffer)[_Size], const wchar_t* fmt, va_list va)
+inline int mir_vsnwprintf(wchar_t(&buffer)[_Size], _Printf_format_string_ const wchar_t* fmt, va_list va)
{
return mir_vsnwprintf(buffer, _Size, fmt, va);
}
diff --git a/include/m_string.h b/include/m_string.h index c8d4a10b7d..a9e2399f77 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -376,12 +376,12 @@ public: return reinterpret_cast<LPSTR>(_mbsrev(reinterpret_cast<unsigned char*>(psz)));
}
- static int __stdcall GetFormattedLength(LPCSTR pszFormat, va_list args)
+ static int __stdcall GetFormattedLength(_Printf_format_string_ LPCSTR pszFormat, va_list args)
{
return _vscprintf(pszFormat, args);
}
- static int __stdcall Format(LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args)
+ static int __stdcall Format(LPSTR pszBuffer, size_t nlength, _Printf_format_string_ LPCSTR pszFormat, va_list args)
{
return vsprintf_s(pszBuffer, nlength, pszFormat, args);
}
@@ -596,12 +596,12 @@ public: return _wcsrev(psz);
}
- static int __stdcall GetFormattedLength(LPCWSTR pszFormat, va_list args)
+ static int __stdcall GetFormattedLength(_Printf_format_string_ LPCWSTR pszFormat, va_list args)
{
return _vscwprintf(pszFormat, args);
}
- static int __stdcall Format(LPWSTR pszBuffer, LPCWSTR pszFormat, va_list args)
+ static int __stdcall Format(LPWSTR pszBuffer, _Printf_format_string_ LPCWSTR pszFormat, va_list args)
{
#pragma warning(push)
#pragma warning(disable : 4996)
@@ -609,7 +609,7 @@ public: #pragma warning(pop)
}
- static int __stdcall Format(LPWSTR pszBuffer, size_t nLength, LPCWSTR pszFormat, va_list args)
+ static int __stdcall Format(LPWSTR pszBuffer, size_t nLength, _Printf_format_string_ LPCWSTR pszFormat, va_list args)
{
#pragma warning(push)
#pragma warning(disable : 4996)
@@ -739,7 +739,7 @@ public: CMStringT(const CMStringT& strSrc);
CMStringT(const XCHAR* pszSrc);
- CMStringT(CMStringDataFormat, const XCHAR* pszFormat, ...);
+ CMStringT(CMStringDataFormat, _Printf_format_string_ const XCHAR* pszFormat, ...);
CMStringT(const YCHAR* pszSrc);
CMStringT(const unsigned char* pszSrc);
@@ -883,12 +883,12 @@ public: CMStringT SpanExcluding(PCXSTR pszCharSet) const;
// Format data using format string 'pszFormat'
- PCXSTR Format(PCXSTR pszFormat, ...);
- PCXSTR FormatV(PCXSTR pszFormat, va_list args);
+ PCXSTR Format(PCXSTR _Printf_format_string_ pszFormat, ...);
+ PCXSTR FormatV(PCXSTR _Printf_format_string_ pszFormat, va_list args);
// Append formatted data using format string 'pszFormat'
- PCXSTR AppendFormat(PCXSTR pszFormat, ...);
- void AppendFormatV(PCXSTR pszFormat, va_list args);
+ PCXSTR AppendFormat(PCXSTR _Printf_format_string_ pszFormat, ...);
+ void AppendFormatV(PCXSTR _Printf_format_string_ pszFormat, va_list args);
// return a copy of string to be freed by mir_free()
PXSTR Detach() const;
|