[vlc-devel] commit: get vout: use size_t for the counter ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Aug 15 16:28:03 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 15 17:08:41 2009 +0300| [71d32071cea5222ad37c9b0b6f199f46b4bb9647] | committer: Rémi Denis-Courmont 

get vout: use size_t for the counter

Internal counter is still int due to tab macros.

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

 include/vlc_input.h  |    4 ++--
 src/input/control.c  |    2 +-
 src/input/resource.c |   11 ++++++++---
 src/input/resource.h |    2 +-
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 561a753..d6048f5 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -568,12 +568,12 @@ static inline int input_AddSubtitle( input_thread_t *p_input, const char *psz_ur
 static inline vout_thread_t *input_GetVout( input_thread_t *p_input )
 {
      vout_thread_t **pp_vout, *p_vout;
-     unsigned i_vout;
+     size_t i_vout;
 
      if( input_Control( p_input, INPUT_GET_VOUTS, &pp_vout, &i_vout ) )
          return NULL;
 
-     for( unsigned i = 1; i < i_vout; i++ )
+     for( size_t i = 1; i < i_vout; i++ )
          vlc_object_release( (vlc_object_t *)(pp_vout[i]) );
 
      p_vout = (i_vout >= 1) ? pp_vout[0] : NULL;
diff --git a/src/input/control.c b/src/input/control.c
index 450905b..826f096 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -427,7 +427,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
         case INPUT_GET_VOUTS:
         {
             vout_thread_t ***ppp_vout = (vout_thread_t***)va_arg( args, vout_thread_t*** );
-            int           *pi_vout = (int*)va_arg( args, int* );
+            size_t        *pi_vout = va_arg( args, size_t * );
 
             input_resource_HoldVouts( p_input->p->p_resource, ppp_vout, pi_vout );
             if( *pi_vout <= 0 )
diff --git a/src/input/resource.c b/src/input/resource.c
index 9132bf6..7b9b1f3 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -288,7 +288,9 @@ static vout_thread_t *HoldVout( input_resource_t *p_resource )
 
     return p_vout;
 }
-static void HoldVouts( input_resource_t *p_resource, vout_thread_t ***ppp_vout, int *pi_vout )
+
+static void HoldVouts( input_resource_t *p_resource, vout_thread_t ***ppp_vout,
+                       size_t *pi_vout )
 {
     vout_thread_t **pp_vout;
 
@@ -300,7 +302,7 @@ static void HoldVouts( input_resource_t *p_resource, vout_thread_t ***ppp_vout,
     if( p_resource->i_vout <= 0 )
         goto exit;
 
-    pp_vout = calloc( p_resource->i_vout, sizeof(*pp_vout) );
+    pp_vout = malloc( p_resource->i_vout * sizeof(*pp_vout) );
     if( !pp_vout )
         goto exit;
 
@@ -460,10 +462,13 @@ vout_thread_t *input_resource_HoldVout( input_resource_t *p_resource )
 {
     return HoldVout( p_resource );
 }
-void input_resource_HoldVouts( input_resource_t *p_resource, vout_thread_t ***ppp_vout, int *pi_vout )
+
+void input_resource_HoldVouts( input_resource_t *p_resource, vout_thread_t ***ppp_vout,
+                               size_t *pi_vout )
 {
     HoldVouts( p_resource, ppp_vout, pi_vout );
 }
+
 void input_resource_TerminateVout( input_resource_t *p_resource )
 {
     input_resource_RequestVout( p_resource, NULL, NULL, false );
diff --git a/src/input/resource.h b/src/input/resource.h
index 15bc377..fa20611 100644
--- a/src/input/resource.h
+++ b/src/input/resource.h
@@ -81,7 +81,7 @@ vout_thread_t *input_resource_HoldVout( input_resource_t * );
  *
  * You must call vlc_object_release on all values returned (if non NULL).
  */
-void input_resource_HoldVouts( input_resource_t *, vout_thread_t ***, int * );
+void input_resource_HoldVouts( input_resource_t *, vout_thread_t ***, size_t * );
 
 #endif
 




More information about the vlc-devel mailing list