diff options
author | Avi Drissman <avi@chromium.org> | 2018-12-26 06:30:14 +0900 |
---|---|---|
committer | Qijiang Fan <fqj@google.com> | 2020-06-05 11:34:29 +0900 |
commit | cf45d5e7541eb73350cbcdc395ea904f669f8bb5 (patch) | |
tree | 6c6af35444d1f70ce89cdd089192e9dd2c612e19 | |
parent | da0663f5e079054c4c9cb4ee102c77e1f5173d01 (diff) | |
download | libchrome-cf45d5e7541eb73350cbcdc395ea904f669f8bb5.tar.gz |
Use base::size rather than arraysize in components/.
This is purely a mechanical change; there is no intended behavior change.
BUG=837308
TBR=caitkp@chromium.org
Change-Id: Icba7642ba9452eb71f6c9148cc4e5cea7dac3b4b
Reviewed-on: https://chromium-review.googlesource.com/c/1390896
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#618884}
CrOS-Libchrome-Original-Commit: ec658401792e10176390ac47e0e864377d9aab08
4 files changed, 12 insertions, 13 deletions
diff --git a/components/policy/core/common/config_dir_policy_loader.cc b/components/policy/core/common/config_dir_policy_loader.cc index e1d9c51ced..6a81e761bf 100644 --- a/components/policy/core/common/config_dir_policy_loader.cc +++ b/components/policy/core/common/config_dir_policy_loader.cc @@ -17,7 +17,6 @@ #include "base/json/json_file_value_serializer.h" #include "base/json/json_reader.h" #include "base/logging.h" -#include "base/macros.h" #include "base/stl_util.h" #include "components/policy/core/common/policy_bundle.h" #include "components/policy/core/common/policy_load_status.h" @@ -100,7 +99,7 @@ base::Time ConfigDirPolicyLoader::LastModificationTime() { base::Time last_modification = base::Time(); base::File::Info info; - for (size_t i = 0; i < arraysize(kConfigDirSuffixes); ++i) { + for (size_t i = 0; i < base::size(kConfigDirSuffixes); ++i) { base::FilePath path(config_dir_.Append(kConfigDirSuffixes[i])); // Skip if the file doesn't exist, or it isn't a directory. diff --git a/components/policy/core/common/policy_service_impl.cc b/components/policy/core/common/policy_service_impl.cc index 5e163d342c..3ff79f1b36 100644 --- a/components/policy/core/common/policy_service_impl.cc +++ b/components/policy/core/common/policy_service_impl.cc @@ -11,8 +11,8 @@ #include "base/bind.h" #include "base/location.h" -#include "base/macros.h" #include "base/single_thread_task_runner.h" +#include "base/stl_util.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "components/policy/core/common/policy_bundle.h" @@ -43,7 +43,7 @@ void RemapProxyPolicies(PolicyMap* policies) { PolicySource inherited_source = POLICY_SOURCE_ENTERPRISE_DEFAULT; std::unique_ptr<base::DictionaryValue> proxy_settings( new base::DictionaryValue); - for (size_t i = 0; i < arraysize(kProxyPolicies); ++i) { + for (size_t i = 0; i < base::size(kProxyPolicies); ++i) { const PolicyMap::Entry* entry = policies->Get(kProxyPolicies[i]); if (entry) { if (entry->has_higher_priority_than(current_priority)) { diff --git a/components/policy/core/common/preg_parser.cc b/components/policy/core/common/preg_parser.cc index 7312e814fc..38a039ac44 100644 --- a/components/policy/core/common/preg_parser.cc +++ b/components/policy/core/common/preg_parser.cc @@ -18,8 +18,8 @@ #include "base/files/file_path.h" #include "base/files/memory_mapped_file.h" #include "base/logging.h" -#include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/stl_util.h" #include "base/strings/string16.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" @@ -259,7 +259,7 @@ void HandleRecord(const base::string16& key_name, std::string data_utf8; std::string action_trigger(base::ToLowerASCII( - value_name.substr(arraysize(kActionTriggerPrefix) - 1))); + value_name.substr(base::size(kActionTriggerPrefix) - 1))); if (action_trigger == kActionTriggerDeleteValues) { if (DecodePRegStringValue(data, &data_utf8)) { for (const std::string& value : @@ -277,8 +277,8 @@ void HandleRecord(const base::string16& key_name, } } else if (base::StartsWith(action_trigger, kActionTriggerDel, base::CompareCase::SENSITIVE)) { - dict->RemoveValue(value_name.substr(arraysize(kActionTriggerPrefix) - 1 + - arraysize(kActionTriggerDel) - 1)); + dict->RemoveValue(value_name.substr(base::size(kActionTriggerPrefix) - 1 + + base::size(kActionTriggerDel) - 1)); } else if (base::StartsWith(action_trigger, kActionTriggerDelVals, base::CompareCase::SENSITIVE)) { // Delete all values. @@ -334,7 +334,7 @@ POLICY_EXPORT bool ReadDataInternal(const uint8_t* preg_data, } // Check the header. - const int kHeaderSize = arraysize(kPRegFileHeader); + const int kHeaderSize = base::size(kPRegFileHeader); if (!preg_data || preg_data_size < kHeaderSize || memcmp(kPRegFileHeader, preg_data, kHeaderSize) != 0) { LOG(ERROR) << "Bad PReg " << debug_name; diff --git a/components/policy/core/common/schema_unittest.cc b/components/policy/core/common/schema_unittest.cc index a45d81dbb4..493b9934b0 100644 --- a/components/policy/core/common/schema_unittest.cc +++ b/components/policy/core/common/schema_unittest.cc @@ -9,7 +9,7 @@ #include <memory> #include <utility> -#include "base/macros.h" +#include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/values.h" #include "components/policy/core/common/schema_internal.h" @@ -424,7 +424,7 @@ TEST(SchemaTest, ValidSchema) { { "StringWithPattern", base::Value::Type::STRING }, }; Schema::Iterator it = schema.GetPropertiesIterator(); - for (size_t i = 0; i < arraysize(kExpectedProperties); ++i) { + for (size_t i = 0; i < base::size(kExpectedProperties); ++i) { ASSERT_FALSE(it.IsAtEnd()); EXPECT_STREQ(kExpectedProperties[i].expected_key, it.key()); ASSERT_TRUE(it.schema().valid()); @@ -485,7 +485,7 @@ TEST(SchemaTest, Lookups) { { "aba", base::Value::Type::INTEGER }, { "abab", base::Value::Type::STRING }, }; - for (size_t i = 0; i < arraysize(kExpectedKeys); ++i) { + for (size_t i = 0; i < base::size(kExpectedKeys); ++i) { Schema sub = schema.GetKnownProperty(kExpectedKeys[i].expected_key); ASSERT_TRUE(sub.valid()); EXPECT_EQ(kExpectedKeys[i].expected_type, sub.type()); @@ -611,7 +611,7 @@ TEST(SchemaTest, Wrap) { }; Schema::Iterator it = schema.GetPropertiesIterator(); - for (size_t i = 0; i < arraysize(kExpectedProperties); ++i) { + for (size_t i = 0; i < base::size(kExpectedProperties); ++i) { ASSERT_FALSE(it.IsAtEnd()); EXPECT_STREQ(kExpectedProperties[i].key, it.key()); Schema sub = it.schema(); |