[12/13] rtpdec_hevc: Initialize variables to silence false positive compiler warnings

Message ID 1424378051-6607-12-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö Feb. 19, 2015, 8:34 p.m.
For some reason, clang didn't warn about this prior to using the
shared function.
---
 libavformat/rtpdec_hevc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Diego Biurrun Feb. 19, 2015, 10:10 p.m. | #1
On Thu, Feb 19, 2015 at 10:34:10PM +0200, Martin Storsjö wrote:
> --- a/libavformat/rtpdec_hevc.c
> +++ b/libavformat/rtpdec_hevc.c
> @@ -91,8 +91,8 @@ static av_cold int hevc_sdp_parse_fmtp_config(AVFormatContext *s,
>      if (!strcmp(attr, "sprop-vps") || !strcmp(attr, "sprop-sps") ||
>          !strcmp(attr, "sprop-pps") || !strcmp(attr, "sprop-sei")) {
> -        uint8_t **data_ptr;
> -        int *size_ptr;
> +        uint8_t **data_ptr = NULL;
> +        int *size_ptr = 0;

Shouldn't both be NULL?

Diego
Martin Storsjö Feb. 20, 2015, 10:11 a.m. | #2
On Thu, 19 Feb 2015, Diego Biurrun wrote:

> On Thu, Feb 19, 2015 at 10:34:10PM +0200, Martin Storsjö wrote:
>> --- a/libavformat/rtpdec_hevc.c
>> +++ b/libavformat/rtpdec_hevc.c
>> @@ -91,8 +91,8 @@ static av_cold int hevc_sdp_parse_fmtp_config(AVFormatContext *s,
>>      if (!strcmp(attr, "sprop-vps") || !strcmp(attr, "sprop-sps") ||
>>          !strcmp(attr, "sprop-pps") || !strcmp(attr, "sprop-sei")) {
>> -        uint8_t **data_ptr;
>> -        int *size_ptr;
>> +        uint8_t **data_ptr = NULL;
>> +        int *size_ptr = 0;
>
> Shouldn't both be NULL?

Oh, indeed. Fixed locally.

// Martin
Diego Biurrun Feb. 20, 2015, 3:37 p.m. | #3
On Fri, Feb 20, 2015 at 12:11:31PM +0200, Martin Storsjö wrote:
> On Thu, 19 Feb 2015, Diego Biurrun wrote:
> >On Thu, Feb 19, 2015 at 10:34:10PM +0200, Martin Storsjö wrote:
> >>--- a/libavformat/rtpdec_hevc.c
> >>+++ b/libavformat/rtpdec_hevc.c
> >>@@ -91,8 +91,8 @@ static av_cold int hevc_sdp_parse_fmtp_config(AVFormatContext *s,
> >>     if (!strcmp(attr, "sprop-vps") || !strcmp(attr, "sprop-sps") ||
> >>         !strcmp(attr, "sprop-pps") || !strcmp(attr, "sprop-sei")) {
> >>-        uint8_t **data_ptr;
> >>-        int *size_ptr;
> >>+        uint8_t **data_ptr = NULL;
> >>+        int *size_ptr = 0;
> >
> >Shouldn't both be NULL?
> 
> Oh, indeed. Fixed locally.

OK then.

Diego

Patch

diff --git a/libavformat/rtpdec_hevc.c b/libavformat/rtpdec_hevc.c
index 13df942..ddb24aa 100644
--- a/libavformat/rtpdec_hevc.c
+++ b/libavformat/rtpdec_hevc.c
@@ -91,8 +91,8 @@  static av_cold int hevc_sdp_parse_fmtp_config(AVFormatContext *s,
     /* sprop-sei: [base64] */
     if (!strcmp(attr, "sprop-vps") || !strcmp(attr, "sprop-sps") ||
         !strcmp(attr, "sprop-pps") || !strcmp(attr, "sprop-sei")) {
-        uint8_t **data_ptr;
-        int *size_ptr;
+        uint8_t **data_ptr = NULL;
+        int *size_ptr = 0;
         if (!strcmp(attr, "sprop-vps")) {
             data_ptr = &hevc_data->vps;
             size_ptr = &hevc_data->vps_size;