Commit cddfefc8 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

ASF: macro removal

parent 764b674d
...@@ -700,6 +700,14 @@ static void ASF_FreeObject_codec_list( asf_object_t *p_obj ) ...@@ -700,6 +700,14 @@ static void ASF_FreeObject_codec_list( asf_object_t *p_obj )
FREENULL( p_cl->codec ); FREENULL( p_cl->codec );
} }
static inline char *get_wstring( const uint8_t *p_data, size_t i_size )
{
char *psz_str = FromCharset( "UTF-16LE", p_data, i_size );
if( psz_str )
p_data += i_size;
return psz_str;
}
/* Microsoft should go to hell. This time the length give number of bytes /* Microsoft should go to hell. This time the length give number of bytes
* and for the some others object, length give char16 count ... */ * and for the some others object, length give char16 count ... */
static int ASF_ReadObject_content_description(stream_t *s, asf_object_t *p_obj) static int ASF_ReadObject_content_description(stream_t *s, asf_object_t *p_obj)
...@@ -711,13 +719,6 @@ static int ASF_ReadObject_content_description(stream_t *s, asf_object_t *p_obj) ...@@ -711,13 +719,6 @@ static int ASF_ReadObject_content_description(stream_t *s, asf_object_t *p_obj)
if( ( i_peek = stream_Peek( s, &p_peek, p_cd->i_object_size ) ) < 34 ) if( ( i_peek = stream_Peek( s, &p_peek, p_cd->i_object_size ) ) < 34 )
return VLC_EGENERIC; return VLC_EGENERIC;
/* FIXME i_size*3 is the worst case. */
#define GETSTRINGW( psz_str, i_size ) do { \
psz_str = FromCharset( "UTF-16LE", p_data, i_size ); \
if( psz_str ) { \
p_data += i_size; \
} } while(0)
p_data = p_peek + 24; p_data = p_peek + 24;
i_title = ASF_READ2(); i_title = ASF_READ2();
...@@ -729,13 +730,11 @@ static int ASF_ReadObject_content_description(stream_t *s, asf_object_t *p_obj) ...@@ -729,13 +730,11 @@ static int ASF_ReadObject_content_description(stream_t *s, asf_object_t *p_obj)
if( !ASF_HAVE( i_title+i_artist+i_copyright+i_description+i_rating ) ) if( !ASF_HAVE( i_title+i_artist+i_copyright+i_description+i_rating ) )
return VLC_EGENERIC; return VLC_EGENERIC;
GETSTRINGW( p_cd->psz_title, i_title ); p_cd->psz_title = get_wstring( p_data, i_title );
GETSTRINGW( p_cd->psz_artist, i_artist ); p_cd->psz_artist = get_wstring( p_data, i_artist );
GETSTRINGW( p_cd->psz_copyright, i_copyright ); p_cd->psz_copyright = get_wstring( p_data, i_copyright );
GETSTRINGW( p_cd->psz_description, i_description ); p_cd->psz_description = get_wstring( p_data, i_description );
GETSTRINGW( p_cd->psz_rating, i_rating ); p_cd->psz_rating = get_wstring( p_data, i_rating );
#undef GETSTRINGW
#ifdef ASF_DEBUG #ifdef ASF_DEBUG
msg_Dbg( s, msg_Dbg( s,
......
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