summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Loftis <ben@glw.com>2010-01-13 16:27:51 +0000
committerBen Loftis <ben@glw.com>2010-01-13 16:27:51 +0000
commit496a2da48f8a02a4be7761f0da6eb0b3828ee68b (patch)
tree58bcc3fcf991636471c474b9ce7bb93db9b7f9cc
parentbab9bc0bd2c3e1f0abf3bfb75c1777cda0506a8d (diff)
fix unprintable chars in au_cache file, version it, and overwrite files of the old version
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6485 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/appleutility/CAComponentDescription.cpp8
-rw-r--r--libs/ardour/audio_unit.cc22
2 files changed, 19 insertions, 11 deletions
diff --git a/libs/appleutility/CAComponentDescription.cpp b/libs/appleutility/CAComponentDescription.cpp
index 261a2b881c..fbfaa8efcb 100644
--- a/libs/appleutility/CAComponentDescription.cpp
+++ b/libs/appleutility/CAComponentDescription.cpp
@@ -54,12 +54,8 @@ char *StringForOSType (OSType t, char *writeLocation)
unsigned char str[4], *q = str;
*(UInt32 *)str = EndianU32_NtoB(t);
for (int i = 0; i < 4; ++i) {
- if (isprint(*q) && *q != '\\')
- *p++ = *q++;
- else {
- sprintf(p, "\\x%02X", *q++);
- p += 4;
- }
+ sprintf(p, "\\x%02X", *q++);
+ p += 4;
}
*p = '\0';
return writeLocation;
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index 42c18fd5f3..eddf49bc28 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -2021,9 +2021,7 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
info->n_inputs = info->cache.io_configs.front().first;
info->n_outputs = info->cache.io_configs.front().second;
- if (info->cache.io_configs.size() > 1) {
- cerr << "ODD: variable IO config for " << info->unique_id << endl;
- }
+ cerr << "detected AU: " << info->name.c_str() << " (" << info->cache.io_configs.size() << " i/o configurations) - " << info->unique_id << endl;
plugs.push_back (info);
@@ -2116,12 +2114,15 @@ AUPluginInfo::add_cached_info (const std::string& id, AUPluginCachedInfo& cinfo)
cached_info[id] = cinfo;
}
+#define AU_CACHE_VERSION "2.0"
+
void
AUPluginInfo::save_cached_info ()
{
XMLNode* node;
node = new XMLNode (X_("AudioUnitPluginCache"));
+ node->add_property( "version", AU_CACHE_VERSION );
for (map<string,AUPluginCachedInfo>::iterator i = cached_info.begin(); i != cached_info.end(); ++i) {
XMLNode* parent = new XMLNode (X_("plugin"));
@@ -2163,13 +2164,24 @@ AUPluginInfo::load_cached_info ()
return 0;
}
- tree.read (path);
+ if ( !tree.read (path) ) {
+ error << "au_cache is not a valid XML file. AU plugins will be re-scanned" << endmsg;
+ return -1;
+ }
+
const XMLNode* root (tree.root());
if (root->name() != X_("AudioUnitPluginCache")) {
return -1;
}
-
+
+ //initial version has incorrectly stored i/o info, and/or garbage chars.
+ const XMLProperty* version = root->property(X_("version"));
+ if (! (version != NULL) && (version->value() == X_(AU_CACHE_VERSION)))) {
+ error << "au_cache is not correct version. AU plugins will be re-scanned" << endmsg;
+ return -1;
+ }
+
cached_info.clear ();
const XMLNodeList children = root->children();