Fix compile Wmaybe-uninitialized warning on WebVTTListener.cpp

RESOLVED FIXED in Firefox 51

Status

()

defect
P3
normal
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: JamesCheng, Assigned: JamesCheng)

Tracking

unspecified
mozilla51
Points:
---

Firefox Tracking Flags

(firefox51 fixed)

Details

Attachments

(1 attachment)

Try fix 
warning: 'cue' may be used uninitialized in this function [-Wmaybe-uninitialized]

Even the logic will check the rv without dereferencing the uninitialized pointer, having a initial value is a good.
Component: Audio/Video → Audio/Video: Playback
Comment on attachment 8791033 [details]
Bug 1302591 - Fix compile Wmaybe-uninitialized warning on WebVTTListener.cpp.

https://reviewboard.mozilla.org/r/78592/#review77344

Thanks!

::: dom/media/WebVTTListener.cpp:165
(Diff revision 1)
>      return NS_ERROR_FAILURE;
>    }
>  
> -  TextTrackCue* cue;
> +  TextTrackCue* cue = nullptr;
>    nsresult rv = UNWRAP_OBJECT(VTTCue, &aCue.toObject(), cue);
>    NS_ENSURE_SUCCESS(rv, rv);

Right, the current implementation of UnwrapObject only returns NS_OK after setting cue.
Attachment #8791033 - Flags: review?(giles) → review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1c708062f870
Fix compile Wmaybe-uninitialized warning on WebVTTListener.cpp. r=rillian
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/1c708062f870
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.