[vlc-commits] services_discovery/microdns: fix iteration variable type compared to vlc_array_count

Filip Roséen git at videolan.org
Tue Feb 21 09:53:26 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Feb 20 15:14:57 2017 +0100| [df7ddbd9e5a3e5fd6477d675be0a83f05709e931] | committer: Thomas Guillem

services_discovery/microdns: fix iteration variable type compared to vlc_array_count

Following the changes introduced by 7ecd927, the affected lines would
result in a warning due to signed vs unsigned integer comparision.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/services_discovery/microdns.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/services_discovery/microdns.c b/modules/services_discovery/microdns.c
index 2e7f940..b68df77 100644
--- a/modules/services_discovery/microdns.c
+++ b/modules/services_discovery/microdns.c
@@ -233,7 +233,7 @@ items_release( struct discovery_sys *p_sys, struct item *p_item )
 static bool
 items_exists( struct discovery_sys *p_sys, const char *psz_uri )
 {
-    for( int i = 0; i < vlc_array_count( &p_sys->items ); ++i )
+    for( size_t i = 0; i < vlc_array_count( &p_sys->items ); ++i )
     {
         struct item *p_item = vlc_array_item_at_index( &p_sys->items, i );
         if( strcmp( p_item->psz_uri, psz_uri ) == 0 )
@@ -253,7 +253,7 @@ items_timeout( struct discovery_sys *p_sys, services_discovery_t *p_sd,
     mtime_t i_now = mdate();
 
     /* Remove items that are not seen since TIMEOUT */
-    for( int i = 0; i < vlc_array_count( &p_sys->items ); ++i )
+    for( size_t i = 0; i < vlc_array_count( &p_sys->items ); ++i )
     {
         struct item *p_item = vlc_array_item_at_index( &p_sys->items, i );
         if( i_now - p_item->i_last_seen > TIMEOUT )
@@ -271,7 +271,7 @@ items_timeout( struct discovery_sys *p_sys, services_discovery_t *p_sd,
 static void
 items_clear( struct discovery_sys *p_sys )
 {
-    for( int i = 0; i < vlc_array_count( &p_sys->items ); ++i )
+    for( size_t i = 0; i < vlc_array_count( &p_sys->items ); ++i )
     {
         struct item *p_item = vlc_array_item_at_index( &p_sys->items, i );
         items_release( p_sys, p_item );



More information about the vlc-commits mailing list