/*
********************************************************************************
-* Copyright (C) 2005-2006, International Business Machines
+* Copyright (C) 2005-2009, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
#include "winutil.h"
#include "locmap.h"
+#include "unicode/uloc.h"
# define WIN32_LEAN_AND_MEAN
# define VC_EXTRALEAN
# define NOMCX
# include <windows.h>
# include <stdio.h>
+# include <string.h>
static Win32Utilities::LCIDRecord *lcidRecords = NULL;
static int32_t lcidCount = 0;
BOOL CALLBACK EnumLocalesProc(LPSTR lpLocaleString)
{
+ const char* localeID = NULL;
UErrorCode status = U_ZERO_ERROR;
if (lcidCount >= lcidMax) {
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;
void Win32Utilities::freeLocales(LCIDRecord *records)
{
+ for (int i = 0; i < lcidCount; i++) {
+ delete lcidRecords[i].localeID;
+ }
delete[] records;
}