From b2b184feecb8f94d03582b7730379adfa74f9de1 Mon Sep 17 00:00:00 2001 From: Chris Rizzitello Date: Tue, 7 Mar 2023 22:20:40 -0500 Subject: [PATCH] use C++ Casts --- src/formats/TexFile.cpp | 6 +++--- src/formats/WindowBinFile.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/formats/TexFile.cpp b/src/formats/TexFile.cpp index 50d977b2a..b21611d8e 100644 --- a/src/formats/TexFile.cpp +++ b/src/formats/TexFile.cpp @@ -88,7 +88,7 @@ bool TexFile::open(const QByteArray &data) } else { quint16 color; _image = QImage(w, h, QImage::Format_ARGB32); - QRgb *pixels = (QRgb *)_image.bits(); + QRgb *pixels = reinterpret_cast(_image.bits()); if (header.bytesPerPixel < 2 || header.bytesPerPixel > 4) { qWarning() << "tex invalid bytesPerPixel!" << header.bytesPerPixel; return false; @@ -146,9 +146,9 @@ bool TexFile::save(QByteArray &data) for (int x=0; x<_image.width(); ++x) data.append((char)_image.pixelIndex(x, y)); } - data.append((char *)colorKeyArray.data(), colorKeyArray.size()); + data.append(reinterpret_cast(colorKeyArray.data()), colorKeyArray.size()); } else { - QRgb *pixels = (QRgb *)_image.bits(); + QRgb *pixels = reinterpret_cast(_image.bits()); for (int i=0; i<_image.width()*_image.height(); ++i) { quint16 color = PsColor::toPsColor(pixels[i]); data.append((char *)&color, 2); diff --git a/src/formats/WindowBinFile.cpp b/src/formats/WindowBinFile.cpp index 9ca4adde9..897e0145f 100644 --- a/src/formats/WindowBinFile.cpp +++ b/src/formats/WindowBinFile.cpp @@ -113,7 +113,7 @@ bool WindowBinFile::save(QByteArray &data) const return false; saveSection(sectionData, data, 0); } - saveSection(QByteArray((char *)_charWidth.data(), _charWidth.size()), data, 1); + saveSection(QByteArray(reinterpret_cast(_charWidth.data()), _charWidth.size()), data, 1); data.append(QByteArray("\0\0", 2)); return true; }