aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-01-31 02:03:10 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-01-31 02:03:10 +0100
commit936973ebcb41e0a491d4cc46a52f703b065967ca (patch)
tree864490a4bca47f43a5590580210e37853d19e709 /contrib
parentsystemd: wg-quick should depend on nss-lookup.target (diff)
downloadwireguard-monolithic-historical-936973ebcb41e0a491d4cc46a52f703b065967ca.tar.xz
wireguard-monolithic-historical-936973ebcb41e0a491d4cc46a52f703b065967ca.zip
highlighter: when subtracting char, cast to unsigned
Windows.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/examples/highlighter/highlighter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/examples/highlighter/highlighter.c b/contrib/examples/highlighter/highlighter.c
index 171a84c..1913e35 100644
--- a/contrib/examples/highlighter/highlighter.c
+++ b/contrib/examples/highlighter/highlighter.c
@@ -166,9 +166,9 @@ static bool is_valid_uint(string_span_t s, bool support_hex, uint64_t min, uint6
if (support_hex && s.len > 2 && s.s[0] == '0' && s.s[1] == 'x') {
for (size_t i = 2; i < s.len; ++i) {
- if (s.s[i] - '0' < 10)
+ if ((unsigned)s.s[i] - '0' < 10)
val = 16 * val + (s.s[i] - '0');
- else if ((s.s[i] | 32) - 'a' < 6)
+ else if (((unsigned)s.s[i] | 32) - 'a' < 6)
val = 16 * val + (s.s[i] | 32) - 'a' + 10;
else
return false;