1 Jul
2015
1 Jul
'15
6 p.m.
At Wed, 1 Jul 2015 14:44:25 +0100, Liam Girdwood wrote:
+int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg,
- int (*fcn)(snd_tplg_t *, snd_config_t *, void *),
- void *private)
+{
- const char *id;
- snd_config_iterator_t i, next;
- snd_config_t *n;
- int err = -EINVAL;
- if (snd_config_get_id(cfg, &id) < 0)
return -EINVAL;
- if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
fprintf(stderr, "error: compound type expected for %s", id);
It's not good to print an error unconditionally from a system library. Better to use SNDERR() macro.
+int snd_tplg_build(snd_tplg_t *tplg, const char *infile, const char *outfile) +{
- snd_config_t *cfg = NULL;
- int err = 0;
- /* delete any old output files */
- unlink(outfile);
- tplg->out_fd =
open(outfile, O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
- if (tplg->out_fd < 0) {
fprintf(stderr, "error: failed to open %s err %d\n",
outfile, -errno);
return -errno;
- }
- err = tplg_load_config(infile, &cfg);
- if (err < 0) {
fprintf(stderr, "error: failed to load topology file %s\n",
infile);
return err;
The outfile is left opened.
Takashi