aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ringler <johannesringler@gmail.com>2022-02-22 19:37:18 +0100
committerPetteri Aimonen <jpa@github.mail.kapsi.fi>2022-02-23 08:50:12 +0200
commit09d10c16d3dfa5c9b9354906f4e66589f3db31d7 (patch)
tree2691eebacdec4da85ef94fa8644d5498f3a73f4b
parent29ddf649e1536dfeb6086430e9fe65c5749b9dad (diff)
fix warnings due to signed char on some platforms
some context: https://stackoverflow.com/a/10186479/1976323
-rw-r--r--libfixmath/fix16_str.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libfixmath/fix16_str.c b/libfixmath/fix16_str.c
index 07df864..f533907 100644
--- a/libfixmath/fix16_str.c
+++ b/libfixmath/fix16_str.c
@@ -71,7 +71,7 @@ void fix16_to_str(fix16_t value, char *buf, int decimals)
fix16_t fix16_from_str(const char *buf)
{
- while (isspace(*buf))
+ while (isspace((unsigned char) *buf))
buf++;
/* Decode the sign */
@@ -82,7 +82,7 @@ fix16_t fix16_from_str(const char *buf)
/* Decode the integer part */
uint32_t intpart = 0;
int count = 0;
- while (isdigit(*buf))
+ while (isdigit((unsigned char) *buf))
{
intpart *= 10;
intpart += *buf++ - '0';
@@ -102,7 +102,7 @@ fix16_t fix16_from_str(const char *buf)
uint32_t fracpart = 0;
uint32_t scale = 1;
- while (isdigit(*buf) && scale < 100000)
+ while (isdigit((unsigned char) *buf) && scale < 100000)
{
scale *= 10;
fracpart *= 10;
@@ -115,7 +115,7 @@ fix16_t fix16_from_str(const char *buf)
/* Verify that there is no garbage left over */
while (*buf != '\0')
{
- if (!isdigit(*buf) && !isspace(*buf))
+ if (!isdigit((unsigned char) *buf) && !isspace((unsigned char) *buf))
return fix16_overflow;
buf++;