[vlc-devel] [PATCH 2/2] misc/rtsp: Clarify conditional assignment

Marvin Scholz epirat07 at gmail.com
Thu Oct 3 21:08:47 CEST 2019



On 3 Oct 2019, at 17:41, Rémi Denis-Courmont wrote:

> Le torstaina 3. lokakuuta 2019, 18.10.37 EEST Marvin Scholz a écrit :
>> Found by lgtm.com
>> ---
>>  modules/misc/rtsp.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/modules/misc/rtsp.c b/modules/misc/rtsp.c
>> index d90f754357..1940aeb731 100644
>> --- a/modules/misc/rtsp.c
>> +++ b/modules/misc/rtsp.c
>> @@ -1251,7 +1251,7 @@ static int RtspCallback( httpd_callback_sys_t 
>> *p_args,
>> httpd_client_t *cl, httpd_MsgAdd( answer, "Server", "VLC/%s", VERSION 
>> );
>>      httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body );
>>      psz_cseq = httpd_MsgGet( query, "Cseq" );
>> -    psz_cseq ? i_cseq = atoi( psz_cseq ) : 0;
>> +    i_cseq = (psz_cseq) ? atoi( psz_cseq ) : 0;
>>      httpd_MsgAdd( answer, "CSeq", "%d", i_cseq );
>>      httpd_MsgAdd( answer, "Cache-Control", "%s", "no-cache" );
>
> This does not clarify the assignment.
> It changes the semantics, the side effects.
>
> (And I don't know if it's right or wrong.)
>

Indeed it does, but i_cseq is initialized to 0 and not
changed anywhere else in this function, so setting it
to 0 in case of psz_cseq being NULL does not make a
difference.

> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list