Commit dbd9819
committed
Add byteCast for conversions between different byte-sized types
https://bugs.webkit.org/show_bug.cgi?id=273380
rdar://127209334
Reviewed by Chris Dumez.
* Source/JavaScriptCore/API/JSStringRef.cpp:
(JSStringGetUTF8CString): Use byteCast.
* Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp:
(JSC::Printer::printMemory): Use static_cast instead of reinterpret_cast.
* Source/JavaScriptCore/assembler/ProbeFrame.h:
(JSC::Probe::Frame::Frame): Ditto.
* Source/JavaScriptCore/bytecode/UnlinkedMetadataTableInlines.h:
(JSC::UnlinkedMetadataTable::link): Ditto.
* Source/JavaScriptCore/runtime/Identifier.h:
(JSC::Identifier::equal): Use byteCast.
(JSC::operator==): Ditto.
* Source/JavaScriptCore/runtime/IntlCollator.cpp:
(JSC::IntlCollator::compareStrings const): Ditto.
* Source/JavaScriptCore/runtime/IntlLocale.cpp:
(JSC::LocaleIDBuilder::setKeywordValue): Ditto.
* Source/JavaScriptCore/runtime/NumberPrototype.cpp:
(JSC::toStringWithRadixInternal): Removed unneeded static_cast.
* Source/JavaScriptCore/wasm/WasmFormat.h:
(JSC::Wasm::Segment::byte): Removed unneeded reinterpret_cast.
* Source/JavaScriptCore/wasm/WasmMemory.cpp:
(JSC::Wasm::Memory::fill): Use static_cast instead of reinterpret_cast.
(JSC::Wasm::Memory::copy): Ditto.
(JSC::Wasm::Memory::init): Ditto.
* Source/JavaScriptCore/yarr/YarrPattern.cpp:
(JSC::Yarr::dumpUChar32): Tweaked formatting.
* Source/WTF/wtf/FastFloat.cpp:
(WTF::parseDouble): Use byteCast.
* Source/WTF/wtf/FileSystem.cpp:
(WTF::FileSystemImpl::toStdFileSystemPath): Ditto.
(WTF::FileSystemImpl::fromStdFileSystemPath): Ditto.
* Source/WTF/wtf/PageBlock.h:
(WTF::PageBlock::end const): Use static_cast instead of reinterpret_cast.
* Source/WTF/wtf/StdLibExtras.h: Added byteCast.
* Source/WTF/wtf/Threading.cpp:
(WTF::Thread::normalizeThreadName): Use byteCast.
* Source/WTF/wtf/URLHelpers.cpp:
(WTF::URLHelpers::userVisibleURL): Use span instead of dataAsUInt8Ptr.
* Source/WTF/wtf/cf/URLCF.cpp:
(WTF::URL::createCFURL const): Ditto.
* Source/WTF/wtf/cf/VectorCF.h:
(WTF::span): Use static_cast instead of reinterpret_cast.
* Source/WTF/wtf/persistence/PersistentCoders.cpp:
(WTF::Persistence::Coder<CString>::encodeForPersistence): Use span
instead of dataAsUInt8Ptr.
(WTF::Persistence::Coder<CString>::decodeForPersistence): Use byteCast.
* Source/WTF/wtf/text/AtomStringImpl.h: Use byteCast.
* Source/WTF/wtf/text/CString.h: Ditto.
* Source/WTF/wtf/text/StringBuilder.h:
(WTF::StringBuilder::append): Ditto.
* Source/WTF/wtf/text/StringCommon.h: Ditto.
* Source/WTF/wtf/text/StringConcatenate.h: Ditto.
* Source/WTF/wtf/text/StringConcatenateNumbers.h: Ditto.
* Source/WTF/wtf/text/StringImpl.cpp:
(WTF::equalInner): Ditto.
* Source/WTF/wtf/text/StringImpl.h: Ditto.
* Source/WTF/wtf/text/StringView.h: Ditto.
* Source/WTF/wtf/text/WTFString.cpp:
(WTF::String::String): Ditto.
(WTF::String::fromUTF8): Ditto.
* Source/WTF/wtf/text/WTFString.h: Ditto.
* Source/WTF/wtf/text/cf/AtomStringImplCF.cpp:
(WTF::AtomStringImpl::add): Ditto.
* Source/WTF/wtf/unicode/Collator.h: Use char8_t instead of UTF8 in the
name for the collate function that takes null-terminated strings.
* Source/WTF/wtf/unicode/CollatorDefault.cpp:
(WTF::Collator::collate const): Use byteCast.
* Source/WTF/wtf/unicode/icu/CollatorICU.cpp:
(WTF::createIterator): Use byteCast.
(WTF::Collator::collate const): Use createIterator.
* Source/WebCore/Modules/WebGPU/GPUQueue.cpp:
(WebCore::getImageBytesFromVideoFrame): Use static_cast instead of reinterpret_cast.
* Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::isPlayReadySanitizedInitializationData): Use byteCast.
* Source/WebCore/PAL/pal/text/EncodingTables.cpp:
(PAL::jis0208): Ditto.
(PAL::jis0212): Ditto.
(PAL::big5): Ditto.
(PAL::eucKR): Ditto.
(PAL::gb18030): Ditto.
* Source/WebCore/PAL/pal/text/TextCodecCJK.cpp:
(PAL::TextCodecCJK::eucJPDecode): Ditto.
(PAL::TextCodecCJK::big5Decode): Ditto.
* Source/WebCore/PAL/pal/text/TextCodecICU.cpp:
(PAL::TextCodecICU::decode): Ditto.
(PAL::TextCodecICU::encode const): Ditto.
* Source/WebCore/PAL/pal/text/TextEncodingDetectorICU.cpp:
(PAL::detectTextEncoding): Ditto.
* Source/WebCore/css/process-css-pseudo-selectors.py: Ditto.
* Source/WebCore/html/track/VTTScanner.h:
(WebCore::VTTScanner::scan): Ditto.
* Source/WebCore/html/track/WebVTTTokenizer.cpp:
(WebCore::equalLiteral): Deleted.
* Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::showText): Use span instead of dataAsUInt8Ptr.
* Source/WebCore/platform/SharedBuffer.h: Deleted dataAsCharPtr.
* Source/WebCore/platform/SharedBufferChunkReader.cpp:
(WebCore::SharedBufferChunkReader::nextChunk): Use byteCast.
* Source/WebCore/platform/graphics/MIMESniffer.cpp:
(WebCore::MIMESniffer::span8): Ditto.
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::initialize): Ditto.
(WebCore::GraphicsContextGLANGLE::getString): Ditto.
* Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm:
(WebCore::ShareableBitmap::createFromImagePixels): Ditto.
* Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::defaultVariationValues): Use assignment instead of static_cast.
* Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::decodeSample): Use byteCast.
* Source/WebCore/platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm:
(WebCore::parseOpusPrivateData): Ditto.
* Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNeonApplier.cpp:
(WebCore::FEBlendNeonApplier::applyPlatform const): Ditto.
* Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::create): Ditto.
* Source/WebCore/platform/network/cf/ResourceRequestCFNet.h:
(WebCore::httpHeaderValueUsingSuitableEncoding): Use span instead of
dataAsUInt8Ptr.
* Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm:
(WebCore::ResourceResponse::platformCertificateInfo const): Ditto.
* Source/WebCore/workers/ScriptBuffer.cpp:
(WebCore::ScriptBuffer::toString const): Use byteCast.
(WebCore::ScriptBuffer::append): Ditto. Also fixed a mistake where this was
using uint8_t instead of char8_t.
* Source/WebCore/xml/XSLTProcessorLibxslt.cpp:
(WebCore::docLoaderFunc): Use byteCast.
(WebCore::writeToStringBuilder): Ditto.
(WebCore::XSLTProcessor::transformToString): Ditto.
* Source/WebCore/xml/XSLTUnicodeSort.cpp:
(WebCore::xsltUnicodeSortFunction): Ditto.
* Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLParserContext::createMemoryParser): Use byteCast.
(WebCore::toString): Ditto.
(WebCore::toAtomString): Ditto.
(WebCore::sharedXHTMLEntity): Ditto.
(WebCore::convertUTF16EntityToUTF8): Ditto.
(WebCore::getXHTMLEntity): Ditto.
(WebCore::xmlDocPtrForString): Ditto.
(WebCore::attributesStartElementNsHandler): Ditto.
* Source/WebGPU/WebGPU/BindGroup.mm:
(WebGPU::Device::createExternalTextureFromPixelBuffer const): Ditto.
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
(getBufferSubData): Ditto.
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::logOnBehalfOfWebContent): Ditto.
* Source/WebKit/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
(WebKit::LibWebRTCSocketClient::signalReadPacket): Ditto.
* Source/WebKit/Shared/API/c/WKString.cpp:
(WKStringGetUTF8CStringImpl): Ditto.
* Source/WebKit/Shared/API/c/cf/WKURLCF.mm:
(WKURLCopyCFURL): Use span instead of dataAsUInt8Ptr.
* Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm:
(WebKit::SandboxExtensionImpl::SandboxExtensionImpl): Ditto.
* Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp:
(WebKit::HistoryEntryDataEncoder::operator<<): Use byteCast.
(WebKit::encodeLegacySessionState): Use checked_cf_cast.
* Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp:
(WebKit::HistoryEntryDataEncoder::operator<<): Use byteCast.
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
(WebKit::LibWebRTCSocket::signalReadPacket): Ditto.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::getAccessibilityTreeData): Use checked_cf_cast.
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::registerLogHook): Use byteCast.
* Source/WebKitLegacy/mac/Misc/WebNSDataExtras.mm:
(-[NSData _webkit_guessedMIMETypeForXML]): Ditto.
* Tools/TestWebKitAPI/Tests/WTF/StdLibExtrasTests.cpp:
(TestWebKitAPI::TEST(WTF_StdLibExtras, ByteCast)): Added some tests.
* Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp: Rewrite tests so it's easier
to see which one failed. Did not use byteCast here.
* Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::TEST(WTF, StringImplEqualIgnoringASCIICaseBasic)): Ditto.
(TestWebKitAPI::TEST(WTF, StringImplEqualIgnoringASCIICaseWithEmpty)): Ditto.
(TestWebKitAPI::TEST(WTF, StringImplFindIgnoringASCIICaseOnEmpty)): Ditto.
(TestWebKitAPI::TEST(WTF, StringImplStartsWithIgnoringASCIICaseWithNull)): Ditto.
(TestWebKitAPI::TEST(WTF, StringImplStartsWithIgnoringASCIICaseWithEmpty)): Ditto.
(TestWebKitAPI::TEST(WTF, StringImplEndsWithIgnoringASCIICaseWithNull)): Ditto.
(TestWebKitAPI::TEST(WTF, StringImplEndsWithIgnoringASCIICaseWithEmpty)): Ditto.
* Tools/TestWebKitAPI/Tests/WTF/StringView.cpp:
(TestWebKitAPI::TEST(WTF, StringViewEqualIgnoringASCIICaseBasic)): Ditto.
(TestWebKitAPI::TEST(WTF, StringViewEqualIgnoringASCIICaseWithEmpty)): Ditto.
* Tools/TestWebKitAPI/Tests/WebCore/CBORWriterTest.cpp:
(TestWebKitAPI::eq): Remomved unneeded reinterpret_cast.
* Tools/TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:
(TestWebKitAPI::TEST_F(FragmentedSharedBufferTest, getSomeData)): Use byteCast
and span instead of dataAsCharPtr.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/PDFLinkReferrer.mm:
(TEST(WebKit, PDFLinkReferrer)): Use byteCast.
* Tools/TestWebKitAPI/cocoa/CGImagePixelReader.cpp:
(TestWebKitAPI::CGImagePixelReader::at const): Use static_cast instead of
reinterpret_cast.
* Tools/TestWebKitAPI/cocoa/HTTPServer.mm:
(TestWebKitAPI::proxyDefinition): Use byteCast.
(TestWebKitAPI::Connection::webSocketHandshake): Ditto.
Canonical link: https://commits.webkit.org/279338@main1 parent 102781a commit dbd9819
75 files changed
Lines changed: 285 additions & 239 deletions
File tree
- Source
- JavaScriptCore
- API
- assembler
- bytecode
- runtime
- wasm
- yarr
- WTF/wtf
- cf
- persistence
- text
- cf
- unicode
- icu
- WebCore
- Modules
- WebGPU
- encryptedmedia
- PAL/pal/text
- css
- html/track
- platform
- graphics
- angle
- cg
- cocoa
- cpu/arm/filters
- network/cocoa
- workers
- xml
- parser
- WebGPU/WebGPU
- WebKitLegacy/mac/Misc
- WebKit
- GPUProcess/graphics
- NetworkProcess
- webrtc
- UIProcess/mac
- WebProcess
- Network/webrtc
- WebPage
- cocoa
- Tools/TestWebKitAPI
- Tests
- WTF
- WebCore
- WebKitCocoa
- cocoa
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
305 | | - | |
| 304 | + | |
| 305 | + | |
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
601 | | - | |
| 601 | + | |
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
414 | | - | |
| 414 | + | |
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | | - | |
| 432 | + | |
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
| 449 | + | |
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| |||
0 commit comments