From db657bb1aa73407141d807e01401ebe7b796290b Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 28 Mar 2023 17:20:59 +0200 Subject: [PATCH] Use QByteArrayLiteral for such literals --- syncthingconnector/syncthingconnection_requests.cpp | 4 ++-- syncthingconnector/tests/connectiontests.cpp | 2 +- syncthingconnector/tests/misctests.cpp | 2 +- syncthingwidgets/misc/syncthinglauncher.cpp | 2 +- syncthingwidgets/webview/webviewinterceptor.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/syncthingconnector/syncthingconnection_requests.cpp b/syncthingconnector/syncthingconnection_requests.cpp index 6b6379b..b19d619 100644 --- a/syncthingconnector/syncthingconnection_requests.cpp +++ b/syncthingconnector/syncthingconnection_requests.cpp @@ -40,7 +40,7 @@ QNetworkRequest SyncthingConnection::prepareRequest(const QString &path, const Q url.setPassword(password()); url.setQuery(query); QNetworkRequest request(url); - request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArray("application/x-www-form-urlencoded")); + request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/x-www-form-urlencoded")); request.setRawHeader("X-API-Key", m_apiKey); return request; } @@ -221,7 +221,7 @@ QString SyncthingConnection::configPath() const */ QByteArray SyncthingConnection::changeConfigVerb() const { - return isUsingDeprecatedRoutes() ? QByteArray("POST") : QByteArray("PUT"); + return isUsingDeprecatedRoutes() ? QByteArrayLiteral("POST") : QByteArrayLiteral("PUT"); } /*! diff --git a/syncthingconnector/tests/connectiontests.cpp b/syncthingconnector/tests/connectiontests.cpp index 10a160e..bae12fb 100644 --- a/syncthingconnector/tests/connectiontests.cpp +++ b/syncthingconnector/tests/connectiontests.cpp @@ -325,7 +325,7 @@ void ConnectionTests::testErrorCases() })); // setup/define test for error handling - m_connection.setApiKey(QByteArray("wrong API key")); + m_connection.setApiKey(QByteArrayLiteral("wrong API key")); bool syncthingAvailable = false; constexpr auto syncthingCheckInterval = TimeSpan::fromMilliseconds(200.0); const auto maxSyncthingStartupTime = TimeSpan::fromSeconds(15.0 * max(timeoutFactor, 5.0)); diff --git a/syncthingconnector/tests/misctests.cpp b/syncthingconnector/tests/misctests.cpp index b4b65c7..d8bfda3 100644 --- a/syncthingconnector/tests/misctests.cpp +++ b/syncthingconnector/tests/misctests.cpp @@ -172,7 +172,7 @@ void MiscTests::testConnectionSettingsAndLoadingSelfSignedCert() { SyncthingConnectionSettings settings; settings.syncthingUrl = QStringLiteral("http://localhost:8080"); - settings.apiKey = QByteArray("foo"); + settings.apiKey = QByteArrayLiteral("foo"); settings.httpsCertPath = SyncthingConfig::locateHttpsCertificate(); if (!settings.httpsCertPath.isEmpty() && settings.loadHttpsCert()) { CPPUNIT_ASSERT_GREATER(static_cast(0), settings.expectedSslErrors.size()); diff --git a/syncthingwidgets/misc/syncthinglauncher.cpp b/syncthingwidgets/misc/syncthinglauncher.cpp index ff12667..df8932a 100644 --- a/syncthingwidgets/misc/syncthinglauncher.cpp +++ b/syncthingwidgets/misc/syncthinglauncher.cpp @@ -280,7 +280,7 @@ void SyncthingLauncher::stopLibSyncthing() #else void SyncthingLauncher::showLibSyncthingNotSupported() { - handleOutputAvailable(QByteArray("libsyncthing support not enabled")); + handleOutputAvailable(QByteArrayLiteral("libsyncthing support not enabled")); emit exited(-1, QProcess::CrashExit); } #endif diff --git a/syncthingwidgets/webview/webviewinterceptor.cpp b/syncthingwidgets/webview/webviewinterceptor.cpp index 378ba71..809d2d7 100644 --- a/syncthingwidgets/webview/webviewinterceptor.cpp +++ b/syncthingwidgets/webview/webviewinterceptor.cpp @@ -10,7 +10,7 @@ namespace QtGui { void WebViewInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) { - info.setHttpHeader(QByteArray("X-API-Key"), m_settings.apiKey); + info.setHttpHeader(QByteArrayLiteral("X-API-Key"), m_settings.apiKey); } } // namespace QtGui