Skip to content

Commit

Permalink
use C++ Casts
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Mar 9, 2023
1 parent 9566d43 commit b2b184f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/formats/TexFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<QRgb *>(_image.bits());
if (header.bytesPerPixel < 2 || header.bytesPerPixel > 4) {
qWarning() << "tex invalid bytesPerPixel!" << header.bytesPerPixel;
return false;
Expand Down Expand Up @@ -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<char *>(colorKeyArray.data()), colorKeyArray.size());
} else {
QRgb *pixels = (QRgb *)_image.bits();
QRgb *pixels = reinterpret_cast<QRgb *>(_image.bits());
for (int i=0; i<_image.width()*_image.height(); ++i) {
quint16 color = PsColor::toPsColor(pixels[i]);
data.append((char *)&color, 2);
Expand Down
2 changes: 1 addition & 1 deletion src/formats/WindowBinFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char*>(_charWidth.data()), _charWidth.size()), data, 1);
data.append(QByteArray("\0\0", 2));
return true;
}
Expand Down

0 comments on commit b2b184f

Please sign in to comment.