Author: cazfi Date: Tue Nov 22 06:44:25 2016 New Revision: 34607 URL: http://svn.gna.org/viewcvs/freeciv?rev=34607&view=rev Log: Fixed clang alignment warning from Qt-client zealous_crop_rect()
See bug #25315 Modified: branches/S2_6/client/gui-qt/canvas.cpp Modified: branches/S2_6/client/gui-qt/canvas.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/canvas.cpp?rev=34607&r1=34606&r2=34607&view=diff ============================================================================== --- branches/S2_6/client/gui-qt/canvas.cpp (original) +++ branches/S2_6/client/gui-qt/canvas.cpp Tue Nov 22 06:44:25 2016 @@ -355,17 +355,24 @@ QRect zealous_crop_rect(QImage &p) { int r, t, b, l; - - l = p.width(); + int oh, ow; + + ow = p.width(); + l = ow; r = 0; - t = p.height(); + oh = p.height(); + t = oh; b = 0; - for (int y = 0; y < p.height(); ++y) { - QRgb *row = (QRgb *)p.scanLine(y); + for (int y = 0; y < oh; y++) { + QRgb row[ow]; bool row_filled = false; int x; - for (x = 0; x < p.width(); ++x) { + /* Copy to a location with guaranteed QRgb suitable alignment. + * That fixes clang compiler warning. */ + memcpy(row, p.scanLine(y), ow * sizeof(QRgb)); + + for (x = 0; x < ow; ++x) { if (qAlpha(row[x])) { row_filled = true; r = qMax(r, x); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits