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

Side by Side Diff: base/win/i18n.cc

Issue 1467003002: Switch to static_assert in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missed one Created 5 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/win/i18n.h" 5 #include "base/win/i18n.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 14 matching lines...) Expand all
25 const char kThreadLanguagesFunctionName[] = "GetThreadPreferredUILanguages"; 25 const char kThreadLanguagesFunctionName[] = "GetThreadPreferredUILanguages";
26 26
27 // Keep this array in sync with enum LanguageFunction. 27 // Keep this array in sync with enum LanguageFunction.
28 const char *const kLanguageFunctionNames[] = { 28 const char *const kLanguageFunctionNames[] = {
29 &kSystemLanguagesFunctionName[0], 29 &kSystemLanguagesFunctionName[0],
30 &kUserLanguagesFunctionName[0], 30 &kUserLanguagesFunctionName[0],
31 &kProcessLanguagesFunctionName[0], 31 &kProcessLanguagesFunctionName[0],
32 &kThreadLanguagesFunctionName[0] 32 &kThreadLanguagesFunctionName[0]
33 }; 33 };
34 34
35 COMPILE_ASSERT(NUM_FUNCTIONS == arraysize(kLanguageFunctionNames), 35 static_assert(NUM_FUNCTIONS == arraysize(kLanguageFunctionNames),
36 language_function_enum_and_names_out_of_sync); 36 "language_function_enum_and_names_out_of_sync");
37 37
38 // Calls one of the MUI Get*PreferredUILanguages functions, placing the result 38 // Calls one of the MUI Get*PreferredUILanguages functions, placing the result
39 // in |languages|. |function| identifies the function to call and |flags| is 39 // in |languages|. |function| identifies the function to call and |flags| is
40 // the function-specific flags (callers must not specify MUI_LANGUAGE_ID or 40 // the function-specific flags (callers must not specify MUI_LANGUAGE_ID or
41 // MUI_LANGUAGE_NAME). Returns true if at least one language is placed in 41 // MUI_LANGUAGE_NAME). Returns true if at least one language is placed in
42 // |languages|. 42 // |languages|.
43 bool GetMUIPreferredUILanguageList(LanguageFunction function, ULONG flags, 43 bool GetMUIPreferredUILanguageList(LanguageFunction function, ULONG flags,
44 std::vector<wchar_t>* languages) { 44 std::vector<wchar_t>* languages) {
45 DCHECK(0 <= function && NUM_FUNCTIONS > function); 45 DCHECK(0 <= function && NUM_FUNCTIONS > function);
46 DCHECK_EQ(0U, (flags & (MUI_LANGUAGE_ID | MUI_LANGUAGE_NAME))); 46 DCHECK_EQ(0U, (flags & (MUI_LANGUAGE_ID | MUI_LANGUAGE_NAME)));
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 bool GetThreadPreferredUILanguageList(std::vector<std::wstring>* languages) { 160 bool GetThreadPreferredUILanguageList(std::vector<std::wstring>* languages) {
161 DCHECK(languages); 161 DCHECK(languages);
162 return GetPreferredUILanguageList( 162 return GetPreferredUILanguageList(
163 THREAD_LANGUAGES, MUI_MERGE_SYSTEM_FALLBACK | MUI_MERGE_USER_FALLBACK, 163 THREAD_LANGUAGES, MUI_MERGE_SYSTEM_FALLBACK | MUI_MERGE_USER_FALLBACK,
164 languages); 164 languages);
165 } 165 }
166 166
167 } // namespace i18n 167 } // namespace i18n
168 } // namespace win 168 } // namespace win
169 } // namespace base 169 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698