[vlc-commits] xiph: handle mixed case comments.
Francois Cartegnie
git at videolan.org
Tue Sep 17 11:03:19 CEST 2013
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Sep 17 09:38:06 2013 +0200| [e99743daed90e6b2cf45142191a509bc1cce8168] | committer: Francois Cartegnie
xiph: handle mixed case comments.
Lowercase or mixed case identifier are legit.
reverts 03c69b44b3ddb9971f34ea4e9bfacc0e23a23a23
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e99743daed90e6b2cf45142191a509bc1cce8168
---
modules/demux/xiph_metadata.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/modules/demux/xiph_metadata.c b/modules/demux/xiph_metadata.c
index e0f7439..ddb3631 100644
--- a/modules/demux/xiph_metadata.c
+++ b/modules/demux/xiph_metadata.c
@@ -299,7 +299,7 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
char *p = strchr( psz_comment, '=' );
char *psz_val;
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 );
if (!psz_val) continue;
@@ -309,7 +309,7 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
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 );
if (!psz_val) continue;
@@ -319,11 +319,11 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
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 );
}
- 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 );
}
@@ -332,9 +332,13 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
{
unsigned int i_chapt;
seekpoint_t *p_seekpoint = NULL;
- if( strcasestr( psz_comment, "NAME=" ) &&
- ( sscanf( psz_comment, "CHAPTER%uNAME=", &i_chapt ) == 1 ||
- sscanf( psz_comment, "chapter%name=", &i_chapt ) == 1 ) )
+
+ for( int i = 0; psz_comment[i] && psz_comment[i] != '='; i++ )
+ 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, '=' );
p_seekpoint = getChapterEntry( i_chapt, &chapters_array );
@@ -342,8 +346,7 @@ void vorbis_ParseComment( vlc_meta_t **pp_meta,
if ( ! p_seekpoint->psz_name )
p_seekpoint->psz_name = strdup( ++p );
}
- else if( sscanf( psz_comment, "CHAPTER%u=", &i_chapt ) == 1 ||
- sscanf( psz_comment, "chapter%u=", &i_chapt ) == 1 )
+ else if( sscanf( psz_comment, "CHAPTER%u=", &i_chapt ) == 1 )
{
unsigned int h, m, s, ms;
char *p = strchr( psz_comment, '=' );
More information about the vlc-commits
mailing list