Bug 161598

Summary: [Mac] Static Analyzer warnings about unused values in CDMSessionAVStreamSession.mm
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: WebCore Misc.Assignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, jer.noble
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[PATCH] Proposed Fix none

Description Joseph Pecoraro 2016-09-05 01:47:21 PDT
Static Analyzer warnings about unused values in CDMSessionAVStreamSession.mm:

    AnalyzeShallow platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm
    Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:314:9: warning: Value stored to 'systemCode' is never read
            systemCode = '!mor';
            ^            ~~~~~~
    Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:323:9: warning: Value stored to 'systemCode' is never read
            systemCode = '!mor';
            ^            ~~~~~~
    Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:330:5: warning: Value stored to 'systemCode' is never read
        systemCode = 0;
        ^            ~
    3 warnings generated.

Seems that in r195410 this parameter accidentally dropped its reference-ness. Lets add it back.
Comment 1 Joseph Pecoraro 2016-09-05 01:48:41 PDT
Created attachment 287942 [details]
[PATCH] Proposed Fix

Jer, could we write a test for this?
Comment 2 Darin Adler 2016-09-05 10:00:00 PDT
Comment on attachment 287942 [details]
[PATCH] Proposed Fix

Wow, seems like this also fixes a bug, not just a static analyzer warning! I wonder if someone knows how to write a test that would demonstrate the bug.

Also, I would like to remind everyone that in new code we should model multiple return values as return value, perhaps using a combination of structures, tuples, pairs, optionals, and variants as needed, not as one return value and two out arguments.
Comment 3 Darin Adler 2016-09-05 10:00:20 PDT
I see Joe’s question/request to Jer now.
Comment 4 WebKit Commit Bot 2016-09-05 10:21:41 PDT
Comment on attachment 287942 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 287942

Committed r205456: <http://trac.webkit.org/changeset/205456>
Comment 5 WebKit Commit Bot 2016-09-05 10:21:45 PDT
All reviewed patches have been landed.  Closing bug.