[vlc-devel] [PATCH 2/3] filter_chain: the length cannot be negative

Steve Lhomme robux4 at videolabs.io
Thu Apr 7 16:23:30 CEST 2016


---
 include/vlc_filter.h                | 2 +-
 src/misc/filter_chain.c             | 2 +-
 src/video_output/display.c          | 2 +-
 src/video_output/vout_subpictures.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index afe0205..11f92b9 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -351,7 +351,7 @@ VLC_API void filter_chain_DeleteFilter(filter_chain_t *chain,
  * \param chain pointer to filter chain
  * \return number of filters in this filter chain
  */
-VLC_API int filter_chain_GetLength(filter_chain_t *chain);
+VLC_API unsigned filter_chain_GetLength(filter_chain_t *chain);
 
 /**
  * Get last output format of the last element in the filter chain.
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 3f18f64..60bfd6e 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -348,7 +348,7 @@ int filter_chain_ForEach( filter_chain_t *chain,
     return VLC_SUCCESS;
 }
 
-int filter_chain_GetLength( filter_chain_t *p_chain )
+unsigned filter_chain_GetLength( filter_chain_t *p_chain )
 {
     return p_chain->length;
 }
diff --git a/src/video_output/display.c b/src/video_output/display.c
index ecf661a..8e233b2 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -1073,7 +1073,7 @@ picture_t *vout_FilterDisplay(vout_display_t *vd, picture_t *picture)
     vout_display_owner_sys_t *osys = vd->owner.sys;
 
     assert(osys->filters);
-    if (filter_chain_GetLength(osys->filters) <= 0) {
+    if (filter_chain_GetLength(osys->filters) == 0) {
         picture_Release(picture);
         return NULL;
     }
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 63a5a65..74ccaf7 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1343,7 +1343,7 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic)
 
             filter_chain_AppendFromString(spu->p->filter_chain, chain_update);
         }
-        else if (filter_chain_GetLength(spu->p->filter_chain) > 0)
+        else if (filter_chain_GetLength(spu->p->filter_chain) != 0)
             filter_chain_Reset(sys->filter_chain, NULL, NULL);
 
         /* "sub-source"  was formerly "sub-filter", so now the "sub-filter"
-- 
2.7.1



More information about the vlc-devel mailing list