OLD | NEW |
| 1 /* |
| 2 * Copyright 2013 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
1 #include "windows.h" | 7 #include "windows.h" |
2 #include "stdio.h" | 8 #include "stdio.h" |
3 | 9 |
4 #define BUFFER_SIZE 512 | 10 #define BUFFER_SIZE 512 |
5 BOOL CALLBACK MyFuncLocaleEx(LPWSTR pStr, DWORD dwFlags, LPARAM lparam) { | 11 BOOL CALLBACK MyFuncLocaleEx(LPWSTR pStr, DWORD dwFlags, LPARAM lparam) { |
6 WCHAR wcBuffer[BUFFER_SIZE]; | 12 WCHAR wcBuffer[BUFFER_SIZE]; |
7 int bufferSize; | 13 int bufferSize; |
8 | 14 |
9 bufferSize = GetLocaleInfoEx(pStr, LOCALE_SENGLANGUAGE, wcBuffer, BUFFER_SIZ
E); | 15 bufferSize = GetLocaleInfoEx(pStr, LOCALE_SENGLANGUAGE, wcBuffer, BUFFER_SIZ
E); |
10 if (bufferSize == 0) { | 16 if (bufferSize == 0) { |
11 wprintf(L"Locale %s had error %d\n", pStr, GetLastError()); | 17 wprintf(L"Locale %s had error %d\n", pStr, GetLastError()); |
12 return (TRUE); | 18 return (TRUE); |
13 } | 19 } |
14 | 20 |
15 LCID lcid = LocaleNameToLCID(pStr, NULL); | 21 LCID lcid = LocaleNameToLCID(pStr, nullptr); |
16 if (lcid == 0) { | 22 if (lcid == 0) { |
17 wprintf(L"Error %d getting LCID\n", GetLastError()); | 23 wprintf(L"Error %d getting LCID\n", GetLastError()); |
18 return (TRUE); | 24 return (TRUE); |
19 } | 25 } |
20 | 26 |
21 if (lcid > 0x8000) { | 27 if (lcid > 0x8000) { |
22 wprintf(L"//"); | 28 wprintf(L"//"); |
23 } | 29 } |
24 wprintf(L" { 0x%.4x, \"%s\" }, //%s\n", lcid, pStr, wcBuffer); | 30 wprintf(L" { 0x%.4x, \"%s\" }, //%s\n", lcid, pStr, wcBuffer); |
25 | 31 |
26 return (TRUE); | 32 return (TRUE); |
27 } | 33 } |
28 | 34 |
29 int main(int argc, wchar_t* argv[]) { | 35 int main(int argc, wchar_t* argv[]) { |
30 EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL, NULL, NULL); | 36 EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL, nullptr, nullptr); |
31 } | 37 } |
OLD | NEW |