[vlc-commits] sout:cycle: make the value tests more explicit
Steve Lhomme
git at videolan.org
Tue Sep 18 15:56:09 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jun 13 14:57:37 2018 +0200| [d0881b6432dcce77697dab64a60bae8553592d5d] | committer: Steve Lhomme
sout:cycle: make the value tests more explicit
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d0881b6432dcce77697dab64a60bae8553592d5d
---
modules/stream_out/cycle.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/modules/stream_out/cycle.c b/modules/stream_out/cycle.c
index aeda97d63e..876f2f4e65 100644
--- a/modules/stream_out/cycle.c
+++ b/modules/stream_out/cycle.c
@@ -208,26 +208,26 @@ static vlc_tick_t ParseTime(const char *str)
switch (*end)
{
case 'w':
- if (u > 15250284U)
- return -1;
- return vlc_tick_from_sec( 604800LLU * u );
+ if (u < ((unsigned long long)INT64_MAX)/ (60 * 60 * 24 * 7 * CLOCK_FREQ))
+ return vlc_tick_from_sec( 60LU * 60 * 24 * 7 * u );
+ break;
case 'd':
- if (u > 106751991U)
- return -1;
- return vlc_tick_from_sec( 86400LLU * u );
+ if (u < ((unsigned long long)INT64_MAX)/ (60 * 60 * 24 * CLOCK_FREQ))
+ return vlc_tick_from_sec( 60LU * 60 * 24 * u );
+ break;
case 'h':
- if (u > 2562047788U)
- return -1;
- return vlc_tick_from_sec( 3600LLU * u );
+ if (u < ((unsigned long long)INT64_MAX)/ (60 * 60 * CLOCK_FREQ))
+ return vlc_tick_from_sec( 60LLU * 60 * u );
+ break;
case 'm':
- if (u > 153722867280U)
- return -1;
- return vlc_tick_from_sec( 60LLU * u );
+ if (u < ((unsigned long long)INT64_MAX)/ (60 * CLOCK_FREQ))
+ return vlc_tick_from_sec( 60LLU * u );
+ break;
case 's':
case 0:
- if (u > 9223372036854U)
- return -1;
- return vlc_tick_from_sec( u );
+ if (u < ((unsigned long long)INT64_MAX)/CLOCK_FREQ)
+ return vlc_tick_from_sec( u );
+ break;
}
return -1;
}
More information about the vlc-commits
mailing list