Commit e99743da authored by Francois Cartegnie's avatar Francois Cartegnie

xiph: handle mixed case comments.

Lowercase or mixed case identifier are legit.
reverts 03c69b44
parent d8295d11
...@@ -299,7 +299,7 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta, ...@@ -299,7 +299,7 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
char *p = strchr( psz_comment, '=' ); char *p = strchr( psz_comment, '=' );
char *psz_val; char *psz_val;
if (!p) continue; if (!p) continue;
if ( !strncmp(psz_comment, "REPLAYGAIN_TRACK_GAIN=", 22) ) if ( !strncasecmp(psz_comment, "REPLAYGAIN_TRACK_GAIN=", 22) )
{ {
psz_val = malloc( strlen(p+1) + 1 ); psz_val = malloc( strlen(p+1) + 1 );
if (!psz_val) continue; if (!psz_val) continue;
...@@ -309,7 +309,7 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta, ...@@ -309,7 +309,7 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
free( psz_val ); free( psz_val );
} }
} }
else if ( !strncmp(psz_comment, "REPLAYGAIN_ALBUM_GAIN=", 22) ) else if ( !strncasecmp(psz_comment, "REPLAYGAIN_ALBUM_GAIN=", 22) )
{ {
psz_val = malloc( strlen(p+1) + 1 ); psz_val = malloc( strlen(p+1) + 1 );
if (!psz_val) continue; if (!psz_val) continue;
...@@ -319,11 +319,11 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta, ...@@ -319,11 +319,11 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
free( psz_val ); free( psz_val );
} }
} }
else if ( !strncmp(psz_comment, "REPLAYGAIN_ALBUM_PEAK=", 22) ) else if ( !strncasecmp(psz_comment, "REPLAYGAIN_ALBUM_PEAK=", 22) )
{ {
(*ppf_replay_peak)[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( ++p ); (*ppf_replay_peak)[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( ++p );
} }
else if ( !strncmp(psz_comment, "REPLAYGAIN_TRACK_PEAK=", 22) ) else if ( !strncasecmp(psz_comment, "REPLAYGAIN_TRACK_PEAK=", 22) )
{ {
(*ppf_replay_peak)[AUDIO_REPLAY_GAIN_TRACK] = us_atof( ++p ); (*ppf_replay_peak)[AUDIO_REPLAY_GAIN_TRACK] = us_atof( ++p );
} }
...@@ -332,9 +332,13 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta, ...@@ -332,9 +332,13 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
{ {
unsigned int i_chapt; unsigned int i_chapt;
seekpoint_t *p_seekpoint = NULL; seekpoint_t *p_seekpoint = NULL;
if( strcasestr( psz_comment, "NAME=" ) &&
( sscanf( psz_comment, "CHAPTER%uNAME=", &i_chapt ) == 1 || for( int i = 0; psz_comment[i] && psz_comment[i] != '='; i++ )
sscanf( psz_comment, "chapter%name=", &i_chapt ) == 1 ) ) if( psz_comment[i] >= 'a' && psz_comment[i] <= 'z' )
psz_comment[i] -= 'a' - 'A';
if( strstr( psz_comment, "NAME=" ) &&
sscanf( psz_comment, "CHAPTER%uNAME=", &i_chapt ) == 1 )
{ {
char *p = strchr( psz_comment, '=' ); char *p = strchr( psz_comment, '=' );
p_seekpoint = getChapterEntry( i_chapt, &chapters_array ); p_seekpoint = getChapterEntry( i_chapt, &chapters_array );
...@@ -342,8 +346,7 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta, ...@@ -342,8 +346,7 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
if ( ! p_seekpoint->psz_name ) if ( ! p_seekpoint->psz_name )
p_seekpoint->psz_name = strdup( ++p ); p_seekpoint->psz_name = strdup( ++p );
} }
else if( sscanf( psz_comment, "CHAPTER%u=", &i_chapt ) == 1 || else if( sscanf( psz_comment, "CHAPTER%u=", &i_chapt ) == 1 )
sscanf( psz_comment, "chapter%u=", &i_chapt ) == 1 )
{ {
unsigned int h, m, s, ms; unsigned int h, m, s, ms;
char *p = strchr( psz_comment, '=' ); char *p = strchr( psz_comment, '=' );
......
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