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

Side by Side Diff: components/captive_portal/captive_portal_types.cc

Issue 794683005: replace COMPILE_ASSERT with static_assert in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: formatting fixup Created 5 years, 12 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/captive_portal/captive_portal_types.h" 5 #include "components/captive_portal/captive_portal_types.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace captive_portal { 9 namespace captive_portal {
10 10
11 namespace { 11 namespace {
12 12
13 const char* const kCaptivePortalResultNames[] = { 13 const char* const kCaptivePortalResultNames[] = {
14 "InternetConnected", 14 "InternetConnected",
15 "NoResponse", 15 "NoResponse",
16 "BehindCaptivePortal", 16 "BehindCaptivePortal",
17 "NumCaptivePortalResults", 17 "NumCaptivePortalResults",
18 }; 18 };
19 COMPILE_ASSERT(arraysize(kCaptivePortalResultNames) == RESULT_COUNT + 1, 19 static_assert(arraysize(kCaptivePortalResultNames) == RESULT_COUNT + 1,
20 captive_portal_result_name_count_mismatch); 20 "kCaptivePortalResultNames should have "
21 "RESULT_COUNT + 1 elements");
21 22
22 } // namespace 23 } // namespace
23 24
24 25
25 std::string CaptivePortalResultToString(CaptivePortalResult result) { 26 std::string CaptivePortalResultToString(CaptivePortalResult result) {
26 DCHECK_GE(result, 0); 27 DCHECK_GE(result, 0);
27 DCHECK_LT(static_cast<unsigned int>(result), 28 DCHECK_LT(static_cast<unsigned int>(result),
28 arraysize(kCaptivePortalResultNames)); 29 arraysize(kCaptivePortalResultNames));
29 return kCaptivePortalResultNames[result]; 30 return kCaptivePortalResultNames[result];
30 } 31 }
31 32
32 } // namespace captive_portal 33 } // namespace captive_portal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698