Mercurial > hg > vamp-plugin-load-checker
diff src/plugincandidates.cpp @ 19:c80c55cabfcd
Untabify
author | Chris Cannam |
---|---|
date | Tue, 01 Nov 2016 15:16:08 +0000 |
parents | 8643d4d1cb14 |
children | 386de1be6226 |
line wrap: on
line diff
--- 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);