Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
6.2
-
None
-
-
16a1ba69a682fbe7855682448ac0340574a67035 (qt/qtbase/dev) de1e66cd8bd957778c61015f53131781d32865d0 (qt/qtbase/6.1)
Description
cl version v16.9.4 warns about C4723 in qpixmap.cpp, qimage.cpp:
C:\dev\qt\dev\src\qtbase\src\gui\image\qpixmap.cpp(516) : warning C4723: potential divide by 0 C:\dev\qt\dev\src\qtbase\src\gui\image\qimage.cpp(1311) : warning C4723: potential divide by 0
The lines in question look fairly standard though, and don't use divisions?
return data ? data->height() : 0;
return d ? d->height : 0;
Anyhow, the warning is only at Release build, and most probably due to some optimizations MSVC does there. One can trace it to:
QPixmap QPixmap::scaledToHeight(int h, Qt::TransformationMode mode) const { if (isNull()) { qWarning("QPixmap::scaleHeight: Pixmap is a null pixmap"); return copy(); } if (h <= 0) return QPixmap(); Q_TRACE_SCOPE(QPixmap_scaledToHeight, h, mode); qreal factor = (qreal) h / height(); QTransform wm = QTransform::fromScale(factor, factor); return transformed(wm, mode); }
One can see that there's a potential problem if height() == 0.