diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2024-02-26 12:18:14 +0100 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2024-03-06 04:09:16 -0600 |
commit | a6a56814702612d8981f594a6158d70a7928cb99 (patch) | |
tree | d4fc482cfd137eda7f7663b54dbb80d6e77076cc | |
parent | 24245d2a85cbcd503816027067aa72995e3ac2ac (diff) |
QLibrary: remove the unnecessary parentheses around dlerror()
We don't need a message like:
"Cannot load library nosuchlib: (nosuchlib: cannot open shared object file: No such file or directory)"
Pick-to: 6.7
Change-Id: I01ec3c774d9943adb903fffd17b76599cea47502
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r-- | src/corelib/plugin/qlibrary_unix.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 1e088bcf6b..e29207e422 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -25,12 +25,6 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; -static QString qdlerror() -{ - const char *err = dlerror(); - return err ? u'(' + QString::fromLocal8Bit(err) + u')' : QString(); -} - QStringList QLibraryPrivate::suffixes_sys(const QString &fullVersion) { QStringList suffixes; @@ -250,7 +244,7 @@ bool QLibraryPrivate::load_sys() locker.relock(); if (!hnd) { - errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, qdlerror()); + errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, dlerror()); } if (hnd) { qualifiedFileName = attempt; @@ -264,15 +258,15 @@ bool QLibraryPrivate::unload_sys() { #if !defined(Q_OS_VXWORKS) // Unloading on VxWorks causes crashes in QtDeclarative autotests if (dlclose(pHnd.loadAcquire())) { -#if defined (Q_OS_QNX) // Workaround until fixed in QNX; fixes crash in - char *error = dlerror(); // QtDeclarative auto test "qqmlenginecleanup" for instance + const char *error = dlerror(); +#if defined (Q_OS_QNX) + // Workaround until fixed in QNX; fixes crash in + // QtDeclarative auto test "qqmlenginecleanup" for instance if (!qstrcmp(error, "Shared objects still referenced")) // On QNX that's only "informative" return true; +#endif errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName, QLatin1StringView(error)); -#else - errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName, qdlerror()); -#endif return false; } errorString.clear(); |