diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2021-09-25 07:50:56 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2021-10-04 14:01:42 -0700 |
commit | 461084b6c483c0dc90415d4f16868e194fcd6f0a (patch) | |
tree | 5ee705532e84c01ed5b0284637bae5363d6d48d7 /src/corelib/plugin/qlibrary.cpp | |
parent | 349fb14c1d387e3ec052953e9f5b91b3f6b0dea7 (diff) |
Q{Elf,Mach}Parser: harmonize the arguments passed
Both functions took a QString for the input file name, but while the ELF
parser had an optional QLibrary pointer (which was never null) where to
store the error string, the Mach-O parser received a pointer to a
QString. So make both of them take a single in/out QString pointer,
which has the file name on input and is cheap for us because of COW.
Drive-by fix the name of the static function in qmachparser.cpp from
"ns" (which stood for "not suitable") to "notfound".
Change-Id: I3eb1bd30e0124f89a052fffd16a8182f4f8541c3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/plugin/qlibrary.cpp')
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index befe784c05..a99ee57a92 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -255,31 +255,30 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib) /* ELF and Mach-O binaries with GCC have .qtmetadata sections. Find them. */ + QString errMsg = library; #if defined (Q_OF_ELF) - r = QElfParser().parse(filedata, r.length, library, lib); + r = QElfParser().parse(filedata, r.length, &errMsg); if (r.length == 0) { if (lib && qt_debug_component()) - qWarning("QElfParser: %ls", qUtf16Printable(lib->errorString)); + qWarning("QElfParser: %ls", qUtf16Printable(errMsg)); + if (lib) + lib->errorString = errMsg; return false; } #elif defined(Q_OF_MACH_O) - { - QString errorString; - r = QMachOParser::parse(filedata, r.length, library, &errorString); - if (r.length == 0) { - if (qt_debug_component()) - qWarning("QMachOParser: %ls", qUtf16Printable(errorString)); - if (lib) - lib->errorString = errorString; - return false; - } + r = QMachOParser::parse(filedata, r.length, &errMsg); + if (r.length == 0) { + if (qt_debug_component()) + qWarning("QMachOParser: %ls", qUtf16Printable(errMsg)); + if (lib) + lib->errorString = errMsg; + return false; } #endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) if (qsizetype rel = qt_find_pattern(filedata + r.pos, r.length); rel >= 0) { const char *data = filedata + r.pos + rel; - QString errMsg; QJsonDocument doc = qJsonFromRawLibraryMetaData(data, r.length, &errMsg); if (doc.isNull()) { qWarning("Found invalid metadata in lib %ls: %ls", |