Commit 1090a5b5 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove compiler warning and clean up (refs #258)

parent 11558099
...@@ -598,37 +598,31 @@ static int ReadICYMeta( access_t *p_access ) ...@@ -598,37 +598,31 @@ static int ReadICYMeta( access_t *p_access )
{ {
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
uint8_t buffer[1]; uint8_t buffer;
char *psz_meta; char *p, *psz_meta;
int i_read; int i_read;
char *p;
/* Read meta data length */ /* Read meta data length */
i_read = net_Read( p_access, p_sys->fd, p_sys->p_vs, buffer, 1, i_read = net_Read( p_access, p_sys->fd, p_sys->p_vs, &buffer, 1,
VLC_TRUE ); VLC_TRUE );
if( i_read <= 0 ) if( ( i_read <= 0 ) || ( buffer == 0 ) )
return VLC_EGENERIC; return VLC_EGENERIC;
i_read = buffer << 4;
msg_Dbg( p_access, "ICY meta size=%u", i_read);
if( buffer[0] <= 0 ) psz_meta = malloc( i_read + 1 );
return VLC_SUCCESS; if( net_Read( p_access, p_sys->fd, p_sys->p_vs,
(uint8_t *)psz_meta, i_read, VLC_TRUE ) != i_read )
msg_Dbg( p_access, "ICY meta size=%d", buffer[0] * 16);
psz_meta = malloc( buffer[0] * 16 + 1 );
i_read = net_Read( p_access, p_sys->fd, p_sys->p_vs,
psz_meta, buffer[0] * 16, VLC_TRUE );
if( i_read != buffer[0] * 16 )
return VLC_EGENERIC; return VLC_EGENERIC;
psz_meta[buffer[0]*16] = '\0'; /* Just in case */ psz_meta[i_read] = '\0'; /* Just in case */
msg_Dbg( p_access, "icy-meta=%s", psz_meta ); msg_Dbg( p_access, "icy-meta=%s", psz_meta );
/* Now parse the meta */ /* Now parse the meta */
/* Look for StreamTitle= */ /* Look for StreamTitle= */
p = strcasestr( psz_meta, "StreamTitle=" ); p = strcasestr( (char *)psz_meta, "StreamTitle=" );
if( p ) if( p )
{ {
p += strlen( "StreamTitle=" ); p += strlen( "StreamTitle=" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment