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 "config.h" | 7 #include "config.h" |
8 #include "StringConcatenate.h" | 8 #include "StringConcatenate.h" |
9 | 9 |
10 // This macro is helpful for testing how many intermediate Strings are created w
hile evaluating an | 10 // This macro is helpful for testing how many intermediate Strings are created w
hile evaluating an |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void WTF::StringTypeAdapter<const LChar*>::writeTo(LChar* destination) | 88 void WTF::StringTypeAdapter<const LChar*>::writeTo(LChar* destination) |
89 { | 89 { |
90 memcpy(destination, m_buffer, static_cast<size_t>(m_length) * sizeof(LChar))
; | 90 memcpy(destination, m_buffer, static_cast<size_t>(m_length) * sizeof(LChar))
; |
91 } | 91 } |
92 | 92 |
93 void WTF::StringTypeAdapter<const LChar*>::writeTo(UChar* destination) | 93 void WTF::StringTypeAdapter<const LChar*>::writeTo(UChar* destination) |
94 { | 94 { |
95 StringImpl::copyChars(destination, m_buffer, m_length); | 95 StringImpl::copyChars(destination, m_buffer, m_length); |
96 } | 96 } |
97 | 97 |
98 void WTF::StringTypeAdapter<Vector<char> >::writeTo(LChar* destination) | 98 void WTF::StringTypeAdapter<Vector<char>>::writeTo(LChar* destination) |
99 { | 99 { |
100 for (size_t i = 0; i < m_buffer.size(); ++i) | 100 for (size_t i = 0; i < m_buffer.size(); ++i) |
101 destination[i] = static_cast<unsigned char>(m_buffer[i]); | 101 destination[i] = static_cast<unsigned char>(m_buffer[i]); |
102 } | 102 } |
103 | 103 |
104 void WTF::StringTypeAdapter<Vector<char> >::writeTo(UChar* destination) | 104 void WTF::StringTypeAdapter<Vector<char>>::writeTo(UChar* destination) |
105 { | 105 { |
106 for (size_t i = 0; i < m_buffer.size(); ++i) | 106 for (size_t i = 0; i < m_buffer.size(); ++i) |
107 destination[i] = static_cast<unsigned char>(m_buffer[i]); | 107 destination[i] = static_cast<unsigned char>(m_buffer[i]); |
108 } | 108 } |
109 | 109 |
110 void WTF::StringTypeAdapter<Vector<LChar> >::writeTo(LChar* destination) | 110 void WTF::StringTypeAdapter<Vector<LChar>>::writeTo(LChar* destination) |
111 { | 111 { |
112 for (size_t i = 0; i < m_buffer.size(); ++i) | 112 for (size_t i = 0; i < m_buffer.size(); ++i) |
113 destination[i] = m_buffer[i]; | 113 destination[i] = m_buffer[i]; |
114 } | 114 } |
115 | 115 |
116 void WTF::StringTypeAdapter<Vector<LChar> >::writeTo(UChar* destination) | 116 void WTF::StringTypeAdapter<Vector<LChar>>::writeTo(UChar* destination) |
117 { | 117 { |
118 for (size_t i = 0; i < m_buffer.size(); ++i) | 118 for (size_t i = 0; i < m_buffer.size(); ++i) |
119 destination[i] = m_buffer[i]; | 119 destination[i] = m_buffer[i]; |
120 } | 120 } |
121 | 121 |
122 void WTF::StringTypeAdapter<String>::writeTo(LChar* destination) | 122 void WTF::StringTypeAdapter<String>::writeTo(LChar* destination) |
123 { | 123 { |
124 unsigned length = m_buffer.length(); | 124 unsigned length = m_buffer.length(); |
125 | 125 |
126 ASSERT(is8Bit()); | 126 ASSERT(is8Bit()); |
(...skipping 14 matching lines...) Expand all Loading... |
141 destination[i] = data[i]; | 141 destination[i] = data[i]; |
142 } else { | 142 } else { |
143 const UChar* data = m_buffer.characters16(); | 143 const UChar* data = m_buffer.characters16(); |
144 for (unsigned i = 0; i < length; ++i) | 144 for (unsigned i = 0; i < length; ++i) |
145 destination[i] = data[i]; | 145 destination[i] = data[i]; |
146 } | 146 } |
147 | 147 |
148 WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING(); | 148 WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING(); |
149 } | 149 } |
150 | 150 |
OLD | NEW |