[vlc-devel] [PATCH 1/3] Fix #8174

Anatoliy Anischovich lin.aaa.lin at gmail.com
Fri Mar 8 01:43:01 CET 2013


Before dictionaries there was a loop, so if-else way was ok, but not now. Also, locale-dependent atof().
---
 include/vlc_input.h    | 18 +++++++++++-------
 modules/codec/vorbis.c |  9 +++++----
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index cbd6aab..f9958f2 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -36,6 +36,7 @@
 #include <vlc_epg.h>
 #include <vlc_events.h>
 #include <vlc_input_item.h>
+#include <vlc_charset.h>
 
 #include <string.h>
 
@@ -54,24 +55,27 @@ static inline void vlc_audio_replay_gain_MergeFromMeta( audio_replay_gain_t *p_d
         (psz_value = vlc_meta_GetExtra(p_meta, "RG_RADIO")) )
     {
         p_dst->pb_gain[AUDIO_REPLAY_GAIN_TRACK] = true;
-        p_dst->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = atof( psz_value );
+        p_dst->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
     }
-    else if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_TRACK_PEAK" )) ||
+
+    if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_TRACK_PEAK" )) ||
              (psz_value = vlc_meta_GetExtra(p_meta, "RG_PEAK" )) )
     {
         p_dst->pb_peak[AUDIO_REPLAY_GAIN_TRACK] = true;
-        p_dst->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = atof( psz_value );
+        p_dst->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
     }
-    else if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_GAIN" )) ||
+
+    if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_GAIN" )) ||
              (psz_value = vlc_meta_GetExtra(p_meta, "RG_AUDIOPHILE" )) )
     {
         p_dst->pb_gain[AUDIO_REPLAY_GAIN_ALBUM] = true;
-        p_dst->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = atof( psz_value );
+        p_dst->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
     }
-    else if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_PEAK" )) )
+
+    if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_PEAK" )) )
     {
         p_dst->pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true;
-        p_dst->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = atof( psz_value );
+        p_dst->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
     }
 }
 
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 7cc2ec9..9f3bd47 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -34,6 +34,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
+#include <vlc_charset.h>
 #include <vlc_aout.h>
 #include <vlc_input.h>
 #include <vlc_sout.h>
@@ -583,7 +584,7 @@ static void ParseVorbisComments( decoder_t *p_dec )
                 audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
 
                 r->pb_gain[AUDIO_REPLAY_GAIN_TRACK] = true;
-                r->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = atof( psz_value );
+                r->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
             }
             else if( !strcasecmp( psz_name, "REPLAYGAIN_TRACK_PEAK" ) ||
                      !strcasecmp( psz_name, "RG_PEAK" ) )
@@ -591,7 +592,7 @@ static void ParseVorbisComments( decoder_t *p_dec )
                 audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
 
                 r->pb_peak[AUDIO_REPLAY_GAIN_TRACK] = true;
-                r->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = atof( psz_value );
+                r->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
             }
             else if( !strcasecmp( psz_name, "REPLAYGAIN_ALBUM_GAIN" ) ||
                      !strcasecmp( psz_name, "RG_AUDIOPHILE" ) )
@@ -599,14 +600,14 @@ static void ParseVorbisComments( decoder_t *p_dec )
                 audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
 
                 r->pb_gain[AUDIO_REPLAY_GAIN_ALBUM] = true;
-                r->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = atof( psz_value );
+                r->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
             }
             else if( !strcasecmp( psz_name, "REPLAYGAIN_ALBUM_PEAK" ) )
             {
                 audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
 
                 r->pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true;
-                r->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = atof( psz_value );
+                r->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
             }
             else if( !strcasecmp( psz_name, "METADATA_BLOCK_PICTURE" ) )
             { /* Do nothing, for now */ }
-- 
1.8.1.5




More information about the vlc-devel mailing list