From 5ff71637968c70f138d8ea6cc24e61c1608f2187 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 3 Aug 2022 19:23:28 +0200 Subject: qputenv: port to QByteArrayView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vast majority of in-tree users pass simple and short C string literals as the value. By porting to QByteArrayView, we document that we'll accept non-NUL-terminated data, and do the NUL-termination internally, using SSO'ed std::string, saving memory allocations in the common case of short strings. I didn't bother to check which direction std::string takes for nullptrs these days (there was a change accepted in that area for C++20 or 23), so play it safe and protect against them. Follow-up to Task-number: QTBUG-105302 Change-Id: I2369acc62f1d5cbc26135396cfe0602d8c75300c Reviewed-by: Sona Kurazyan Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Qt CI Bot --- tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/printsupport') diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp index 15af4c899b..adf4cb7181 100644 --- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp @@ -174,7 +174,7 @@ QString tst_QPrinterInfo::getOutputFromCommand(const QStringList &command) { // Forces the ouptut from the command to be in English const QByteArray origSoftwareEnv = qgetenv("SOFTWARE"); - qputenv("SOFTWARE", QByteArray()); + qputenv("SOFTWARE", nullptr); QString output = getOutputFromCommandInternal(command); qputenv("SOFTWARE", origSoftwareEnv); return output; -- cgit v1.2.3