Bug 137526 - [Win] Resolve various static analyzer warnings in WebCore
Summary: [Win] Resolve various static analyzer warnings in WebCore
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-08 10:28 PDT by Brent Fulgham
Modified: 2018-12-17 22:59 PST (History)
3 users (show)

See Also:


Attachments
Patch (17.09 KB, patch)
2014-10-08 10:30 PDT, Brent Fulgham
dino: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2014-10-08 10:28:45 PDT
This patch corrects a set of issues found by the MSVC static analyzer.
Comment 1 Brent Fulgham 2014-10-08 10:30:20 PDT
Created attachment 239480 [details]
Patch
Comment 2 Myles C. Maxfield 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
Comment 3 Brent Fulgham 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.
Comment 4 Dean Jackson 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.
Comment 5 Brent Fulgham 2014-10-08 11:33:20 PDT
Committed r174465: <http://trac.webkit.org/changeset/174465>