From 774574b6ccdfb7b87e5d5a97ad42e887109b1725 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 18 Dec 2014 16:00:04 +0000 Subject: fixes bug #800 (CMString::MakeUpper() and CMString::MakeLower() bug) git-svn-id: http://svn.miranda-ng.org/main/trunk@11514 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_string.h | 46 ++++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) (limited to 'include') diff --git a/include/m_string.h b/include/m_string.h index 54c464461a..0d488ff851 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -675,37 +675,25 @@ public: static LPSTR __stdcall StringUppercase(LPSTR psz) { -#pragma warning (push) -#pragma warning(disable : 4996) - return reinterpret_cast< LPSTR >(_mbsupr(reinterpret_cast< unsigned char* >(psz))); -#pragma warning (pop) + CharUpperBuffA(psz, (DWORD)strlen(psz)); + return psz; } static LPSTR __stdcall StringLowercase(LPSTR psz) { -#pragma warning (push) -#pragma warning(disable : 4996) - return reinterpret_cast< LPSTR >(_mbslwr(reinterpret_cast< unsigned char* >(psz))); -#pragma warning (pop) + CharLowerBuffA(psz, (DWORD)strlen(psz)); + return psz; } static LPSTR __stdcall StringUppercase(LPSTR psz, size_t size) { - #if _MSC_VER >= 1400 - _mbsupr_s(reinterpret_cast< unsigned char* >(psz), size); - #else - _mbsupr(reinterpret_cast< unsigned char* >(psz)); - #endif + CharUpperBuffA(psz, (DWORD)size); return psz; } static LPSTR __stdcall StringLowercase(LPSTR psz, size_t size) { - #if _MSC_VER >= 1400 - _mbslwr_s(reinterpret_cast< unsigned char* >(psz), size); - #else - _mbslwr(reinterpret_cast< unsigned char* >(psz)); - #endif + CharLowerBuffA(psz, (DWORD)size); return psz; } @@ -923,28 +911,26 @@ public: static LPWSTR __stdcall StringUppercase(LPWSTR psz) { -#pragma warning (push) -#pragma warning(disable : 4996) - return _wcsupr(psz); -#pragma warning (pop) + CharUpperBuffW(psz, (DWORD)wcslen(psz)); + return psz; } static LPWSTR __stdcall StringLowercase(LPWSTR psz) { -#pragma warning (push) -#pragma warning(disable : 4996) - return _wcslwr(psz); -#pragma warning (pop) + CharLowerBuffW(psz, (DWORD)wcslen(psz)); + return psz; } - static LPWSTR __stdcall StringUppercase(LPWSTR psz, size_t) + static LPWSTR __stdcall StringUppercase(LPWSTR psz, size_t len) { - return _wcsupr(psz); + CharUpperBuffW(psz, (DWORD)len); + return psz; } - static LPWSTR __stdcall StringLowercase(LPWSTR psz, size_t) + static LPWSTR __stdcall StringLowercase(LPWSTR psz, size_t len) { - return _wcslwr(psz); + CharLowerBuffW(psz, (DWORD)len); + return psz; } static LPWSTR __stdcall StringReverse(LPWSTR psz) -- cgit v1.2.3