diff options
author | David Robillard <d@drobilla.net> | 2007-06-24 16:01:26 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-06-24 16:01:26 +0000 |
commit | 433b5c46520b16882cb2a79f9d44840037ec914d (patch) | |
tree | 2ef1879de9d26a901d7709b14ca06747e942763f | |
parent | 51918d8e3743d178bba2dbd788c8a5c3fc7cc3bc (diff) | |
download | ingen-433b5c46520b16882cb2a79f9d44840037ec914d.tar.gz ingen-433b5c46520b16882cb2a79f9d44840037ec914d.tar.bz2 ingen-433b5c46520b16882cb2a79f9d44840037ec914d.zip |
Fixed unnnecessary name mangling of deprecated patches.
git-svn-id: http://svn.drobilla.net/lad/ingen@541 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/libs/client/DeprecatedLoader.cpp | 36 | ||||
-rw-r--r-- | src/libs/client/DeprecatedLoader.h | 1 | ||||
-rw-r--r-- | src/libs/client/client.cpp | 1 | ||||
-rw-r--r-- | src/libs/client/client.h | 3 |
4 files changed, 28 insertions, 13 deletions
diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index d4b650df..3c95d9ac 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -98,11 +98,25 @@ DeprecatedLoader::find_file(const string& filename, const string& additional_pat #endif string +DeprecatedLoader::nameify_if_invalid(const string& name) +{ + if (Path::is_valid_name(name)) { + return name; + } else { + const string new_name = Path::nameify(name); + cerr << "WARNING: Illegal name '" << name << "' converted to '" << name << "'" << endl; + return new_name; + } +} + + +string DeprecatedLoader::translate_load_path(const string& path) { std::map<string,string>::iterator t = _load_path_translations.find(path); if (t != _load_path_translations.end()) { + assert(Path::is_valid((*t).second)); return (*t).second; } else { assert(Path::is_valid(path)); @@ -217,7 +231,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, if (load_name) { assert(key != NULL); if (parent_path) - path = Path(parent_path.get()).base() + Path::nameify((char*)key); + path = Path(parent_path.get()).base() + nameify_if_invalid((char*)key); else path = Path("/"); } @@ -333,9 +347,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) { - cerr << "NAME: " << (char*)key; - path = parent.base() + Path::nameify((char*)key); - cerr << ", PATH: " << path << endl; + path = parent.base() + nameify_if_invalid((char*)key); } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphonic"))) { polyphonic = !strcmp((char*)key, "true"); } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"type"))) { @@ -359,7 +371,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr key = xmlNodeListGetString(doc, child->xmlChildrenNode, 1); if ((!xmlStrcmp(child->name, (const xmlChar*)"name"))) { - port_name = Path::nameify((char*)key); + port_name = nameify_if_invalid((char*)key); } else if ((!xmlStrcmp(child->name, (const xmlChar*)"user-min"))) { user_min = atof((char*)key); } else if ((!xmlStrcmp(child->name, (const xmlChar*)"user-max"))) { @@ -480,7 +492,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr if (is_port) { const string old_path = path; - const string new_path = Path::pathify(old_path); + const string new_path = (Path::is_valid(old_path) ? old_path : Path::pathify(old_path)); // Set up translations (for connections etc) to alias both the old // module path and the old module/port path to the new port path @@ -607,10 +619,10 @@ DeprecatedLoader::load_connection(const Path& parent, xmlDocPtr doc, const xmlNo } // Compatibility fixes for old (fundamentally broken) patches - source_node = Path::nameify(source_node); - source_port = Path::nameify(source_port); - dest_node = Path::nameify(dest_node); - dest_port = Path::nameify(dest_port); + source_node = nameify_if_invalid(source_node); + source_port = nameify_if_invalid(source_port); + dest_node = nameify_if_invalid(dest_node); + dest_port = nameify_if_invalid(dest_port); _engine->connect( translate_load_path(parent.base() + source_node +"/"+ source_port), @@ -662,8 +674,8 @@ DeprecatedLoader::load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePt } // Compatibility fixes for old patch files - node_name = Path::nameify(node_name); - port_name = Path::nameify(port_name); + node_name = nameify_if_invalid(node_name); + port_name = nameify_if_invalid(port_name); if (port_name == "") { string msg = "Unable to parse control in patch file ( node = "; diff --git a/src/libs/client/DeprecatedLoader.h b/src/libs/client/DeprecatedLoader.h index dde9f631..1bf81c9d 100644 --- a/src/libs/client/DeprecatedLoader.h +++ b/src/libs/client/DeprecatedLoader.h @@ -70,6 +70,7 @@ public: private: void add_metadata(MetadataMap& data, string key, string value); + string nameify_if_invalid(const string& name); string translate_load_path(const string& path); //string _patch_search_path; diff --git a/src/libs/client/client.cpp b/src/libs/client/client.cpp index 99fa116c..da28a342 100644 --- a/src/libs/client/client.cpp +++ b/src/libs/client/client.cpp @@ -30,7 +30,6 @@ new_osc_interface(const std::string& url) return SharedPtr<Shared::EngineInterface>(oes); } - } // namespace Client } // namespace Ingen diff --git a/src/libs/client/client.h b/src/libs/client/client.h index c2b19d12..fa4ad6c9 100644 --- a/src/libs/client/client.h +++ b/src/libs/client/client.h @@ -22,6 +22,8 @@ namespace Ingen { +class Engine; + namespace Shared { class EngineInterface; } namespace Client { @@ -29,6 +31,7 @@ namespace Client { extern "C" { SharedPtr<Shared::EngineInterface> new_osc_interface(const std::string& url); + SharedPtr<Shared::EngineInterface> new_queued_interface(SharedPtr<Ingen::Engine> engine); } |