From a6a56814702612d8981f594a6158d70a7928cb99 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 26 Feb 2024 12:18:14 +0100 Subject: 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 --- src/corelib/plugin/qlibrary_unix.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/corelib/plugin/qlibrary_unix.cpp') 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(); -- cgit v1.2.3