mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
spa: use strtoull for atou32
On machines with a 32 bits long, converting a negative value will still result in v == (uint32_t)v and the unit test will fail. Extend to 64 bits and strtoull to reject negative values in atou32.
This commit is contained in:
parent
0b0a4897d6
commit
3fcb9c44ef
1 changed files with 2 additions and 2 deletions
|
|
@ -100,13 +100,13 @@ static inline bool spa_atoi32(const char *str, int32_t *val, int base)
|
|||
static inline bool spa_atou32(const char *str, uint32_t *val, int base)
|
||||
{
|
||||
char *endptr;
|
||||
unsigned long v;
|
||||
unsigned long long v;
|
||||
|
||||
if (!str || *str =='\0')
|
||||
return false;
|
||||
|
||||
errno = 0;
|
||||
v = strtoul(str, &endptr, base);
|
||||
v = strtoull(str, &endptr, base);
|
||||
if (errno != 0 || *endptr != '\0')
|
||||
return false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue