X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/73c04bcfe1096173b00431f0cdc742894b15eef0..b25be06635768807f8f693286fa73bb2297bb06c:/icuSources/test/intltest/winutil.cpp diff --git a/icuSources/test/intltest/winutil.cpp b/icuSources/test/intltest/winutil.cpp index 1963221e..760e9fee 100644 --- a/icuSources/test/intltest/winutil.cpp +++ b/icuSources/test/intltest/winutil.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2006, International Business Machines +* Copyright (C) 2005-2009, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -17,6 +17,7 @@ #include "winutil.h" #include "locmap.h" +#include "unicode/uloc.h" # define WIN32_LEAN_AND_MEAN # define VC_EXTRALEAN @@ -26,6 +27,7 @@ # define NOMCX # include # include +# include static Win32Utilities::LCIDRecord *lcidRecords = NULL; static int32_t lcidCount = 0; @@ -33,6 +35,7 @@ static int32_t lcidMax = 0; BOOL CALLBACK EnumLocalesProc(LPSTR lpLocaleString) { + const char* localeID = NULL; UErrorCode status = U_ZERO_ERROR; if (lcidCount >= lcidMax) { @@ -49,7 +52,11 @@ BOOL CALLBACK EnumLocalesProc(LPSTR lpLocaleString) sscanf(lpLocaleString, "%8x", &lcidRecords[lcidCount].lcid); - lcidRecords[lcidCount].localeID = uprv_convertToPosix(lcidRecords[lcidCount].lcid, &status); + localeID = uprv_convertToPosix(lcidRecords[lcidCount].lcid, &status); + + lcidRecords[lcidCount].localeID = new char[strlen(localeID)]; + + strcpy(lcidRecords[lcidCount].localeID, localeID); lcidCount += 1; @@ -73,6 +80,9 @@ Win32Utilities::LCIDRecord *Win32Utilities::getLocales(int32_t &localeCount) void Win32Utilities::freeLocales(LCIDRecord *records) { + for (int i = 0; i < lcidCount; i++) { + delete lcidRecords[i].localeID; + } delete[] records; }