[vlc-devel] [PATCH 2/2] asx: remove useless test
Francois Cartegnie
fcvlcdev at free.fr
Mon Dec 11 13:13:31 CET 2017
Le 11/12/2017 à 10:22, Pierre Lamot a écrit :
> ---
> modules/demux/playlist/asx.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/modules/demux/playlist/asx.c b/modules/demux/playlist/asx.c
> index 0c0614cec7..c4d7170013 100644
> --- a/modules/demux/playlist/asx.c
> +++ b/modules/demux/playlist/asx.c
> @@ -356,16 +356,17 @@ end:
> /// this looks for patterns like &name; &#DEC; or &#xHEX;
> static bool isXmlEncoded(const char* psz_str)
> {
> + assert( psz_str != NULL );
> //look for special characters
> if( strpbrk(psz_str, "<>'\"") != NULL )
> return false;
>
> bool is_escaped = false;
> - while (psz_str != NULL)
> + while( true )
> {
> const char* psz_amp = strchr(psz_str, '&');
> if( psz_amp == NULL )
> - return is_escaped;
> + break;
> const char* psz_end = strchr(psz_amp, ';');
> if( psz_end == NULL )
> return false;
> @@ -414,6 +415,9 @@ static void memstream_puts_xmlencoded(struct vlc_memstream* p_stream, const char
> else
> psz_tmp = strndup( psz_begin, psz_end - psz_begin );
>
> + if ( psz_tmp == NULL )
> + return;
> +
> if( isXmlEncoded( psz_tmp ) )
> vlc_memstream_puts( p_stream, psz_tmp );
> else
>
Claiming a test being useless and just moving it before call ?
--
Francois Cartegnie
VideoLAN - VLC Developer
More information about the vlc-devel
mailing list