@@ -201,16 +201,16 @@ bool TimFile::save(QByteArray &data) const
201201
202202 // Header
203203 data.append (" \x10\x00\x00\x00 " , 4 );
204- data.append (( char *) &flag, 4 );
204+ data.append (reinterpret_cast < const char *>( &flag) , 4 );
205205
206206 if (hasPal) {
207207 quint16 colorPerPal = bpp == 0 ? 16 : 256 ;
208208 quint32 sizePalSection = 12 + quint32 (_colorTables.size ()) * colorPerPal * 2 ;
209- data.append (( char *) &sizePalSection, 4 );
210- data.append (( char *) &palX, 2 );
211- data.append (( char *)& palY, 2 );
212- data.append (( char *) &palW, 2 );
213- data.append (( char *) &palH, 2 );
209+ data.append (reinterpret_cast < const char *>( &sizePalSection) , 4 );
210+ data.append (reinterpret_cast < const char *>( &palX) , 2 );
211+ data.append (reinterpret_cast < const char *>( palY) , 2 );
212+ data.append (reinterpret_cast < const char *>( &palW) , 2 );
213+ data.append (reinterpret_cast < const char *>( &palH) , 2 );
214214 int colorTableId = 0 ;
215215 for (const QList<QRgb> &colorTable : _colorTables) {
216216 const QBitArray &alphaBit = _alphaBits.at (colorTableId);
@@ -220,7 +220,7 @@ bool TimFile::save(QByteArray &data) const
220220 for (i=0 ; i<colorTable.size () && i<colorPerPal; ++i) {
221221 quint16 psColor = PsColor::toPsColor (colorTable.at (i));
222222 psColor = setPsColorAlphaBit (psColor, alphaBit.at (i));
223- data.append (( char *) &psColor, 2 );
223+ data.append (reinterpret_cast < const char *>( &psColor) , 2 );
224224 }
225225 if (i<colorPerPal)
226226 data.append (QByteArray (colorPerPal - i, ' \0 ' ));
@@ -232,11 +232,11 @@ bool TimFile::save(QByteArray &data) const
232232 width/=4 ;
233233 else
234234 width/=2 ;
235- data.append (( char *) &sizeImgSection, 4 );
236- data.append (( char *) &imgX, 2 );
237- data.append (( char *) &imgY, 2 );
238- data.append (( char *)& width, 2 );
239- data.append (( char *) &height, 2 );
235+ data.append (reinterpret_cast < const char *>( &sizeImgSection) , 4 );
236+ data.append (reinterpret_cast < const char *>( &imgX) , 2 );
237+ data.append (reinterpret_cast < const char *>( &imgY) , 2 );
238+ data.append (reinterpret_cast < const char *>( width) , 2 );
239+ data.append (reinterpret_cast < const char *>( &height) , 2 );
240240 width *= 2 ;
241241 for (int y=0 ; y<height; ++y) {
242242 for (int x=0 ; x<width; ++x) {
@@ -251,21 +251,21 @@ bool TimFile::save(QByteArray &data) const
251251 } else {
252252 quint16 width = quint16 (_image.width ()), height = quint16 (_image.height ());
253253 const QBitArray &alphaBit = _alphaBits.first ();
254- data.append (( char *) &sizeImgSection, 4 );
255- data.append (( char *) &imgX, 2 );
256- data.append (( char *) &imgY, 2 );
257- data.append (( char *) &width, 2 );
258- data.append (( char *) &height, 2 );
254+ data.append (reinterpret_cast < const char *>( &sizeImgSection) , 4 );
255+ data.append (reinterpret_cast < const char *>( &imgX) , 2 );
256+ data.append (reinterpret_cast < const char *>( &imgY) , 2 );
257+ data.append (reinterpret_cast < const char *>( &width) , 2 );
258+ data.append (reinterpret_cast < const char *>( &height) , 2 );
259259 for (int y=0 ; y<height; ++y) {
260260 for (int x=0 ; x<width; ++x) {
261261 if (bpp == 2 ) {
262262 quint16 color = PsColor::toPsColor (_image.pixel (x, y));
263263 setPsColorAlphaBit (color, alphaBit.at (y * width + x));
264- data.append (( char *) &color, 2 );
264+ data.append (reinterpret_cast < const char *>( &color) , 2 );
265265 } else {
266266 QRgb c = _image.pixel (x, y);
267267 qint32 color = ((qRed (c) & 0xFF ) << 16 ) | ((qGreen (c) & 0xFF ) << 8 ) | (qBlue (c) & 0xFF );
268- data.append (( char *) &color, 3 );
268+ data.append (reinterpret_cast < const char *>( &color) , 3 );
269269 }
270270 }
271271 }
0 commit comments