[vlc-commits] Taglib: extract first value only if couple is incomplete

Jean-Baptiste Kempf git at videolan.org
Fri Oct 16 19:08:55 CEST 2015


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Oct 16 19:00:09 2015 +0200| [84a19e118248b01cb5b18c693f6d03a3f15c1ad9] | committer: Jean-Baptiste Kempf

Taglib: extract first value only if couple is incomplete

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=84a19e118248b01cb5b18c693f6d03a3f15c1ad9
---

 modules/meta_engine/taglib.cpp |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 02ba794..417b352 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -114,18 +114,24 @@ vlc_module_end ()
 
 using namespace TagLib;
 
-static void ExtractCoupleNumberValues( vlc_meta_t* p_meta, const char *psz_value,
+static int ExtractCoupleNumberValues( vlc_meta_t* p_meta, const char *psz_value,
         vlc_meta_type_t first, vlc_meta_type_t second)
 {
     unsigned int i_trknum, i_trktot;
-    if( sscanf( psz_value, "%u/%u", &i_trknum, &i_trktot ) == 2 )
+
+    int i_ret = sscanf( psz_value, "%u/%u", &i_trknum, &i_trktot );
+    char psz_trck[11];
+    if( i_ret >= 1 )
     {
-        char psz_trck[11];
         snprintf( psz_trck, sizeof( psz_trck ), "%u", i_trknum );
         vlc_meta_Set( p_meta, first, psz_trck );
+    }
+    if( i_ret == 2)
+    {
         snprintf( psz_trck, sizeof( psz_trck ), "%u", i_trktot );
         vlc_meta_Set( p_meta, second, psz_trck );
     }
+    return i_ret;
 }
 
 /**



More information about the vlc-commits mailing list