Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: icu46/source/test/intltest/winutil.cpp

Issue 5516007: Check in the pristine copy of ICU 4.6... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « icu46/source/test/intltest/winutil.h ('k') | icu46/source/test/iotest/Makefile.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 ********************************************************************************
3 * Copyright (C) 2005-2009, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ********************************************************************************
6 *
7 * File WINUTIL.CPP
8 *
9 ********************************************************************************
10 */
11
12 #include "unicode/utypes.h"
13
14 #ifdef U_WINDOWS
15
16 #if !UCONFIG_NO_FORMATTING
17
18 #include "winutil.h"
19 #include "locmap.h"
20 #include "unicode/uloc.h"
21
22 # define WIN32_LEAN_AND_MEAN
23 # define VC_EXTRALEAN
24 # define NOUSER
25 # define NOSERVICE
26 # define NOIME
27 # define NOMCX
28 # include <windows.h>
29 # include <stdio.h>
30 # include <string.h>
31
32 static Win32Utilities::LCIDRecord *lcidRecords = NULL;
33 static int32_t lcidCount = 0;
34 static int32_t lcidMax = 0;
35
36 BOOL CALLBACK EnumLocalesProc(LPSTR lpLocaleString)
37 {
38 const char* localeID = NULL;
39 UErrorCode status = U_ZERO_ERROR;
40
41 if (lcidCount >= lcidMax) {
42 Win32Utilities::LCIDRecord *newRecords = new Win32Utilities::LCIDRecord[ lcidMax + 32];
43
44 for (int i = 0; i < lcidMax; i += 1) {
45 newRecords[i] = lcidRecords[i];
46 }
47
48 delete[] lcidRecords;
49 lcidRecords = newRecords;
50 lcidMax += 32;
51 }
52
53 sscanf(lpLocaleString, "%8x", &lcidRecords[lcidCount].lcid);
54
55 localeID = uprv_convertToPosix(lcidRecords[lcidCount].lcid, &status);
56
57 lcidRecords[lcidCount].localeID = new char[strlen(localeID)];
58
59 strcpy(lcidRecords[lcidCount].localeID, localeID);
60
61 lcidCount += 1;
62
63 return TRUE;
64 }
65
66 Win32Utilities::LCIDRecord *Win32Utilities::getLocales(int32_t &localeCount)
67 {
68 LCIDRecord *result;
69
70 EnumSystemLocalesA(EnumLocalesProc, LCID_INSTALLED);
71
72 localeCount = lcidCount;
73 result = lcidRecords;
74
75 lcidCount = lcidMax = 0;
76 lcidRecords = NULL;
77
78 return result;
79 }
80
81 void Win32Utilities::freeLocales(LCIDRecord *records)
82 {
83 for (int i = 0; i < lcidCount; i++) {
84 delete lcidRecords[i].localeID;
85 }
86 delete[] records;
87 }
88
89 #endif /* #if !UCONFIG_NO_FORMATTING */
90
91 #endif /* #ifdef U_WINDOWS */
OLDNEW
« no previous file with comments | « icu46/source/test/intltest/winutil.h ('k') | icu46/source/test/iotest/Makefile.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698