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, ...@@ -98,10 +98,13 @@ static bool ParseFontSize(const CharacterType* characters,
// Step 8 // Step 8
int value; int value;
if (digits.Is8Bit()) if (digits.Is8Bit()) {
value = CharactersToIntStrict(digits.Characters8(), digits.length()); value =
else CharactersToIntStrict(digits.Characters8(), digits.length(), nullptr);
value = CharactersToIntStrict(digits.Characters16(), digits.length()); } else {
value =
CharactersToIntStrict(digits.Characters16(), digits.length(), nullptr);
}
// Step 9 // Step 9
if (mode == kRelativePlus) if (mode == kRelativePlus)
......
...@@ -42,8 +42,8 @@ static inline int PartialStringToInt(const String& string, ...@@ -42,8 +42,8 @@ static inline int PartialStringToInt(const String& string,
size_t start, size_t start,
size_t end) { size_t end) {
if (string.Is8Bit()) if (string.Is8Bit())
return CharactersToInt(string.Characters8() + start, end - start); return CharactersToInt(string.Characters8() + start, end - start, nullptr);
return CharactersToInt(string.Characters16() + start, end - start); return CharactersToInt(string.Characters16() + start, end - start, nullptr);
} }
} // namespace } // namespace
......
...@@ -11,14 +11,11 @@ ...@@ -11,14 +11,11 @@
namespace WTF { namespace WTF {
// string -> int. // string -> int.
WTF_EXPORT int CharactersToIntStrict(const LChar*, size_t, bool* ok = 0); WTF_EXPORT int CharactersToIntStrict(const LChar*, size_t, bool* ok);
WTF_EXPORT int CharactersToIntStrict(const UChar*, size_t, bool* ok = 0); WTF_EXPORT int CharactersToIntStrict(const UChar*, size_t, bool* ok);
WTF_EXPORT int CharactersToInt(const LChar*, // The following two functions ignore trailing garbage.
size_t, WTF_EXPORT int CharactersToInt(const LChar*, size_t, bool* ok);
bool* ok = 0); // ignores trailing garbage WTF_EXPORT int CharactersToInt(const UChar*, size_t, bool* ok);
WTF_EXPORT int CharactersToInt(const UChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
enum class NumberParsingState { enum class NumberParsingState {
kSuccess, kSuccess,
...@@ -32,16 +29,13 @@ enum class NumberParsingState { ...@@ -32,16 +29,13 @@ enum class NumberParsingState {
// string -> unsigned. // string -> unsigned.
// These functions do not accept "-0". // These functions do not accept "-0".
WTF_EXPORT unsigned CharactersToUIntStrict(const LChar*, 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 = 0); 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 LChar*, size_t, bool* ok);
WTF_EXPORT unsigned HexCharactersToUIntStrict(const UChar*, size_t, bool* ok); WTF_EXPORT unsigned HexCharactersToUIntStrict(const UChar*, size_t, bool* ok);
WTF_EXPORT unsigned CharactersToUInt(const LChar*, // The following two functions ignore trailing garbage.
size_t, WTF_EXPORT unsigned CharactersToUInt(const LChar*, size_t, bool* ok);
bool* ok = 0); // ignores trailing garbage WTF_EXPORT unsigned CharactersToUInt(const UChar*, size_t, bool* ok);
WTF_EXPORT unsigned CharactersToUInt(const UChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
// NumberParsingState versions of CharactersToUIntStrict. They can detect // NumberParsingState versions of CharactersToUIntStrict. They can detect
// overflow. |NumberParsingState*| should not be nullptr; // overflow. |NumberParsingState*| should not be nullptr;
...@@ -53,31 +47,19 @@ WTF_EXPORT unsigned CharactersToUIntStrict(const UChar*, ...@@ -53,31 +47,19 @@ WTF_EXPORT unsigned CharactersToUIntStrict(const UChar*,
NumberParsingState*); NumberParsingState*);
// string -> int64_t. // string -> int64_t.
WTF_EXPORT int64_t CharactersToInt64Strict(const LChar*, size_t, bool* ok = 0); WTF_EXPORT int64_t CharactersToInt64Strict(const LChar*, size_t, bool* ok);
WTF_EXPORT int64_t CharactersToInt64Strict(const UChar*, size_t, bool* ok = 0); WTF_EXPORT int64_t CharactersToInt64Strict(const UChar*, size_t, bool* ok);
WTF_EXPORT int64_t CharactersToInt64(const LChar*, // The following two functions ignore trailing garbage.
size_t, WTF_EXPORT int64_t CharactersToInt64(const LChar*, size_t, bool* ok);
bool* ok = 0); // ignores trailing garbage WTF_EXPORT int64_t CharactersToInt64(const UChar*, size_t, bool* ok);
WTF_EXPORT int64_t CharactersToInt64(const UChar*,
size_t,
bool* ok = 0); // ignores trailing garbage
// string -> uint64_t. // string -> uint64_t.
// These functions do not accept "-0". // These functions do not accept "-0".
WTF_EXPORT uint64_t CharactersToUInt64Strict(const LChar*, WTF_EXPORT uint64_t CharactersToUInt64Strict(const LChar*, size_t, bool* ok);
size_t, WTF_EXPORT uint64_t CharactersToUInt64Strict(const UChar*, size_t, bool* ok);
bool* ok = 0); // The following two functions ignore trailing garbage.
WTF_EXPORT uint64_t CharactersToUInt64Strict(const UChar*, WTF_EXPORT uint64_t CharactersToUInt64(const LChar*, size_t, bool* ok);
size_t, WTF_EXPORT uint64_t CharactersToUInt64(const UChar*, size_t, bool* ok);
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
// FIXME: Like the strict functions above, these give false for "ok" when there // 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 // is trailing garbage. Like the non-strict functions above, these return the
...@@ -85,8 +67,8 @@ CharactersToUInt64(const UChar*, ...@@ -85,8 +67,8 @@ CharactersToUInt64(const UChar*,
// consistent with the above functions instead. // consistent with the above functions instead.
// //
// string -> double. // string -> double.
WTF_EXPORT double CharactersToDouble(const LChar*, 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 = 0); WTF_EXPORT double CharactersToDouble(const UChar*, size_t, bool* ok);
WTF_EXPORT double CharactersToDouble(const LChar*, WTF_EXPORT double CharactersToDouble(const LChar*,
size_t, size_t,
size_t& parsed_length); size_t& parsed_length);
...@@ -95,8 +77,8 @@ WTF_EXPORT double CharactersToDouble(const UChar*, ...@@ -95,8 +77,8 @@ WTF_EXPORT double CharactersToDouble(const UChar*,
size_t& parsed_length); size_t& parsed_length);
// string -> float. // string -> float.
WTF_EXPORT float CharactersToFloat(const LChar*, 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 = 0); 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 LChar*, size_t, size_t& parsed_length);
WTF_EXPORT float CharactersToFloat(const UChar*, 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