[webkit-reviews] review granted: [Bug 40602] Use an array for extensions in MimeClassInfo : [Attachment 58737] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 14 18:20:38 PDT 2010


Darin Adler <darin at apple.com> has granted Anders Carlsson
<andersca at apple.com>'s request for review:
Bug 40602: Use an array for extensions in MimeClassInfo
https://bugs.webkit.org/show_bug.cgi?id=40602

Attachment 58737: Patch
https://bugs.webkit.org/attachment.cgi?id=58737&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
> +    const Vector<String> &extensions = mimeClassInfo().extensions;

The "&" here is in the wrong place.

> +    StringBuilder builder;
> +    for (size_t i = 0; i < extensions.size(); ++i) {
> +	   if (i)
> +	       builder.append(',');
> +	   builder.append(extensions[i]);
> +    }
> +    return builder.toString();

Would Vector<UChar> do a better job? I never know which to use.

> +	       NSArray *extensions = [plugin extensionsForMIMEType:MIME];
> +	       NSUInteger count = [extensions count];
> +	       for (NSUInteger i = 0; i < count; ++i) {
> +		   NSString *extension = [extensions objectAtIndex:i];
> +		   mime.extensions.append(extension);
> +	       }

This is a lot like toStringVector in WebView.mm and
WebEditorClient::getGuessesForWord in WebEditorClient.mm. I wish we had shared
code to make NSArray of NSString into Vector<String> and vice versa.

r=me


More information about the webkit-reviews mailing list