RESOLVED FIXED137526
[Win] Resolve various static analyzer warnings in WebCore
https://bugs.webkit.org/show_bug.cgi?id=137526
Summary [Win] Resolve various static analyzer warnings in WebCore
Brent Fulgham
Reported 2014-10-08 10:28:45 PDT
This patch corrects a set of issues found by the MSVC static analyzer.
Attachments
Patch (17.09 KB, patch)
2014-10-08 10:30 PDT, Brent Fulgham
dino: review+
Brent Fulgham
Comment 1 2014-10-08 10:30:20 PDT
Myles C. Maxfield
Comment 2 2014-10-08 10:51:04 PDT
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
Brent Fulgham
Comment 3 2014-10-08 10:59:12 PDT
(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.
Dean Jackson
Comment 4 2014-10-08 11:01:27 PDT
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.
Brent Fulgham
Comment 5 2014-10-08 11:33:20 PDT
Note You need to log in before you can comment on or make changes to this bug.