From ee8c052395d484e2d094816beeb7a879947b72bd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 27 Jun 2018 11:38:53 +0200 Subject: QtNetwork: Fix and streamline translations of QDtls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use %-placeholder formatting instead of string concatenation for messages of the form "XX failed: %1" - Introduce helper functions for duplicate messages - Introduce helper function for message reporting function failures to avoid duplication - Extract helper function for reporting SSL handshake errors Complemements ac583b686d0677517e7f8a10ce4e79c7fe227ccf. Change-Id: Iaf6c158ca8086d0b17a3e3c51955707734829615 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslsocket_openssl.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/network/ssl/qsslsocket_openssl.cpp') diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 9a5997253c..298475b100 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -891,6 +891,12 @@ QSslError _q_OpenSSL_to_QSslError(int errorCode, const QSslCertificate &cert) return error; } +QString QSslSocketBackendPrivate::msgErrorsDuringHandshake() +{ + return QSslSocket::tr("Error during SSL handshake: %1") + .arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); +} + bool QSslSocketBackendPrivate::startHandshake() { Q_Q(QSslSocket); @@ -926,8 +932,7 @@ bool QSslSocketBackendPrivate::startHandshake() // The handshake is not yet complete. break; default: - QString errorString - = QSslSocket::tr("Error during SSL handshake: %1").arg(getErrorsFromOpenSsl()); + QString errorString = QSslSocketBackendPrivate::msgErrorsDuringHandshake(); #ifdef QSSLSOCKET_DEBUG qCDebug(lcSsl) << "QSslSocketBackendPrivate::startHandshake: error!" << errorString; #endif -- cgit v1.2.3