Changeset 278619 in webkit
- Timestamp:
- Jun 8, 2021, 10:35:15 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 77 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/CryptographicallyRandomNumber.cpp (modified) (1 diff)
-
WTF/wtf/FastMalloc.h (modified) (1 diff)
-
WTF/wtf/SHA1.h (modified) (1 diff)
-
WTF/wtf/StackCheck.h (modified) (2 diffs)
-
WTF/wtf/URLHelpers.cpp (modified) (1 diff)
-
WTF/wtf/URLParser.cpp (modified) (1 diff)
-
WTF/wtf/cf/URLCF.cpp (modified) (1 diff)
-
WTF/wtf/cocoa/URLCocoa.mm (modified) (1 diff)
-
WTF/wtf/persistence/PersistentCoders.cpp (modified) (2 diffs)
-
WTF/wtf/text/CString.h (modified) (2 diffs)
-
WTF/wtf/text/WTFString.cpp (modified) (1 diff)
-
WTF/wtf/text/cf/StringImplCF.cpp (modified) (2 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp (modified) (1 diff)
-
WebCore/Modules/fetch/FetchBody.cpp (modified) (1 diff)
-
WebCore/Modules/fetch/FetchBodyConsumer.cpp (modified) (3 diffs)
-
WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.cpp (modified) (3 diffs)
-
WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp (modified) (1 diff)
-
WebCore/Modules/webauthn/AuthenticatorResponseData.h (modified) (2 diffs)
-
WebCore/Modules/websockets/WebSocketChannel.cpp (modified) (2 diffs)
-
WebCore/Modules/websockets/WebSocketHandshake.cpp (modified) (2 diffs)
-
WebCore/bindings/js/ScriptBufferSourceProvider.h (modified) (1 diff)
-
WebCore/bindings/js/SerializedScriptValue.cpp (modified) (1 diff)
-
WebCore/contentextensions/SerializedNFA.cpp (modified) (1 diff)
-
WebCore/dom/Node.cpp (modified) (1 diff)
-
WebCore/dom/TextEncoder.cpp (modified) (1 diff)
-
WebCore/dom/TextEncoderStreamEncoder.cpp (modified) (1 diff)
-
WebCore/editing/cocoa/WebContentReaderCocoa.mm (modified) (1 diff)
-
WebCore/html/canvas/WebGLRenderingContextBase.cpp (modified) (1 diff)
-
WebCore/inspector/DOMPatchSupport.cpp (modified) (1 diff)
-
WebCore/loader/TextResourceDecoder.cpp (modified) (1 diff)
-
WebCore/loader/cache/CachedScript.cpp (modified) (2 diffs)
-
WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm (modified) (1 diff)
-
WebCore/platform/cf/SharedBufferCF.cpp (modified) (1 diff)
-
WebCore/platform/generic/KeyedEncoderGeneric.cpp (modified) (1 diff)
-
WebCore/platform/graphics/GraphicsContextGL.cpp (modified) (1 diff)
-
WebCore/platform/graphics/ImageBufferBackend.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp (modified) (1 diff)
-
WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp (modified) (1 diff)
-
WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp (modified) (1 diff)
-
WebCore/platform/graphics/displaylists/DisplayListIterator.cpp (modified) (1 diff)
-
WebCore/platform/image-decoders/gif/GIFImageReader.h (modified) (1 diff)
-
WebCore/platform/mac/SSLKeyGeneratorMac.mm (modified) (1 diff)
-
WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp (modified) (1 diff)
-
WebCore/platform/network/FormDataBuilder.cpp (modified) (1 diff)
-
WebCore/platform/network/SocketStreamHandle.cpp (modified) (1 diff)
-
WebCore/platform/network/cf/ResourceRequestCFNet.cpp (modified) (1 diff)
-
WebCore/platform/network/cf/ResourceRequestCFNet.h (modified) (1 diff)
-
WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (modified) (1 diff)
-
WebCore/platform/network/curl/CurlCacheEntry.cpp (modified) (1 diff)
-
WebCore/platform/sql/SQLiteStatement.cpp (modified) (1 diff)
-
WebCore/testing/MockCDMFactory.cpp (modified) (1 diff)
-
WebDriver/ChangeLog (modified) (1 diff)
-
WebDriver/socket/HTTPParser.cpp (modified) (1 diff)
-
WebDriver/socket/SessionHostSocket.cpp (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp (modified) (1 diff)
-
WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp (modified) (1 diff)
-
WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp (modified) (1 diff)
-
WebKit/NetworkProcess/cache/NetworkCacheDataCurl.cpp (modified) (1 diff)
-
WebKit/NetworkProcess/cache/NetworkCacheKey.cpp (modified) (1 diff)
-
WebKit/NetworkProcess/soup/WebKitDirectoryInputStream.cpp (modified) (1 diff)
-
WebKit/Platform/IPC/ArgumentCoders.cpp (modified) (2 diffs)
-
WebKit/Shared/API/c/cf/WKStringCF.mm (modified) (1 diff)
-
WebKit/Shared/API/c/cf/WKURLCF.mm (modified) (1 diff)
-
WebKit/Shared/ShareableResource.cpp (modified) (1 diff)
-
WebKit/Shared/SharedDisplayListHandle.h (modified) (1 diff)
-
WebKit/Shared/WebCompiledContentRuleList.cpp (modified) (1 diff)
-
WebKit/UIProcess/API/APIWebAuthenticationAssertionResponse.cpp (modified) (1 diff)
-
WebKit/UIProcess/API/C/WKPage.cpp (modified) (1 diff)
-
WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm (modified) (1 diff)
-
WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp (modified) (1 diff)
-
WebKit/WebProcess/Network/WebSocketChannel.cpp (modified) (2 diffs)
-
WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp (modified) (2 diffs)
-
WebKit/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r278618 r278619 1 2021-06-08 Chris Dumez <cdumez@apple.com> 2 3 Reduce use of reinterpret_cast<> in the codebase 4 https://bugs.webkit.org/show_bug.cgi?id=226743 5 6 Reviewed by Darin Adler. 7 8 * wtf/CryptographicallyRandomNumber.cpp: 9 * wtf/FastMalloc.h: 10 (WTF::FastAllocator::allocate): 11 * wtf/SHA1.h: 12 (WTF::SHA1::addBytes): 13 * wtf/StackCheck.h: 14 (WTF::StackCheck::Scope::Scope): 15 (WTF::StackCheck::StackCheck): 16 * wtf/URLHelpers.cpp: 17 (WTF::URLHelpers::userVisibleURL): 18 * wtf/URLParser.cpp: 19 (WTF::URLParser::formURLDecode): 20 * wtf/cf/URLCF.cpp: 21 (WTF::URL::createCFURL const): 22 * wtf/cocoa/URLCocoa.mm: 23 (WTF::URL::createCFURL const): 24 * wtf/persistence/PersistentCoders.cpp: 25 (WTF::Persistence::Coder<CString>::encode): 26 (WTF::Persistence::Coder<String>::encode): 27 * wtf/text/CString.h: 28 * wtf/text/WTFString.cpp: 29 (WTF::String::latin1 const): 30 * wtf/text/cf/StringImplCF.cpp: 31 (WTF::StringImpl::createCFString): 32 1 33 2021-06-08 Devin Rousso <drousso@apple.com> 2 34 -
trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp
r277958 r278619 150 150 Locker locker { m_lock }; 151 151 152 unsigned char* result = reinterpret_cast<unsigned char*>(buffer);152 auto result = static_cast<unsigned char*>(buffer); 153 153 stirIfNeeded(); 154 154 while (length--) { -
trunk/Source/WTF/wtf/FastMalloc.h
r274871 r278619 204 204 T* allocate(size_t count) 205 205 { 206 return reinterpret_cast<T*>(fastMalloc(sizeof(T) * count));206 return static_cast<T*>(fastMalloc(sizeof(T) * count)); 207 207 } 208 208 -
trunk/Source/WTF/wtf/SHA1.h
r251263 r278619 52 52 void addBytes(const CString& input) 53 53 { 54 const char* string = input.data(); 55 addBytes(reinterpret_cast<const uint8_t*>(string), input.length()); 54 addBytes(input.dataAsUInt8Ptr(), input.length()); 56 55 } 57 56 WTF_EXPORT_PRIVATE void addBytes(const uint8_t* input, size_t length); -
trunk/Source/WTF/wtf/StackCheck.h
r261325 r278619 58 58 // 1. break the interval into smaller pieces (i.e. insert more checks), or 59 59 // 2. use a larger reservedZone size. 60 uint8_t* currentStackCheckpoint = reinterpret_cast<uint8_t*>(currentStackPointer());60 uint8_t* currentStackCheckpoint = static_cast<uint8_t*>(currentStackPointer()); 61 61 uint8_t* previousStackCheckpoint = m_checker.m_lastStackCheckpoint; 62 62 RELEASE_ASSERT(previousStackCheckpoint - currentStackCheckpoint > 0); … … 88 88 #if VERIFY_STACK_CHECK_RESERVED_ZONE_SIZE 89 89 , m_ownerThread(&Thread::current()) 90 , m_lastStackCheckpoint( reinterpret_cast<uint8_t*>(currentStackPointer()))90 , m_lastStackCheckpoint(static_cast<uint8_t*>(currentStackPointer())) 91 91 , m_reservedZone(minReservedZone) 92 92 #endif -
trunk/Source/WTF/wtf/URLHelpers.cpp
r278351 r278619 823 823 String userVisibleURL(const CString& url) 824 824 { 825 auto* before = reinterpret_cast<const unsigned char*>(url.data());825 auto* before = url.dataAsUInt8Ptr(); 826 826 int length = url.length(); 827 827 -
trunk/Source/WTF/wtf/URLParser.cpp
r278351 r278619 2793 2793 if (utf8.isNull()) 2794 2794 return std::nullopt; 2795 auto percentDecoded = percentDecode( reinterpret_cast<const LChar*>(utf8.data()), utf8.length());2795 auto percentDecoded = percentDecode(utf8.dataAsUInt8Ptr(), utf8.length()); 2796 2796 return String::fromUTF8ReplacingInvalidSequences(percentDecoded.data(), percentDecoded.size()); 2797 2797 } -
trunk/Source/WTF/wtf/cf/URLCF.cpp
r264382 r278619 53 53 RetainPtr<CFURLRef> cfURL; 54 54 if (LIKELY(m_string.is8Bit() && m_string.isAllASCII())) 55 cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(m_string.characters8()), m_string.length(), kCFStringEncodingUTF8, nullptr, true));55 cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, m_string.characters8(), m_string.length(), kCFStringEncodingUTF8, nullptr, true)); 56 56 else { 57 57 CString utf8 = m_string.utf8(); 58 cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(utf8.data()), utf8.length(), kCFStringEncodingUTF8, nullptr, true));58 cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, utf8.dataAsUInt8Ptr(), utf8.length(), kCFStringEncodingUTF8, nullptr, true)); 59 59 } 60 60 -
trunk/Source/WTF/wtf/cocoa/URLCocoa.mm
r278253 r278619 71 71 RetainPtr<CFURLRef> cfURL; 72 72 if (LIKELY(m_string.is8Bit() && m_string.isAllASCII())) 73 cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(m_string.characters8()), m_string.length(), kCFStringEncodingUTF8, nullptr, true));73 cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, m_string.characters8(), m_string.length(), kCFStringEncodingUTF8, nullptr, true)); 74 74 else { 75 75 CString utf8 = m_string.utf8(); 76 cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(utf8.data()), utf8.length(), kCFStringEncodingUTF8, nullptr, true));76 cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, utf8.dataAsUInt8Ptr(), utf8.length(), kCFStringEncodingUTF8, nullptr, true)); 77 77 } 78 78 -
trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp
r278253 r278619 58 58 uint32_t length = string.length(); 59 59 encoder << length; 60 encoder.encodeFixedLengthData( reinterpret_cast<const uint8_t*>(string.data()), length);60 encoder.encodeFixedLengthData(string.dataAsUInt8Ptr(), length); 61 61 } 62 62 … … 99 99 100 100 if (is8Bit) 101 encoder.encodeFixedLengthData( reinterpret_cast<const uint8_t*>(string.characters8()), length * sizeof(LChar));101 encoder.encodeFixedLengthData(string.characters8(), length); 102 102 else 103 103 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters16()), length * sizeof(UChar)); -
trunk/Source/WTF/wtf/text/CString.h
r264488 r278619 62 62 WTF_EXPORT_PRIVATE CString(const char*); 63 63 WTF_EXPORT_PRIVATE CString(const char*, size_t length); 64 CString(const uint8_t* data, size_t length) : CString(reinterpret_cast<const char*>(data), length) { } 64 65 CString(CStringBuffer* buffer) : m_buffer(buffer) { } 65 66 WTF_EXPORT_PRIVATE static CString newUninitialized(size_t length, char*& characterBuffer); … … 70 71 return m_buffer ? m_buffer->data() : nullptr; 71 72 } 73 74 const uint8_t* dataAsUInt8Ptr() const { return reinterpret_cast<const uint8_t*>(data()); } 75 72 76 WTF_EXPORT_PRIVATE char* mutableData(); 73 77 size_t length() const -
trunk/Source/WTF/wtf/text/WTFString.cpp
r278146 r278619 661 661 662 662 if (is8Bit()) 663 return CString( reinterpret_cast<const char*>(this->characters8()), length);663 return CString(this->characters8(), length); 664 664 665 665 const UChar* characters = this->characters16(); -
trunk/Source/WTF/wtf/text/cf/StringImplCF.cpp
r274324 r278619 120 120 if (!m_length || !isMainThread()) { 121 121 if (is8Bit()) 122 return adoptCF(CFStringCreateWithBytes(nullptr, reinterpret_cast<const UInt8*>(characters8()), m_length, kCFStringEncodingISOLatin1, false));122 return adoptCF(CFStringCreateWithBytes(nullptr, characters8(), m_length, kCFStringEncodingISOLatin1, false)); 123 123 return adoptCF(CFStringCreateWithCharacters(nullptr, reinterpret_cast<const UniChar*>(characters16()), m_length)); 124 124 } … … 131 131 RetainPtr<CFStringRef> string; 132 132 if (is8Bit()) 133 string = adoptCF(CFStringCreateWithBytesNoCopy(allocator, reinterpret_cast<const UInt8*>(characters8()), m_length, kCFStringEncodingISOLatin1, false, kCFAllocatorNull));133 string = adoptCF(CFStringCreateWithBytesNoCopy(allocator, characters8(), m_length, kCFStringEncodingISOLatin1, false, kCFAllocatorNull)); 134 134 else 135 135 string = adoptCF(CFStringCreateWithCharactersNoCopy(allocator, reinterpret_cast<const UniChar*>(characters16()), m_length, kCFAllocatorNull)); -
trunk/Source/WebCore/ChangeLog
r278618 r278619 1 2021-06-08 Chris Dumez <cdumez@apple.com> 2 3 Reduce use of reinterpret_cast<> in the codebase 4 https://bugs.webkit.org/show_bug.cgi?id=226743 5 6 Reviewed by Darin Adler. 7 8 * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: 9 (WebCore::CDMSessionClearKey::generateKeyRequest): 10 * Modules/fetch/FetchBody.cpp: 11 (WebCore::FetchBody::take): 12 * Modules/fetch/FetchBodyConsumer.cpp: 13 (WebCore::FetchBodyConsumer::resolve): 14 (WebCore::FetchBodyConsumer::takeAsBlob): 15 (WebCore::FetchBodyConsumer::takeAsText): 16 * Modules/mediastream/RTCDataChannelRemoteHandler.cpp: 17 (WebCore::RTCDataChannelRemoteHandler::readyToSend): 18 (WebCore::RTCDataChannelRemoteHandler::sendStringData): 19 (WebCore::RTCDataChannelRemoteHandler::sendRawData): 20 * Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp: 21 (WebCore::copyBusData): 22 * Modules/webauthn/AuthenticatorResponseData.h: 23 (WebCore::encodeArrayBuffer): 24 (WebCore::decodeArrayBuffer): 25 * Modules/websockets/WebSocketChannel.cpp: 26 (WebCore::WebSocketChannel::startClosingHandshake): 27 (WebCore::WebSocketChannel::processOutgoingFrameQueue): 28 * Modules/websockets/WebSocketHandshake.cpp: 29 (WebCore::WebSocketHandshake::getExpectedWebSocketAccept): 30 (WebCore::headerHasValidHTTPVersion): 31 * bindings/js/ScriptBufferSourceProvider.h: 32 * bindings/js/SerializedScriptValue.cpp: 33 (WebCore::CloneDeserializer::readString): 34 * contentextensions/SerializedNFA.cpp: 35 (WebCore::ContentExtensions::SerializedNFA::pointerAtOffsetInFile const): 36 * dom/Node.cpp: 37 (WebCore::hashPointer): 38 * dom/TextEncoder.cpp: 39 (WebCore::TextEncoder::encode const): 40 * dom/TextEncoderStreamEncoder.cpp: 41 (WebCore::TextEncoderStreamEncoder::flush): 42 * editing/cocoa/WebContentReaderCocoa.mm: 43 (WebCore::sanitizeMarkupWithArchive): 44 * html/canvas/WebGLRenderingContextBase.cpp: 45 (WebCore::WebGLRenderingContextBase::texImageArrayBufferViewHelper): 46 * inspector/DOMPatchSupport.cpp: 47 (WebCore::addStringToSHA1): 48 * loader/TextResourceDecoder.cpp: 49 (WebCore::TextResourceDecoder::textFromUTF8): 50 * loader/cache/CachedScript.cpp: 51 (WebCore::CachedScript::script): 52 * page/cocoa/ResourceUsageOverlayCocoa.mm: 53 (WebCore::showText): 54 * platform/SharedBufferChunkReader.cpp: 55 (WebCore::SharedBufferChunkReader::nextChunk): 56 * platform/cf/SharedBufferCF.cpp: 57 (WebCore::SharedBuffer::createCFData const): 58 * platform/generic/KeyedEncoderGeneric.cpp: 59 (WebCore::KeyedEncoderGeneric::encodeString): 60 * platform/graphics/GraphicsContextGL.cpp: 61 (WebCore::GraphicsContextGL::packImageData): 62 * platform/graphics/ImageBufferBackend.cpp: 63 (WebCore::ImageBufferBackend::getPixelBuffer const): 64 (WebCore::ImageBufferBackend::putPixelBuffer): 65 * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: 66 (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): 67 * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp: 68 (WebCore::CDMSessionAVFoundationCF::generateKeyRequest): 69 (WebCore::CDMSessionAVFoundationCF::update): 70 * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp: 71 (WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer): 72 * platform/graphics/displaylists/DisplayListItemBuffer.cpp: 73 (WebCore::DisplayList::ItemBuffer::createItemBuffer): 74 * platform/graphics/displaylists/DisplayListIterator.cpp: 75 (WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem): 76 * platform/image-decoders/gif/GIFImageReader.h: 77 (GIFImageReader::data const): 78 * platform/mac/SSLKeyGeneratorMac.mm: 79 (WebCore::signedPublicKeyAndChallengeString): 80 * platform/mediastream/RealtimeMediaSourceCenter.cpp: 81 (WebCore::addStringToSHA1): 82 * platform/network/FormDataBuilder.cpp: 83 (WebCore::FormDataBuilder::encodeStringAsFormData): 84 * platform/network/SocketStreamHandle.cpp: 85 (WebCore::SocketStreamHandle::sendHandshake): 86 * platform/network/cf/ResourceRequestCFNet.cpp: 87 (WebCore::ResourceRequest::doUpdatePlatformRequest): 88 * platform/network/cf/ResourceRequestCFNet.h: 89 (WebCore::httpHeaderValueUsingSuitableEncoding): 90 * platform/network/cf/SocketStreamHandleImplCFNet.cpp: 91 (WebCore::SocketStreamHandleImpl::platformSendInternal): 92 * platform/network/curl/CurlCacheEntry.cpp: 93 (WebCore::CurlCacheEntry::generateBaseFilename): 94 * platform/sql/SQLiteStatement.cpp: 95 (WebCore::SQLiteStatement::columnBlobView): 96 * testing/MockCDMFactory.cpp: 97 (WebCore::MockCDM::sanitizeResponse const): 98 1 99 2021-06-08 Devin Rousso <drousso@apple.com> 2 100 -
trunk/Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp
r277740 r278619 71 71 72 72 bool sawError = false; 73 String keyID = UTF8Encoding().decode( reinterpret_cast_ptr<char*>(m_initData->baseAddress()), m_initData->byteLength(), true, sawError);73 String keyID = UTF8Encoding().decode(static_cast<char*>(m_initData->baseAddress()), m_initData->byteLength(), true, sawError); 74 74 if (sawError) { 75 75 errorCode = WebKitMediaKeyError::MEDIA_KEYERR_CLIENT; -
trunk/Source/WebCore/Modules/fetch/FetchBody.cpp
r278516 r278619 305 305 306 306 if (isArrayBuffer()) 307 return SharedBuffer::create( reinterpret_cast<const char*>(arrayBufferBody().data()), arrayBufferBody().byteLength());307 return SharedBuffer::create(static_cast<const char*>(arrayBufferBody().data()), arrayBufferBody().byteLength()); 308 308 if (isArrayBufferView()) 309 return SharedBuffer::create( reinterpret_cast<const uint8_t*>(arrayBufferViewBody().baseAddress()), arrayBufferViewBody().byteLength());309 return SharedBuffer::create(static_cast<const uint8_t*>(arrayBufferViewBody().baseAddress()), arrayBufferViewBody().byteLength()); 310 310 311 311 return nullptr; -
trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp
r278532 r278619 279 279 data->append(chunk->data, chunk->size); 280 280 else 281 resolveWithTypeAndData(WTFMove(promise), type, contentType, reinterpret_cast<const unsigned char*>(data->data()), data->size());281 resolveWithTypeAndData(WTFMove(promise), type, contentType, data->data(), data->size()); 282 282 }); 283 283 m_sink->pipeFrom(*stream); … … 356 356 357 357 // FIXME: We should try to move m_buffer to Blob without doing extra copy. 358 return blobFromData(context, reinterpret_cast<const unsigned char*>(m_buffer->data()), m_buffer->size(), m_contentType);358 return blobFromData(context, m_buffer->data(), m_buffer->size(), m_contentType); 359 359 } 360 360 … … 365 365 return String(); 366 366 367 auto text = TextResourceDecoder::textFromUTF8( reinterpret_cast<const unsigned char*>(m_buffer->data()), m_buffer->size());367 auto text = TextResourceDecoder::textFromUTF8(m_buffer->data(), m_buffer->size()); 368 368 m_buffer = nullptr; 369 369 return text; -
trunk/Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.cpp
r278516 r278619 81 81 82 82 for (auto& message : m_pendingMessages) 83 m_connection->sendData(m_remoteIdentifier, message.isRaw, reinterpret_cast<const unsigned char*>(message.buffer->data()), message.buffer->size());83 m_connection->sendData(m_remoteIdentifier, message.isRaw, message.buffer->data(), message.buffer->size()); 84 84 m_pendingMessages.clear(); 85 85 … … 101 101 return true; 102 102 } 103 m_connection->sendData(m_remoteIdentifier, false, reinterpret_cast<const unsigned char*>(text.data()), text.length());103 m_connection->sendData(m_remoteIdentifier, false, text.dataAsUInt8Ptr(), text.length()); 104 104 return true; 105 105 } … … 111 111 return true; 112 112 } 113 m_connection->sendData(m_remoteIdentifier, true, reinterpret_cast<const unsigned char*>(data), size);113 m_connection->sendData(m_remoteIdentifier, true, data, size); 114 114 return true; 115 115 } -
trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp
r275510 r278619 44 44 for (size_t channelIndex = 0; channelIndex < bus.numberOfChannels(); ++channelIndex) { 45 45 const auto& channel = *bus.channel(channelIndex); 46 auto offset = reinterpret_cast<size_t>(channelIndex * size);47 memcpy( reinterpret_cast<float*>(mappedBuffer.data() + offset), channel.data(), sizeof(float) * channel.length());46 auto offset = channelIndex * size; 47 memcpy(mappedBuffer.data() + offset, channel.data(), sizeof(float) * channel.length()); 48 48 offsets.uncheckedAppend(offset); 49 49 } -
trunk/Source/WebCore/Modules/webauthn/AuthenticatorResponseData.h
r278253 r278619 60 60 { 61 61 encoder << static_cast<uint64_t>(buffer.byteLength()); 62 encoder.encodeFixedLengthData( reinterpret_cast<const uint8_t*>(buffer.data()), buffer.byteLength(), 1);62 encoder.encodeFixedLengthData(static_cast<const uint8_t*>(buffer.data()), buffer.byteLength(), 1); 63 63 } 64 64 … … 76 76 if (!buffer) 77 77 return nullptr; 78 if (!decoder.decodeFixedLengthData( reinterpret_cast<uint8_t*>(buffer->data()), length.value(), 1))78 if (!decoder.decodeFixedLengthData(static_cast<uint8_t*>(buffer->data()), length.value(), 1)) 79 79 return nullptr; 80 80 return buffer; -
trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp
r278532 r278619 496 496 buf.append(lowByte); 497 497 auto reasonUTF8 = reason.utf8(); 498 buf.append(re interpret_cast<const uint8_t*>(reasonUTF8.data()), reasonUTF8.length());498 buf.append(reasonUTF8.dataAsUInt8Ptr(), reasonUTF8.length()); 499 499 } 500 500 enqueueRawFrame(WebSocketFrame::OpCodeClose, buf.data(), buf.size()); … … 744 744 switch (frame->frameType) { 745 745 case QueuedFrameTypeString: { 746 sendFrame(frame->opCode, reinterpret_cast<const uint8_t*>(frame->stringData.data()), frame->stringData.length(), [this, protectedThis = makeRef(*this)] (bool success) {746 sendFrame(frame->opCode, frame->stringData.dataAsUInt8Ptr(), frame->stringData.length(), [this, protectedThis = makeRef(*this)] (bool success) { 747 747 if (!success) 748 748 fail("Failed to send WebSocket frame."); -
trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
r278532 r278619 103 103 String WebSocketHandshake::getExpectedWebSocketAccept(const String& secWebSocketKey) 104 104 { 105 static const char* const webSocketKeyGUID= "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";105 constexpr uint8_t webSocketKeyGUID[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; 106 106 SHA1 sha1; 107 107 CString keyData = secWebSocketKey.ascii(); 108 sha1.addBytes( reinterpret_cast<const uint8_t*>(keyData.data()), keyData.length());109 sha1.addBytes( reinterpret_cast<const uint8_t*>(webSocketKeyGUID), strlen(webSocketKeyGUID));108 sha1.addBytes(keyData.dataAsUInt8Ptr(), keyData.length()); 109 sha1.addBytes(webSocketKeyGUID, std::size(webSocketKeyGUID) - 1); 110 110 SHA1::Digest hash; 111 111 sha1.computeHash(hash); … … 329 329 static inline bool headerHasValidHTTPVersion(StringView httpStatusLine) 330 330 { 331 const char* httpVersionStaticPreambleLiteral = "HTTP/"; 332 StringView httpVersionStaticPreamble(reinterpret_cast<const LChar*>(httpVersionStaticPreambleLiteral), strlen(httpVersionStaticPreambleLiteral)); 333 if (!httpStatusLine.startsWith(httpVersionStaticPreamble)) 331 constexpr char preamble[] = "HTTP/"; 332 if (!httpStatusLine.startsWith(preamble)) 334 333 return false; 335 334 336 335 // Check that there is a version number which should be at least three characters after "HTTP/" 337 unsigned preambleLength = httpVersionStaticPreamble.length();336 unsigned preambleLength = strlen(preamble); 338 337 if (httpStatusLine.length() < preambleLength + 3) 339 338 return false; -
trunk/Source/WebCore/bindings/js/ScriptBufferSourceProvider.h
r278253 r278619 53 53 54 54 if (!m_containsOnlyASCII) { 55 m_containsOnlyASCII = charactersAreAllASCII( reinterpret_cast<const LChar*>(m_scriptBuffer.buffer()->data()), m_scriptBuffer.buffer()->size());55 m_containsOnlyASCII = charactersAreAllASCII(m_scriptBuffer.buffer()->data(), m_scriptBuffer.buffer()->size()); 56 56 if (*m_containsOnlyASCII) 57 m_scriptHash = StringHasher::computeHashAndMaskTop8Bits( reinterpret_cast<const LChar*>(m_scriptBuffer.buffer()->data()), m_scriptBuffer.buffer()->size());57 m_scriptHash = StringHasher::computeHashAndMaskTop8Bits(m_scriptBuffer.buffer()->data(), m_scriptBuffer.buffer()->size()); 58 58 } 59 59 if (*m_containsOnlyASCII) 60 return { reinterpret_cast<const LChar*>(m_scriptBuffer.buffer()->data()), static_cast<unsigned>(m_scriptBuffer.buffer()->size()) };60 return { m_scriptBuffer.buffer()->data(), static_cast<unsigned>(m_scriptBuffer.buffer()->size()) }; 61 61 62 62 if (!m_cachedScriptString) { -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r278338 r278619 2341 2341 if ((end - ptr) < static_cast<int>(length)) 2342 2342 return false; 2343 str = String (reinterpret_cast<const LChar*>(ptr), length);2343 str = String { ptr, length }; 2344 2344 ptr += length; 2345 2345 return true; -
trunk/Source/WebCore/contentextensions/SerializedNFA.cpp
r278532 r278619 108 108 const T* SerializedNFA::pointerAtOffsetInFile(size_t offset) const 109 109 { 110 return reinterpret_cast<const T*>( reinterpret_cast<const uint8_t*>(m_file.data()) + offset);110 return reinterpret_cast<const T*>(static_cast<const uint8_t*>(m_file.data()) + offset); 111 111 } 112 112 -
trunk/Source/WebCore/dom/Node.cpp
r278058 r278619 1601 1601 } 1602 1602 1603 static SHA1::Digest hashPointer( void* pointer)1603 static SHA1::Digest hashPointer(const void* pointer) 1604 1604 { 1605 1605 SHA1 sha1; -
trunk/Source/WebCore/dom/TextEncoder.cpp
r266621 r278619 41 41 // FIXME: We should not need to allocate a CString to encode into a Uint8Array. 42 42 CString utf8 = input.utf8(); 43 return Uint8Array::tryCreate( reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length());43 return Uint8Array::tryCreate(utf8.dataAsUInt8Ptr(), utf8.length()); 44 44 } 45 45 -
trunk/Source/WebCore/dom/TextEncoderStreamEncoder.cpp
r278516 r278619 78 78 return nullptr; 79 79 80 auto byteSequence = "\xEF\xBF\xBD";81 return Uint8Array::tryCreate( reinterpret_cast<const uint8_t*>(byteSequence), 3);80 constexpr uint8_t byteSequence[] = { 0xEF, 0xBF, 0xBD }; 81 return Uint8Array::tryCreate(byteSequence, std::size(byteSequence)); 82 82 } 83 83 -
trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
r278253 r278619 487 487 Vector<uint8_t> blobBuffer; 488 488 blobBuffer.reserveCapacity(utf8.length()); 489 blobBuffer.append( reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length());489 blobBuffer.append(utf8.dataAsUInt8Ptr(), utf8.length()); 490 490 auto blob = Blob::create(&destinationDocument, WTFMove(blobBuffer), type); 491 491 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r278351 r278619 4963 4963 if (!validateTexFuncData(functionName, sourceType, width, height, depth, format, type, pixels.get(), nullDisposition, srcOffset)) 4964 4964 return; 4965 uint8_t* data = reinterpret_cast<uint8_t*>(pixels ? pixels->baseAddress() : nullptr);4965 auto data = static_cast<uint8_t*>(pixels ? pixels->baseAddress() : nullptr); 4966 4966 if (srcOffset) { 4967 4967 ASSERT(pixels); -
trunk/Source/WebCore/inspector/DOMPatchSupport.cpp
r277740 r278619 398 398 { 399 399 CString cString = string.utf8(); 400 sha1.addBytes( reinterpret_cast<const uint8_t*>(cString.data()), cString.length());400 sha1.addBytes(cString.dataAsUInt8Ptr(), cString.length()); 401 401 } 402 402 -
trunk/Source/WebCore/loader/TextResourceDecoder.cpp
r263022 r278619 334 334 if (shouldPrependBOM(data, length)) 335 335 decoder->decode("\xef\xbb\xbf", 3); 336 return decoder->decodeAndFlush( reinterpret_cast<const char*>(data), length);336 return decoder->decodeAndFlush(data, length); 337 337 } 338 338 -
trunk/Source/WebCore/loader/cache/CachedScript.cpp
r261597 r278619 63 63 && TextEncoding(encoding()).isByteBasedEncoding() 64 64 && m_data->size() 65 && charactersAreAllASCII( reinterpret_cast<const LChar*>(m_data->data()), m_data->size())) {65 && charactersAreAllASCII(m_data->data(), m_data->size())) { 66 66 67 67 m_decodingState = DataAndDecodedStringHaveSameBytes; … … 71 71 m_decodedDataDeletionTimer.stop(); 72 72 73 m_scriptHash = StringHasher::computeHashAndMaskTop8Bits( reinterpret_cast<const LChar*>(m_data->data()), m_data->size());73 m_scriptHash = StringHasher::computeHashAndMaskTop8Bits(m_data->data(), m_data->size()); 74 74 } 75 75 76 76 if (m_decodingState == DataAndDecodedStringHaveSameBytes) 77 return { reinterpret_cast<const LChar*>(m_data->data()), static_cast<unsigned>(m_data->size()) };77 return { m_data->data(), static_cast<unsigned>(m_data->size()) }; 78 78 79 79 if (!m_script) { -
trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm
r277967 r278619 270 270 auto attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); 271 271 CString cstr = text.ascii(); 272 auto string = adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(cstr.data()), cstr.length(), kCFStringEncodingASCII, false, kCFAllocatorNull));272 auto string = adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, cstr.dataAsUInt8Ptr(), cstr.length(), kCFStringEncodingASCII, false, kCFAllocatorNull)); 273 273 auto attributedString = adoptCF(CFAttributedStringCreate(kCFAllocatorDefault, string.get(), attributes.get())); 274 274 auto line = adoptCF(CTLineCreateWithAttributedString(attributedString.get())); -
trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp
r217260 r278619 48 48 return *data; 49 49 } 50 return adoptCF(CFDataCreate(nullptr, reinterpret_cast<const UInt8*>(data()), size()));50 return adoptCF(CFDataCreate(nullptr, data(), size())); 51 51 } 52 52 #endif -
trunk/Source/WebCore/platform/generic/KeyedEncoderGeneric.cpp
r248846 r278619 41 41 auto utf8 = key.utf8(); 42 42 m_encoder << utf8.length(); 43 m_encoder.encodeFixedLengthData( reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length());43 m_encoder.encodeFixedLengthData(utf8.dataAsUInt8Ptr(), utf8.length()); 44 44 } 45 45 -
trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp
r278351 r278619 758 758 data.resize(packedSize); 759 759 760 if (!packPixels( reinterpret_cast<const uint8_t*>(pixels), sourceFormat, sourceImageWidth, sourceImageHeight, sourceImageSubRectangle, depth, sourceUnpackAlignment, unpackImageHeight, format, type, alphaOp, data.data(), flipY))760 if (!packPixels(static_cast<const uint8_t*>(pixels), sourceFormat, sourceImageWidth, sourceImageHeight, sourceImageSubRectangle, depth, sourceUnpackAlignment, unpackImageHeight, format, type, alphaOp, data.data(), flipY)) 761 761 return false; 762 762 if (ImageObserver* observer = image->imageObserver()) -
trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp
r278338 r278619 119 119 { AlphaPremultiplication::Premultiplied, pixelFormat(), colorSpace() }, 120 120 bytesPerRow(), 121 reinterpret_cast<uint8_t*>(data) + sourceRectClipped.y() * source.bytesPerRow + sourceRectClipped.x() * 4121 static_cast<uint8_t*>(data) + sourceRectClipped.y() * source.bytesPerRow + sourceRectClipped.x() * 4 122 122 }; 123 123 … … 160 160 { destinationAlphaFormat, pixelFormat(), colorSpace() }, 161 161 bytesPerRow(), 162 reinterpret_cast<uint8_t*>(data) + destinationRect.y() * destination.bytesPerRow + destinationRect.x() * 4162 static_cast<uint8_t*>(data) + destinationRect.y() * destination.bytesPerRow + destinationRect.x() * 4 163 163 }; 164 164 -
trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp
r278253 r278619 531 531 // A WebVTT header is terminated by "One or more WebVTT line terminators" so append two line feeds to make sure the parser 532 532 // reccognized this string as a full header. 533 StringBuilder header; 534 header.appendCharacters(reinterpret_cast<const unsigned char*>(CFDataGetBytePtr(webvttHeaderData)), length); 535 header.append("\n\n"); 536 537 INFO_LOG(LOGIDENTIFIER, "VTT header ", &header); 538 client()->parseWebVTTFileHeader(header.toString()); 533 auto header = makeString(StringView { CFDataGetBytePtr(webvttHeaderData), length }, "\n\n"); 534 535 INFO_LOG(LOGIDENTIFIER, "VTT header ", header); 536 client()->parseWebVTTFileHeader(WTFMove(header)); 539 537 m_haveReportedVTTHeader = true; 540 538 } while (0); -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp
r237009 r278619 75 75 76 76 auto certificateData = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, certificate->byteLength())); 77 CFDataAppendBytes(certificateData.get(), reinterpret_cast<const UInt8*>(certificate->baseAddress()), certificate->byteLength());77 CFDataAppendBytes(certificateData.get(), certificate->data(), certificate->byteLength()); 78 78 79 79 auto assetStr = keyID.utf8(); 80 80 auto assetID = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, assetStr.length())); 81 CFDataAppendBytes(assetID.get(), reinterpret_cast<const UInt8*>(assetStr.data()), assetStr.length());81 CFDataAppendBytes(assetID.get(), assetStr.dataAsUIntPtr(), assetStr.length()); 82 82 83 83 CFErrorRef cfError = nullptr; … … 111 111 { 112 112 auto keyData = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, key->byteLength())); 113 CFDataAppendBytes(keyData.get(), reinterpret_cast<const UInt8*>(key->baseAddress()), key->byteLength());113 CFDataAppendBytes(keyData.get(), key->data(), key->byteLength()); 114 114 115 115 AVCFAssetResourceLoadingRequestFinishLoadingWithResponse(m_request.get(), nullptr, keyData.get(), nullptr); -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp
r256353 r278619 205 205 206 206 m_sampleInputBuffer.grow(m_sampleInputBuffer.size() + bufferLength); 207 CFDataGetBytes(sampleBuffer->buffer, CFRangeMake(0, bufferLength), reinterpret_cast<UInt8*>(m_sampleInputBuffer.data()) + m_sampleInputBuffer.size() - bufferLength);207 CFDataGetBytes(sampleBuffer->buffer, CFRangeMake(0, bufferLength), m_sampleInputBuffer.data() + m_sampleInputBuffer.size() - bufferLength); 208 208 209 209 buffer = ArrayBuffer::create(m_sampleInputBuffer.data(), m_sampleInputBuffer.size()); -
trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp
r278516 r278619 703 703 704 704 auto newBufferCapacity = std::max(capacity, defaultItemBufferCapacity); 705 auto* buffer = reinterpret_cast<uint8_t*>(fastMalloc(newBufferCapacity));705 auto* buffer = static_cast<uint8_t*>(fastMalloc(newBufferCapacity)); 706 706 m_allocatedBuffers.append(buffer); 707 707 return { ItemBufferIdentifier::generate(), buffer, newBufferCapacity }; -
trunk/Source/WebCore/platform/graphics/displaylists/DisplayListIterator.cpp
r278185 r278619 80 80 81 81 auto paddedSizeOfTypeAndItem = paddedSizeOfTypeAndItemInBytes(itemType); 82 m_currentBufferForItem = paddedSizeOfTypeAndItem <= sizeOfFixedBufferForCurrentItem ? m_fixedBufferForCurrentItem : reinterpret_cast<uint8_t*>(fastMalloc(paddedSizeOfTypeAndItem));82 m_currentBufferForItem = paddedSizeOfTypeAndItem <= sizeOfFixedBufferForCurrentItem ? m_fixedBufferForCurrentItem : static_cast<uint8_t*>(fastMalloc(paddedSizeOfTypeAndItem)); 83 83 if (isInlineItem(itemType)) { 84 84 if (UNLIKELY(static_cast<uint64_t>(m_currentEndOfBuffer - m_cursor) < paddedSizeOfTypeAndItem)) { -
trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.h
r251836 r278619 286 286 void setRemainingBytes(size_t); 287 287 288 const u nsigned char* data(size_t dataPosition) const289 { 290 return reinterpret_cast<const unsigned char*>(m_data->data()) + dataPosition;288 const uint8_t* data(size_t dataPosition) const 289 { 290 return m_data->data() + dataPosition; 291 291 } 292 292 -
trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm
r277740 r278619 190 190 // Length needs to account for the null terminator. 191 191 signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Length = challenge.length() + 1; 192 signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Data = reinterpret_cast<uint8_t*>(const_cast<char*>(challenge.data()));192 signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Data = const_cast<uint8_t*>(challenge.dataAsUInt8Ptr()); 193 193 194 194 CSSM_DATA encodedPublicKeyAndChallenge { 0, nullptr }; -
trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp
r277361 r278619 146 146 147 147 auto utf8 = string.utf8(); 148 sha1.addBytes( reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length() + 1); // Include terminating null byte.148 sha1.addBytes(utf8.dataAsUInt8Ptr(), utf8.length() + 1); // Include terminating null byte. 149 149 } 150 150 -
trunk/Source/WebCore/platform/network/FormDataBuilder.cpp
r266187 r278619 212 212 void encodeStringAsFormData(Vector<char>& buffer, const CString& string) 213 213 { 214 appendFormURLEncoded(buffer, reinterpret_cast<const uint8_t*>(string.data()), string.length());215 } 216 217 } 218 219 } 214 appendFormURLEncoded(buffer, string.dataAsUInt8Ptr(), string.length()); 215 } 216 217 } 218 219 } -
trunk/Source/WebCore/platform/network/SocketStreamHandle.cpp
r278532 r278619 62 62 if (m_state == Connecting || m_state == Closing) 63 63 return completionHandler(false, false); 64 platformSendHandshake( reinterpret_cast<const uint8_t*>(handshake.data()), handshake.length(), WTFMove(headerFieldProxy), WTFMove(completionHandler));64 platformSendHandshake(handshake.dataAsUInt8Ptr(), handshake.length(), WTFMove(headerFieldProxy), WTFMove(completionHandler)); 65 65 } 66 66 -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
r274252 r278619 229 229 if (!partition.isNull() && !partition.isEmpty()) { 230 230 CString utf8String = partition.utf8(); 231 RetainPtr<CFStringRef> partitionValue = adoptCF(CFStringCreateWithBytes(0, reinterpret_cast<const UInt8*>(utf8String.data()), utf8String.length(), kCFStringEncodingUTF8, false));231 RetainPtr<CFStringRef> partitionValue = adoptCF(CFStringCreateWithBytes(0, utf8String.dataAsUInt8Ptr(), utf8String.length(), kCFStringEncodingUTF8, false)); 232 232 _CFURLRequestSetProtocolProperty(cfRequest.get(), _kCFURLCachePartitionKey, partitionValue.get()); 233 233 } -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h
r274180 r278619 132 132 auto utf8Value = header.value.utf8(); 133 133 // Constructing a string with the UTF-8 bytes but claiming that it’s Latin-1 is the way to get CFNetwork to put those UTF-8 bytes on the wire. 134 return adoptCF(CFStringCreateWithBytes(nullptr, reinterpret_cast<const UInt8*>(utf8Value.data()), utf8Value.length(), kCFStringEncodingISOLatin1, false));134 return adoptCF(CFStringCreateWithBytes(nullptr, utf8Value.dataAsUInt8Ptr(), utf8Value.length(), kCFStringEncodingISOLatin1, false)); 135 135 } 136 136 return header.value.createCFString(); -
trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp
r278532 r278619 723 723 return 0; 724 724 725 CFIndex result = CFWriteStreamWrite(m_writeStream.get(), reinterpret_cast<const UInt8*>(data), length);725 CFIndex result = CFWriteStreamWrite(m_writeStream.get(), data, length); 726 726 if (result == -1) 727 727 return std::nullopt; -
trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp
r278532 r278619 212 212 { 213 213 SHA1 sha1; 214 sha1.addBytes( reinterpret_cast<const uint8_t*>(url.data()), url.length());214 sha1.addBytes(url.dataAsUInt8Ptr(), url.length()); 215 215 216 216 SHA1::Digest sum; -
trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp
r277920 r278619 305 305 return { }; 306 306 307 return { reinterpret_cast<const uint8_t*>(blob), static_cast<size_t>(blobSize) };307 return { static_cast<const uint8_t*>(blob), static_cast<size_t>(blobSize) }; 308 308 } 309 309 -
trunk/Source/WebCore/testing/MockCDMFactory.cpp
r278253 r278619 214 214 RefPtr<SharedBuffer> MockCDM::sanitizeResponse(const SharedBuffer& response) const 215 215 { 216 if (!charactersAreAllASCII(re interpret_cast<const LChar*>(response.data()), response.size()))216 if (!charactersAreAllASCII(response.data(), response.size())) 217 217 return nullptr; 218 218 -
trunk/Source/WebDriver/ChangeLog
r278340 r278619 1 2021-06-08 Chris Dumez <cdumez@apple.com> 2 3 Reduce use of reinterpret_cast<> in the codebase 4 https://bugs.webkit.org/show_bug.cgi?id=226743 5 6 Reviewed by Darin Adler. 7 8 * socket/HTTPParser.cpp: 9 (WebDriver::HTTPParser::readLine): 10 * socket/SessionHostSocket.cpp: 11 (WebDriver::SessionHost::sendWebInspectorEvent): 12 1 13 2021-06-01 Darin Adler <darin@apple.com> 2 14 -
trunk/Source/WebDriver/socket/HTTPParser.cpp
r278185 r278619 131 131 return false; 132 132 133 line = String::fromUTF8( reinterpret_cast<char*>(m_buffer.data()), position);133 line = String::fromUTF8(m_buffer.data(), position); 134 134 if (line.isNull()) 135 135 LOG_ERROR("Client error: invalid encoding in HTTP header."); -
trunk/Source/WebDriver/socket/SessionHostSocket.cpp
r278253 r278619 51 51 52 52 const CString message = event.utf8(); 53 send(m_clientID.value(), reinterpret_cast<const uint8_t*>(message.data()), message.length());53 send(m_clientID.value(), message.dataAsUInt8Ptr(), message.length()); 54 54 } 55 55 -
trunk/Source/WebKit/ChangeLog
r278614 r278619 1 2021-06-08 Chris Dumez <cdumez@apple.com> 2 3 Reduce use of reinterpret_cast<> in the codebase 4 https://bugs.webkit.org/show_bug.cgi?id=226743 5 6 Reviewed by Darin Adler. 7 8 * GPUProcess/media/RemoteMediaPlayerProxy.cpp: 9 (WebKit::RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered): 10 * GPUProcess/media/RemoteTextTrackProxy.cpp: 11 (WebKit::RemoteTextTrackProxy::addDataCue): 12 * GPUProcess/webrtc/RemoteMediaRecorder.cpp: 13 (WebKit::RemoteMediaRecorder::fetchData): 14 * NetworkProcess/cache/NetworkCacheDataCurl.cpp: 15 (WebKit::NetworkCache::Data::apply const): 16 * NetworkProcess/cache/NetworkCacheKey.cpp: 17 (WebKit::NetworkCache::hashString): 18 * NetworkProcess/soup/WebKitDirectoryInputStream.cpp: 19 (webkitDirectoryInputStreamRead): 20 * Platform/IPC/ArgumentCoders.cpp: 21 (IPC::ArgumentCoder<CString>::encode): 22 (IPC::ArgumentCoder<String>::encode): 23 * Shared/API/c/cf/WKStringCF.mm: 24 (WKStringCopyCFString): 25 * Shared/API/c/cf/WKURLCF.mm: 26 (WKURLCopyCFURL): 27 * Shared/ShareableResource.cpp: 28 (WebKit::ShareableResource::wrapInSharedBuffer): 29 * Shared/SharedDisplayListHandle.h: 30 (WebKit::SharedDisplayListHandle::data const): 31 * Shared/WebCompiledContentRuleList.cpp: 32 (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const): 33 * UIProcess/API/APIWebAuthenticationAssertionResponse.cpp: 34 (API::WebAuthenticationAssertionResponse::userHandle const): 35 * UIProcess/API/C/WKPage.cpp: 36 (dataFrom): 37 * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm: 38 (WebKit::RedirectSOAuthorizationSession::completeInternal): 39 * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: 40 (WebKit::RemoteInspectorClient::sendWebInspectorEvent): 41 * WebProcess/Network/WebSocketChannel.cpp: 42 (WebKit::WebSocketChannel::createMessageQueue): 43 (WebKit::WebSocketChannel::didReceiveText): 44 * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: 45 (WebKit::RTCDataChannelRemoteManager::sendData): 46 (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData): 47 * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: 48 (WebKit::NetscapePluginStream::sendJavaScriptStream): 49 1 50 2021-06-08 Devin Rousso <drousso@apple.com> 2 51 -
trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp
r278253 r278619 692 692 void RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered(const String& initDataType, RefPtr<ArrayBuffer>&& initData) 693 693 { 694 m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::InitializationDataEncountered(initDataType, IPC::DataReference( reinterpret_cast<uint8_t*>(initData->data()), initData->byteLength())), m_id);694 m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::InitializationDataEncountered(initDataType, IPC::DataReference(static_cast<uint8_t*>(initData->data()), initData->byteLength())), m_id); 695 695 } 696 696 -
trunk/Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp
r278532 r278619 114 114 return; 115 115 116 m_connectionToWebProcess->connection().send(Messages::MediaPlayerPrivateRemote::AddDataCue(m_identifier, start, end, IPC::DataReference( reinterpret_cast<const uint8_t*>(data), length)), m_mediaPlayerIdentifier);116 m_connectionToWebProcess->connection().send(Messages::MediaPlayerPrivateRemote::AddDataCue(m_identifier, start, end, IPC::DataReference(static_cast<const uint8_t*>(data), length)), m_mediaPlayerIdentifier); 117 117 } 118 118 -
trunk/Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp
r277728 r278619 108 108 { 109 109 m_writer->fetchData([completionHandler = WTFMove(completionHandler)](auto&& data, auto timeCode) mutable { 110 auto* pointer = reinterpret_cast<const uint8_t*>(data ? data->data() : nullptr);110 auto* pointer = data ? data->data() : nullptr; 111 111 completionHandler(IPC::DataReference { pointer, data ? data->size() : 0 }, timeCode); 112 112 }); -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataCurl.cpp
r257518 r278619 74 74 return false; 75 75 76 return applier( reinterpret_cast<const uint8_t*>(data()), size());76 return applier(data(), size()); 77 77 } 78 78 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.cpp
r278253 r278619 95 95 auto cString = string.utf8(); 96 96 // Include terminating null byte. 97 sha1.addBytes( reinterpret_cast<const uint8_t*>(cString.data()), cString.length() + 1);97 sha1.addBytes(cString.dataAsUInt8Ptr(), cString.length() + 1); 98 98 } 99 99 -
trunk/Source/WebKit/NetworkProcess/soup/WebKitDirectoryInputStream.cpp
r272409 r278619 152 152 auto* bufferData = g_bytes_get_data(stream->priv->buffer.get(), &bufferSize); 153 153 gsize bytesRead = std::min(bufferSize, count - totalBytesRead); 154 memcpy( reinterpret_cast<char*>(buffer) + totalBytesRead, bufferData, bytesRead);154 memcpy(static_cast<char*>(buffer) + totalBytesRead, bufferData, bytesRead); 155 155 if (bytesRead == bufferSize) 156 156 stream->priv->buffer = nullptr; -
trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp
r278253 r278619 83 83 uint32_t length = string.length(); 84 84 encoder << length; 85 encoder.encodeFixedLengthData( reinterpret_cast<const uint8_t*>(string.data()), length, 1);85 encoder.encodeFixedLengthData(string.dataAsUInt8Ptr(), length, 1); 86 86 } 87 87 … … 126 126 127 127 if (is8Bit) 128 encoder.encodeFixedLengthData( reinterpret_cast<const uint8_t*>(string.characters8()), length * sizeof(LChar), alignof(LChar));128 encoder.encodeFixedLengthData(string.characters8(), length * sizeof(LChar), alignof(LChar)); 129 129 else 130 130 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters16()), length * sizeof(UChar), alignof(UChar)); -
trunk/Source/WebKit/Shared/API/c/cf/WKStringCF.mm
r242339 r278619 58 58 // expects to be called on the thread running WebCore. 59 59 if (WebKit::toImpl(stringRef)->string().is8Bit()) 60 return CFStringCreateWithBytes(allocatorRef, reinterpret_cast<const UInt8*>(WebKit::toImpl(stringRef)->string().characters8()), WebKit::toImpl(stringRef)->string().length(), kCFStringEncodingISOLatin1, true);60 return CFStringCreateWithBytes(allocatorRef, WebKit::toImpl(stringRef)->string().characters8(), WebKit::toImpl(stringRef)->string().length(), kCFStringEncodingISOLatin1, true); 61 61 return CFStringCreateWithCharacters(allocatorRef, reinterpret_cast<const UniChar*>(WebKit::toImpl(stringRef)->string().characters16()), WebKit::toImpl(stringRef)->string().length()); 62 62 } -
trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm
r270810 r278619 68 68 69 69 CString buffer = string.utf8(); 70 return CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(buffer.data()), buffer.length(), kCFStringEncodingUTF8, nullptr, true);70 return CFURLCreateAbsoluteURLWithBytes(nullptr, buffer.dataAsUInt8Ptr(), buffer.length(), kCFStringEncodingUTF8, nullptr, true); 71 71 } -
trunk/Source/WebKit/Shared/ShareableResource.cpp
r278532 r278619 85 85 #if USE(CF) 86 86 auto deallocator = createShareableResourceDeallocator(this); 87 auto cfData = adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(data()), static_cast<CFIndex>(size()), deallocator.get()));87 auto cfData = adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, data(), static_cast<CFIndex>(size()), deallocator.get())); 88 88 return SharedBuffer::create(cfData.get()); 89 89 #elif USE(GLIB) -
trunk/Source/WebKit/Shared/SharedDisplayListHandle.h
r278161 r278619 49 49 50 50 WebCore::DisplayList::ItemBufferIdentifier identifier() const { return m_identifier; } 51 uint8_t* data() const { return reinterpret_cast<uint8_t*>(sharedMemory().data()); }51 uint8_t* data() const { return static_cast<uint8_t*>(sharedMemory().data()); } 52 52 53 53 uint64_t unreadBytes() -
trunk/Source/WebKit/Shared/WebCompiledContentRuleList.cpp
r244597 r278619 47 47 bool WebCompiledContentRuleList::conditionsApplyOnlyToDomain() const 48 48 { 49 return *reinterpret_cast<const uint32_t*>( reinterpret_cast<const uint8_t*>(m_data.data->data()) + m_data.conditionsApplyOnlyToDomainOffset);49 return *reinterpret_cast<const uint32_t*>(static_cast<const uint8_t*>(m_data.data->data()) + m_data.conditionsApplyOnlyToDomainOffset); 50 50 } 51 51 -
trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationAssertionResponse.cpp
r254554 r278619 51 51 if (auto* userHandle = m_response->userHandle()) { 52 52 userHandle->ref(); 53 data = API::Data::createWithoutCopying( reinterpret_cast<unsigned char*>(userHandle->data()), userHandle->byteLength(), [] (unsigned char*, const void* data) {53 data = API::Data::createWithoutCopying(static_cast<unsigned char*>(userHandle->data()), userHandle->byteLength(), [] (unsigned char*, const void* data) { 54 54 static_cast<ArrayBuffer*>(const_cast<void*>(data))->deref(); 55 55 }, userHandle); -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r278253 r278619 242 242 if (string.isNull() || !string.is8Bit()) 243 243 return { reinterpret_cast<const uint8_t*>(string.characters16()), string.length() * sizeof(UChar) }; 244 return { reinterpret_cast<const uint8_t*>(string.characters8()), string.length() * sizeof(LChar) };244 return { string.characters8(), string.length() * sizeof(LChar) }; 245 245 } 246 246 -
trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm
r261968 r278619 78 78 page->setShouldSuppressSOAuthorizationInNextNavigationPolicyDecision(); 79 79 auto html = makeString("<script>location = '", response.httpHeaderFields().get(HTTPHeaderName::Location), "'</script>").utf8(); 80 auto data = IPC::DataReference( reinterpret_cast<const uint8_t*>(html.data()), html.length());80 auto data = IPC::DataReference(html.dataAsUInt8Ptr(), html.length()); 81 81 page->loadData(data, "text/html"_s, "UTF-8"_s, navigationAction->request().url().string(), nullptr, navigationAction->shouldOpenExternalURLsPolicy()); 82 82 return; -
trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp
r278244 r278619 125 125 ASSERT(m_connectionID); 126 126 auto message = event.utf8(); 127 send(m_connectionID.value(), reinterpret_cast<const uint8_t*>(message.data()), message.length());127 send(m_connectionID.value(), message.dataAsUInt8Ptr(), message.length()); 128 128 } 129 129 -
trunk/Source/WebKit/WebProcess/Network/WebSocketChannel.cpp
r278532 r278619 57 57 { 58 58 return { document, [&channel](auto& utf8String) { 59 channel.notifySendFrame(WebSocketFrame::OpCode::OpCodeText, reinterpret_cast<const uint8_t*>(utf8String.data()), utf8String.length());60 channel.sendMessage(Messages::NetworkSocketChannel::SendString { IPC::DataReference { reinterpret_cast<const uint8_t*>(utf8String.data()), utf8String.length() } }, utf8String.length());59 channel.notifySendFrame(WebSocketFrame::OpCode::OpCodeText, utf8String.dataAsUInt8Ptr(), utf8String.length()); 60 channel.sendMessage(Messages::NetworkSocketChannel::SendString { IPC::DataReference { utf8String.dataAsUInt8Ptr(), utf8String.length() } }, utf8String.length()); 61 61 }, [&channel](const uint8_t* data, size_t byteLength) { 62 62 channel.notifySendFrame(WebSocketFrame::OpCode::OpCodeBinary, data, byteLength); … … 296 296 297 297 auto utf8Message = message.utf8(); 298 m_inspector.didReceiveWebSocketFrame(m_document.get(), createWebSocketFrameForWebInspector( reinterpret_cast<const uint8_t*>(utf8Message.data()), utf8Message.length(), WebSocketFrame::OpCode::OpCodeText));298 m_inspector.didReceiveWebSocketFrame(m_document.get(), createWebSocketFrameForWebInspector(utf8Message.dataAsUInt8Ptr(), utf8Message.length(), WebSocketFrame::OpCode::OpCodeText)); 299 299 300 300 m_client->didReceiveMessage(message); -
trunk/Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp
r278516 r278619 124 124 source->sendRawData(data.data(), data.size()); 125 125 else 126 source->sendStringData(CString( reinterpret_cast<const char*>(data.data()), data.size()));126 source->sendStringData(CString(data.data(), data.size())); 127 127 } 128 128 } … … 228 228 { 229 229 auto text = string.utf8(); 230 m_connection->send(Messages::RTCDataChannelRemoteManagerProxy::ReceiveData { identifier, false, IPC::DataReference { reinterpret_cast<const unsigned char*>(text.data()), text.length() } }, 0);230 m_connection->send(Messages::RTCDataChannelRemoteManagerProxy::ReceiveData { identifier, false, IPC::DataReference { text.dataAsUInt8Ptr(), text.length() } }, 0); 231 231 } 232 232 -
trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
r278516 r278619 118 118 return; 119 119 120 deliverData(re interpret_cast<const uint8_t*>(resultCString.data()), resultCString.length());120 deliverData(resultCString.dataAsUInt8Ptr(), resultCString.length()); 121 121 stop(NPRES_DONE); 122 122 }
Note:
See TracChangeset
for help on using the changeset viewer.