summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qgifhandler.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-02-09 09:14:12 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-02-13 08:17:00 +0000
commitac8a3b948da1980bc59bae3fc76d20b5b45662a0 (patch)
treef08eed7df003491d742190f9eeb5a2fb06518ae5 /src/gui/image/qgifhandler.cpp
parent9915630d0886434e8984904b1cadedc81dc78ca0 (diff)
QtGui: Use QImage::constBits()/constScanLine() in non-const contexts.
Prevent potential detaching by using constBits()/constScanLine() instead of bits()/scanLine(). Change-Id: If03f8d4d3b8ed4c07aed5eff7f580e57ca771919 Reviewed-by: Gunnar Sletta <gunnar@sletta.org> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/gui/image/qgifhandler.cpp')
-rw-r--r--src/gui/image/qgifhandler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp
index 7ba6b123e8..9c748c0373 100644
--- a/src/gui/image/qgifhandler.cpp
+++ b/src/gui/image/qgifhandler.cpp
@@ -199,7 +199,7 @@ void QGIFFormat::disposePrevious(QImage *image)
fillRect(image, l, t, r-l+1, b-t+1, color(bgcol));
} else {
// Impossible: We don't know of a bgcol - use pixel 0
- QRgb *bits = (QRgb*)image->bits();
+ const QRgb *bits = reinterpret_cast<const QRgb *>(image->constBits());
fillRect(image, l, t, r-l+1, b-t+1, bits[0]);
}
// ### Changed: QRect(l, t, r-l+1, b-t+1)
@@ -208,7 +208,7 @@ void QGIFFormat::disposePrevious(QImage *image)
if (frame >= 0) {
for (int ln=t; ln<=b; ln++) {
memcpy(image->scanLine(ln)+l,
- backingstore.scanLine(ln-t),
+ backingstore.constScanLine(ln-t),
(r-l+1)*sizeof(QRgb));
}
// ### Changed: QRect(l, t, r-l+1, b-t+1)