summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorviettrungluu <viettrungluu@chromium.org>2014-10-15 21:02:49 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-16 04:03:06 +0000
commit805eabb91d386c86bd64336c7643f6dfa864151d (patch)
tree843a45e9bd0ec5a3aa22dc317a811d155a90c947
parent4b691586093fae3feb41fa39e345c42a4ce66932 (diff)
downloadchromium_src-805eabb91d386c86bd64336c7643f6dfa864151d.zip
chromium_src-805eabb91d386c86bd64336c7643f6dfa864151d.tar.gz
chromium_src-805eabb91d386c86bd64336c7643f6dfa864151d.tar.bz2
Convert ARRAYSIZE_UNSAFE -> arraysize in base/.
R=thestig@chromium.org BUG=423134 Review URL: https://codereview.chromium.org/656033009 Cr-Commit-Position: refs/heads/master@{#299835}
-rw-r--r--base/debug/proc_maps_linux_unittest.cc2
-rw-r--r--base/debug/stack_trace_posix.cc2
-rw-r--r--base/files/file_proxy_unittest.cc2
-rw-r--r--base/i18n/icu_string_conversions_unittest.cc6
-rw-r--r--base/i18n/number_formatting_unittest.cc4
-rw-r--r--base/i18n/rtl_unittest.cc8
-rw-r--r--base/json/string_escape_unittest.cc8
-rw-r--r--base/mac/mac_util_unittest.mm2
-rw-r--r--base/metrics/field_trial_unittest.cc2
-rw-r--r--base/strings/string_number_conversions_unittest.cc28
-rw-r--r--base/strings/string_split_unittest.cc2
-rw-r--r--base/strings/string_util_unittest.cc12
-rw-r--r--base/strings/utf_offset_string_conversions_unittest.cc4
-rw-r--r--base/strings/utf_string_conversions_unittest.cc4
-rw-r--r--base/sync_socket_win.cc2
-rw-r--r--base/version_unittest.cc8
16 files changed, 48 insertions, 48 deletions
diff --git a/base/debug/proc_maps_linux_unittest.cc b/base/debug/proc_maps_linux_unittest.cc
index fc8ced6..4be5a0f 100644
--- a/base/debug/proc_maps_linux_unittest.cc
+++ b/base/debug/proc_maps_linux_unittest.cc
@@ -167,7 +167,7 @@ TEST(ProcMapsTest, Permissions) {
MappedMemoryRegion::EXECUTE | MappedMemoryRegion::PRIVATE},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
+ for (size_t i = 0; i < arraysize(kTestCases); ++i) {
SCOPED_TRACE(
base::StringPrintf("kTestCases[%zu] = %s", i, kTestCases[i].input));
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
index ae40d7c..25acbe0 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -343,7 +343,7 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) {
const int kRegisterPadding = 16;
#endif
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(registers); i++) {
+ for (size_t i = 0; i < arraysize(registers); i++) {
PrintToStderr(registers[i].label);
internal::itoa_r(registers[i].value, buf, sizeof(buf),
16, kRegisterPadding);
diff --git a/base/files/file_proxy_unittest.cc b/base/files/file_proxy_unittest.cc
index 0034a1c..b5ed395 100644
--- a/base/files/file_proxy_unittest.cc
+++ b/base/files/file_proxy_unittest.cc
@@ -267,7 +267,7 @@ TEST_F(FileProxyTest, WriteAndFlush) {
CreateProxy(File::FLAG_CREATE | File::FLAG_WRITE, &proxy);
const char data[] = "foo!";
- int data_bytes = ARRAYSIZE_UNSAFE(data);
+ int data_bytes = arraysize(data);
proxy.Write(0, data, data_bytes,
Bind(&FileProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
diff --git a/base/i18n/icu_string_conversions_unittest.cc b/base/i18n/icu_string_conversions_unittest.cc
index 04c3b92..107e240 100644
--- a/base/i18n/icu_string_conversions_unittest.cc
+++ b/base/i18n/icu_string_conversions_unittest.cc
@@ -234,7 +234,7 @@ static const struct {
};
TEST(ICUStringConversionsTest, ConvertBetweenCodepageAndWide) {
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kConvertCodepageCases); ++i) {
+ for (size_t i = 0; i < arraysize(kConvertCodepageCases); ++i) {
SCOPED_TRACE(base::StringPrintf(
"Test[%" PRIuS "]: <encoded: %s> <codepage: %s>", i,
kConvertCodepageCases[i].encoded,
@@ -301,7 +301,7 @@ TEST(ICUStringConversionsTest, ConvertBetweenCodepageAndWide) {
}
TEST(ICUStringConversionsTest, ConvertBetweenCodepageAndUTF16) {
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kConvertCodepageCases); ++i) {
+ for (size_t i = 0; i < arraysize(kConvertCodepageCases); ++i) {
SCOPED_TRACE(base::StringPrintf(
"Test[%" PRIuS "]: <encoded: %s> <codepage: %s>", i,
kConvertCodepageCases[i].encoded,
@@ -355,7 +355,7 @@ static const struct {
};
TEST(ICUStringConversionsTest, ConvertToUtf8AndNormalize) {
std::string result;
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kConvertAndNormalizeCases); ++i) {
+ for (size_t i = 0; i < arraysize(kConvertAndNormalizeCases); ++i) {
SCOPED_TRACE(base::StringPrintf(
"Test[%" PRIuS "]: <encoded: %s> <codepage: %s>", i,
kConvertAndNormalizeCases[i].encoded,
diff --git a/base/i18n/number_formatting_unittest.cc b/base/i18n/number_formatting_unittest.cc
index da6397d..3b0718d 100644
--- a/base/i18n/number_formatting_unittest.cc
+++ b/base/i18n/number_formatting_unittest.cc
@@ -27,7 +27,7 @@ TEST(NumberFormattingTest, FormatNumber) {
{-42, "-42", "-42"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
i18n::SetICUDefaultLocale("en");
testing::ResetFormatters();
EXPECT_EQ(cases[i].expected_english,
@@ -72,7 +72,7 @@ TEST(NumberFormattingTest, FormatDouble) {
{-42.7, 3, "-42.700", "-42,700"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
i18n::SetICUDefaultLocale("en");
testing::ResetFormatters();
EXPECT_EQ(cases[i].expected_english,
diff --git a/base/i18n/rtl_unittest.cc b/base/i18n/rtl_unittest.cc
index 2d923ac..87ac87d 100644
--- a/base/i18n/rtl_unittest.cc
+++ b/base/i18n/rtl_unittest.cc
@@ -96,7 +96,7 @@ TEST_F(RTLTest, GetFirstStrongCharacterDirection) {
LEFT_TO_RIGHT },
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i)
+ for (size_t i = 0; i < arraysize(cases); ++i)
EXPECT_EQ(cases[i].direction,
GetFirstStrongCharacterDirection(WideToUTF16(cases[i].text)));
}
@@ -158,7 +158,7 @@ TEST_F(RTLTest, GetLastStrongCharacterDirection) {
LEFT_TO_RIGHT },
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i)
+ for (size_t i = 0; i < arraysize(cases); ++i)
EXPECT_EQ(cases[i].direction,
GetLastStrongCharacterDirection(WideToUTF16(cases[i].text)));
}
@@ -236,7 +236,7 @@ TEST_F(RTLTest, GetStringDirection) {
LEFT_TO_RIGHT },
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i)
+ for (size_t i = 0; i < arraysize(cases); ++i)
EXPECT_EQ(cases[i].direction,
GetStringDirection(WideToUTF16(cases[i].text)));
}
@@ -355,7 +355,7 @@ TEST_F(RTLTest, GetDisplayStringInLTRDirectionality) {
for (size_t i = 0; i < 2; ++i) {
// Toggle the application default text direction (to try each direction).
SetRTL(!IsRTL());
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
string16 input = WideToUTF16(cases[i].path);
string16 output = GetDisplayStringInLTRDirectionality(input);
// Test the expected wrapping behavior for the current UI directionality.
diff --git a/base/json/string_escape_unittest.cc b/base/json/string_escape_unittest.cc
index 7d82f9b..3eb4e8e 100644
--- a/base/json/string_escape_unittest.cc
+++ b/base/json/string_escape_unittest.cc
@@ -23,7 +23,7 @@ TEST(JSONStringEscapeTest, EscapeUTF8) {
{"c<>d", "c\\u003C>d"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
const char* in_ptr = cases[i].to_escape;
std::string in_str = in_ptr;
@@ -81,7 +81,7 @@ TEST(JSONStringEscapeTest, EscapeUTF16) {
{L"c<>d", "c\\u003C>d"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
string16 in = WideToUTF16(cases[i].to_escape);
std::string out;
@@ -162,7 +162,7 @@ TEST(JSONStringEscapeTest, EscapeBytes) {
{"\xe5\xc4\x4f\x05\xb6\xfd\0", "\\u00E5\\u00C4O\\u0005\\u00B6\\u00FD"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
std::string in = std::string(cases[i].to_escape);
EXPECT_FALSE(IsStringUTF8(in));
@@ -173,7 +173,7 @@ TEST(JSONStringEscapeTest, EscapeBytes) {
}
const char kEmbedNull[] = { '\xab', '\x39', '\0', '\x9f', '\xab' };
- std::string in(kEmbedNull, ARRAYSIZE_UNSAFE(kEmbedNull));
+ std::string in(kEmbedNull, arraysize(kEmbedNull));
EXPECT_FALSE(IsStringUTF8(in));
EXPECT_EQ(std::string("\\u00AB9\\u0000\\u009F\\u00AB"),
EscapeBytesAsInvalidJSONString(in, false));
diff --git a/base/mac/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm
index aae40a6..6a1acb3 100644
--- a/base/mac/mac_util_unittest.mm
+++ b/base/mac/mac_util_unittest.mm
@@ -92,7 +92,7 @@ TEST_F(MacUtilTest, TestGetAppBundlePath) {
{ "/Applications/Google Foo.app/bar/Foo Helper.app/quux/Foo Helper",
"/Applications/Google Foo.app" },
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid_inputs); i++) {
+ for (size_t i = 0; i < arraysize(valid_inputs); i++) {
out = GetAppBundlePath(FilePath(valid_inputs[i].in));
EXPECT_FALSE(out.empty()) << "loop: " << i;
EXPECT_STREQ(valid_inputs[i].expected_out,
diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc
index b3a6eb3..b474ddb 100644
--- a/base/metrics/field_trial_unittest.cc
+++ b/base/metrics/field_trial_unittest.cc
@@ -963,7 +963,7 @@ TEST_F(FieldTrialTest, CreateSimulatedFieldTrial) {
{ 0.95, kDefaultGroupName },
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
+ for (size_t i = 0; i < arraysize(test_cases); ++i) {
TestFieldTrialObserver observer;
scoped_refptr<FieldTrial> trial(
FieldTrial::CreateSimulatedFieldTrial(kTrialName, 100, kDefaultGroupName,
diff --git a/base/strings/string_number_conversions_unittest.cc b/base/strings/string_number_conversions_unittest.cc
index 134ba01..4787614 100644
--- a/base/strings/string_number_conversions_unittest.cc
+++ b/base/strings/string_number_conversions_unittest.cc
@@ -73,7 +73,7 @@ TEST(StringNumberConversionsTest, Uint64ToString) {
{kuint64max, "18446744073709551615"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i)
+ for (size_t i = 0; i < arraysize(cases); ++i)
EXPECT_EQ(cases[i].output, Uint64ToString(cases[i].input));
}
@@ -96,7 +96,7 @@ TEST(StringNumberConversionsTest, SizeTToString) {
{size_t_max, size_t_max_string},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i)
+ for (size_t i = 0; i < arraysize(cases); ++i)
EXPECT_EQ(cases[i].output, Uint64ToString(cases[i].input));
}
@@ -132,7 +132,7 @@ TEST(StringNumberConversionsTest, StringToInt) {
{"99999999999", INT_MAX, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
int output = 0;
EXPECT_EQ(cases[i].success, StringToInt(cases[i].input, &output));
EXPECT_EQ(cases[i].output, output);
@@ -196,7 +196,7 @@ TEST(StringNumberConversionsTest, StringToUint) {
{"99999999999", UINT_MAX, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
unsigned output = 0;
EXPECT_EQ(cases[i].success, StringToUint(cases[i].input, &output));
EXPECT_EQ(cases[i].output, output);
@@ -266,7 +266,7 @@ TEST(StringNumberConversionsTest, StringToInt64) {
{"99999999999999999999", kint64max, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
int64 output = 0;
EXPECT_EQ(cases[i].success, StringToInt64(cases[i].input, &output));
EXPECT_EQ(cases[i].output, output);
@@ -333,7 +333,7 @@ TEST(StringNumberConversionsTest, StringToUint64) {
{"18446744073709551616", kuint64max, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
uint64 output = 0;
EXPECT_EQ(cases[i].success, StringToUint64(cases[i].input, &output));
EXPECT_EQ(cases[i].output, output);
@@ -402,7 +402,7 @@ TEST(StringNumberConversionsTest, StringToSizeT) {
{size_t_max_string, size_t_max, true},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
size_t output = 0;
EXPECT_EQ(cases[i].success, StringToSizeT(cases[i].input, &output));
EXPECT_EQ(cases[i].output, output);
@@ -465,7 +465,7 @@ TEST(StringNumberConversionsTest, HexStringToInt) {
{"0x", 0, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
int output = 0;
EXPECT_EQ(cases[i].success, HexStringToInt(cases[i].input, &output));
EXPECT_EQ(cases[i].output, output);
@@ -525,7 +525,7 @@ TEST(StringNumberConversionsTest, HexStringToUInt) {
{"0x", 0, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
uint32 output = 0;
EXPECT_EQ(cases[i].success, HexStringToUInt(cases[i].input, &output));
EXPECT_EQ(cases[i].output, output);
@@ -582,7 +582,7 @@ TEST(StringNumberConversionsTest, HexStringToInt64) {
{"0x", 0, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
int64 output = 0;
EXPECT_EQ(cases[i].success, HexStringToInt64(cases[i].input, &output));
EXPECT_EQ(cases[i].output, output);
@@ -644,7 +644,7 @@ TEST(StringNumberConversionsTest, HexStringToUInt64) {
{"0x", 0, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
uint64 output = 0;
EXPECT_EQ(cases[i].success, HexStringToUInt64(cases[i].input, &output));
EXPECT_EQ(cases[i].output, output);
@@ -686,7 +686,7 @@ TEST(StringNumberConversionsTest, HexStringToBytes) {
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
std::vector<uint8> output;
std::vector<uint8> compare;
EXPECT_EQ(cases[i].success, HexStringToBytes(cases[i].input, &output)) <<
@@ -735,7 +735,7 @@ TEST(StringNumberConversionsTest, StringToDouble) {
{"", 0.0, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
double output;
errno = 1;
EXPECT_EQ(cases[i].success, StringToDouble(cases[i].input, &output));
@@ -768,7 +768,7 @@ TEST(StringNumberConversionsTest, DoubleToString) {
{1.33503e+009, "1335030000"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
EXPECT_EQ(cases[i].expected, DoubleToString(cases[i].input));
}
diff --git a/base/strings/string_split_unittest.cc b/base/strings/string_split_unittest.cc
index 998b61f..32bbe28 100644
--- a/base/strings/string_split_unittest.cc
+++ b/base/strings/string_split_unittest.cc
@@ -312,7 +312,7 @@ TEST(StringSplitTest, SplitStringAlongWhitespace) {
{ "b\tat", 2, "b", "at" },
{ "b\t at", 2, "b", "at" },
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
+ for (size_t i = 0; i < arraysize(data); ++i) {
std::vector<std::string> results;
SplitStringAlongWhitespace(data[i].input, &results);
ASSERT_EQ(data[i].expected_result_count, results.size());
diff --git a/base/strings/string_util_unittest.cc b/base/strings/string_util_unittest.cc
index d46bc9b..a3e8992 100644
--- a/base/strings/string_util_unittest.cc
+++ b/base/strings/string_util_unittest.cc
@@ -539,7 +539,7 @@ TEST(StringUtilTest, LowerCaseEqualsASCII) {
{ "FOO", "foo" },
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(lowercase_cases); ++i) {
+ for (size_t i = 0; i < arraysize(lowercase_cases); ++i) {
EXPECT_TRUE(LowerCaseEqualsASCII(ASCIIToUTF16(lowercase_cases[i].src_a),
lowercase_cases[i].dst));
EXPECT_TRUE(LowerCaseEqualsASCII(lowercase_cases[i].src_a,
@@ -576,7 +576,7 @@ TEST(StringUtilTest, FormatBytesUnlocalized) {
{100LL*1024*1024*1024, "100 GB"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
EXPECT_EQ(ASCIIToUTF16(cases[i].expected),
FormatBytesUnlocalized(cases[i].bytes));
}
@@ -603,7 +603,7 @@ TEST(StringUtilTest, ReplaceSubstringsAfterOffset) {
{"abababab", 2, "ab", "c", "abccc"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
+ for (size_t i = 0; i < arraysize(cases); i++) {
string16 str = ASCIIToUTF16(cases[i].str);
ReplaceSubstringsAfterOffset(&str, cases[i].start_offset,
ASCIIToUTF16(cases[i].find_this),
@@ -633,7 +633,7 @@ TEST(StringUtilTest, ReplaceFirstSubstringAfterOffset) {
{"abababab", 2, "ab", "c", "abcabab"},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
+ for (size_t i = 0; i < arraysize(cases); i++) {
string16 str = ASCIIToUTF16(cases[i].str);
ReplaceFirstSubstringAfterOffset(&str, cases[i].start_offset,
ASCIIToUTF16(cases[i].find_this),
@@ -1148,7 +1148,7 @@ TEST(StringUtilTest, WprintfFormatPortabilityTest) {
{ L"% 10s", false },
{ L"% 10ls", true }
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i)
+ for (size_t i = 0; i < arraysize(cases); ++i)
EXPECT_EQ(cases[i].portable, base::IsWprintfFormatPortable(cases[i].input));
}
@@ -1191,7 +1191,7 @@ TEST(StringUtilTest, ReplaceChars) {
{ "test", "t", "test", "testestest", true },
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
std::string output;
bool result = ReplaceChars(cases[i].input,
cases[i].replace_chars,
diff --git a/base/strings/utf_offset_string_conversions_unittest.cc b/base/strings/utf_offset_string_conversions_unittest.cc
index b50e1b6..529939f 100644
--- a/base/strings/utf_offset_string_conversions_unittest.cc
+++ b/base/strings/utf_offset_string_conversions_unittest.cc
@@ -34,7 +34,7 @@ TEST(UTFOffsetStringConversionsTest, AdjustOffset) {
{"A\xF0\x90\x8C\x80z", 6, 4},
{"A\xF0\x90\x8C\x80z", kNpos, kNpos},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(utf8_to_utf16_cases); ++i) {
+ for (size_t i = 0; i < arraysize(utf8_to_utf16_cases); ++i) {
const size_t offset = utf8_to_utf16_cases[i].input_offset;
std::vector<size_t> offsets;
offsets.push_back(offset);
@@ -64,7 +64,7 @@ TEST(UTFOffsetStringConversionsTest, AdjustOffset) {
{{'A', 0xd800, 0xdf00, 'z'}, 3, 5},
{{'A', 0xd800, 0xdf00, 'z'}, 4, 6},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(utf16_to_utf8_cases); ++i) {
+ for (size_t i = 0; i < arraysize(utf16_to_utf8_cases); ++i) {
size_t offset = utf16_to_utf8_cases[i].input_offset;
std::vector<size_t> offsets;
offsets.push_back(offset);
diff --git a/base/strings/utf_string_conversions_unittest.cc b/base/strings/utf_string_conversions_unittest.cc
index 08009c4..009af7c 100644
--- a/base/strings/utf_string_conversions_unittest.cc
+++ b/base/strings/utf_string_conversions_unittest.cc
@@ -94,7 +94,7 @@ TEST(UTFStringConversionsTest, ConvertUTF8ToWide) {
#endif
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(convert_cases); i++) {
+ for (size_t i = 0; i < arraysize(convert_cases); i++) {
std::wstring converted;
EXPECT_EQ(convert_cases[i].success,
UTF8ToWide(convert_cases[i].utf8,
@@ -172,7 +172,7 @@ TEST(UTFStringConversionsTest, ConvertUTF32ToUTF8) {
{L"\xdc01Hello", "\xef\xbf\xbdHello", false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(convert_cases); i++) {
+ for (size_t i = 0; i < arraysize(convert_cases); i++) {
std::string converted;
EXPECT_EQ(convert_cases[i].success,
WideToUTF8(convert_cases[i].utf32,
diff --git a/base/sync_socket_win.cc b/base/sync_socket_win.cc
index a8deedb..e508816 100644
--- a/base/sync_socket_win.cc
+++ b/base/sync_socket_win.cc
@@ -150,7 +150,7 @@ size_t CancelableFileOperation(Function operation,
if (::GetLastError() == ERROR_IO_PENDING) {
HANDLE events[] = { io_event->handle(), cancel_event->handle() };
const int wait_result = WaitForMultipleObjects(
- ARRAYSIZE_UNSAFE(events), events, FALSE,
+ arraysize(events), events, FALSE,
timeout_in_ms == INFINITE ?
timeout_in_ms :
static_cast<DWORD>(
diff --git a/base/version_unittest.cc b/base/version_unittest.cc
index 2a2309e..3119c39 100644
--- a/base/version_unittest.cc
+++ b/base/version_unittest.cc
@@ -53,7 +53,7 @@ TEST(VersionTest, GetVersionFromString) {
{"f.1", 0, false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
Version version(cases[i].input);
EXPECT_EQ(cases[i].success, version.IsValid());
if (cases[i].success)
@@ -78,7 +78,7 @@ TEST(VersionTest, Compare) {
{"1.0.0", "1.0", 0},
{"1.0.3", "1.0.20", -1},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
Version lhs(cases[i].lhs);
Version rhs(cases[i].rhs);
EXPECT_EQ(lhs.CompareTo(rhs), cases[i].expected) <<
@@ -108,7 +108,7 @@ TEST(VersionTest, CompareToWildcardString) {
{"1.3.9", "1.3.*", 0},
{"1.2.0.0.0.0", "1.2.*", 0},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
const Version version(cases[i].lhs);
const int result = version.CompareToWildcardString(cases[i].rhs);
EXPECT_EQ(result, cases[i].expected) << cases[i].lhs << "?" << cases[i].rhs;
@@ -132,7 +132,7 @@ TEST(VersionTest, IsValidWildcardString) {
{"*", false},
{"*.2", false},
};
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ for (size_t i = 0; i < arraysize(cases); ++i) {
EXPECT_EQ(Version::IsValidWildcardString(cases[i].version),
cases[i].expected) << cases[i].version << "?" << cases[i].expected;
}