Download raw body.
Pointer sign warnings
On Tue, 28 Sep 2021 20:13:59 +0200, Christian Weisgerber wrote:
> Christian Weisgerber:
>
> > There are, however, a bunch of low-hanging fruits:
>
> (2) fix unsigned/signed char mismatch in parse.y
It is important to cast to unsigned char before assigning to an int
or passing to a function that expects an int. Otherwise, a signed
char > 127 becomes a negative value when converted to int.
This was the reason for changing the buffer to unsigned char in the
first place.
- todd
diff --git a/gotweb/parse.y b/gotweb/parse.y
index d07e4ee7..37b4716e 100644
--- a/gotweb/parse.y
+++ b/gotweb/parse.y
@@ -455,8 +455,8 @@ top:
} else {
nodigits:
while (p > buf + 1)
- lungetc(*--p);
- c = *--p;
+ lungetc((unsigned char)*--p);
+ c = (unsigned char)*--p;
if (c == '-')
return (c);
}
diff --git a/libexec/got-read-gotconfig/parse.y b/libexec/got-read-gotconfig/parse.y
index e3bc2bff..e42abc90 100644
--- a/libexec/got-read-gotconfig/parse.y
+++ b/libexec/got-read-gotconfig/parse.y
@@ -624,8 +624,8 @@ top:
} else {
nodigits:
while (p > buf + 1)
- lungetc(*--p);
- c = *--p;
+ lungetc((unsigned char)*--p);
+ c = (unsigned char)*--p;
if (c == '-')
return (c);
}
Pointer sign warnings