Mercurial > hg > vamp-plugin-load-checker
changeset 19:c80c55cabfcd
Untabify
author | Chris Cannam |
---|---|
date | Tue, 01 Nov 2016 15:16:08 +0000 |
parents | 7eff522b23ae |
children | c1081e8d26a7 |
files | checker/knownplugins.h checker/plugincandidates.h src/checker.cpp src/knownplugins.cpp src/plugincandidates.cpp |
diffstat | 5 files changed, 132 insertions(+), 132 deletions(-) [+] |
line wrap: on
line diff
--- a/checker/knownplugins.h Tue Nov 01 15:09:44 2016 +0000 +++ b/checker/knownplugins.h Tue Nov 01 15:16:08 2016 +0000 @@ -42,33 +42,33 @@ public: enum PluginType { - VampPlugin, - LADSPAPlugin, - DSSIPlugin + VampPlugin, + LADSPAPlugin, + DSSIPlugin }; KnownPlugins(std::string helperExecutableName, PluginCandidates::LogCallback *cb = 0); std::vector<PluginType> getKnownPluginTypes() const { - return { VampPlugin, LADSPAPlugin, DSSIPlugin }; + return { VampPlugin, LADSPAPlugin, DSSIPlugin }; }; std::string getTagFor(PluginType type) const { - return m_known.at(type).tag; + return m_known.at(type).tag; } stringlist getCandidateLibrariesFor(PluginType type) const { - return m_candidates.getCandidateLibrariesFor(getTagFor(type)); + return m_candidates.getCandidateLibrariesFor(getTagFor(type)); } std::string getFailureReport() const; private: struct TypeRec { - std::string tag; - stringlist path; - std::string descriptor; + std::string tag; + stringlist path; + std::string descriptor; }; std::map<PluginType, TypeRec> m_known;
--- a/checker/plugincandidates.h Tue Nov 01 15:09:44 2016 +0000 +++ b/checker/plugincandidates.h Tue Nov 01 15:16:08 2016 +0000 @@ -72,8 +72,8 @@ * Not thread-safe. */ void scan(std::string tag, - stringlist pluginPath, - std::string descriptorSymbolName); + stringlist pluginPath, + std::string descriptorSymbolName); /** Return list of plugin library paths that were checked * successfully during the scan for the given tag. @@ -81,8 +81,8 @@ stringlist getCandidateLibrariesFor(std::string tag) const; struct FailureRec { - std::string library; - std::string message; + std::string library; + std::string message; }; /** Return list of failure reports arising from the prior scan for
--- a/src/checker.cpp Tue Nov 01 15:09:44 2016 +0000 +++ b/src/checker.cpp Tue Nov 01 15:16:08 2016 +0000 @@ -45,11 +45,11 @@ KnownPlugins kp("./plugin-checker-helper", &cb); //!!! for (auto t: kp.getKnownPluginTypes()) { - cout << "successful libraries for plugin type \"" - << kp.getTagFor(t) << "\":" << endl; - for (auto lib: kp.getCandidateLibrariesFor(t)) { - cout << lib << endl; - } + cout << "successful libraries for plugin type \"" + << kp.getTagFor(t) << "\":" << endl; + for (auto lib: kp.getCandidateLibrariesFor(t)) { + cout << lib << endl; + } } cout << "Failure message (if any):" << endl;
--- a/src/knownplugins.cpp Tue Nov 01 15:09:44 2016 +0000 +++ b/src/knownplugins.cpp Tue Nov 01 15:16:08 2016 +0000 @@ -46,32 +46,32 @@ m_candidates.setLogCallback(cb); m_known = { - { - VampPlugin, - { - "vamp", - expandConventionalPath(VampPlugin, "VAMP_PATH"), - "vampGetPluginDescriptor" - }, - }, { - LADSPAPlugin, - { - "ladspa", - expandConventionalPath(LADSPAPlugin, "LADSPA_PATH"), - "ladspa_descriptor" - }, - }, { - DSSIPlugin, - { - "dssi", - expandConventionalPath(DSSIPlugin, "DSSI_PATH"), - "dssi_descriptor" - } - } + { + VampPlugin, + { + "vamp", + expandConventionalPath(VampPlugin, "VAMP_PATH"), + "vampGetPluginDescriptor" + }, + }, { + LADSPAPlugin, + { + "ladspa", + expandConventionalPath(LADSPAPlugin, "LADSPA_PATH"), + "ladspa_descriptor" + }, + }, { + DSSIPlugin, + { + "dssi", + expandConventionalPath(DSSIPlugin, "DSSI_PATH"), + "dssi_descriptor" + } + } }; for (const auto &k: m_known) { - m_candidates.scan(k.second.tag, k.second.path, k.second.descriptor); + m_candidates.scan(k.second.tag, k.second.path, k.second.descriptor); } } @@ -83,29 +83,29 @@ #if defined(_WIN32) case VampPlugin: - return "%ProgramFiles%\\Vamp Plugins"; + return "%ProgramFiles%\\Vamp Plugins"; case LADSPAPlugin: - return "%ProgramFiles%\\LADSPA Plugins;%ProgramFiles%\\Audacity\\Plug-Ins"; + return "%ProgramFiles%\\LADSPA Plugins;%ProgramFiles%\\Audacity\\Plug-Ins"; case DSSIPlugin: - return "%ProgramFiles%\\DSSI Plugins"; - + return "%ProgramFiles%\\DSSI Plugins"; + #elif defined(__APPLE__) - + case VampPlugin: - return "$HOME/Library/Audio/Plug-Ins/Vamp:/Library/Audio/Plug-Ins/Vamp"; + return "$HOME/Library/Audio/Plug-Ins/Vamp:/Library/Audio/Plug-Ins/Vamp"; case LADSPAPlugin: - return "$HOME/Library/Audio/Plug-Ins/LADSPA:/Library/Audio/Plug-Ins/LADSPA"; + return "$HOME/Library/Audio/Plug-Ins/LADSPA:/Library/Audio/Plug-Ins/LADSPA"; case DSSIPlugin: - return "$HOME/Library/Audio/Plug-Ins/DSSI:/Library/Audio/Plug-Ins/DSSI"; - + return "$HOME/Library/Audio/Plug-Ins/DSSI:/Library/Audio/Plug-Ins/DSSI"; + #else /* Linux, BSDs, etc */ - + case VampPlugin: - return "$HOME/vamp:$HOME/.vamp:/usr/local/lib/vamp:/usr/lib/vamp"; + return "$HOME/vamp:$HOME/.vamp:/usr/local/lib/vamp:/usr/lib/vamp"; case LADSPAPlugin: - return "$HOME/ladspa:$HOME/.ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa"; + return "$HOME/ladspa:$HOME/.ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa"; case DSSIPlugin: - return "$HOME/dssi:$HOME/.dssi:/usr/local/lib/dssi:/usr/lib/dssi"; + return "$HOME/dssi:$HOME/.dssi:/usr/local/lib/dssi:/usr/lib/dssi"; #endif } @@ -125,36 +125,36 @@ path = getDefaultPath(type); - if (path != "") { + if (path != "") { - char *home = getenv("HOME"); - if (home) { - string::size_type f; - while ((f = path.find("$HOME")) != string::npos && - f < path.length()) { - path.replace(f, 5, home); - } - } + char *home = getenv("HOME"); + if (home) { + string::size_type f; + while ((f = path.find("$HOME")) != string::npos && + f < path.length()) { + path.replace(f, 5, home); + } + } #ifdef _WIN32 const char *pfiles = getenv("ProgramFiles"); - if (!pfiles) pfiles = "C:\\Program Files"; - { - string::size_type f; - while ((f = path.find("%ProgramFiles%")) != string::npos && - f < path.length()) { - path.replace(f, 14, pfiles); - } - } + if (!pfiles) pfiles = "C:\\Program Files"; + { + string::size_type f; + while ((f = path.find("%ProgramFiles%")) != string::npos && + f < path.length()) { + path.replace(f, 14, pfiles); + } + } #endif - } + } } string::size_type index = 0, newindex = 0; while ((newindex = path.find(PATH_SEPARATOR, index)) < path.size()) { - pathList.push_back(path.substr(index, newindex - index).c_str()); - index = newindex + 1; + pathList.push_back(path.substr(index, newindex - index).c_str()); + index = newindex + 1; } pathList.push_back(path.substr(index)); @@ -168,8 +168,8 @@ vector<PluginCandidates::FailureRec> failures; for (auto t: getKnownPluginTypes()) { - auto ff = m_candidates.getFailedLibrariesFor(getTagFor(t)); - failures.insert(failures.end(), ff.begin(), ff.end()); + auto ff = m_candidates.getFailedLibrariesFor(getTagFor(t)); + failures.insert(failures.end(), ff.begin(), ff.end()); } if (failures.empty()) return ""; @@ -181,20 +181,20 @@ os << "<ul>"; for (auto f: failures) { - os << "<li>" + f.library; - if (f.message != "") { - os << "<br><i>" + f.message + "</i>"; - } else { - os << "<br><i>unknown error</i>"; - } - os << "</li>"; + os << "<li>" + f.library; + if (f.message != "") { + os << "<br><i>" + f.message + "</i>"; + } else { + os << "<br><i>unknown error</i>"; + } + os << "</li>"; - if (n > 10) { - if (++i == 5) { - os << "<li>(... and " << (n - i) << " further failures)</li>"; - break; - } - } + if (n > 10) { + if (++i == 5) { + os << "<li>(... and " << (n - i) << " further failures)</li>"; + break; + } + } } os << "</ul>";
--- a/src/plugincandidates.cpp Tue Nov 01 15:09:44 2016 +0000 +++ b/src/plugincandidates.cpp Tue Nov 01 15:16:08 2016 +0000 @@ -1,30 +1,30 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* - Copyright (c) 2016 Queen Mary, University of London + Copyright (c) 2016 Queen Mary, University of London - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - Except as contained in this notice, the names of the Centre for - Digital Music and Queen Mary, University of London shall not be - used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. + Except as contained in this notice, the names of the Centre for + Digital Music and Queen Mary, University of London shall not be + used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. */ #include "plugincandidates.h" @@ -89,10 +89,10 @@ log("scanning directory " + dirname + "\n"); QDir dir(dirname.c_str(), PLUGIN_GLOB, - QDir::Name | QDir::IgnoreCase, - QDir::Files | QDir::Readable); + QDir::Name | QDir::IgnoreCase, + QDir::Files | QDir::Readable); - for (unsigned int i = 0; i < dir.count(); ++i) { + for (unsigned int i = 0; i < dir.count(); ++i) { QString soname = dir.filePath(dir[i]); // NB this means the library names passed to the helper // are UTF-8 encoded @@ -105,8 +105,8 @@ void PluginCandidates::scan(string tag, - vector<string> pluginPath, - string descriptorSymbolName) + vector<string> pluginPath, + string descriptorSymbolName) { vector<string> libraries = getLibrariesInPath(pluginPath); vector<string> remaining = libraries; @@ -117,21 +117,21 @@ vector<string> result; while (result.size() < libraries.size() && runcount < runlimit) { - vector<string> output = runHelper(remaining, descriptorSymbolName); - result.insert(result.end(), output.begin(), output.end()); - int shortfall = int(remaining.size()) - int(output.size()); - if (shortfall > 0) { - // Helper bailed out for some reason presumably associated - // with the plugin following the last one it reported - // on. Add a failure entry for that one and continue with - // the following ones. + vector<string> output = runHelper(remaining, descriptorSymbolName); + result.insert(result.end(), output.begin(), output.end()); + int shortfall = int(remaining.size()) - int(output.size()); + if (shortfall > 0) { + // Helper bailed out for some reason presumably associated + // with the plugin following the last one it reported + // on. Add a failure entry for that one and continue with + // the following ones. string failed = *(remaining.rbegin() + shortfall - 1); log("helper output ended before result for plugin " + failed + "\n"); - result.push_back("FAILURE|" + failed + "|Plugin load check failed or timed out"); + result.push_back("FAILURE|" + failed + "|Plugin load check failed or timed out"); remaining = vector<string> (remaining.rbegin(), remaining.rbegin() + shortfall - 1); - } - ++runcount; + } + ++runcount; } recordResult(tag, result); @@ -162,11 +162,11 @@ << " failed on startup with error code " << err << std::endl; } - throw runtime_error("plugin load helper failed to start"); + throw runtime_error("plugin load helper failed to start"); } for (auto &lib: libraries) { - process.write(lib.c_str(), lib.size()); - process.write("\n", 1); + process.write(lib.c_str(), lib.size()); + process.write("\n", 1); } QTime t; @@ -177,8 +177,8 @@ bool done = false; while (!done) { - char buf[buflen]; - qint64 linelen = process.readLine(buf, buflen); + char buf[buflen]; + qint64 linelen = process.readLine(buf, buflen); if (linelen > 0) { output.push_back(buf); done = (output.size() == libraries.size()); @@ -186,7 +186,7 @@ // error case log("received error code while reading from helper\n"); done = true; - } else { + } else { // no error, but no line read (could just be between // lines, or could be eof) done = (process.state() == QProcess::NotRunning);