mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
module-rt{kit}: use spa_atoi32 instead of custom strtol
And duplicate the function into rtkit which had a similar but different approach to it. Let's get both to do the same here.
This commit is contained in:
parent
87a1e1534c
commit
696a4b22e9
2 changed files with 12 additions and 7 deletions
|
|
@ -501,12 +501,20 @@ static int get_default_int(struct pw_properties *properties, const char *name, i
|
|||
{
|
||||
int val;
|
||||
const char *str;
|
||||
if ((str = pw_properties_get(properties, name)) != NULL)
|
||||
val = atoi(str);
|
||||
else {
|
||||
bool set_default = true;
|
||||
|
||||
if ((str = pw_properties_get(properties, name)) != NULL) {
|
||||
if (spa_atoi32(str, &val, 10))
|
||||
set_default = false;
|
||||
else
|
||||
pw_log_warn("invalid integer value '%s' of property %s, using default (%d) instead", str, name, def);
|
||||
}
|
||||
|
||||
if (set_default) {
|
||||
val = def;
|
||||
pw_properties_setf(properties, name, "%d", val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue