[vlc-commits] input: use unsigned size_t for control indexes

Thomas Guillem git at videolan.org
Tue Sep 4 14:07:13 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Sep  4 10:55:45 2018 +0200| [8aa283dffc5c27e3a8b8f0ae58e0c8fc9e8322b5] | committer: Thomas Guillem

input: use unsigned size_t for control indexes

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

 src/input/input.c          | 12 ++++++------
 src/input/input_internal.h |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index f120b21ba9..ddac6fa57a 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -206,7 +206,7 @@ void input_Stop( input_thread_t *p_input )
 
     vlc_mutex_lock( &sys->lock_control );
     /* Discard all pending controls */
-    for( int i = 0; i < sys->i_control; i++ )
+    for( size_t i = 0; i < sys->i_control; i++ )
     {
         input_control_t *ctrl = &sys->control[i];
         ControlRelease( ctrl->i_type, &ctrl->param );
@@ -277,7 +277,7 @@ static void input_Destructor( vlc_object_t *obj )
     if( priv->stats != NULL )
         input_stats_Destroy( priv->stats );
 
-    for( int i = 0; i < priv->i_control; i++ )
+    for( size_t i = 0; i < priv->i_control; i++ )
     {
         input_control_t *p_ctrl = &priv->control[i];
         ControlRelease( p_ctrl->i_type, &p_ctrl->param );
@@ -1513,10 +1513,10 @@ void input_ControlPush( input_thread_t *p_input,
     vlc_mutex_unlock( &sys->lock_control );
 }
 
-static int ControlGetReducedIndexLocked( input_thread_t *p_input )
+static size_t ControlGetReducedIndexLocked( input_thread_t *p_input )
 {
     const int i_lt = input_priv(p_input)->control[0].i_type;
-    int i;
+    size_t i;
     for( i = 1; i < input_priv(p_input)->i_control; i++ )
     {
         const int i_ct = input_priv(p_input)->control[i].i_type;
@@ -1578,9 +1578,9 @@ static inline int ControlPop( input_thread_t *p_input,
     }
 
     /* */
-    const int i_index = ControlGetReducedIndexLocked( p_input );
+    const size_t i_index = ControlGetReducedIndexLocked( p_input );
 
-    for( int i = 0; i < i_index; ++i )
+    for( size_t i = 0; i < i_index; ++i )
     {
         /* Release Reduced controls */
         ControlRelease( p_sys->control[i].i_type, &p_sys->control[i].param );
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index d49f9dc403..5848d95e30 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -175,7 +175,7 @@ typedef struct input_thread_private_t
     /* Buffer of pending actions */
     vlc_mutex_t lock_control;
     vlc_cond_t  wait_control;
-    int i_control;
+    size_t i_control;
     input_control_t control[INPUT_CONTROL_FIFO_SIZE];
 
     vlc_thread_t thread;



More information about the vlc-commits mailing list