[vlc-devel] [v4 10/10] input:item: return 0 when the duration is unset

Steve Lhomme robux4 at ycbcr.xyz
Fri Jul 27 12:49:10 CEST 2018


The return value is not checked anywhere and the function is not documented.

In case the value of VLC_TICK_INVALID changes we should not return a bad value.

--
or we need to document the function and check the return value everywhere
---
 src/input/item.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/input/item.c b/src/input/item.c
index 62fee5770c..934d86e4ac 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -405,6 +405,8 @@ vlc_tick_t input_item_GetDuration( input_item_t *p_i )
     vlc_mutex_unlock( &p_i->lock );
     if (i_duration == INPUT_DURATION_INDEFINITE)
         i_duration = 0;
+    else if (i_duration == INPUT_DURATION_UNSET)
+        i_duration = 0;
     return i_duration;
 }
 
-- 
2.17.0



More information about the vlc-devel mailing list