Commit 46dc1cac authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Remove |ok| default argument for CharactersToType() functions.

Almost all callsites specify the |ok| argument. We should not use default
argument for rare cases.

Bug: 746157
Change-Id: I1cbc3491a510666a4269a6c993e0d811c29ecf5c
Reviewed-on: https://chromium-review.googlesource.com/579108Reviewed-by: default avatarTakayoshi Kochi <kochi@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488456}
parent c30954c5
......@@ -98,10 +98,13 @@ static bool ParseFontSize(const CharacterType* characters,
// Step 8
int value;
if (digits.Is8Bit())
value = CharactersToIntStrict(digits.Characters8(), digits.length());
else
value = CharactersToIntStrict(digits.Characters16(), digits.length());
if (digits.Is8Bit()) {
value =
CharactersToIntStrict(digits.Characters8(), digits.length(), nullptr);
} else {
value =
CharactersToIntStrict(digits.Characters16(), digits.length(), nullptr);
}
// Step 9
if (mode == kRelativePlus)
......
......@@ -42,8 +42,8 @@ static inline int PartialStringToInt(const String& string,
size_t start,
size_t end) {
if (string.Is8Bit())
return CharactersToInt(string.Characters8() + start, end - start);
return CharactersToInt(string.Characters16() + start, end - start);
return CharactersToInt(string.Characters8() + start, end - start, nullptr);
return CharactersToInt(string.Characters16() + start, end - start, nullptr);
}
} // namespace
......
......@@ -11,14 +11,11 @@
namespace WTF {
// string -> int.
WTF_EXPORT int CharactersToIntStrict(const LChar*, size_t, bool* ok = 0);
WTF_EXPORT int CharactersToIntStrict(const UChar*, size_t, bool* ok = 0);
WTF_EXPORT int CharactersToInt(const LChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
WTF_EXPORT int CharactersToInt(const UChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
WTF_EXPORT int CharactersToIntStrict(const LChar*, size_t, bool* ok);
WTF_EXPORT int CharactersToIntStrict(const UChar*, size_t, bool* ok);
// The following two functions ignore trailing garbage.
WTF_EXPORT int CharactersToInt(const LChar*, size_t, bool* ok);
WTF_EXPORT int CharactersToInt(const UChar*, size_t, bool* ok);
enum class NumberParsingState {
kSuccess,
......@@ -32,16 +29,13 @@ enum class NumberParsingState {
// string -> unsigned.
// These functions do not accept "-0".
WTF_EXPORT unsigned CharactersToUIntStrict(const LChar*, size_t, bool* ok = 0);
WTF_EXPORT unsigned CharactersToUIntStrict(const UChar*, size_t, bool* ok = 0);
WTF_EXPORT unsigned CharactersToUIntStrict(const LChar*, size_t, bool* ok);
WTF_EXPORT unsigned CharactersToUIntStrict(const UChar*, size_t, bool* ok);
WTF_EXPORT unsigned HexCharactersToUIntStrict(const LChar*, size_t, bool* ok);
WTF_EXPORT unsigned HexCharactersToUIntStrict(const UChar*, size_t, bool* ok);
WTF_EXPORT unsigned CharactersToUInt(const LChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
WTF_EXPORT unsigned CharactersToUInt(const UChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
// The following two functions ignore trailing garbage.
WTF_EXPORT unsigned CharactersToUInt(const LChar*, size_t, bool* ok);
WTF_EXPORT unsigned CharactersToUInt(const UChar*, size_t, bool* ok);
// NumberParsingState versions of CharactersToUIntStrict. They can detect
// overflow. |NumberParsingState*| should not be nullptr;
......@@ -53,31 +47,19 @@ WTF_EXPORT unsigned CharactersToUIntStrict(const UChar*,
NumberParsingState*);
// string -> int64_t.
WTF_EXPORT int64_t CharactersToInt64Strict(const LChar*, size_t, bool* ok = 0);
WTF_EXPORT int64_t CharactersToInt64Strict(const UChar*, size_t, bool* ok = 0);
WTF_EXPORT int64_t CharactersToInt64(const LChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
WTF_EXPORT int64_t CharactersToInt64(const UChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
WTF_EXPORT int64_t CharactersToInt64Strict(const LChar*, size_t, bool* ok);
WTF_EXPORT int64_t CharactersToInt64Strict(const UChar*, size_t, bool* ok);
// The following two functions ignore trailing garbage.
WTF_EXPORT int64_t CharactersToInt64(const LChar*, size_t, bool* ok);
WTF_EXPORT int64_t CharactersToInt64(const UChar*, size_t, bool* ok);
// string -> uint64_t.
// These functions do not accept "-0".
WTF_EXPORT uint64_t CharactersToUInt64Strict(const LChar*,
size_t,
bool* ok = 0);
WTF_EXPORT uint64_t CharactersToUInt64Strict(const UChar*,
size_t,
bool* ok = 0);
WTF_EXPORT uint64_t
CharactersToUInt64(const LChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
WTF_EXPORT uint64_t
CharactersToUInt64(const UChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
WTF_EXPORT uint64_t CharactersToUInt64Strict(const LChar*, size_t, bool* ok);
WTF_EXPORT uint64_t CharactersToUInt64Strict(const UChar*, size_t, bool* ok);
// The following two functions ignore trailing garbage.
WTF_EXPORT uint64_t CharactersToUInt64(const LChar*, size_t, bool* ok);
WTF_EXPORT uint64_t CharactersToUInt64(const UChar*, size_t, bool* ok);
// FIXME: Like the strict functions above, these give false for "ok" when there
// is trailing garbage. Like the non-strict functions above, these return the
......@@ -85,8 +67,8 @@ CharactersToUInt64(const UChar*,
// consistent with the above functions instead.
//
// string -> double.
WTF_EXPORT double CharactersToDouble(const LChar*, size_t, bool* ok = 0);
WTF_EXPORT double CharactersToDouble(const UChar*, size_t, bool* ok = 0);
WTF_EXPORT double CharactersToDouble(const LChar*, size_t, bool* ok);
WTF_EXPORT double CharactersToDouble(const UChar*, size_t, bool* ok);
WTF_EXPORT double CharactersToDouble(const LChar*,
size_t,
size_t& parsed_length);
......@@ -95,8 +77,8 @@ WTF_EXPORT double CharactersToDouble(const UChar*,
size_t& parsed_length);
// string -> float.
WTF_EXPORT float CharactersToFloat(const LChar*, size_t, bool* ok = 0);
WTF_EXPORT float CharactersToFloat(const UChar*, size_t, bool* ok = 0);
WTF_EXPORT float CharactersToFloat(const LChar*, size_t, bool* ok);
WTF_EXPORT float CharactersToFloat(const UChar*, size_t, bool* ok);
WTF_EXPORT float CharactersToFloat(const LChar*, size_t, size_t& parsed_length);
WTF_EXPORT float CharactersToFloat(const UChar*, size_t, size_t& parsed_length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment