Fix infinite parse of recursive definitions

Fixed the infinite parse (and eventually segfault) of recursive definitions.
Also fixed the parse of a string slave PCM of direct plugins.
This commit is contained in:
Takashi Iwai 2006-01-30 14:41:51 +00:00
parent bf174b7046
commit eccc92a34d
29 changed files with 127 additions and 36 deletions

View file

@ -919,7 +919,8 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
}
static int snd_seq_open_noupdate(snd_seq_t **seqp, snd_config_t *root,
const char *name, int streams, int mode)
const char *name, int streams, int mode,
int hop)
{
int err;
snd_config_t *seq_conf;
@ -928,6 +929,7 @@ static int snd_seq_open_noupdate(snd_seq_t **seqp, snd_config_t *root,
SNDERR("Unknown SEQ %s", name);
return err;
}
snd_config_set_hop(seq_conf, hop);
err = snd_seq_open_conf(seqp, name, root, seq_conf, streams, mode);
snd_config_delete(seq_conf);
return err;
@ -971,7 +973,7 @@ int snd_seq_open(snd_seq_t **seqp, const char *name,
err = snd_config_update();
if (err < 0)
return err;
return snd_seq_open_noupdate(seqp, snd_config, name, streams, mode);
return snd_seq_open_noupdate(seqp, snd_config, name, streams, mode, 0);
}
/**
@ -993,9 +995,22 @@ int snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
int streams, int mode, snd_config_t *lconf)
{
assert(seqp && name && lconf);
return snd_seq_open_noupdate(seqp, lconf, name, streams, mode);
return snd_seq_open_noupdate(seqp, lconf, name, streams, mode, 0);
}
#ifndef DOC_HIDDEN
int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
int streams, int mode, snd_config_t *lconf,
snd_config_t *parent_conf)
{
int hop;
assert(seqp && name && lconf);
if ((hop = snd_config_check_hop(parent_conf)) < 0)
return hop;
return snd_seq_open_noupdate(seqp, lconf, name, streams, mode, hop + 1);
}
#endif
/**
* \brief Close the sequencer
* \param seq Handle returned from #snd_seq_open()