Bug 222441 - Streamline decoding NSURL so it doesn't require allocating NSData and autoreleasing
Summary: Streamline decoding NSURL so it doesn't require allocating NSData and autorel...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on: 222145
Blocks:
  Show dependency treegraph
 
Reported: 2021-02-25 15:37 PST by Darin Adler
Modified: 2021-03-05 12:41 PST (History)
6 users (show)

See Also:


Attachments
Patch (7.22 KB, patch)
2021-02-25 15:46 PST, Darin Adler
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2021-02-25 15:37:38 PST
Streamline decoding NSURL so it doesn't require allocating NSData and autoreleasing
Comment 1 Darin Adler 2021-02-25 15:46:57 PST
Created attachment 421577 [details]
Patch
Comment 2 Sam Weinig 2021-02-25 15:56:11 PST
Comment on attachment 421577 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=421577&action=review

> Source/WTF/wtf/cocoa/NSURLExtras.mm:153
> +NSURL *URLWithData(const void* bytes, size_t length, NSURL *baseURL)

What is the reason behind using const void* here rather than const uint8_t*? With string code, I like to be more specific if I can to avoid people accidentally passing in UChar* to a function like this.
Comment 3 Darin Adler 2021-02-25 16:04:11 PST
Comment on attachment 421577 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=421577&action=review

>> Source/WTF/wtf/cocoa/NSURLExtras.mm:153
>> +NSURL *URLWithData(const void* bytes, size_t length, NSURL *baseURL)
> 
> What is the reason behind using const void* here rather than const uint8_t*? With string code, I like to be more specific if I can to avoid people accidentally passing in UChar* to a function like this.

I was trying to side step the three different types for bytes and was a little bit influenced by the types in NSData methods. But your argument seems compelling, and CFData functions take uint8_t*. I will go with uint8_t instead.
Comment 4 Darin Adler 2021-02-25 16:08:13 PST
Looks like Brent’s patch had to be rolled out. I’ll have to wait to land this until it’s landed again.
Comment 5 Radar WebKit Bug Importer 2021-03-04 15:38:22 PST
<rdar://problem/75061347>
Comment 6 Darin Adler 2021-03-05 12:41:52 PST
Not needed any more. Brent’s latest is using CFURLCreateAbsoluteURLWithBytes now, not URLWithData, so there’s no need for this.