[vlc-commits] vlc_fingerprinter: use size_t for index argument in callback

Filip Roséen git at videolan.org
Thu May 18 18:09:55 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 12:19:39 2017 +0200| [abbf65fc3634223c7f739eadaf193b8520a2c45a] | committer: Rémi Denis-Courmont

vlc_fingerprinter: use size_t for index argument in callback

It does not make sense for the passed index to be negative, nor is the
current diagnostic related to comparision of different signedness very
nice to look at.

This fixes both issues by changing the argument to size_t, making sure
that the values passed are suitable for interaction with
vlc_array-related functions.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 include/vlc_fingerprinter.h             | 2 +-
 modules/gui/qt/adapters/chromaprint.cpp | 2 +-
 modules/gui/qt/adapters/chromaprint.hpp | 2 +-
 modules/misc/fingerprinter.c            | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/vlc_fingerprinter.h b/include/vlc_fingerprinter.h
index 01bbcabc11..a958ef7692 100644
--- a/include/vlc_fingerprinter.h
+++ b/include/vlc_fingerprinter.h
@@ -77,7 +77,7 @@ struct fingerprinter_thread_t
 
     void ( *pf_enqueue ) ( struct fingerprinter_thread_t *f, fingerprint_request_t *r );
     fingerprint_request_t * ( *pf_getresults ) ( struct fingerprinter_thread_t *f );
-    void ( *pf_apply ) ( fingerprint_request_t *, int i_resultid );
+    void ( *pf_apply ) ( fingerprint_request_t *, size_t i_resultid );
 };
 typedef struct fingerprinter_thread_t fingerprinter_thread_t;
 
diff --git a/modules/gui/qt/adapters/chromaprint.cpp b/modules/gui/qt/adapters/chromaprint.cpp
index f4b19c4d25..e08d968cac 100644
--- a/modules/gui/qt/adapters/chromaprint.cpp
+++ b/modules/gui/qt/adapters/chromaprint.cpp
@@ -46,7 +46,7 @@ fingerprint_request_t * Chromaprint::fetchResults()
     return p_fingerprinter->pf_getresults( p_fingerprinter );
 }
 
-void Chromaprint::apply( fingerprint_request_t *p_r, int i_id )
+void Chromaprint::apply( fingerprint_request_t *p_r, size_t i_id )
 {
     p_fingerprinter->pf_apply( p_r, i_id );
 }
diff --git a/modules/gui/qt/adapters/chromaprint.hpp b/modules/gui/qt/adapters/chromaprint.hpp
index af159d6238..aeb9250d8a 100644
--- a/modules/gui/qt/adapters/chromaprint.hpp
+++ b/modules/gui/qt/adapters/chromaprint.hpp
@@ -40,7 +40,7 @@ public:
     static int results_available( vlc_object_t *p_this, const char *,
                                   vlc_value_t, vlc_value_t newval, void *param );
     fingerprint_request_t * fetchResults();
-    void apply( fingerprint_request_t *, int i_id );
+    void apply( fingerprint_request_t *, size_t i_id );
     static bool isSupported( QString uri );
 
 signals:
diff --git a/modules/misc/fingerprinter.c b/modules/misc/fingerprinter.c
index 216431547d..6f09362747 100644
--- a/modules/misc/fingerprinter.c
+++ b/modules/misc/fingerprinter.c
@@ -114,7 +114,7 @@ static fingerprint_request_t * GetResult( fingerprinter_thread_t *f )
     return r;
 }
 
-static void ApplyResult( fingerprint_request_t *p_r, int i_resultid )
+static void ApplyResult( fingerprint_request_t *p_r, size_t i_resultid )
 {
     if ( i_resultid >= vlc_array_count( & p_r->results.metas_array ) ) return;
 



More information about the vlc-commits mailing list