OLD | NEW |
1 /**************************************************************** | 1 /**************************************************************** |
2 * | 2 * |
3 * The author of this software is David M. Gay. | 3 * The author of this software is David M. Gay. |
4 * | 4 * |
5 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. | 5 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. |
6 * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights
reserved. |
7 * | 7 * |
8 * Permission to use, copy, modify, and distribute this software for any | 8 * Permission to use, copy, modify, and distribute this software for any |
9 * purpose without fee is hereby granted, provided that this entire notice | 9 * purpose without fee is hereby granted, provided that this entire notice |
10 * is included in all copies of any software which is or includes a copy | 10 * is included in all copies of any software which is or includes a copy |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 // FIXME: Zeros should be stripped before the 'e'. | 1240 // FIXME: Zeros should be stripped before the 'e'. |
1241 if (memchr(buffer, 'e', length)) | 1241 if (memchr(buffer, 'e', length)) |
1242 return builder.Finalize(); | 1242 return builder.Finalize(); |
1243 | 1243 |
1244 size_t decimalPointPosition = 0; | 1244 size_t decimalPointPosition = 0; |
1245 for (; decimalPointPosition < length; ++decimalPointPosition) { | 1245 for (; decimalPointPosition < length; ++decimalPointPosition) { |
1246 if (buffer[decimalPointPosition] == '.') | 1246 if (buffer[decimalPointPosition] == '.') |
1247 break; | 1247 break; |
1248 } | 1248 } |
1249 | 1249 |
1250 // No decimal seperator found, early exit. | 1250 // No decimal separator found, early exit. |
1251 if (decimalPointPosition == length) | 1251 if (decimalPointPosition == length) |
1252 return builder.Finalize(); | 1252 return builder.Finalize(); |
1253 | 1253 |
1254 size_t truncatedLength = length - 1; | 1254 size_t truncatedLength = length - 1; |
1255 for (; truncatedLength > decimalPointPosition; --truncatedLength) { | 1255 for (; truncatedLength > decimalPointPosition; --truncatedLength) { |
1256 if (buffer[truncatedLength] != '0') | 1256 if (buffer[truncatedLength] != '0') |
1257 break; | 1257 break; |
1258 } | 1258 } |
1259 | 1259 |
1260 // No trailing zeros found to strip. | 1260 // No trailing zeros found to strip. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 { | 1311 { |
1312 Vector<LChar> conversionBuffer(length); | 1312 Vector<LChar> conversionBuffer(length); |
1313 for (size_t i = 0; i < length; ++i) | 1313 for (size_t i = 0; i < length; ++i) |
1314 conversionBuffer[i] = isASCII(string[i]) ? string[i] : 0; | 1314 conversionBuffer[i] = isASCII(string[i]) ? string[i] : 0; |
1315 return parseDouble(conversionBuffer.data(), length, parsedLength); | 1315 return parseDouble(conversionBuffer.data(), length, parsedLength); |
1316 } | 1316 } |
1317 | 1317 |
1318 } // namespace Internal | 1318 } // namespace Internal |
1319 | 1319 |
1320 } // namespace WTF | 1320 } // namespace WTF |
OLD | NEW |