[vlc-commits] [Git][videolan/vlc][master] 3 commits: url: pick type to avoid casts
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Mar 5 19:50:12 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
cdfea222 by Rémi Denis-Courmont at 2022-03-05T19:20:41+00:00
url: pick type to avoid casts
- - - - -
3028c3b9 by Rémi Denis-Courmont at 2022-03-05T19:20:41+00:00
url: don't force 8-bit masking
If a subtraction underflows, we do not care what the exact result is,
only that it is large.
- - - - -
7550e1ff by Rémi Denis-Courmont at 2022-03-05T19:20:41+00:00
url: use signed type as needed
Errors are signaled by -1, so the type has to be signed.
There are no needs to force 8-bit sign extension here since the
non-error result is always positive. So better use a fast type.
Regression from 88e3a4f0017196af2139576daf76ad4564864eb6.
Fixes #26679.
- - - - -
1 changed file:
- src/text/url.c
Changes:
=====================================
src/text/url.c
=====================================
@@ -51,15 +51,15 @@ char *vlc_uri_decode_duplicate (const char *str)
return buf;
}
-static char hex_to_char( char c )
+static int_fast8_t hex_to_char(unsigned char c)
{
- unsigned char v = (unsigned char)c - '0';
+ uint_fast8_t v = c - '0';
if ( v < 10 )
return v;
- v = (unsigned)c - 'a';
+ v = c - 'a';
if ( v <= 5 )
return v + 10;
- v = (unsigned)c - 'A';
+ v = c - 'A';
if ( v <= 5 )
return v + 10;
return -1;
@@ -76,7 +76,7 @@ char *vlc_uri_decode (char *str)
{
if (c == '%')
{
- char a, b;
+ int_fast8_t a, b;
if ((a = hex_to_char(*(in++))) < 0 ||
(b = hex_to_char(*(in++))) < 0)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/801529c641446c857e87c2d7db6a7ff79cad631b...7550e1ff5911059a5591b4e16438f41d4a059606
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/801529c641446c857e87c2d7db6a7ff79cad631b...7550e1ff5911059a5591b4e16438f41d4a059606
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list