From 30ee89a6764a8d38a078374c6ed5de70635b42c0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 16 Aug 2013 10:57:40 +0000 Subject: rest or mir_*printf in protocols git-svn-id: http://svn.miranda-ng.org/main/trunk@5715 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/MString.cpp | 86 ++++---------------------------------- protocols/JabberG/src/MString.h | 11 +---- protocols/JabberG/src/jabber_xml.h | 4 +- 3 files changed, 11 insertions(+), 90 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/MString.cpp b/protocols/JabberG/src/MString.cpp index 2e11348425..f5772c5f5b 100644 --- a/protocols/JabberG/src/MString.cpp +++ b/protocols/JabberG/src/MString.cpp @@ -107,95 +107,25 @@ CNilMStringData::CNilMStringData() ///////////////////////////////////////////////////////////////////////////////////////// // ChTraitsCRT -#if _MSC_VER < 1400 -static HINSTANCE hCrt = NULL; - -typedef int (__cdecl *_vscprintf_func)(LPCSTR pszFormat, va_list args); -static _vscprintf_func _vscprintf_ptr = NULL; - -typedef int (__cdecl *_vscwprintf_func)(LPCWSTR pszFormat, va_list args); -static _vscwprintf_func _vscwprintf_ptr = NULL; - -typedef int (__cdecl *_vsnprintf_func)(char*, size_t, const char*, va_list); -static _vsnprintf_func _vsnprintf_ptr = NULL; - -typedef int (__cdecl *_vsnwprintf_func)(wchar_t *, size_t, const wchar_t *, va_list); -static _vsnwprintf_func _vsnwprintf_ptr = NULL; - -typedef int (__cdecl *vswprintf_func)(wchar_t *, size_t, const wchar_t *, va_list); -static vswprintf_func vswprintf_ptr = NULL; - -typedef int (__cdecl *vsprintf_func)(char*, size_t, const char*, va_list); -static vsprintf_func vsprintf_ptr = NULL; - -static void checkCrt(void) -{ - if (hCrt == NULL) { - hCrt = GetModuleHandleA("msvcrt.dll"); - _vscprintf_ptr = (_vscprintf_func)GetProcAddress(hCrt, "_vscprintf"); - _vscwprintf_ptr = (_vscwprintf_func)GetProcAddress(hCrt, "_vscwprintf"); - _vsnprintf_ptr = (_vsnprintf_func)GetProcAddress(hCrt, "_vsnprintf"); - _vsnwprintf_ptr = (_vsnwprintf_func)GetProcAddress(hCrt, "_vsnwprintf"); - vswprintf_ptr = (vswprintf_func)GetProcAddress(hCrt, "vswprintf"); - vsprintf_ptr = (vsprintf_func)GetProcAddress(hCrt, "vsprintf"); -} } -#endif - -int __stdcall ChTraitsCRT::GetFormattedLength(LPCWSTR pszFormat, va_list args) +int __stdcall ChTraitsCRT::GetFormattedLength( LPCWSTR pszFormat, va_list args ) { - #if _MSC_VER < 1400 - checkCrt(); - - if (_vscwprintf_ptr != NULL) - return _vscwprintf_ptr(pszFormat, args); - - WCHAR buf[ 4000 ]; - return vswprintf_ptr(buf, SIZEOF(buf), pszFormat, args); - #else - return _vscwprintf(pszFormat, args); - #endif + return _vscwprintf(pszFormat, args); } -int __stdcall ChTraitsCRT::Format(LPWSTR pszBuffer, size_t nLength, LPCWSTR pszFormat, va_list args) +int __stdcall ChTraitsCRT::Format( LPWSTR pszBuffer, size_t nLength, LPCWSTR pszFormat, va_list args) { - #if _MSC_VER < 1400 - checkCrt(); - - if (_vsnwprintf_ptr != NULL) - return _vsnwprintf_ptr(pszBuffer, nLength, pszFormat, args); - - return vswprintf_ptr(pszBuffer, nLength, pszFormat, args); - #else - return _vsnwprintf(pszBuffer, nLength, pszFormat, args); - #endif + return _vsnwprintf(pszBuffer, nLength, pszFormat, args); } ///////////////////////////////////////////////////////////////////////////////////////// // ChTraitsCRT -int __stdcall ChTraitsCRT::GetFormattedLength(LPCSTR pszFormat, va_list args) +int __stdcall ChTraitsCRT::GetFormattedLength( LPCSTR pszFormat, va_list args ) { - #if _MSC_VER < 1400 - checkCrt(); - - if (_vscprintf_ptr != NULL) - return _vscprintf_ptr(pszFormat, args); - - char buf[4000]; - return vsprintf_ptr(buf, sizeof(buf), pszFormat, args); - #else - return _vscprintf(pszFormat, args); - #endif + return _vscprintf(pszFormat, args); } -int __stdcall ChTraitsCRT::Format(LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args) +int __stdcall ChTraitsCRT::Format( LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args ) { - #if _MSC_VER < 1400 - checkCrt(); - - return _vsnprintf(pszBuffer, nlength, pszFormat, args); - #else - return vsprintf_s(pszBuffer, nlength, pszFormat, args); - #endif + return vsprintf_s(pszBuffer, nlength, pszFormat, args); } - diff --git a/protocols/JabberG/src/MString.h b/protocols/JabberG/src/MString.h index eef6a9a4f3..b524296373 100644 --- a/protocols/JabberG/src/MString.h +++ b/protocols/JabberG/src/MString.h @@ -727,15 +727,6 @@ public: static int __stdcall GetFormattedLength(LPCSTR pszFormat, va_list args); - static int __stdcall Format(LPSTR pszBuffer, LPCSTR pszFormat, va_list args) - { -#pragma warning (push) -#pragma warning(disable : 4996) - return vsprintf(pszBuffer, pszFormat, args); -#pragma warning (pop) - - } - static int __stdcall Format(LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args); static int __stdcall GetBaseTypeLength(LPCSTR pszSrc) @@ -979,7 +970,7 @@ public: { #pragma warning (push) #pragma warning(disable : 4996) - return vswprintf(pszBuffer, pszFormat, args); + return vswprintf(pszBuffer, pszFormat, args); //!!!!!!!!! #pragma warning (pop) } diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h index 3622707db5..e591e5d852 100644 --- a/protocols/JabberG/src/jabber_xml.h +++ b/protocols/JabberG/src/jabber_xml.h @@ -358,7 +358,7 @@ public: va_list args; va_start(args, path); - _vsntprintf(m_buf, BUFSIZE, path, args); + mir_vsntprintf(m_buf, BUFSIZE, path, args); m_buf[BUFSIZE-1] = 0; va_end(args); } @@ -370,7 +370,7 @@ public: va_list args; va_start(args, path); - _vsnprintf(buf, BUFSIZE, path, args); + mir_vsnprintf(buf, BUFSIZE, path, args); buf[BUFSIZE-1] = 0; MultiByteToWideChar(CP_ACP, 0, buf, -1, m_buf, BUFSIZE); va_end(args); -- cgit v1.2.3