diff options
author | Robin Gareus <robin@gareus.org> | 2018-01-30 19:12:01 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-01-30 19:52:09 +0100 |
commit | 1dd32bae94c639008b79a98339e19fc1feb9462b (patch) | |
tree | 4994926c53368a86d59de4bf623b625ec20d2019 /libs/ardour/plugin_manager.cc | |
parent | 54e155f4c7d63117e9ff4a42a57563ae18490c31 (diff) |
Move LADSPA Author string sanitation to libardour.
(Also allow dot as valid char: e.g. "James T. Kirk" but keep stripping
common suffixes like <e@mail>.
Diffstat (limited to 'libs/ardour/plugin_manager.cc')
-rw-r--r-- | libs/ardour/plugin_manager.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 37721e6a3a..cff8cc7924 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -678,13 +678,30 @@ PluginManager::ladspa_discover (string path) PluginInfoPtr info(new LadspaPluginInfo); info->name = descriptor->Name; info->category = get_ladspa_category(descriptor->UniqueID); - info->creator = descriptor->Maker; info->path = path; info->index = i; info->n_inputs = ChanCount(); info->n_outputs = ChanCount(); info->type = ARDOUR::LADSPA; + string::size_type pos = 0; + string creator = descriptor->Maker; + /* stupid LADSPA creator strings */ +#ifdef PLATFORM_WINDOWS + while (pos < creator.length() && creator[pos] > -2 && creator[pos] < 256 && (isalnum (creator[pos]) || isspace (creator[pos]) || creator[pos] == '.')) ++pos; +#else + while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]) || creator[pos] == '.')) ++pos; +#endif + + /* If there were too few characters to create a + * meaningful name, mark this creator as 'Unknown' + */ + if (creator.length() < 2 || pos < 3) { + info->creator = "Unknown"; + } else{ + info->creator = creator.substr (0, pos); + } + char buf[32]; snprintf (buf, sizeof (buf), "%lu", descriptor->UniqueID); info->unique_id = buf; |