pre-process-dapm.c (alsa-utils-1.2.5.tar.bz2) | : | pre-process-dapm.c (alsa-utils-1.2.5.1.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 149 | skipping to change at line 149 | |||
static int tplg_pp_get_widget_name(struct tplg_pre_processor *tplg_pp, | static int tplg_pp_get_widget_name(struct tplg_pre_processor *tplg_pp, | |||
const char *string, long index, char **widg et) | const char *string, long index, char **widg et) | |||
{ | { | |||
snd_config_iterator_t i, next; | snd_config_iterator_t i, next; | |||
snd_config_t *temp_cfg, *child, *class_cfg, *n; | snd_config_t *temp_cfg, *child, *class_cfg, *n; | |||
char *class_name, *args, *widget_name; | char *class_name, *args, *widget_name; | |||
int ret; | int ret; | |||
/* get class name */ | /* get class name */ | |||
args = strchr(string, '.'); | args = strchr(string, '.'); | |||
if (!args) { | ||||
SNDERR("Error getting class name for %s\n", string); | ||||
return -EINVAL; | ||||
} | ||||
class_name = calloc(1, strlen(string) - strlen(args) + 1); | class_name = calloc(1, strlen(string) - strlen(args) + 1); | |||
if (!class_name) | if (!class_name) | |||
return -ENOMEM; | return -ENOMEM; | |||
snprintf(class_name, strlen(string) - strlen(args) + 1, "%s", string); | snprintf(class_name, strlen(string) - strlen(args) + 1, "%s", string); | |||
/* create config with Widget class type */ | /* create config with Widget class type */ | |||
ret = snd_config_make(&temp_cfg, "Widget", SND_CONFIG_TYPE_COMPOUND); | ret = snd_config_make(&temp_cfg, "Widget", SND_CONFIG_TYPE_COMPOUND); | |||
if (ret < 0) { | if (ret < 0) { | |||
free(class_name); | free(class_name); | |||
skipping to change at line 201 | skipping to change at line 206 | |||
snd_config_for_each(i, next, temp_cfg) { | snd_config_for_each(i, next, temp_cfg) { | |||
const char *id; | const char *id; | |||
char *arg, *remaining, *temp; | char *arg, *remaining, *temp; | |||
n = snd_config_iterator_entry(i); | n = snd_config_iterator_entry(i); | |||
if (snd_config_get_string(n, &id) < 0) | if (snd_config_get_string(n, &id) < 0) | |||
continue; | continue; | |||
if (!args) { | if (!args) { | |||
SNDERR("insufficient arugments for widget %s\n", string); | SNDERR("insufficient arugments for widget %s\n", string); | |||
return -EINVAL; | ret = -EINVAL; | |||
goto err; | ||||
} | } | |||
remaining = strchr(args + 1, '.'); | remaining = strchr(args + 1, '.'); | |||
if (remaining) { | if (remaining) { | |||
arg = calloc(1, strlen(args + 1) - strlen(remaining) + 1) ; | arg = calloc(1, strlen(args + 1) - strlen(remaining) + 1) ; | |||
if (!arg) { | if (!arg) { | |||
ret = -ENOMEM; | ret = -ENOMEM; | |||
goto err; | goto err; | |||
} | } | |||
snprintf(arg, strlen(args + 1) - strlen(remaining) + 1, " %s", args + 1); | snprintf(arg, strlen(args + 1) - strlen(remaining) + 1, " %s", args + 1); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added |