roken: strtoull.c negation is a no-op on unsigned integer
strtoull() returns an unsigned long long. However, then the input string represents a negative number the return value is supposed to be the unsigned representation of the negative value. Before applying the negation the value must be cast to (long long). Change-Id: Icf9e75400ff736819b1f7e0e6fb3c8abd707a23a
This commit is contained in:
@@ -119,9 +119,8 @@ strtoull(const char * nptr, char ** endptr, int base)
|
||||
noconv:
|
||||
errno = EINVAL;
|
||||
} else if (neg)
|
||||
acc = -acc;
|
||||
acc = -(long long)acc;
|
||||
if (endptr != NULL)
|
||||
*endptr = (char *)(any ? s - 1 : nptr);
|
||||
return (acc);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user