Diff
Modified: trunk/Source/WTF/ChangeLog (278618 => 278619)
--- trunk/Source/WTF/ChangeLog 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/ChangeLog 2021-06-08 17:35:15 UTC (rev 278619)
@@ -1,3 +1,35 @@
+2021-06-08 Chris Dumez <[email protected]>
+
+ Reduce use of reinterpret_cast<> in the codebase
+ https://bugs.webkit.org/show_bug.cgi?id=226743
+
+ Reviewed by Darin Adler.
+
+ * wtf/CryptographicallyRandomNumber.cpp:
+ * wtf/FastMalloc.h:
+ (WTF::FastAllocator::allocate):
+ * wtf/SHA1.h:
+ (WTF::SHA1::addBytes):
+ * wtf/StackCheck.h:
+ (WTF::StackCheck::Scope::Scope):
+ (WTF::StackCheck::StackCheck):
+ * wtf/URLHelpers.cpp:
+ (WTF::URLHelpers::userVisibleURL):
+ * wtf/URLParser.cpp:
+ (WTF::URLParser::formURLDecode):
+ * wtf/cf/URLCF.cpp:
+ (WTF::URL::createCFURL const):
+ * wtf/cocoa/URLCocoa.mm:
+ (WTF::URL::createCFURL const):
+ * wtf/persistence/PersistentCoders.cpp:
+ (WTF::Persistence::Coder<CString>::encode):
+ (WTF::Persistence::Coder<String>::encode):
+ * wtf/text/CString.h:
+ * wtf/text/WTFString.cpp:
+ (WTF::String::latin1 const):
+ * wtf/text/cf/StringImplCF.cpp:
+ (WTF::StringImpl::createCFString):
+
2021-06-08 Devin Rousso <[email protected]>
[Modern Media Controls] upstream new features
Modified: trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp (278618 => 278619)
--- trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -149,7 +149,7 @@
{
Locker locker { m_lock };
- unsigned char* result = reinterpret_cast<unsigned char*>(buffer);
+ auto result = static_cast<unsigned char*>(buffer);
stirIfNeeded();
while (length--) {
m_count--;
Modified: trunk/Source/WTF/wtf/FastMalloc.h (278618 => 278619)
--- trunk/Source/WTF/wtf/FastMalloc.h 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/FastMalloc.h 2021-06-08 17:35:15 UTC (rev 278619)
@@ -203,7 +203,7 @@
T* allocate(size_t count)
{
- return reinterpret_cast<T*>(fastMalloc(sizeof(T) * count));
+ return static_cast<T*>(fastMalloc(sizeof(T) * count));
}
void deallocate(T* pointer, size_t)
Modified: trunk/Source/WTF/wtf/SHA1.h (278618 => 278619)
--- trunk/Source/WTF/wtf/SHA1.h 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/SHA1.h 2021-06-08 17:35:15 UTC (rev 278619)
@@ -51,8 +51,7 @@
}
void addBytes(const CString& input)
{
- const char* string = input.data();
- addBytes(reinterpret_cast<const uint8_t*>(string), input.length());
+ addBytes(input.dataAsUInt8Ptr(), input.length());
}
WTF_EXPORT_PRIVATE void addBytes(const uint8_t* input, size_t length);
Modified: trunk/Source/WTF/wtf/StackCheck.h (278618 => 278619)
--- trunk/Source/WTF/wtf/StackCheck.h 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/StackCheck.h 2021-06-08 17:35:15 UTC (rev 278619)
@@ -57,7 +57,7 @@
// then we either need to:
// 1. break the interval into smaller pieces (i.e. insert more checks), or
// 2. use a larger reservedZone size.
- uint8_t* currentStackCheckpoint = reinterpret_cast<uint8_t*>(currentStackPointer());
+ uint8_t* currentStackCheckpoint = static_cast<uint8_t*>(currentStackPointer());
uint8_t* previousStackCheckpoint = m_checker.m_lastStackCheckpoint;
RELEASE_ASSERT(previousStackCheckpoint - currentStackCheckpoint > 0);
RELEASE_ASSERT(previousStackCheckpoint - currentStackCheckpoint < static_cast<ptrdiff_t>(m_checker.m_reservedZone));
@@ -87,7 +87,7 @@
: m_stackLimit(bounds.recursionLimit(minReservedZone))
#if VERIFY_STACK_CHECK_RESERVED_ZONE_SIZE
, m_ownerThread(&Thread::current())
- , m_lastStackCheckpoint(reinterpret_cast<uint8_t*>(currentStackPointer()))
+ , m_lastStackCheckpoint(static_cast<uint8_t*>(currentStackPointer()))
, m_reservedZone(minReservedZone)
#endif
{ }
Modified: trunk/Source/WTF/wtf/URLHelpers.cpp (278618 => 278619)
--- trunk/Source/WTF/wtf/URLHelpers.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/URLHelpers.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -822,7 +822,7 @@
String userVisibleURL(const CString& url)
{
- auto* before = reinterpret_cast<const unsigned char*>(url.data());
+ auto* before = url.dataAsUInt8Ptr();
int length = url.length();
if (!length)
Modified: trunk/Source/WTF/wtf/URLParser.cpp (278618 => 278619)
--- trunk/Source/WTF/wtf/URLParser.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/URLParser.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -2792,7 +2792,7 @@
auto utf8 = input.utf8(StrictConversion);
if (utf8.isNull())
return std::nullopt;
- auto percentDecoded = percentDecode(reinterpret_cast<const LChar*>(utf8.data()), utf8.length());
+ auto percentDecoded = percentDecode(utf8.dataAsUInt8Ptr(), utf8.length());
return String::fromUTF8ReplacingInvalidSequences(percentDecoded.data(), percentDecoded.size());
}
Modified: trunk/Source/WTF/wtf/cf/URLCF.cpp (278618 => 278619)
--- trunk/Source/WTF/wtf/cf/URLCF.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/cf/URLCF.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -52,10 +52,10 @@
{
RetainPtr<CFURLRef> cfURL;
if (LIKELY(m_string.is8Bit() && m_string.isAllASCII()))
- cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(m_string.characters8()), m_string.length(), kCFStringEncodingUTF8, nullptr, true));
+ cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, m_string.characters8(), m_string.length(), kCFStringEncodingUTF8, nullptr, true));
else {
CString utf8 = m_string.utf8();
- cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(utf8.data()), utf8.length(), kCFStringEncodingUTF8, nullptr, true));
+ cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, utf8.dataAsUInt8Ptr(), utf8.length(), kCFStringEncodingUTF8, nullptr, true));
}
if (protocolIsInHTTPFamily() && !isCFURLSameOrigin(cfURL.get(), *this))
Modified: trunk/Source/WTF/wtf/cocoa/URLCocoa.mm (278618 => 278619)
--- trunk/Source/WTF/wtf/cocoa/URLCocoa.mm 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/cocoa/URLCocoa.mm 2021-06-08 17:35:15 UTC (rev 278619)
@@ -70,10 +70,10 @@
RetainPtr<CFURLRef> cfURL;
if (LIKELY(m_string.is8Bit() && m_string.isAllASCII()))
- cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(m_string.characters8()), m_string.length(), kCFStringEncodingUTF8, nullptr, true));
+ cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, m_string.characters8(), m_string.length(), kCFStringEncodingUTF8, nullptr, true));
else {
CString utf8 = m_string.utf8();
- cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(utf8.data()), utf8.length(), kCFStringEncodingUTF8, nullptr, true));
+ cfURL = adoptCF(CFURLCreateAbsoluteURLWithBytes(nullptr, utf8.dataAsUInt8Ptr(), utf8.length(), kCFStringEncodingUTF8, nullptr, true));
}
if (protocolIsInHTTPFamily() && !WTF::isCFURLSameOrigin(cfURL.get(), *this))
Modified: trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp (278618 => 278619)
--- trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -57,7 +57,7 @@
uint32_t length = string.length();
encoder << length;
- encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.data()), length);
+ encoder.encodeFixedLengthData(string.dataAsUInt8Ptr(), length);
}
std::optional<CString> Coder<CString>::decode(Decoder& decoder)
@@ -98,7 +98,7 @@
encoder << length << is8Bit;
if (is8Bit)
- encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters8()), length * sizeof(LChar));
+ encoder.encodeFixedLengthData(string.characters8(), length);
else
encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters16()), length * sizeof(UChar));
}
Modified: trunk/Source/WTF/wtf/text/CString.h (278618 => 278619)
--- trunk/Source/WTF/wtf/text/CString.h 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/text/CString.h 2021-06-08 17:35:15 UTC (rev 278619)
@@ -61,6 +61,7 @@
CString() { }
WTF_EXPORT_PRIVATE CString(const char*);
WTF_EXPORT_PRIVATE CString(const char*, size_t length);
+ CString(const uint8_t* data, size_t length) : CString(reinterpret_cast<const char*>(data), length) { }
CString(CStringBuffer* buffer) : m_buffer(buffer) { }
WTF_EXPORT_PRIVATE static CString newUninitialized(size_t length, char*& characterBuffer);
CString(HashTableDeletedValueType) : m_buffer(HashTableDeletedValue) { }
@@ -69,6 +70,9 @@
{
return m_buffer ? m_buffer->data() : nullptr;
}
+
+ const uint8_t* dataAsUInt8Ptr() const { return reinterpret_cast<const uint8_t*>(data()); }
+
WTF_EXPORT_PRIVATE char* mutableData();
size_t length() const
{
Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (278618 => 278619)
--- trunk/Source/WTF/wtf/text/WTFString.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -660,7 +660,7 @@
return CString("", 0);
if (is8Bit())
- return CString(reinterpret_cast<const char*>(this->characters8()), length);
+ return CString(this->characters8(), length);
const UChar* characters = this->characters16();
Modified: trunk/Source/WTF/wtf/text/cf/StringImplCF.cpp (278618 => 278619)
--- trunk/Source/WTF/wtf/text/cf/StringImplCF.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WTF/wtf/text/cf/StringImplCF.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -119,7 +119,7 @@
{
if (!m_length || !isMainThread()) {
if (is8Bit())
- return adoptCF(CFStringCreateWithBytes(nullptr, reinterpret_cast<const UInt8*>(characters8()), m_length, kCFStringEncodingISOLatin1, false));
+ return adoptCF(CFStringCreateWithBytes(nullptr, characters8(), m_length, kCFStringEncodingISOLatin1, false));
return adoptCF(CFStringCreateWithCharacters(nullptr, reinterpret_cast<const UniChar*>(characters16()), m_length));
}
CFAllocatorRef allocator = StringWrapperCFAllocator::allocator();
@@ -130,7 +130,7 @@
RetainPtr<CFStringRef> string;
if (is8Bit())
- string = adoptCF(CFStringCreateWithBytesNoCopy(allocator, reinterpret_cast<const UInt8*>(characters8()), m_length, kCFStringEncodingISOLatin1, false, kCFAllocatorNull));
+ string = adoptCF(CFStringCreateWithBytesNoCopy(allocator, characters8(), m_length, kCFStringEncodingISOLatin1, false, kCFAllocatorNull));
else
string = adoptCF(CFStringCreateWithCharactersNoCopy(allocator, reinterpret_cast<const UniChar*>(characters16()), m_length, kCFAllocatorNull));
// CoreFoundation might not have to allocate anything, we clear currentString in case we did not execute allocate().
Modified: trunk/Source/WebCore/ChangeLog (278618 => 278619)
--- trunk/Source/WebCore/ChangeLog 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/ChangeLog 2021-06-08 17:35:15 UTC (rev 278619)
@@ -1,3 +1,101 @@
+2021-06-08 Chris Dumez <[email protected]>
+
+ Reduce use of reinterpret_cast<> in the codebase
+ https://bugs.webkit.org/show_bug.cgi?id=226743
+
+ Reviewed by Darin Adler.
+
+ * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
+ (WebCore::CDMSessionClearKey::generateKeyRequest):
+ * Modules/fetch/FetchBody.cpp:
+ (WebCore::FetchBody::take):
+ * Modules/fetch/FetchBodyConsumer.cpp:
+ (WebCore::FetchBodyConsumer::resolve):
+ (WebCore::FetchBodyConsumer::takeAsBlob):
+ (WebCore::FetchBodyConsumer::takeAsText):
+ * Modules/mediastream/RTCDataChannelRemoteHandler.cpp:
+ (WebCore::RTCDataChannelRemoteHandler::readyToSend):
+ (WebCore::RTCDataChannelRemoteHandler::sendStringData):
+ (WebCore::RTCDataChannelRemoteHandler::sendRawData):
+ * Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp:
+ (WebCore::copyBusData):
+ * Modules/webauthn/AuthenticatorResponseData.h:
+ (WebCore::encodeArrayBuffer):
+ (WebCore::decodeArrayBuffer):
+ * Modules/websockets/WebSocketChannel.cpp:
+ (WebCore::WebSocketChannel::startClosingHandshake):
+ (WebCore::WebSocketChannel::processOutgoingFrameQueue):
+ * Modules/websockets/WebSocketHandshake.cpp:
+ (WebCore::WebSocketHandshake::getExpectedWebSocketAccept):
+ (WebCore::headerHasValidHTTPVersion):
+ * bindings/js/ScriptBufferSourceProvider.h:
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneDeserializer::readString):
+ * contentextensions/SerializedNFA.cpp:
+ (WebCore::ContentExtensions::SerializedNFA::pointerAtOffsetInFile const):
+ * dom/Node.cpp:
+ (WebCore::hashPointer):
+ * dom/TextEncoder.cpp:
+ (WebCore::TextEncoder::encode const):
+ * dom/TextEncoderStreamEncoder.cpp:
+ (WebCore::TextEncoderStreamEncoder::flush):
+ * editing/cocoa/WebContentReaderCocoa.mm:
+ (WebCore::sanitizeMarkupWithArchive):
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::texImageArrayBufferViewHelper):
+ * inspector/DOMPatchSupport.cpp:
+ (WebCore::addStringToSHA1):
+ * loader/TextResourceDecoder.cpp:
+ (WebCore::TextResourceDecoder::textFromUTF8):
+ * loader/cache/CachedScript.cpp:
+ (WebCore::CachedScript::script):
+ * page/cocoa/ResourceUsageOverlayCocoa.mm:
+ (WebCore::showText):
+ * platform/SharedBufferChunkReader.cpp:
+ (WebCore::SharedBufferChunkReader::nextChunk):
+ * platform/cf/SharedBufferCF.cpp:
+ (WebCore::SharedBuffer::createCFData const):
+ * platform/generic/KeyedEncoderGeneric.cpp:
+ (WebCore::KeyedEncoderGeneric::encodeString):
+ * platform/graphics/GraphicsContextGL.cpp:
+ (WebCore::GraphicsContextGL::packImageData):
+ * platform/graphics/ImageBufferBackend.cpp:
+ (WebCore::ImageBufferBackend::getPixelBuffer const):
+ (WebCore::ImageBufferBackend::putPixelBuffer):
+ * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
+ (WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
+ * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
+ (WebCore::CDMSessionAVFoundationCF::generateKeyRequest):
+ (WebCore::CDMSessionAVFoundationCF::update):
+ * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
+ (WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer):
+ * platform/graphics/displaylists/DisplayListItemBuffer.cpp:
+ (WebCore::DisplayList::ItemBuffer::createItemBuffer):
+ * platform/graphics/displaylists/DisplayListIterator.cpp:
+ (WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem):
+ * platform/image-decoders/gif/GIFImageReader.h:
+ (GIFImageReader::data const):
+ * platform/mac/SSLKeyGeneratorMac.mm:
+ (WebCore::signedPublicKeyAndChallengeString):
+ * platform/mediastream/RealtimeMediaSourceCenter.cpp:
+ (WebCore::addStringToSHA1):
+ * platform/network/FormDataBuilder.cpp:
+ (WebCore::FormDataBuilder::encodeStringAsFormData):
+ * platform/network/SocketStreamHandle.cpp:
+ (WebCore::SocketStreamHandle::sendHandshake):
+ * platform/network/cf/ResourceRequestCFNet.cpp:
+ (WebCore::ResourceRequest::doUpdatePlatformRequest):
+ * platform/network/cf/ResourceRequestCFNet.h:
+ (WebCore::httpHeaderValueUsingSuitableEncoding):
+ * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
+ (WebCore::SocketStreamHandleImpl::platformSendInternal):
+ * platform/network/curl/CurlCacheEntry.cpp:
+ (WebCore::CurlCacheEntry::generateBaseFilename):
+ * platform/sql/SQLiteStatement.cpp:
+ (WebCore::SQLiteStatement::columnBlobView):
+ * testing/MockCDMFactory.cpp:
+ (WebCore::MockCDM::sanitizeResponse const):
+
2021-06-08 Devin Rousso <[email protected]>
[Modern Media Controls] upstream new features
Modified: trunk/Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp (278618 => 278619)
--- trunk/Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -70,7 +70,7 @@
m_initData = initData;
bool sawError = false;
- String keyID = UTF8Encoding().decode(reinterpret_cast_ptr<char*>(m_initData->baseAddress()), m_initData->byteLength(), true, sawError);
+ String keyID = UTF8Encoding().decode(static_cast<char*>(m_initData->baseAddress()), m_initData->byteLength(), true, sawError);
if (sawError) {
errorCode = WebKitMediaKeyError::MEDIA_KEYERR_CLIENT;
return nullptr;
Modified: trunk/Source/WebCore/Modules/fetch/FetchBody.cpp (278618 => 278619)
--- trunk/Source/WebCore/Modules/fetch/FetchBody.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/Modules/fetch/FetchBody.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -304,9 +304,9 @@
return SharedBuffer::create(UTF8Encoding().encode(urlSearchParamsBody().toString(), UnencodableHandling::Entities));
if (isArrayBuffer())
- return SharedBuffer::create(reinterpret_cast<const char*>(arrayBufferBody().data()), arrayBufferBody().byteLength());
+ return SharedBuffer::create(static_cast<const char*>(arrayBufferBody().data()), arrayBufferBody().byteLength());
if (isArrayBufferView())
- return SharedBuffer::create(reinterpret_cast<const uint8_t*>(arrayBufferViewBody().baseAddress()), arrayBufferViewBody().byteLength());
+ return SharedBuffer::create(static_cast<const uint8_t*>(arrayBufferViewBody().baseAddress()), arrayBufferViewBody().byteLength());
return nullptr;
}
Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp (278618 => 278619)
--- trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -278,7 +278,7 @@
if (auto chunk = result.returnValue())
data->append(chunk->data, chunk->size);
else
- resolveWithTypeAndData(WTFMove(promise), type, contentType, reinterpret_cast<const unsigned char*>(data->data()), data->size());
+ resolveWithTypeAndData(WTFMove(promise), type, contentType, data->data(), data->size());
});
m_sink->pipeFrom(*stream);
return;
@@ -355,7 +355,7 @@
return Blob::create(context, Vector<uint8_t>(), Blob::normalizedContentType(m_contentType));
// FIXME: We should try to move m_buffer to Blob without doing extra copy.
- return blobFromData(context, reinterpret_cast<const unsigned char*>(m_buffer->data()), m_buffer->size(), m_contentType);
+ return blobFromData(context, m_buffer->data(), m_buffer->size(), m_contentType);
}
String FetchBodyConsumer::takeAsText()
@@ -364,7 +364,7 @@
if (!m_buffer)
return String();
- auto text = TextResourceDecoder::textFromUTF8(reinterpret_cast<const unsigned char*>(m_buffer->data()), m_buffer->size());
+ auto text = TextResourceDecoder::textFromUTF8(m_buffer->data(), m_buffer->size());
m_buffer = nullptr;
return text;
}
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.cpp (278618 => 278619)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -80,7 +80,7 @@
m_isReadyToSend = true;
for (auto& message : m_pendingMessages)
- m_connection->sendData(m_remoteIdentifier, message.isRaw, reinterpret_cast<const unsigned char*>(message.buffer->data()), message.buffer->size());
+ m_connection->sendData(m_remoteIdentifier, message.isRaw, message.buffer->data(), message.buffer->size());
m_pendingMessages.clear();
if (m_isPendingClose)
@@ -100,7 +100,7 @@
m_pendingMessages.append(Message { false, SharedBuffer::create(text.data(), text.length()) });
return true;
}
- m_connection->sendData(m_remoteIdentifier, false, reinterpret_cast<const unsigned char*>(text.data()), text.length());
+ m_connection->sendData(m_remoteIdentifier, false, text.dataAsUInt8Ptr(), text.length());
return true;
}
@@ -110,7 +110,7 @@
m_pendingMessages.append(Message { true, SharedBuffer::create(data, size) });
return true;
}
- m_connection->sendData(m_remoteIdentifier, true, reinterpret_cast<const unsigned char*>(data), size);
+ m_connection->sendData(m_remoteIdentifier, true, data, size);
return true;
}
Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp (278618 => 278619)
--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -43,8 +43,8 @@
size_t size = mappedBuffer.size() / bus.numberOfChannels();
for (size_t channelIndex = 0; channelIndex < bus.numberOfChannels(); ++channelIndex) {
const auto& channel = *bus.channel(channelIndex);
- auto offset = reinterpret_cast<size_t>(channelIndex * size);
- memcpy(reinterpret_cast<float*>(mappedBuffer.data() + offset), channel.data(), sizeof(float) * channel.length());
+ auto offset = channelIndex * size;
+ memcpy(mappedBuffer.data() + offset, channel.data(), sizeof(float) * channel.length());
offsets.uncheckedAppend(offset);
}
return offsets;
Modified: trunk/Source/WebCore/Modules/webauthn/AuthenticatorResponseData.h (278618 => 278619)
--- trunk/Source/WebCore/Modules/webauthn/AuthenticatorResponseData.h 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/Modules/webauthn/AuthenticatorResponseData.h 2021-06-08 17:35:15 UTC (rev 278619)
@@ -59,7 +59,7 @@
static void encodeArrayBuffer(Encoder& encoder, const ArrayBuffer& buffer)
{
encoder << static_cast<uint64_t>(buffer.byteLength());
- encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(buffer.data()), buffer.byteLength(), 1);
+ encoder.encodeFixedLengthData(static_cast<const uint8_t*>(buffer.data()), buffer.byteLength(), 1);
}
template<class Decoder>
@@ -75,7 +75,7 @@
auto buffer = ArrayBuffer::tryCreate(length.value(), sizeof(uint8_t));
if (!buffer)
return nullptr;
- if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer->data()), length.value(), 1))
+ if (!decoder.decodeFixedLengthData(static_cast<uint8_t*>(buffer->data()), length.value(), 1))
return nullptr;
return buffer;
}
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp (278618 => 278619)
--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -495,7 +495,7 @@
buf.append(highByte);
buf.append(lowByte);
auto reasonUTF8 = reason.utf8();
- buf.append(reinterpret_cast<const uint8_t*>(reasonUTF8.data()), reasonUTF8.length());
+ buf.append(reasonUTF8.dataAsUInt8Ptr(), reasonUTF8.length());
}
enqueueRawFrame(WebSocketFrame::OpCodeClose, buf.data(), buf.size());
Ref<WebSocketChannel> protectedThis(*this); // An attempt to send closing handshake may fail, which will get the channel closed and dereferenced.
@@ -743,7 +743,7 @@
auto frame = m_outgoingFrameQueue.takeFirst();
switch (frame->frameType) {
case QueuedFrameTypeString: {
- sendFrame(frame->opCode, reinterpret_cast<const uint8_t*>(frame->stringData.data()), frame->stringData.length(), [this, protectedThis = makeRef(*this)] (bool success) {
+ sendFrame(frame->opCode, frame->stringData.dataAsUInt8Ptr(), frame->stringData.length(), [this, protectedThis = makeRef(*this)] (bool success) {
if (!success)
fail("Failed to send WebSocket frame.");
});
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (278618 => 278619)
--- trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -102,11 +102,11 @@
String WebSocketHandshake::getExpectedWebSocketAccept(const String& secWebSocketKey)
{
- static const char* const webSocketKeyGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
+ constexpr uint8_t webSocketKeyGUID[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
SHA1 sha1;
CString keyData = secWebSocketKey.ascii();
- sha1.addBytes(reinterpret_cast<const uint8_t*>(keyData.data()), keyData.length());
- sha1.addBytes(reinterpret_cast<const uint8_t*>(webSocketKeyGUID), strlen(webSocketKeyGUID));
+ sha1.addBytes(keyData.dataAsUInt8Ptr(), keyData.length());
+ sha1.addBytes(webSocketKeyGUID, std::size(webSocketKeyGUID) - 1);
SHA1::Digest hash;
sha1.computeHash(hash);
return base64EncodeToString(hash.data(), SHA1::hashSize);
@@ -328,13 +328,12 @@
// "The HTTP version MUST be at least 1.1."
static inline bool headerHasValidHTTPVersion(StringView httpStatusLine)
{
- const char* httpVersionStaticPreambleLiteral = "HTTP/";
- StringView httpVersionStaticPreamble(reinterpret_cast<const LChar*>(httpVersionStaticPreambleLiteral), strlen(httpVersionStaticPreambleLiteral));
- if (!httpStatusLine.startsWith(httpVersionStaticPreamble))
+ constexpr char preamble[] = "HTTP/";
+ if (!httpStatusLine.startsWith(preamble))
return false;
// Check that there is a version number which should be at least three characters after "HTTP/"
- unsigned preambleLength = httpVersionStaticPreamble.length();
+ unsigned preambleLength = strlen(preamble);
if (httpStatusLine.length() < preambleLength + 3)
return false;
Modified: trunk/Source/WebCore/bindings/js/ScriptBufferSourceProvider.h (278618 => 278619)
--- trunk/Source/WebCore/bindings/js/ScriptBufferSourceProvider.h 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/bindings/js/ScriptBufferSourceProvider.h 2021-06-08 17:35:15 UTC (rev 278619)
@@ -52,12 +52,12 @@
return emptyString();
if (!m_containsOnlyASCII) {
- m_containsOnlyASCII = charactersAreAllASCII(reinterpret_cast<const LChar*>(m_scriptBuffer.buffer()->data()), m_scriptBuffer.buffer()->size());
+ m_containsOnlyASCII = charactersAreAllASCII(m_scriptBuffer.buffer()->data(), m_scriptBuffer.buffer()->size());
if (*m_containsOnlyASCII)
- m_scriptHash = StringHasher::computeHashAndMaskTop8Bits(reinterpret_cast<const LChar*>(m_scriptBuffer.buffer()->data()), m_scriptBuffer.buffer()->size());
+ m_scriptHash = StringHasher::computeHashAndMaskTop8Bits(m_scriptBuffer.buffer()->data(), m_scriptBuffer.buffer()->size());
}
if (*m_containsOnlyASCII)
- return { reinterpret_cast<const LChar*>(m_scriptBuffer.buffer()->data()), static_cast<unsigned>(m_scriptBuffer.buffer()->size()) };
+ return { m_scriptBuffer.buffer()->data(), static_cast<unsigned>(m_scriptBuffer.buffer()->size()) };
if (!m_cachedScriptString) {
m_cachedScriptString = m_scriptBuffer.toString();
Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (278618 => 278619)
--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -2340,7 +2340,7 @@
if (is8Bit) {
if ((end - ptr) < static_cast<int>(length))
return false;
- str = String(reinterpret_cast<const LChar*>(ptr), length);
+ str = String { ptr, length };
ptr += length;
return true;
}
Modified: trunk/Source/WebCore/contentextensions/SerializedNFA.cpp (278618 => 278619)
--- trunk/Source/WebCore/contentextensions/SerializedNFA.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/contentextensions/SerializedNFA.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -107,7 +107,7 @@
template<typename T>
const T* SerializedNFA::pointerAtOffsetInFile(size_t offset) const
{
- return reinterpret_cast<const T*>(reinterpret_cast<const uint8_t*>(m_file.data()) + offset);
+ return reinterpret_cast<const T*>(static_cast<const uint8_t*>(m_file.data()) + offset);
}
auto SerializedNFA::nodes() const -> const Range<ImmutableNFANode>
Modified: trunk/Source/WebCore/dom/Node.cpp (278618 => 278619)
--- trunk/Source/WebCore/dom/Node.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/dom/Node.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -1600,7 +1600,7 @@
return { };
}
-static SHA1::Digest hashPointer(void* pointer)
+static SHA1::Digest hashPointer(const void* pointer)
{
SHA1 sha1;
sha1.addBytes(reinterpret_cast<const uint8_t*>(&pointer), sizeof(pointer));
Modified: trunk/Source/WebCore/dom/TextEncoder.cpp (278618 => 278619)
--- trunk/Source/WebCore/dom/TextEncoder.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/dom/TextEncoder.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -40,7 +40,7 @@
{
// FIXME: We should not need to allocate a CString to encode into a Uint8Array.
CString utf8 = input.utf8();
- return Uint8Array::tryCreate(reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length());
+ return Uint8Array::tryCreate(utf8.dataAsUInt8Ptr(), utf8.length());
}
auto TextEncoder::encodeInto(String&& input, Ref<Uint8Array>&& array) -> EncodeIntoResult
Modified: trunk/Source/WebCore/dom/TextEncoderStreamEncoder.cpp (278618 => 278619)
--- trunk/Source/WebCore/dom/TextEncoderStreamEncoder.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/dom/TextEncoderStreamEncoder.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -77,8 +77,8 @@
if (!m_pendingHighSurrogate)
return nullptr;
- auto byteSequence = "\xEF\xBF\xBD";
- return Uint8Array::tryCreate(reinterpret_cast<const uint8_t*>(byteSequence), 3);
+ constexpr uint8_t byteSequence[] = { 0xEF, 0xBF, 0xBD };
+ return Uint8Array::tryCreate(byteSequence, std::size(byteSequence));
}
}
Modified: trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (278618 => 278619)
--- trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm 2021-06-08 17:35:15 UTC (rev 278619)
@@ -486,7 +486,7 @@
CString utf8 = subframeMarkup.utf8();
Vector<uint8_t> blobBuffer;
blobBuffer.reserveCapacity(utf8.length());
- blobBuffer.append(reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length());
+ blobBuffer.append(utf8.dataAsUInt8Ptr(), utf8.length());
auto blob = Blob::create(&destinationDocument, WTFMove(blobBuffer), type);
String subframeBlobURL = DOMURL::createObjectURL(destinationDocument, blob);
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (278618 => 278619)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -4962,7 +4962,7 @@
sourceType = TexImageDimension::Tex3D;
if (!validateTexFuncData(functionName, sourceType, width, height, depth, format, type, pixels.get(), nullDisposition, srcOffset))
return;
- uint8_t* data = "" ? pixels->baseAddress() : nullptr);
+ auto data = "" ? pixels->baseAddress() : nullptr);
if (srcOffset) {
ASSERT(pixels);
// No need to check overflow because validateTexFuncData() already did.
Modified: trunk/Source/WebCore/inspector/DOMPatchSupport.cpp (278618 => 278619)
--- trunk/Source/WebCore/inspector/DOMPatchSupport.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/inspector/DOMPatchSupport.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -397,7 +397,7 @@
static void addStringToSHA1(SHA1& sha1, const String& string)
{
CString cString = string.utf8();
- sha1.addBytes(reinterpret_cast<const uint8_t*>(cString.data()), cString.length());
+ sha1.addBytes(cString.dataAsUInt8Ptr(), cString.length());
}
std::unique_ptr<DOMPatchSupport::Digest> DOMPatchSupport::createDigest(Node& node, UnusedNodesMap* unusedNodesMap)
Modified: trunk/Source/WebCore/loader/TextResourceDecoder.cpp (278618 => 278619)
--- trunk/Source/WebCore/loader/TextResourceDecoder.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/loader/TextResourceDecoder.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -333,7 +333,7 @@
auto decoder = TextResourceDecoder::create("text/plain", "UTF-8");
if (shouldPrependBOM(data, length))
decoder->decode("\xef\xbb\xbf", 3);
- return decoder->decodeAndFlush(reinterpret_cast<const char*>(data), length);
+ return decoder->decodeAndFlush(data, length);
}
void TextResourceDecoder::setEncoding(const TextEncoding& encoding, EncodingSource source)
Modified: trunk/Source/WebCore/loader/cache/CachedScript.cpp (278618 => 278619)
--- trunk/Source/WebCore/loader/cache/CachedScript.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/loader/cache/CachedScript.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -62,7 +62,7 @@
if (m_decodingState == NeverDecoded
&& TextEncoding(encoding()).isByteBasedEncoding()
&& m_data->size()
- && charactersAreAllASCII(reinterpret_cast<const LChar*>(m_data->data()), m_data->size())) {
+ && charactersAreAllASCII(m_data->data(), m_data->size())) {
m_decodingState = DataAndDecodedStringHaveSameBytes;
@@ -70,11 +70,11 @@
setDecodedSize(0);
m_decodedDataDeletionTimer.stop();
- m_scriptHash = StringHasher::computeHashAndMaskTop8Bits(reinterpret_cast<const LChar*>(m_data->data()), m_data->size());
+ m_scriptHash = StringHasher::computeHashAndMaskTop8Bits(m_data->data(), m_data->size());
}
if (m_decodingState == DataAndDecodedStringHaveSameBytes)
- return { reinterpret_cast<const LChar*>(m_data->data()), static_cast<unsigned>(m_data->size()) };
+ return { m_data->data(), static_cast<unsigned>(m_data->size()) };
if (!m_script) {
m_script = m_decoder->decodeAndFlush(m_data->data(), encodedSize());
Modified: trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm (278618 => 278619)
--- trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm 2021-06-08 17:35:15 UTC (rev 278619)
@@ -269,7 +269,7 @@
CFTypeRef values[] = { font.get(), kCFBooleanTrue };
auto attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
CString cstr = text.ascii();
- auto string = adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(cstr.data()), cstr.length(), kCFStringEncodingASCII, false, kCFAllocatorNull));
+ auto string = adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, cstr.dataAsUInt8Ptr(), cstr.length(), kCFStringEncodingASCII, false, kCFAllocatorNull));
auto attributedString = adoptCF(CFAttributedStringCreate(kCFAllocatorDefault, string.get(), attributes.get()));
auto line = adoptCF(CTLineCreateWithAttributedString(attributedString.get()));
CGContextSetTextPosition(context, x, y);
Modified: trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -47,7 +47,7 @@
if (auto data = ""
return *data;
}
- return adoptCF(CFDataCreate(nullptr, reinterpret_cast<const UInt8*>(data()), size()));
+ return adoptCF(CFDataCreate(nullptr, data(), size()));
}
#endif
Modified: trunk/Source/WebCore/platform/generic/KeyedEncoderGeneric.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/generic/KeyedEncoderGeneric.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/generic/KeyedEncoderGeneric.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -40,7 +40,7 @@
{
auto utf8 = key.utf8();
m_encoder << utf8.length();
- m_encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length());
+ m_encoder.encodeFixedLengthData(utf8.dataAsUInt8Ptr(), utf8.length());
}
void KeyedEncoderGeneric::encodeBytes(const String& key, const uint8_t* bytes, size_t size)
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -757,7 +757,7 @@
return false;
data.resize(packedSize);
- if (!packPixels(reinterpret_cast<const uint8_t*>(pixels), sourceFormat, sourceImageWidth, sourceImageHeight, sourceImageSubRectangle, depth, sourceUnpackAlignment, unpackImageHeight, format, type, alphaOp, data.data(), flipY))
+ if (!packPixels(static_cast<const uint8_t*>(pixels), sourceFormat, sourceImageWidth, sourceImageHeight, sourceImageSubRectangle, depth, sourceUnpackAlignment, unpackImageHeight, format, type, alphaOp, data.data(), flipY))
return false;
if (ImageObserver* observer = image->imageObserver())
observer->didDraw(*image);
Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -118,7 +118,7 @@
ConstPixelBufferConversionView source {
{ AlphaPremultiplication::Premultiplied, pixelFormat(), colorSpace() },
bytesPerRow(),
- reinterpret_cast<uint8_t*>(data) + sourceRectClipped.y() * source.bytesPerRow + sourceRectClipped.x() * 4
+ static_cast<uint8_t*>(data) + sourceRectClipped.y() * source.bytesPerRow + sourceRectClipped.x() * 4
};
PixelBufferConversionView destination {
@@ -159,7 +159,7 @@
PixelBufferConversionView destination {
{ destinationAlphaFormat, pixelFormat(), colorSpace() },
bytesPerRow(),
- reinterpret_cast<uint8_t*>(data) + destinationRect.y() * destination.bytesPerRow + destinationRect.x() * 4
+ static_cast<uint8_t*>(data) + destinationRect.y() * destination.bytesPerRow + destinationRect.x() * 4
};
convertImagePixels(source, destination, destinationRect.size());
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -530,12 +530,10 @@
// A WebVTT header is terminated by "One or more WebVTT line terminators" so append two line feeds to make sure the parser
// reccognized this string as a full header.
- StringBuilder header;
- header.appendCharacters(reinterpret_cast<const unsigned char*>(CFDataGetBytePtr(webvttHeaderData)), length);
- header.append("\n\n");
+ auto header = makeString(StringView { CFDataGetBytePtr(webvttHeaderData), length }, "\n\n");
- INFO_LOG(LOGIDENTIFIER, "VTT header ", &header);
- client()->parseWebVTTFileHeader(header.toString());
+ INFO_LOG(LOGIDENTIFIER, "VTT header ", header);
+ client()->parseWebVTTFileHeader(WTFMove(header));
m_haveReportedVTTHeader = true;
} while (0);
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -74,11 +74,11 @@
}
auto certificateData = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, certificate->byteLength()));
- CFDataAppendBytes(certificateData.get(), reinterpret_cast<const UInt8*>(certificate->baseAddress()), certificate->byteLength());
+ CFDataAppendBytes(certificateData.get(), certificate->data(), certificate->byteLength());
auto assetStr = keyID.utf8();
auto assetID = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, assetStr.length()));
- CFDataAppendBytes(assetID.get(), reinterpret_cast<const UInt8*>(assetStr.data()), assetStr.length());
+ CFDataAppendBytes(assetID.get(), assetStr.dataAsUIntPtr(), assetStr.length());
CFErrorRef cfError = nullptr;
auto keyRequest = adoptCF(AVCFAssetResourceLoadingRequestCreateStreamingContentKeyRequestDataForApp(m_request.get(), certificateData.get(), assetID.get(), nullptr, &cfError));
@@ -110,7 +110,7 @@
bool CDMSessionAVFoundationCF::update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode)
{
auto keyData = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, key->byteLength()));
- CFDataAppendBytes(keyData.get(), reinterpret_cast<const UInt8*>(key->baseAddress()), key->byteLength());
+ CFDataAppendBytes(keyData.get(), key->data(), key->byteLength());
AVCFAssetResourceLoadingRequestFinishLoadingWithResponse(m_request.get(), nullptr, keyData.get(), nullptr);
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -204,7 +204,7 @@
}
m_sampleInputBuffer.grow(m_sampleInputBuffer.size() + bufferLength);
- CFDataGetBytes(sampleBuffer->buffer, CFRangeMake(0, bufferLength), reinterpret_cast<UInt8*>(m_sampleInputBuffer.data()) + m_sampleInputBuffer.size() - bufferLength);
+ CFDataGetBytes(sampleBuffer->buffer, CFRangeMake(0, bufferLength), m_sampleInputBuffer.data() + m_sampleInputBuffer.size() - bufferLength);
buffer = ArrayBuffer::create(m_sampleInputBuffer.data(), m_sampleInputBuffer.size());
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -702,7 +702,7 @@
constexpr size_t defaultItemBufferCapacity = 1 << 10;
auto newBufferCapacity = std::max(capacity, defaultItemBufferCapacity);
- auto* buffer = reinterpret_cast<uint8_t*>(fastMalloc(newBufferCapacity));
+ auto* buffer = static_cast<uint8_t*>(fastMalloc(newBufferCapacity));
m_allocatedBuffers.append(buffer);
return { ItemBufferIdentifier::generate(), buffer, newBufferCapacity };
}
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListIterator.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListIterator.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListIterator.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -79,7 +79,7 @@
}
auto paddedSizeOfTypeAndItem = paddedSizeOfTypeAndItemInBytes(itemType);
- m_currentBufferForItem = paddedSizeOfTypeAndItem <= sizeOfFixedBufferForCurrentItem ? m_fixedBufferForCurrentItem : reinterpret_cast<uint8_t*>(fastMalloc(paddedSizeOfTypeAndItem));
+ m_currentBufferForItem = paddedSizeOfTypeAndItem <= sizeOfFixedBufferForCurrentItem ? m_fixedBufferForCurrentItem : static_cast<uint8_t*>(fastMalloc(paddedSizeOfTypeAndItem));
if (isInlineItem(itemType)) {
if (UNLIKELY(static_cast<uint64_t>(m_currentEndOfBuffer - m_cursor) < paddedSizeOfTypeAndItem)) {
m_isValid = false;
Modified: trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.h (278618 => 278619)
--- trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.h 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.h 2021-06-08 17:35:15 UTC (rev 278619)
@@ -285,9 +285,9 @@
bool parse(size_t dataPosition, size_t len, bool parseSizeOnly);
void setRemainingBytes(size_t);
- const unsigned char* data(size_t dataPosition) const
+ const uint8_t* data(size_t dataPosition) const
{
- return reinterpret_cast<const unsigned char*>(m_data->data()) + dataPosition;
+ return m_data->data() + dataPosition;
}
void addFrameIfNecessary();
Modified: trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm (278618 => 278619)
--- trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm 2021-06-08 17:35:15 UTC (rev 278619)
@@ -189,7 +189,7 @@
// Length needs to account for the null terminator.
signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Length = challenge.length() + 1;
- signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Data = ""
+ signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Data = ""
CSSM_DATA encodedPublicKeyAndChallenge { 0, nullptr };
if (SecAsn1EncodeItem(coder, &signedPublicKeyAndChallenge.publicKeyAndChallenge, publicKeyAndChallengeTemplate, &encodedPublicKeyAndChallenge) != noErr)
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -145,7 +145,7 @@
}
auto utf8 = string.utf8();
- sha1.addBytes(reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length() + 1); // Include terminating null byte.
+ sha1.addBytes(utf8.dataAsUInt8Ptr(), utf8.length() + 1); // Include terminating null byte.
}
String RealtimeMediaSourceCenter::hashStringWithSalt(const String& id, const String& hashSalt)
Modified: trunk/Source/WebCore/platform/network/FormDataBuilder.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/network/FormDataBuilder.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/network/FormDataBuilder.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -211,7 +211,7 @@
void encodeStringAsFormData(Vector<char>& buffer, const CString& string)
{
- appendFormURLEncoded(buffer, reinterpret_cast<const uint8_t*>(string.data()), string.length());
+ appendFormURLEncoded(buffer, string.dataAsUInt8Ptr(), string.length());
}
}
Modified: trunk/Source/WebCore/platform/network/SocketStreamHandle.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/network/SocketStreamHandle.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/network/SocketStreamHandle.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -61,7 +61,7 @@
{
if (m_state == Connecting || m_state == Closing)
return completionHandler(false, false);
- platformSendHandshake(reinterpret_cast<const uint8_t*>(handshake.data()), handshake.length(), WTFMove(headerFieldProxy), WTFMove(completionHandler));
+ platformSendHandshake(handshake.dataAsUInt8Ptr(), handshake.length(), WTFMove(headerFieldProxy), WTFMove(completionHandler));
}
void SocketStreamHandle::close()
Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -228,7 +228,7 @@
String partition = cachePartition();
if (!partition.isNull() && !partition.isEmpty()) {
CString utf8String = partition.utf8();
- RetainPtr<CFStringRef> partitionValue = adoptCF(CFStringCreateWithBytes(0, reinterpret_cast<const UInt8*>(utf8String.data()), utf8String.length(), kCFStringEncodingUTF8, false));
+ RetainPtr<CFStringRef> partitionValue = adoptCF(CFStringCreateWithBytes(0, utf8String.dataAsUInt8Ptr(), utf8String.length(), kCFStringEncodingUTF8, false));
_CFURLRequestSetProtocolProperty(cfRequest.get(), _kCFURLCachePartitionKey, partitionValue.get());
}
#endif
Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h (278618 => 278619)
--- trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h 2021-06-08 17:35:15 UTC (rev 278619)
@@ -131,7 +131,7 @@
if (header.keyAsHTTPHeaderName && *header.keyAsHTTPHeaderName == HTTPHeaderName::LastEventID && !header.value.isAllASCII()) {
auto utf8Value = header.value.utf8();
// 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.
- return adoptCF(CFStringCreateWithBytes(nullptr, reinterpret_cast<const UInt8*>(utf8Value.data()), utf8Value.length(), kCFStringEncodingISOLatin1, false));
+ return adoptCF(CFStringCreateWithBytes(nullptr, utf8Value.dataAsUInt8Ptr(), utf8Value.length(), kCFStringEncodingISOLatin1, false));
}
return header.value.createCFString();
}
Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -722,7 +722,7 @@
if (!CFWriteStreamCanAcceptBytes(m_writeStream.get()))
return 0;
- CFIndex result = CFWriteStreamWrite(m_writeStream.get(), reinterpret_cast<const UInt8*>(data), length);
+ CFIndex result = CFWriteStreamWrite(m_writeStream.get(), data, length);
if (result == -1)
return std::nullopt;
Modified: trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -211,7 +211,7 @@
void CurlCacheEntry::generateBaseFilename(const CString& url)
{
SHA1 sha1;
- sha1.addBytes(reinterpret_cast<const uint8_t*>(url.data()), url.length());
+ sha1.addBytes(url.dataAsUInt8Ptr(), url.length());
SHA1::Digest sum;
sha1.computeHash(sum);
Modified: trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp (278618 => 278619)
--- trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/platform/sql/SQLiteStatement.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -304,7 +304,7 @@
if (blobSize <= 0)
return { };
- return { reinterpret_cast<const uint8_t*>(blob), static_cast<size_t>(blobSize) };
+ return { static_cast<const uint8_t*>(blob), static_cast<size_t>(blobSize) };
}
bool SQLiteStatement::hasStartedStepping()
Modified: trunk/Source/WebCore/testing/MockCDMFactory.cpp (278618 => 278619)
--- trunk/Source/WebCore/testing/MockCDMFactory.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebCore/testing/MockCDMFactory.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -213,7 +213,7 @@
RefPtr<SharedBuffer> MockCDM::sanitizeResponse(const SharedBuffer& response) const
{
- if (!charactersAreAllASCII(reinterpret_cast<const LChar*>(response.data()), response.size()))
+ if (!charactersAreAllASCII(response.data(), response.size()))
return nullptr;
Vector<String> responseArray = String(response.data(), response.size()).split(' ');
Modified: trunk/Source/WebDriver/ChangeLog (278618 => 278619)
--- trunk/Source/WebDriver/ChangeLog 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebDriver/ChangeLog 2021-06-08 17:35:15 UTC (rev 278619)
@@ -1,3 +1,15 @@
+2021-06-08 Chris Dumez <[email protected]>
+
+ Reduce use of reinterpret_cast<> in the codebase
+ https://bugs.webkit.org/show_bug.cgi?id=226743
+
+ Reviewed by Darin Adler.
+
+ * socket/HTTPParser.cpp:
+ (WebDriver::HTTPParser::readLine):
+ * socket/SessionHostSocket.cpp:
+ (WebDriver::SessionHost::sendWebInspectorEvent):
+
2021-06-01 Darin Adler <[email protected]>
Remove <wtf/Optional.h>
Modified: trunk/Source/WebDriver/socket/HTTPParser.cpp (278618 => 278619)
--- trunk/Source/WebDriver/socket/HTTPParser.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebDriver/socket/HTTPParser.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -130,7 +130,7 @@
if (position == notFound || position + 1 == length || m_buffer[position + 1] != 0x0a)
return false;
- line = String::fromUTF8(reinterpret_cast<char*>(m_buffer.data()), position);
+ line = String::fromUTF8(m_buffer.data(), position);
if (line.isNull())
LOG_ERROR("Client error: invalid encoding in HTTP header.");
Modified: trunk/Source/WebDriver/socket/SessionHostSocket.cpp (278618 => 278619)
--- trunk/Source/WebDriver/socket/SessionHostSocket.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebDriver/socket/SessionHostSocket.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -50,7 +50,7 @@
return;
const CString message = event.utf8();
- send(m_clientID.value(), reinterpret_cast<const uint8_t*>(message.data()), message.length());
+ send(m_clientID.value(), message.dataAsUInt8Ptr(), message.length());
}
void SessionHost::connectToBrowser(Function<void (std::optional<String> error)>&& completionHandler)
Modified: trunk/Source/WebKit/ChangeLog (278618 => 278619)
--- trunk/Source/WebKit/ChangeLog 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/ChangeLog 2021-06-08 17:35:15 UTC (rev 278619)
@@ -1,3 +1,52 @@
+2021-06-08 Chris Dumez <[email protected]>
+
+ Reduce use of reinterpret_cast<> in the codebase
+ https://bugs.webkit.org/show_bug.cgi?id=226743
+
+ Reviewed by Darin Adler.
+
+ * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
+ (WebKit::RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered):
+ * GPUProcess/media/RemoteTextTrackProxy.cpp:
+ (WebKit::RemoteTextTrackProxy::addDataCue):
+ * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
+ (WebKit::RemoteMediaRecorder::fetchData):
+ * NetworkProcess/cache/NetworkCacheDataCurl.cpp:
+ (WebKit::NetworkCache::Data::apply const):
+ * NetworkProcess/cache/NetworkCacheKey.cpp:
+ (WebKit::NetworkCache::hashString):
+ * NetworkProcess/soup/WebKitDirectoryInputStream.cpp:
+ (webkitDirectoryInputStreamRead):
+ * Platform/IPC/ArgumentCoders.cpp:
+ (IPC::ArgumentCoder<CString>::encode):
+ (IPC::ArgumentCoder<String>::encode):
+ * Shared/API/c/cf/WKStringCF.mm:
+ (WKStringCopyCFString):
+ * Shared/API/c/cf/WKURLCF.mm:
+ (WKURLCopyCFURL):
+ * Shared/ShareableResource.cpp:
+ (WebKit::ShareableResource::wrapInSharedBuffer):
+ * Shared/SharedDisplayListHandle.h:
+ (WebKit::SharedDisplayListHandle::data const):
+ * Shared/WebCompiledContentRuleList.cpp:
+ (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
+ * UIProcess/API/APIWebAuthenticationAssertionResponse.cpp:
+ (API::WebAuthenticationAssertionResponse::userHandle const):
+ * UIProcess/API/C/WKPage.cpp:
+ (dataFrom):
+ * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm:
+ (WebKit::RedirectSOAuthorizationSession::completeInternal):
+ * UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
+ (WebKit::RemoteInspectorClient::sendWebInspectorEvent):
+ * WebProcess/Network/WebSocketChannel.cpp:
+ (WebKit::WebSocketChannel::createMessageQueue):
+ (WebKit::WebSocketChannel::didReceiveText):
+ * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp:
+ (WebKit::RTCDataChannelRemoteManager::sendData):
+ (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData):
+ * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
+ (WebKit::NetscapePluginStream::sendJavaScriptStream):
+
2021-06-08 Devin Rousso <[email protected]>
Require that callsites of `SnapshotOptions` specify a `PixelFormat` and `DestinationColorSpace`
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp (278618 => 278619)
--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -691,7 +691,7 @@
#if ENABLE(ENCRYPTED_MEDIA)
void RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered(const String& initDataType, RefPtr<ArrayBuffer>&& initData)
{
- m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::InitializationDataEncountered(initDataType, IPC::DataReference(reinterpret_cast<uint8_t*>(initData->data()), initData->byteLength())), m_id);
+ m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::InitializationDataEncountered(initDataType, IPC::DataReference(static_cast<uint8_t*>(initData->data()), initData->byteLength())), m_id);
}
void RemoteMediaPlayerProxy::mediaPlayerWaitingForKeyChanged()
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp (278618 => 278619)
--- trunk/Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -113,7 +113,7 @@
if (!m_connectionToWebProcess)
return;
- m_connectionToWebProcess->connection().send(Messages::MediaPlayerPrivateRemote::AddDataCue(m_identifier, start, end, IPC::DataReference(reinterpret_cast<const uint8_t*>(data), length)), m_mediaPlayerIdentifier);
+ m_connectionToWebProcess->connection().send(Messages::MediaPlayerPrivateRemote::AddDataCue(m_identifier, start, end, IPC::DataReference(static_cast<const uint8_t*>(data), length)), m_mediaPlayerIdentifier);
}
#if ENABLE(DATACUE_VALUE)
Modified: trunk/Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp (278618 => 278619)
--- trunk/Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -107,7 +107,7 @@
void RemoteMediaRecorder::fetchData(CompletionHandler<void(IPC::DataReference&&, double)>&& completionHandler)
{
m_writer->fetchData([completionHandler = WTFMove(completionHandler)](auto&& data, auto timeCode) mutable {
- auto* pointer = reinterpret_cast<const uint8_t*>(data ? data->data() : nullptr);
+ auto* pointer = data ? data->data() : nullptr;
completionHandler(IPC::DataReference { pointer, data ? data->size() : 0 }, timeCode);
});
}
Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataCurl.cpp (278618 => 278619)
--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataCurl.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheDataCurl.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -73,7 +73,7 @@
if (isEmpty())
return false;
- return applier(reinterpret_cast<const uint8_t*>(data()), size());
+ return applier(data(), size());
}
Data Data::subrange(size_t offset, size_t size) const
Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.cpp (278618 => 278619)
--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheKey.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -94,7 +94,7 @@
}
auto cString = string.utf8();
// Include terminating null byte.
- sha1.addBytes(reinterpret_cast<const uint8_t*>(cString.data()), cString.length() + 1);
+ sha1.addBytes(cString.dataAsUInt8Ptr(), cString.length() + 1);
}
Key::HashType Key::computeHash(const Salt& salt) const
Modified: trunk/Source/WebKit/NetworkProcess/soup/WebKitDirectoryInputStream.cpp (278618 => 278619)
--- trunk/Source/WebKit/NetworkProcess/soup/WebKitDirectoryInputStream.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/NetworkProcess/soup/WebKitDirectoryInputStream.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -151,7 +151,7 @@
gsize bufferSize;
auto* bufferData = g_bytes_get_data(stream->priv->buffer.get(), &bufferSize);
gsize bytesRead = std::min(bufferSize, count - totalBytesRead);
- memcpy(reinterpret_cast<char*>(buffer) + totalBytesRead, bufferData, bytesRead);
+ memcpy(static_cast<char*>(buffer) + totalBytesRead, bufferData, bytesRead);
if (bytesRead == bufferSize)
stream->priv->buffer = nullptr;
else
Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp (278618 => 278619)
--- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -82,7 +82,7 @@
uint32_t length = string.length();
encoder << length;
- encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.data()), length, 1);
+ encoder.encodeFixedLengthData(string.dataAsUInt8Ptr(), length, 1);
}
WARN_UNUSED_RETURN bool ArgumentCoder<CString>::decode(Decoder& decoder, CString& result)
@@ -125,7 +125,7 @@
encoder << length << is8Bit;
if (is8Bit)
- encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters8()), length * sizeof(LChar), alignof(LChar));
+ encoder.encodeFixedLengthData(string.characters8(), length * sizeof(LChar), alignof(LChar));
else
encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters16()), length * sizeof(UChar), alignof(UChar));
}
Modified: trunk/Source/WebKit/Shared/API/c/cf/WKStringCF.mm (278618 => 278619)
--- trunk/Source/WebKit/Shared/API/c/cf/WKStringCF.mm 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/Shared/API/c/cf/WKStringCF.mm 2021-06-08 17:35:15 UTC (rev 278619)
@@ -57,6 +57,6 @@
// NOTE: This does not use StringImpl::createCFString() since that function
// expects to be called on the thread running WebCore.
if (WebKit::toImpl(stringRef)->string().is8Bit())
- return CFStringCreateWithBytes(allocatorRef, reinterpret_cast<const UInt8*>(WebKit::toImpl(stringRef)->string().characters8()), WebKit::toImpl(stringRef)->string().length(), kCFStringEncodingISOLatin1, true);
+ return CFStringCreateWithBytes(allocatorRef, WebKit::toImpl(stringRef)->string().characters8(), WebKit::toImpl(stringRef)->string().length(), kCFStringEncodingISOLatin1, true);
return CFStringCreateWithCharacters(allocatorRef, reinterpret_cast<const UniChar*>(WebKit::toImpl(stringRef)->string().characters16()), WebKit::toImpl(stringRef)->string().length());
}
Modified: trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm (278618 => 278619)
--- trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/Shared/API/c/cf/WKURLCF.mm 2021-06-08 17:35:15 UTC (rev 278619)
@@ -67,5 +67,5 @@
// UTF-8 which uses less memory and is what WebKit clients might expect.
CString buffer = string.utf8();
- return CFURLCreateAbsoluteURLWithBytes(nullptr, reinterpret_cast<const UInt8*>(buffer.data()), buffer.length(), kCFStringEncodingUTF8, nullptr, true);
+ return CFURLCreateAbsoluteURLWithBytes(nullptr, buffer.dataAsUInt8Ptr(), buffer.length(), kCFStringEncodingUTF8, nullptr, true);
}
Modified: trunk/Source/WebKit/Shared/ShareableResource.cpp (278618 => 278619)
--- trunk/Source/WebKit/Shared/ShareableResource.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/Shared/ShareableResource.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -84,7 +84,7 @@
#if USE(CF)
auto deallocator = createShareableResourceDeallocator(this);
- auto cfData = adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(data()), static_cast<CFIndex>(size()), deallocator.get()));
+ auto cfData = adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, data(), static_cast<CFIndex>(size()), deallocator.get()));
return SharedBuffer::create(cfData.get());
#elif USE(GLIB)
GRefPtr<GBytes> bytes = adoptGRef(g_bytes_new_with_free_func(data(), size(), [](void* data) {
Modified: trunk/Source/WebKit/Shared/SharedDisplayListHandle.h (278618 => 278619)
--- trunk/Source/WebKit/Shared/SharedDisplayListHandle.h 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/Shared/SharedDisplayListHandle.h 2021-06-08 17:35:15 UTC (rev 278619)
@@ -48,7 +48,7 @@
const SharedMemory& sharedMemory() const { return m_sharedMemory.get(); }
WebCore::DisplayList::ItemBufferIdentifier identifier() const { return m_identifier; }
- uint8_t* data() const { return reinterpret_cast<uint8_t*>(sharedMemory().data()); }
+ uint8_t* data() const { return static_cast<uint8_t*>(sharedMemory().data()); }
uint64_t unreadBytes()
{
Modified: trunk/Source/WebKit/Shared/WebCompiledContentRuleList.cpp (278618 => 278619)
--- trunk/Source/WebKit/Shared/WebCompiledContentRuleList.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/Shared/WebCompiledContentRuleList.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -46,7 +46,7 @@
bool WebCompiledContentRuleList::conditionsApplyOnlyToDomain() const
{
- return *reinterpret_cast<const uint32_t*>(reinterpret_cast<const uint8_t*>(m_data.data->data()) + m_data.conditionsApplyOnlyToDomainOffset);
+ return *reinterpret_cast<const uint32_t*>(static_cast<const uint8_t*>(m_data.data->data()) + m_data.conditionsApplyOnlyToDomainOffset);
}
const WebCore::ContentExtensions::DFABytecode* WebCompiledContentRuleList::filtersWithoutConditionsBytecode() const
Modified: trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationAssertionResponse.cpp (278618 => 278619)
--- trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationAssertionResponse.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationAssertionResponse.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -50,7 +50,7 @@
RefPtr<API::Data> data;
if (auto* userHandle = m_response->userHandle()) {
userHandle->ref();
- data = "" char*>(userHandle->data()), userHandle->byteLength(), [] (unsigned char*, const void* data) {
+ data = "" char*>(userHandle->data()), userHandle->byteLength(), [] (unsigned char*, const void* data) {
static_cast<ArrayBuffer*>(const_cast<void*>(data))->deref();
}, userHandle);
}
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (278618 => 278619)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -241,7 +241,7 @@
{
if (string.isNull() || !string.is8Bit())
return { reinterpret_cast<const uint8_t*>(string.characters16()), string.length() * sizeof(UChar) };
- return { reinterpret_cast<const uint8_t*>(string.characters8()), string.length() * sizeof(LChar) };
+ return { string.characters8(), string.length() * sizeof(LChar) };
}
static void loadString(WKPageRef pageRef, WKStringRef stringRef, const String& mimeType, const String& baseURL, WKTypeRef userDataRef)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm (278618 => 278619)
--- trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm 2021-06-08 17:35:15 UTC (rev 278619)
@@ -77,7 +77,7 @@
if (!navigationAction->isProcessingUserGesture()) {
page->setShouldSuppressSOAuthorizationInNextNavigationPolicyDecision();
auto html = makeString("<script>location = '", response.httpHeaderFields().get(HTTPHeaderName::Location), "'</script>").utf8();
- auto data = "" uint8_t*>(html.data()), html.length());
+ auto data = "" html.length());
page->loadData(data, "text/html"_s, "UTF-8"_s, navigationAction->request().url().string(), nullptr, navigationAction->shouldOpenExternalURLsPolicy());
return;
}
Modified: trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp (278618 => 278619)
--- trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorClient.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -124,7 +124,7 @@
ASSERT(isMainRunLoop());
ASSERT(m_connectionID);
auto message = event.utf8();
- send(m_connectionID.value(), reinterpret_cast<const uint8_t*>(message.data()), message.length());
+ send(m_connectionID.value(), message.dataAsUInt8Ptr(), message.length());
}
HashMap<String, Inspector::RemoteInspectorConnectionClient::CallHandler>& RemoteInspectorClient::dispatchMap()
Modified: trunk/Source/WebKit/WebProcess/Network/WebSocketChannel.cpp (278618 => 278619)
--- trunk/Source/WebKit/WebProcess/Network/WebSocketChannel.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/WebProcess/Network/WebSocketChannel.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -56,8 +56,8 @@
NetworkSendQueue WebSocketChannel::createMessageQueue(Document& document, WebSocketChannel& channel)
{
return { document, [&channel](auto& utf8String) {
- channel.notifySendFrame(WebSocketFrame::OpCode::OpCodeText, reinterpret_cast<const uint8_t*>(utf8String.data()), utf8String.length());
- channel.sendMessage(Messages::NetworkSocketChannel::SendString { IPC::DataReference { reinterpret_cast<const uint8_t*>(utf8String.data()), utf8String.length() } }, utf8String.length());
+ channel.notifySendFrame(WebSocketFrame::OpCode::OpCodeText, utf8String.dataAsUInt8Ptr(), utf8String.length());
+ channel.sendMessage(Messages::NetworkSocketChannel::SendString { IPC::DataReference { utf8String.dataAsUInt8Ptr(), utf8String.length() } }, utf8String.length());
}, [&channel](const uint8_t* data, size_t byteLength) {
channel.notifySendFrame(WebSocketFrame::OpCode::OpCodeBinary, data, byteLength);
channel.sendMessage(Messages::NetworkSocketChannel::SendData { IPC::DataReference { data, byteLength } }, byteLength);
@@ -295,7 +295,7 @@
}
auto utf8Message = message.utf8();
- m_inspector.didReceiveWebSocketFrame(m_document.get(), createWebSocketFrameForWebInspector(reinterpret_cast<const uint8_t*>(utf8Message.data()), utf8Message.length(), WebSocketFrame::OpCode::OpCodeText));
+ m_inspector.didReceiveWebSocketFrame(m_document.get(), createWebSocketFrameForWebInspector(utf8Message.dataAsUInt8Ptr(), utf8Message.length(), WebSocketFrame::OpCode::OpCodeText));
m_client->didReceiveMessage(message);
}
Modified: trunk/Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp (278618 => 278619)
--- trunk/Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -123,7 +123,7 @@
if (isRaw)
source->sendRawData(data.data(), data.size());
else
- source->sendStringData(CString(reinterpret_cast<const char*>(data.data()), data.size()));
+ source->sendStringData(CString(data.data(), data.size()));
}
}
@@ -227,7 +227,7 @@
void RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData(WebCore::RTCDataChannelIdentifier identifier, const String& string)
{
auto text = string.utf8();
- m_connection->send(Messages::RTCDataChannelRemoteManagerProxy::ReceiveData { identifier, false, IPC::DataReference { reinterpret_cast<const unsigned char*>(text.data()), text.length() } }, 0);
+ m_connection->send(Messages::RTCDataChannelRemoteManagerProxy::ReceiveData { identifier, false, IPC::DataReference { text.dataAsUInt8Ptr(), text.length() } }, 0);
}
void RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveRawData(WebCore::RTCDataChannelIdentifier identifier, const uint8_t* data, size_t size)
Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp (278618 => 278619)
--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp 2021-06-08 17:27:33 UTC (rev 278618)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp 2021-06-08 17:35:15 UTC (rev 278619)
@@ -117,7 +117,7 @@
if (!start(m_requestURLString, resultCString.length(), 0, "text/plain", ""))
return;
- deliverData(reinterpret_cast<const uint8_t*>(resultCString.data()), resultCString.length());
+ deliverData(resultCString.dataAsUInt8Ptr(), resultCString.length());
stop(NPRES_DONE);
}