Bug 138052 - [Mac] Use modern loops in ResourceRequestCocoa.mm
Summary: [Mac] Use modern loops in ResourceRequestCocoa.mm
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac Unspecified
: P2 Enhancement
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-24 11:57 PDT by Chris Dumez
Modified: 2014-10-24 15:24 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.75 KB, patch)
2014-10-24 12:23 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (5.65 KB, patch)
2014-10-24 14:27 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2014-10-24 11:57:24 PDT
Use modern loops in ResourceRequestCocoa.mm and leverage Objective-C's fast enumeration.
Comment 1 Chris Dumez 2014-10-24 12:23:28 PDT
Created attachment 240424 [details]
Patch
Comment 2 WebKit Commit Bot 2014-10-24 12:24:54 PDT
Attachment 240424 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:88:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2014-10-24 14:19:39 PDT
Comment on attachment 240424 [details]
Patch

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

> Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:88
> +    [[m_nsRequest.get() allHTTPHeaderFields] enumerateKeysAndObjectsUsingBlock: ^(NSString *name, NSString *value, BOOL *) {

You don’t need the .get() here.

> Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:95
> +    for (NSNumber *encodingFallback in [m_nsRequest.get() contentDispositionEncodingFallbackArray]) {

You don’t need the .get() here.

> Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:172
> +        RetainPtr<CFStringRef> cfEncodingName = encodingName.createCFString();
> +        CFStringEncoding nsEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding(cfEncodingName.get()));

Reads fine without the local variable. Just encodingName.createCFString().get().
Comment 4 Chris Dumez 2014-10-24 14:27:29 PDT
Created attachment 240436 [details]
Patch
Comment 5 WebKit Commit Bot 2014-10-24 14:29:45 PDT
Attachment 240436 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:88:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 WebKit Commit Bot 2014-10-24 15:24:28 PDT
Comment on attachment 240436 [details]
Patch

Clearing flags on attachment: 240436

Committed r175186: <http://trac.webkit.org/changeset/175186>
Comment 7 WebKit Commit Bot 2014-10-24 15:24:32 PDT
All reviewed patches have been landed.  Closing bug.