From 249903acc8e1d2517f1a5863ecfbce56989dc6d9 Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 25 Jan 2007 13:07:28 +0000 Subject: [PATCH] use winchar git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4887 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/DialogTemplate.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Source/DialogTemplate.cpp b/Source/DialogTemplate.cpp index 406a646d..c1c88551 100644 --- a/Source/DialogTemplate.cpp +++ b/Source/DialogTemplate.cpp @@ -15,6 +15,7 @@ */ #include "DialogTemplate.h" +#include "winchar.h" #include // for assert(3) #ifndef _WIN32 # include "util.h" // for Unicode conversion functions @@ -58,21 +59,7 @@ void ReadVarLenArr(LPBYTE &seeker, char* &readInto, unsigned int uCodePage) { break; default: { - int iStrLen = WideCharToMultiByte(uCodePage, 0, (WCHAR*)arr, -1, 0, 0, 0, 0); - if (iStrLen) - { - readInto = new char[iStrLen]; - if (!WideCharToMultiByte(uCodePage, 0, (WCHAR*)arr, -1, readInto, iStrLen, 0, 0)) - { - delete [] readInto; - throw runtime_error("ReadVarLenArr - Unicode conversion failed."); - } - } - else - { - throw runtime_error("ReadVarLenArr - Unicode conversion failed."); - } - + readInto = winchar_toansi(arr, uCodePage); PWCHAR wseeker = PWCHAR(seeker); while (*wseeker++); seeker = LPBYTE(wseeker);