From 4fb4a1f688d37fa67880c4511ca681a111fd69e6 Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 25 Jan 2007 13:09:24 +0000 Subject: [PATCH] StrToWstrAlloc -> winchar_fromansi git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4889 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/ResourceVersionInfo.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Source/ResourceVersionInfo.cpp b/Source/ResourceVersionInfo.cpp index 3be4b3c7..666b03bb 100644 --- a/Source/ResourceVersionInfo.cpp +++ b/Source/ResourceVersionInfo.cpp @@ -18,6 +18,7 @@ #include "Platform.h" #include "util.h" +#include "winchar.h" #ifdef NSIS_SUPPORT_VERSION_INFO @@ -131,19 +132,6 @@ void CResourceVersionInfo::SetProductVersion(int HighPart, int LowPart) m_FixedInfo.dwProductVersionMS = HighPart; } -// Util function - must be freeded -WCHAR* StrToWstrAlloc(const char* istr, int codepage) -{ - int strSize = MultiByteToWideChar(codepage, 0, istr, -1, 0, 0); - WCHAR* wstr = new WCHAR[strSize]; - if (!MultiByteToWideChar(codepage, 0, istr, -1, wstr, strSize)) - { - delete [] wstr; - wstr = NULL; - } - return wstr; -} - int GetVersionHeader (LPSTR &p, WORD &wLength, WORD &wValueLength, WORD &wType) { WCHAR *szKey; @@ -202,7 +190,7 @@ void CResourceVersionInfo::ExportToStream(GrowBuf &strm, int Index) WCHAR *KeyName, *KeyValue; strm.resize(0); - KeyName = StrToWstrAlloc("VS_VERSION_INFO", CP_ACP); + KeyName = winchar_fromansi("VS_VERSION_INFO"); SaveVersionHeader (strm, 0, sizeof (VS_FIXEDFILEINFO), 0, KeyName, &m_FixedInfo); delete [] KeyName;