| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 if (m_is8Bit) { | 193 if (m_is8Bit) { |
| 194 ensureBuffer8(length); | 194 ensureBuffer8(length); |
| 195 m_string = String(); | 195 m_string = String(); |
| 196 m_buffer8->append(characters, length); | 196 m_buffer8->append(characters, length); |
| 197 m_length += length; | 197 m_length += length; |
| 198 return; | 198 return; |
| 199 } | 199 } |
| 200 | 200 |
| 201 ensureBuffer16(length); | 201 ensureBuffer16(length); |
| 202 m_string = String(); | 202 m_string = String(); |
| 203 m_buffer16->reserveCapacity(m_buffer16->size() + length); | 203 m_buffer16->append(characters, length); |
| 204 for (size_t i = 0; i < length; ++i) | |
| 205 m_buffer16->uncheckedAppend(characters[i]); | |
| 206 m_length += length; | 204 m_length += length; |
| 207 } | 205 } |
| 208 | 206 |
| 209 template<typename IntegerType> | 207 template<typename IntegerType> |
| 210 static void appendIntegerInternal(StringBuilder& builder, IntegerType input) | 208 static void appendIntegerInternal(StringBuilder& builder, IntegerType input) |
| 211 { | 209 { |
| 212 IntegerToStringConverter<IntegerType> converter(input); | 210 IntegerToStringConverter<IntegerType> converter(input); |
| 213 builder.append(converter.characters8(), converter.length()); | 211 builder.append(converter.characters8(), converter.length()); |
| 214 } | 212 } |
| 215 | 213 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 243 appendIntegerInternal(*this, number); | 241 appendIntegerInternal(*this, number); |
| 244 } | 242 } |
| 245 | 243 |
| 246 void StringBuilder::appendNumber(double number, unsigned precision, TrailingZero
sTruncatingPolicy trailingZerosTruncatingPolicy) | 244 void StringBuilder::appendNumber(double number, unsigned precision, TrailingZero
sTruncatingPolicy trailingZerosTruncatingPolicy) |
| 247 { | 245 { |
| 248 NumberToStringBuffer buffer; | 246 NumberToStringBuffer buffer; |
| 249 append(numberToFixedPrecisionString(number, precision, buffer, trailingZeros
TruncatingPolicy == TruncateTrailingZeros)); | 247 append(numberToFixedPrecisionString(number, precision, buffer, trailingZeros
TruncatingPolicy == TruncateTrailingZeros)); |
| 250 } | 248 } |
| 251 | 249 |
| 252 } // namespace WTF | 250 } // namespace WTF |
| OLD | NEW |