| 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. | 6 * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * | 8 * |
| 9 * Permission to use, copy, modify, and distribute this software for any | 9 * Permission to use, copy, modify, and distribute this software for any |
| 10 * purpose without fee is hereby granted, provided that this entire notice | 10 * purpose without fee is hereby granted, provided that this entire notice |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (buffer[truncatedLength] != '0') | 73 if (buffer[truncatedLength] != '0') |
| 74 break; | 74 break; |
| 75 } | 75 } |
| 76 | 76 |
| 77 // No trailing zeros found to strip. | 77 // No trailing zeros found to strip. |
| 78 if (truncatedLength == length - 1) | 78 if (truncatedLength == length - 1) |
| 79 return builder.Finalize(); | 79 return builder.Finalize(); |
| 80 | 80 |
| 81 // If we removed all trailing zeros, remove the decimal point as well. | 81 // If we removed all trailing zeros, remove the decimal point as well. |
| 82 if (truncatedLength == decimalPointPosition) { | 82 if (truncatedLength == decimalPointPosition) { |
| 83 ASSERT(truncatedLength > 0); | 83 DCHECK_GT(truncatedLength, 0u); |
| 84 --truncatedLength; | 84 --truncatedLength; |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Truncate the StringBuilder, and return the final result. | 87 // Truncate the StringBuilder, and return the final result. |
| 88 builder.SetPosition(truncatedLength + 1); | 88 builder.SetPosition(truncatedLength + 1); |
| 89 return builder.Finalize(); | 89 return builder.Finalize(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 const char* numberToFixedPrecisionString(double d, | 92 const char* numberToFixedPrecisionString(double d, |
| 93 unsigned significantFigures, | 93 unsigned significantFigures, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 size_t& parsedLength) { | 138 size_t& parsedLength) { |
| 139 Vector<LChar> conversionBuffer(length); | 139 Vector<LChar> conversionBuffer(length); |
| 140 for (size_t i = 0; i < length; ++i) | 140 for (size_t i = 0; i < length; ++i) |
| 141 conversionBuffer[i] = isASCII(string[i]) ? string[i] : 0; | 141 conversionBuffer[i] = isASCII(string[i]) ? string[i] : 0; |
| 142 return parseDouble(conversionBuffer.data(), length, parsedLength); | 142 return parseDouble(conversionBuffer.data(), length, parsedLength); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace Internal | 145 } // namespace Internal |
| 146 | 146 |
| 147 } // namespace WTF | 147 } // namespace WTF |
| OLD | NEW |