[webkit-reviews] review granted: [Bug 178036] Part 2: Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler : [Attachment 323061] Patch v1

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Oct 7 23:58:47 PDT 2017


Darin Adler <darin at apple.com> has granted David Kilzer (:ddkilzer)
<ddkilzer at webkit.org>'s request for review:
Bug 178036: Part 2: Fix -Wcast-qual and -Wunused-lambda-capture warnings in
WebCore with new clang compiler
https://bugs.webkit.org/show_bug.cgi?id=178036

Attachment 323061: Patch v1

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




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

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

> Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp:141
> +#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) ||
(PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300)
> +#define _CCRSACryptorCreateFromData_arg_data_cast(value)
(const_cast<uint8_t*>(value))
> +#else
> +#define _CCRSACryptorCreateFromData_arg_data_cast(value) (value)
> +#endif

This doesn’t need to be a macro; it can be an inline function, and we could try
to give it a more normal WebKit-style name.

Why the strange macro name with an underscore?	Names that start with an
underscore and a capital letter are technically reserved, so it’s not a great
idea to use a name like that.

> Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp:57
> +    attributesDictionary = adoptCF(CFDictionaryCreateCopy(nullptr,
mutableAttributes.get()));

Since this sidesteps the type safety issue by making a copy of the dictionary,
we need to be sure it doesn’t make things too slow. On the other hand,
performance of these things changes over time anyway. I think there is some new
copy-on-write logic that makes this kind of idiom fast with NSDictionary; not
sure if the Foundation programmers made it do the same thing when using the
CFDictionary functions.

Also, above we used kCFAllocatorDefault, but here we are using nullptr for the
same thing.


More information about the webkit-reviews mailing list