Changeset 172735 in webkit
- Timestamp:
- Aug 18, 2014 4:22:59 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r172730 r172735 1 2014-08-18 Pratik Solanki <psolanki@apple.com> 2 3 Use modern for loop instead of iterators in SharedBufferCF.cpp 4 https://bugs.webkit.org/show_bug.cgi?id=136000 5 6 Reviewed by Andreas Kling. 7 8 * platform/cf/SharedBufferCF.cpp: 9 (WebCore::SharedBuffer::copyBufferAndClear): 10 (WebCore::SharedBuffer::copySomeDataFromDataArray): 11 (WebCore::SharedBuffer::maybeAppendDataArray): Use auto& instead of auto for less RetainPtr/refcount churn. 12 1 13 2014-08-18 Antti Koivisto <antti@apple.com> 2 14 -
trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp
r171526 r172735 158 158 159 159 CFIndex bytesLeft = bytesToCopy; 160 Vector<RetainPtr<CFDataRef>>::const_iterator end = m_dataArray.end(); 161 for (Vector<RetainPtr<CFDataRef>>::const_iterator it = m_dataArray.begin(); it != end; ++it) { 162 CFIndex dataLen = CFDataGetLength(it->get()); 160 for (auto& cfData : m_dataArray) { 161 CFIndex dataLen = CFDataGetLength(cfData.get()); 163 162 ASSERT(bytesLeft >= dataLen); 164 memcpy(destination, CFDataGetBytePtr( it->get()), dataLen);163 memcpy(destination, CFDataGetBytePtr(cfData.get()), dataLen); 165 164 destination += dataLen; 166 165 bytesLeft -= dataLen; … … 171 170 unsigned SharedBuffer::copySomeDataFromDataArray(const char*& someData, unsigned position) const 172 171 { 173 Vector<RetainPtr<CFDataRef>>::const_iterator end = m_dataArray.end();174 172 unsigned totalOffset = 0; 175 for ( Vector<RetainPtr<CFDataRef>>::const_iterator it = m_dataArray.begin(); it != end; ++it) {176 unsigned dataLen = static_cast<unsigned>(CFDataGetLength( it->get()));173 for (auto& cfData : m_dataArray) { 174 unsigned dataLen = static_cast<unsigned>(CFDataGetLength(cfData.get())); 177 175 ASSERT(totalOffset <= position); 178 176 unsigned localOffset = position - totalOffset; 179 177 if (localOffset < dataLen) { 180 someData = reinterpret_cast<const char *>(CFDataGetBytePtr( it->get())) + localOffset;178 someData = reinterpret_cast<const char *>(CFDataGetBytePtr(cfData.get())) + localOffset; 181 179 return dataLen - localOffset; 182 180 } … … 206 204 unsigned originalSize = size(); 207 205 #endif 208 for (auto cfData : data->m_dataArray)206 for (auto& cfData : data->m_dataArray) 209 207 append(cfData.get()); 210 208 ASSERT(size() == originalSize + data->size());
Note: See TracChangeset
for help on using the changeset viewer.