From 51a0cb7355f4da79010fad6274bedcff7a19b8b4 Mon Sep 17 00:00:00 2001 From: anders_k Date: Tue, 13 Dec 2011 02:13:20 +0000 Subject: [PATCH] Use malloc and not GlobalAlloc in makensis (POSIX) git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6208 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/tstring.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/tstring.h b/Source/tstring.h index 2565f58b..ec4982bc 100644 --- a/Source/tstring.h +++ b/Source/tstring.h @@ -57,23 +57,23 @@ public: CtoTString(const char* str) { int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - m_wStr = (wchar_t*) GlobalAlloc(GPTR, len*sizeof(wchar_t)); + m_wStr = (wchar_t*) malloc(len*sizeof(wchar_t)); MultiByteToWideChar(CP_ACP, 0, str, -1, m_wStr, len); } CtoTString(const char* str, UINT cp) { int len = MultiByteToWideChar(cp, 0, str, -1, NULL, 0); - m_wStr = (wchar_t*) GlobalAlloc(GPTR, len*sizeof(wchar_t)); + m_wStr = (wchar_t*) malloc(len*sizeof(wchar_t)); MultiByteToWideChar(cp, 0, str, -1, m_wStr, len); } CtoTString(const std::string& str) { int len = MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.length()+1, NULL, 0); - m_wStr = (wchar_t*) GlobalAlloc(GPTR, len*sizeof(wchar_t)); + m_wStr = (wchar_t*) malloc(len*sizeof(wchar_t)); MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.length()+1, m_wStr, len); } - ~CtoTString() { GlobalFree(m_wStr); m_wStr = 0; } + ~CtoTString() { free(m_wStr); m_wStr = 0; } operator const wchar_t*() { return m_wStr; } @@ -89,17 +89,17 @@ public: TtoCString(const wchar_t* wStr) { int len = WideCharToMultiByte(CP_ACP, 0, wStr, -1, NULL, 0, 0, 0); - m_cStr = (char*) GlobalAlloc(GPTR, len); + m_cStr = (char*) malloc(len); WideCharToMultiByte(CP_ACP, 0, wStr, -1, m_cStr, len, 0, 0); } TtoCString(const tstring& wStr) { int len = WideCharToMultiByte(CP_ACP, 0, wStr.c_str(), wStr.length()+1, NULL, 0, 0, 0); - m_cStr = (char*) GlobalAlloc(GPTR, len); + m_cStr = (char*) malloc(len); WideCharToMultiByte(CP_ACP, 0, wStr.c_str(), wStr.length()+1, m_cStr, len, 0, 0); } - ~TtoCString() { GlobalFree(m_cStr); m_cStr = 0; } + ~TtoCString() { free(m_cStr); m_cStr = 0; } operator const char*() { return m_cStr; }