X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fnsc.c;h=d6561d3547a749371af88a216ffb693040880988;hb=bcddfd6382fb71b0021008eb63f1bc4a1b1bae0e;hp=fb61a8a5373d68e24b3296afb77d31ee0632a3a7;hpb=562dc13be82f723cf48dab68fc363c965f33ba76;p=vlc diff --git a/modules/demux/nsc.c b/modules/demux/nsc.c index fb61a8a537..d6561d3547 100644 --- a/modules/demux/nsc.c +++ b/modules/demux/nsc.c @@ -25,12 +25,15 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include -#include +#include #include +#include #define MAX_LINE 16024 /***************************************************************************** @@ -43,7 +46,7 @@ vlc_module_begin(); set_description( _("Windows Media NSC metademux") ); set_category( CAT_INPUT ); set_subcategory( SUBCAT_INPUT_DEMUX ); - set_capability( "demux2", 2 ); + set_capability( "demux2", 3 ); set_callbacks( DemuxOpen, DemuxClose ); vlc_module_end(); @@ -136,7 +139,7 @@ static int load_byte( unsigned char encoding_type, return 0; } -char *nscdec( vlc_object_t *p_demux, char* p_encoded ) +static char *nscdec( vlc_object_t *p_demux, char* p_encoded ) { unsigned int i; unsigned char tmp; @@ -235,7 +238,7 @@ char *nscdec( vlc_object_t *p_demux, char* p_encoded ) } conv = vlc_iconv_open( "UTF-8", "UTF-16LE" ); - if( conv == (vlc_iconv_t)-1 ) + if( conv == (vlc_iconv_t)(-1) ) { msg_Err( p_demux, "iconv_open failed" ); free( buf16 ); @@ -246,7 +249,7 @@ char *nscdec( vlc_object_t *p_demux, char* p_encoded ) p_buf8 = buf8; p_buf16 = (const char *)buf16; - if( vlc_iconv( conv, &p_buf16, &buf16_size, &p_buf8, &buf8_size ) == 0 ) + if( vlc_iconv( conv, &p_buf16, &buf16_size, &p_buf8, &buf8_size ) == (size_t)(-1) ) { msg_Err( p_demux, "iconv failed" ); return NULL; @@ -265,7 +268,7 @@ char *nscdec( vlc_object_t *p_demux, char* p_encoded ) static int DemuxOpen( vlc_object_t * p_this ) { demux_t *p_demux = (demux_t *)p_this; - byte_t *p_peek; + const byte_t *p_peek; int i_size; /* Lets check the content to see if this is a NSC file */ @@ -319,7 +322,7 @@ static int ParseLine ( demux_t *p_demux, char *psz_line ) } *psz_value = '\0'; psz_value++; - + if( !strncasecmp( psz_value, "0x", 2 ) ) { int i_value; @@ -338,7 +341,7 @@ static int ParseLine ( demux_t *p_demux, char *psz_line ) if( psz_out ) { msg_Dbg( p_demux, "%s = %s", psz_bol, psz_out ); - if( psz_out) free( psz_out ); + free( psz_out ); } } return VLC_SUCCESS; @@ -356,7 +359,7 @@ static int Demux ( demux_t *p_demux ) while( ( psz_line = stream_ReadLine( p_demux->s ) ) ) { ParseLine( p_demux, psz_line ); - if( psz_line ) free( psz_line ); + free( psz_line ); } return VLC_SUCCESS; }