fix various issues with AU ID handling

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6596 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-01-29 17:59:00 +00:00
parent a3eb67b0e3
commit 06c8a2baef
3 changed files with 33 additions and 13 deletions

View file

@ -623,12 +623,12 @@ AUPlugin::maybe_fix_broken_au_id (const std::string& id)
uint32_t n[3];
int in;
int next_int;
char short_buf[5];
char short_buf[3];
stringstream s;
in = 0;
next_int = 0;
short_buf[4] = '\0';
short_buf[2] = '\0';
while (*cstr && next_int < 4) {
@ -649,7 +649,7 @@ AUPlugin::maybe_fix_broken_au_id (const std::string& id)
/* parse \xNN */
memcpy (short_buf, cstr, 4);
memcpy (short_buf, &cstr[2], 2);
nascent[in] = strtol (short_buf, NULL, 16);
cstr += 4;
++in;
@ -696,7 +696,6 @@ AUPlugin::maybe_fix_broken_au_id (const std::string& id)
return s.str();
err:
error << string_compose (_("This session contains an AU plugin whose ID cannot be understood - ignored (%1)"), id) << endmsg;
return string();
}
@ -2337,14 +2336,29 @@ AUPluginInfo::load_cached_info ()
if (!prop) {
continue;
}
string id = prop->value();
string fixed;
string version;
std::string id = prop->value();
string::size_type slash = id.find_last_of ('/');
id = AUPlugin::maybe_fix_broken_au_id (id);
if (id.empty()) {
if (slash == string::npos) {
continue;
}
version = id.substr (slash);
id = id.substr (0, slash);
fixed = AUPlugin::maybe_fix_broken_au_id (id);
if (fixed.empty()) {
error << string_compose (_("Your AudioUnit configuration cache contains an AU plugin whose ID cannot be understood - ignored (%1)"), id) << endmsg;
continue;
}
id = fixed;
id += version;
AUPluginCachedInfo cinfo;
for (XMLNodeConstIterator giter = gchildren.begin(); giter != gchildren.end(); giter++) {

View file

@ -347,9 +347,13 @@ ARDOUR::find_plugin(Session& session, string identifier, PluginType type)
the identifier we are looking for and check again.
*/
identifier = AUPlugin::maybe_fix_broken_au_id (identifier);
if (identifier.empty()) {
return PluginPtr ((Plugin*) 0);
{
std::string fixed = AUPlugin::maybe_fix_broken_au_id (identifier);
if (fixed.empty()) {
error << string_compose (_("This session contains an AU plugin whose ID cannot be understood - ignored (%1)"), identifier) << endmsg;
return PluginPtr ((Plugin*) 0);
}
identifier = fixed;
}
plugs = mgr->au_plugin_info();
break;

View file

@ -685,16 +685,18 @@ PluginManager::load_statuses ()
}
id = buf;
strip_whitespace_edges (id);
#ifdef HAVE_AUDIOUNITS
if (type == AudioUnit) {
id = AUPlugin::maybe_fix_broken_au_id (id);
if (id.empty()) {
string fixed = AUPlugin::maybe_fix_broken_au_id (id);
if (fixed.empty()) {
error << string_compose (_("Your favorite plugin list contains an AU plugin whose ID cannot be understood - ignored (%1)"), id) << endmsg;
continue;
}
id = fixed;
}
#endif
strip_whitespace_edges (id);
set_status (type, id, status);
}