Pass QSslError::SslError by value
It is a small and trivially copyable type. As a drive-by, make the operator a hidden friend. Found by an Axivion scan. [ChangeLog][Potentially Source-Incompatible Changes][QtNetwork] Made the QSslError::SslError QDebug operator<< a hidden friend of QSslError. This means the operator is no longer a match for arguments implicitly converting to SslError, only for SslError itself. A backwards-compatible fix is to make the conversion explicit: debug << QSslError::SslError(arg). Task-number: QTBUG-125026 Change-Id: I9b6673397b6a26d508783304240c91fa058139bc Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit f02402044e552f2940d4677039f3d02c41eb27ee) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
df6d88ea2c
commit
6065ed9948
@ -63,6 +63,17 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin
|
||||
#endif
|
||||
#include "qnetworkrequest.h" // inlined API
|
||||
|
||||
#include "qsslerror.h"
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
#if QT_CONFIG(ssl)
|
||||
QDebug operator<<(QDebug debug, const QSslError::SslError &error)
|
||||
{
|
||||
return print(std::move(debug), error);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include "qotherheader.h"
|
||||
// // implement removed functions from qotherheader.h
|
||||
// order sections alphabetically
|
||||
|
@ -348,7 +348,8 @@ QDebug operator<<(QDebug debug, const QSslError &error)
|
||||
debug << error.errorString();
|
||||
return debug;
|
||||
}
|
||||
QDebug operator<<(QDebug debug, const QSslError::SslError &error)
|
||||
|
||||
QDebug print(QDebug debug, QSslError::SslError error)
|
||||
{
|
||||
debug << QSslError(error).errorString();
|
||||
return debug;
|
||||
|
@ -16,6 +16,10 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_SSL
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
class QDebug;
|
||||
#endif
|
||||
|
||||
class QSslErrorPrivate;
|
||||
class Q_NETWORK_EXPORT QSslError
|
||||
{
|
||||
@ -88,16 +92,23 @@ public:
|
||||
private:
|
||||
// ### Qt 7: make QSslError implicitly shared
|
||||
std::unique_ptr<QSslErrorPrivate> d;
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_NETWORK_EXPORT friend QDebug print(QDebug debug, QSslError::SslError error);
|
||||
friend QDebug operator<<(QDebug debug, SslError error)
|
||||
{ return print(std::move(debug), error); }
|
||||
#endif
|
||||
};
|
||||
Q_DECLARE_SHARED(QSslError)
|
||||
|
||||
Q_NETWORK_EXPORT size_t qHash(const QSslError &key, size_t seed = 0) noexcept;
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
class QDebug;
|
||||
|
||||
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslError &error);
|
||||
#if QT_NETWORK_REMOVED_SINCE(6, 8)
|
||||
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslError::SslError &error);
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
class Q_NETWORK_EXPORT QSslError {}; // dummy class so that moc has a complete type
|
||||
#endif // QT_NO_SSL
|
||||
|
Loading…
x
Reference in New Issue
Block a user