| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if (m_is8Bit) { | 184 if (m_is8Bit) { |
| 185 ensureBuffer8(); | 185 ensureBuffer8(); |
| 186 m_string = String(); | 186 m_string = String(); |
| 187 m_buffer8->append(characters, length); | 187 m_buffer8->append(characters, length); |
| 188 m_length += length; | 188 m_length += length; |
| 189 return; | 189 return; |
| 190 } | 190 } |
| 191 | 191 |
| 192 ensureBuffer16(); | 192 ensureBuffer16(); |
| 193 m_string = String(); | 193 m_string = String(); |
| 194 m_buffer16->reserveCapacity(m_buffer16->size() + length); | 194 m_buffer16->append(characters, length); |
| 195 for (size_t i = 0; i < length; ++i) | |
| 196 m_buffer16->uncheckedAppend(characters[i]); | |
| 197 m_length += length; | 195 m_length += length; |
| 198 } | 196 } |
| 199 | 197 |
| 200 template<typename IntegerType> | 198 template<typename IntegerType> |
| 201 static void appendIntegerInternal(StringBuilder& builder, IntegerType input) | 199 static void appendIntegerInternal(StringBuilder& builder, IntegerType input) |
| 202 { | 200 { |
| 203 IntegerToStringConverter<IntegerType> converter(input); | 201 IntegerToStringConverter<IntegerType> converter(input); |
| 204 builder.append(converter.characters8(), converter.length()); | 202 builder.append(converter.characters8(), converter.length()); |
| 205 } | 203 } |
| 206 | 204 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 234 appendIntegerInternal(*this, number); | 232 appendIntegerInternal(*this, number); |
| 235 } | 233 } |
| 236 | 234 |
| 237 void StringBuilder::appendNumber(double number, unsigned precision, TrailingZero
sTruncatingPolicy trailingZerosTruncatingPolicy) | 235 void StringBuilder::appendNumber(double number, unsigned precision, TrailingZero
sTruncatingPolicy trailingZerosTruncatingPolicy) |
| 238 { | 236 { |
| 239 NumberToStringBuffer buffer; | 237 NumberToStringBuffer buffer; |
| 240 append(numberToFixedPrecisionString(number, precision, buffer, trailingZeros
TruncatingPolicy == TruncateTrailingZeros)); | 238 append(numberToFixedPrecisionString(number, precision, buffer, trailingZeros
TruncatingPolicy == TruncateTrailingZeros)); |
| 241 } | 239 } |
| 242 | 240 |
| 243 } // namespace WTF | 241 } // namespace WTF |
| OLD | NEW |