| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "wtf/text/StringConcatenate.h" | 7 #include "wtf/text/StringConcatenate.h" |
| 8 | 8 |
| 9 // This macro is helpful for testing how many intermediate Strings are created w
hile evaluating an | 9 // This macro is helpful for testing how many intermediate Strings are created w
hile evaluating an |
| 10 // expression containing operator+. | 10 // expression containing operator+. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 StringImpl::copyChars(destination, m_buffer, m_length); | 42 StringImpl::copyChars(destination, m_buffer, m_length); |
| 43 } | 43 } |
| 44 | 44 |
| 45 WTF::StringTypeAdapter<const UChar*>::StringTypeAdapter(const UChar* buffer) | 45 WTF::StringTypeAdapter<const UChar*>::StringTypeAdapter(const UChar* buffer) |
| 46 : m_buffer(buffer) | 46 : m_buffer(buffer) |
| 47 { | 47 { |
| 48 size_t len = 0; | 48 size_t len = 0; |
| 49 while (m_buffer[len] != UChar(0)) | 49 while (m_buffer[len] != UChar(0)) |
| 50 ++len; | 50 ++len; |
| 51 | 51 |
| 52 RELEASE_ASSERT(len <= std::numeric_limits<unsigned>::max()); | 52 CHECK_LE(len, std::numeric_limits<unsigned>::max()); |
| 53 | 53 |
| 54 m_length = len; | 54 m_length = len; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void WTF::StringTypeAdapter<const UChar*>::writeTo(UChar* destination) | 57 void WTF::StringTypeAdapter<const UChar*>::writeTo(UChar* destination) |
| 58 { | 58 { |
| 59 memcpy(destination, m_buffer, m_length * sizeof(UChar)); | 59 memcpy(destination, m_buffer, m_length * sizeof(UChar)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 WTF::StringTypeAdapter<const char*>::StringTypeAdapter(const char* buffer) | 62 WTF::StringTypeAdapter<const char*>::StringTypeAdapter(const char* buffer) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 destination[i] = data[i]; | 140 destination[i] = data[i]; |
| 141 } else { | 141 } else { |
| 142 const UChar* data = m_buffer.characters16(); | 142 const UChar* data = m_buffer.characters16(); |
| 143 for (unsigned i = 0; i < length; ++i) | 143 for (unsigned i = 0; i < length; ++i) |
| 144 destination[i] = data[i]; | 144 destination[i] = data[i]; |
| 145 } | 145 } |
| 146 | 146 |
| 147 WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING(); | 147 WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING(); |
| 148 } | 148 } |
| 149 | 149 |
| OLD | NEW |