From f6b851837df08b3f2fc6a571a2cc4567471a2495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 22 Aug 2021 10:35:44 +0200 Subject: [PATCH] Fix warning about loop variable creating a copy qxpmhandler.cpp:1162:21: warning: loop variable '[color, index]' of type 'const std::__1::pair' creates a copy from type 'const std::__1::pair' [-Wrange-loop-analysis] for (const auto [color, index] : colorMap) ^ Change-Id: Ifabf1c569efdcd929859227d860f4598250ba5bd Reviewed-by: Volker Hilsheimer --- src/gui/image/qxpmhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index da975869d5..b9b0f443fa 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -1159,7 +1159,7 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const << '\"' << w << ' ' << h << ' ' << ncolors << ' ' << cpp << '\"'; // write palette - for (const auto [color, index] : colorMap) { + for (const auto &[color, index] : colorMap) { const QString line = image.format() != QImage::Format_RGB32 && !qAlpha(color) ? QString::asprintf("\"%s c None\"", xpm_color_name(cpp, index)) : QString::asprintf("\"%s c #%02x%02x%02x\"", xpm_color_name(cpp, index),