[webkit-reviews] review granted: [Bug 114970] StringImpl.h should compile with -Wshorten-64-to-32 : [Attachment 199053] Patch v1

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 22 11:35:09 PDT 2013


Darin Adler <darin at apple.com> has granted David Kilzer (:ddkilzer)
<ddkilzer at webkit.org>'s request for review:
Bug 114970: StringImpl.h should compile with -Wshorten-64-to-32
https://bugs.webkit.org/show_bug.cgi?id=114970

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

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=199053&action=review


> Source/WTF/wtf/text/StringImpl.h:316
> -	   unsigned hash = reinterpret_cast<uintptr_t>(this);
> +	   unsigned hash =
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this));

This is a silly approach to creating the hash. For example, the low bits will
always be due to alignment zero. I suggest we use a random number instead.

Code change is OK, but code is dumb.


More information about the webkit-reviews mailing list