Fix warning about loop variable creating a copy

qxpmhandler.cpp:1162:21: warning: loop variable '[color, index]' of type
  'const std::__1::pair<const unsigned int, int>' creates a copy from type
  'const std::__1::pair<const unsigned int, int>' [-Wrange-loop-analysis]
    for (const auto [color, index] : colorMap)
                    ^

Change-Id: Ifabf1c569efdcd929859227d860f4598250ba5bd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Tor Arne Vestbø 2021-08-22 10:35:44 +02:00
parent 01aeb5f7e4
commit f6b851837d

View File

@ -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),