Summary: | [Win] Resolve various static analyzer warnings in WebCore | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Brent Fulgham <bfulgham> | ||||
Component: | WebCore Misc. | Assignee: | Brent Fulgham <bfulgham> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | commit-queue, mmaxfield, simon.fraser | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=192805 | ||||||
Attachments: |
|
Description
Brent Fulgham
2014-10-08 10:28:45 PDT
Created attachment 239480 [details]
Patch
Comment on attachment 239480 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=239480&action=review > Source/WebCore/page/SessionIDHash.h:45 > + static void constructDeletedValue(WebCore::SessionID& slot) { slot = WebCore::SessionID(static_cast<uint64_t>(-2)); } This is confusing even though I know it's correct. Perhaps this is worth pulling out the -2 into a static const variable, and maybe setting it to something like 0xFFFFFFFFFFFFFFFE (In reply to comment #2) > (From update of attachment 239480 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=239480&action=review > > > Source/WebCore/page/SessionIDHash.h:45 > > + static void constructDeletedValue(WebCore::SessionID& slot) { slot = WebCore::SessionID(static_cast<uint64_t>(-2)); } > > This is confusing even though I know it's correct. Perhaps this is worth pulling out the -2 into a static const variable, and maybe setting it to something like 0xFFFFFFFFFFFFFFFE Yeah, we have a few places where an unsigned value is initialized with a negative number as a sentinel value... I'm not sure what the right thing to do is in this case. Comment on attachment 239480 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=239480&action=review >> Source/WebCore/page/SessionIDHash.h:45 >> + static void constructDeletedValue(WebCore::SessionID& slot) { slot = WebCore::SessionID(static_cast<uint64_t>(-2)); } > > This is confusing even though I know it's correct. Perhaps this is worth pulling out the -2 into a static const variable, and maybe setting it to something like 0xFFFFFFFFFFFFFFFE I agree with Myles that it is weird looking. Committed r174465: <http://trac.webkit.org/changeset/174465> |