[webkit-reviews] review granted: [Bug 232404] [Tools] Enable -Wformat=2 warnings : [Attachment 442638] Patch v1

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 27 15:34:59 PDT 2021


Darin Adler <darin at apple.com> has granted David Kilzer (:ddkilzer)
<ddkilzer at webkit.org>'s request for review:
Bug 232404: [Tools] Enable -Wformat=2 warnings
https://bugs.webkit.org/show_bug.cgi?id=232404

Attachment 442638: Patch v1

https://bugs.webkit.org/attachment.cgi?id=442638&action=review




--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 442638
  --> https://bugs.webkit.org/attachment.cgi?id=442638
Patch v1

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

> Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm:174
> +    NSString *const html = @"<script>var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://127.0.0.1:%d/', true); xhr.send();</script>";

I suggest you use constexpr instead. One nice thing about that is that then it
can be at the beginning of the line.

> Tools/TestWebKitAPI/Tests/WebKitCocoa/OpenAndCloseWindow.mm:239
> +    NSString *const windowOpenFormatString = @"window.open(\"about:blank\",
\"_blank\", \"%@\")";

Ditto.

> Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h:83
> +	       NSString *const format = @"HTTP/1.1 200 OK\r\n"

Ditto.

> Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerTCPServer.h:95
> +    NSURLRequest *requestWithURLString(NSString *url) { return [NSURLRequest
requestWithURL:[NSURL URLWithString:url]]; }

I would name this argument "string", not "url".

> Tools/TestWebKitAPI/cocoa/HTTPServer.mm:368
> +    return [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString
stringWithFormat:@"%s://127.0.0.1:%d%s", scheme, port(), path.utf8().data()]]];

No good reason to convert to a UTF8 string just to format. Can use %@ and use
path.createCFString().get() instead.


More information about the webkit-reviews mailing list