fix warnings due to signed char on some platforms
some context: https://stackoverflow.com/a/10186479/1976323
This commit is contained in:
parent
29ddf649e1
commit
09d10c16d3
|
@ -71,7 +71,7 @@ void fix16_to_str(fix16_t value, char *buf, int decimals)
|
||||||
|
|
||||||
fix16_t fix16_from_str(const char *buf)
|
fix16_t fix16_from_str(const char *buf)
|
||||||
{
|
{
|
||||||
while (isspace(*buf))
|
while (isspace((unsigned char) *buf))
|
||||||
buf++;
|
buf++;
|
||||||
|
|
||||||
/* Decode the sign */
|
/* Decode the sign */
|
||||||
|
@ -82,7 +82,7 @@ fix16_t fix16_from_str(const char *buf)
|
||||||
/* Decode the integer part */
|
/* Decode the integer part */
|
||||||
uint32_t intpart = 0;
|
uint32_t intpart = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (isdigit(*buf))
|
while (isdigit((unsigned char) *buf))
|
||||||
{
|
{
|
||||||
intpart *= 10;
|
intpart *= 10;
|
||||||
intpart += *buf++ - '0';
|
intpart += *buf++ - '0';
|
||||||
|
@ -102,7 +102,7 @@ fix16_t fix16_from_str(const char *buf)
|
||||||
|
|
||||||
uint32_t fracpart = 0;
|
uint32_t fracpart = 0;
|
||||||
uint32_t scale = 1;
|
uint32_t scale = 1;
|
||||||
while (isdigit(*buf) && scale < 100000)
|
while (isdigit((unsigned char) *buf) && scale < 100000)
|
||||||
{
|
{
|
||||||
scale *= 10;
|
scale *= 10;
|
||||||
fracpart *= 10;
|
fracpart *= 10;
|
||||||
|
@ -115,7 +115,7 @@ fix16_t fix16_from_str(const char *buf)
|
||||||
/* Verify that there is no garbage left over */
|
/* Verify that there is no garbage left over */
|
||||||
while (*buf != '\0')
|
while (*buf != '\0')
|
||||||
{
|
{
|
||||||
if (!isdigit(*buf) && !isspace(*buf))
|
if (!isdigit((unsigned char) *buf) && !isspace((unsigned char) *buf))
|
||||||
return fix16_overflow;
|
return fix16_overflow;
|
||||||
|
|
||||||
buf++;
|
buf++;
|
||||||
|
|
Loading…
Reference in New Issue