Bug 161598 - [Mac] Static Analyzer warnings about unused values in CDMSessionAVStreamSession.mm
Summary: [Mac] Static Analyzer warnings about unused values in CDMSessionAVStreamSessi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-05 01:47 PDT by Joseph Pecoraro
Modified: 2016-09-05 10:21 PDT (History)
3 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (2.44 KB, patch)
2016-09-05 01:48 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.