OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "wtf/text/StringToNumber.h" | 5 #include "wtf/text/StringToNumber.h" |
6 | 6 |
| 7 #include <type_traits> |
7 #include "wtf/ASCIICType.h" | 8 #include "wtf/ASCIICType.h" |
8 #include "wtf/dtoa.h" | 9 #include "wtf/dtoa.h" |
9 #include "wtf/text/StringImpl.h" | 10 #include "wtf/text/StringImpl.h" |
10 #include <type_traits> | |
11 | 11 |
12 namespace WTF { | 12 namespace WTF { |
13 | 13 |
14 static bool isCharacterAllowedInBase(UChar c, int base) { | 14 static bool isCharacterAllowedInBase(UChar c, int base) { |
15 if (c > 0x7F) | 15 if (c > 0x7F) |
16 return false; | 16 return false; |
17 if (isASCIIDigit(c)) | 17 if (isASCIIDigit(c)) |
18 return c - '0' < base; | 18 return c - '0' < base; |
19 if (isASCIIAlpha(c)) { | 19 if (isASCIIAlpha(c)) { |
20 if (base > 36) | 20 if (base > 36) |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 float charactersToFloat(const UChar* data, | 313 float charactersToFloat(const UChar* data, |
314 size_t length, | 314 size_t length, |
315 size_t& parsedLength) { | 315 size_t& parsedLength) { |
316 // FIXME: This will return ok even when the string fits into a double but | 316 // FIXME: This will return ok even when the string fits into a double but |
317 // not a float. | 317 // not a float. |
318 return static_cast<float>( | 318 return static_cast<float>( |
319 toDoubleType<UChar, AllowTrailingJunk>(data, length, 0, parsedLength)); | 319 toDoubleType<UChar, AllowTrailingJunk>(data, length, 0, parsedLength)); |
320 } | 320 } |
321 | 321 |
322 } // namespace WTF | 322 } // namespace WTF |
OLD | NEW |