mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
mark some qWarning cases as unlikely
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
de2d95eef4
commit
7bd30599f6
4 changed files with 23 additions and 23 deletions
|
@ -438,7 +438,7 @@ static void setup()
|
|||
|
||||
|
||||
#ifdef Q_DEBUG_TEXTCODEC
|
||||
if (destroying_is_ok)
|
||||
if (Q_UNLIKELY(destroying_is_ok))
|
||||
qWarning("QTextCodec: Creating new codec during codec cleanup");
|
||||
#endif
|
||||
all = new QList<QTextCodec*>;
|
||||
|
@ -655,7 +655,7 @@ QTextCodec::QTextCodec()
|
|||
QTextCodec::~QTextCodec()
|
||||
{
|
||||
#ifdef Q_DEBUG_TEXTCODEC
|
||||
if (!destroying_is_ok)
|
||||
if (Q_UNLIKELY(!destroying_is_ok))
|
||||
qWarning("QTextCodec::~QTextCodec: Called by application");
|
||||
#endif
|
||||
if (all) {
|
||||
|
|
|
@ -693,7 +693,7 @@ static char *aargv[] = { (char*)"unknown", 0 };
|
|||
QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap)
|
||||
: QCoreApplication(*new QApplicationPrivate(aargc, aargv, QApplication::Gui))
|
||||
{
|
||||
if (! dpy)
|
||||
if (Q_UNLIKELY(!dpy))
|
||||
qWarning("QApplication: Invalid Display* argument");
|
||||
Q_D(QApplication);
|
||||
d->construct(dpy, visual, colormap);
|
||||
|
@ -717,7 +717,7 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv,
|
|||
Qt::HANDLE visual, Qt::HANDLE colormap)
|
||||
: QCoreApplication(*new QApplicationPrivate(argc, argv, QApplication::Gui))
|
||||
{
|
||||
if (! dpy)
|
||||
if (Q_UNLIKELY(!dpy))
|
||||
qWarning("QApplication: Invalid Display* argument");
|
||||
Q_D(QApplication);
|
||||
d->construct(dpy, visual, colormap);;
|
||||
|
@ -1277,7 +1277,7 @@ QString QApplication::graphicsSystem()
|
|||
|
||||
void QApplication::setGraphicsSystem(const QString &system)
|
||||
{
|
||||
if (system == QLatin1String("native")) {
|
||||
if (Q_UNLIKELY(system == QLatin1String("native"))) {
|
||||
qWarning() << "Attempt to set native graphicssystem";
|
||||
QApplicationPrivate::graphics_system_name = QLatin1String("raster");
|
||||
} else {
|
||||
|
@ -2665,7 +2665,7 @@ QDesktopWidget *QApplication::desktop()
|
|||
QClipboard *QApplication::clipboard()
|
||||
{
|
||||
if (qt_clipboard == 0) {
|
||||
if (!qApp) {
|
||||
if (Q_UNLIKELY(!qApp)) {
|
||||
qWarning("QApplication: Must construct a QApplication before accessing a QClipboard");
|
||||
return 0;
|
||||
}
|
||||
|
@ -3202,7 +3202,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
|
|||
if (QApplicationPrivate::is_app_closing)
|
||||
return true;
|
||||
|
||||
if (receiver == 0) { // serious error
|
||||
if (Q_UNLIKELY(receiver == 0)) { // serious error
|
||||
qWarning("QApplication::notify: Unexpected null receiver");
|
||||
return true;
|
||||
}
|
||||
|
@ -3420,7 +3420,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
|
|||
QObject *obj = d->eventFilters.at(i);
|
||||
if (!obj)
|
||||
continue;
|
||||
if (obj->d_func()->threadData != w->d_func()->threadData) {
|
||||
if (Q_UNLIKELY(obj->d_func()->threadData != w->d_func()->threadData)) {
|
||||
qWarning("QApplication: Object event filter cannot be in a different thread.");
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ QPaintDevice::QPaintDevice()
|
|||
|
||||
QPaintDevice::~QPaintDevice()
|
||||
{
|
||||
if (paintingActive())
|
||||
if (Q_UNLIKELY(paintingActive()))
|
||||
qWarning("QPaintDevice: Cannot destroy paint device that is being "
|
||||
"painted");
|
||||
}
|
||||
|
|
|
@ -636,7 +636,7 @@ void QPainterPath::moveTo(const QPointF &p)
|
|||
printf("QPainterPath::moveTo() (%.2f,%.2f)\n", p.x(), p.y());
|
||||
#endif
|
||||
|
||||
if (!qIsFinite(p.x()) || !qIsFinite(p.y())) {
|
||||
if (Q_UNLIKELY(!qIsFinite(p.x()) || !qIsFinite(p.y()))) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
qWarning("QPainterPath::moveTo: Adding point where x or y is NaN or Inf, ignoring call");
|
||||
#endif
|
||||
|
@ -686,7 +686,7 @@ void QPainterPath::lineTo(const QPointF &p)
|
|||
printf("QPainterPath::lineTo() (%.2f,%.2f)\n", p.x(), p.y());
|
||||
#endif
|
||||
|
||||
if (!qIsFinite(p.x()) || !qIsFinite(p.y())) {
|
||||
if (Q_UNLIKELY(!qIsFinite(p.x()) || !qIsFinite(p.y()))) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
qWarning("QPainterPath::lineTo: Adding point where x or y is NaN or Inf, ignoring call");
|
||||
#endif
|
||||
|
@ -745,8 +745,8 @@ void QPainterPath::cubicTo(const QPointF &c1, const QPointF &c2, const QPointF &
|
|||
c1.x(), c1.y(), c2.x(), c2.y(), e.x(), e.y());
|
||||
#endif
|
||||
|
||||
if (!qIsFinite(c1.x()) || !qIsFinite(c1.y()) || !qIsFinite(c2.x()) || !qIsFinite(c2.y())
|
||||
|| !qIsFinite(e.x()) || !qIsFinite(e.y())) {
|
||||
if (Q_UNLIKELY(!qIsFinite(c1.x()) || !qIsFinite(c1.y()) || !qIsFinite(c2.x()) || !qIsFinite(c2.y())
|
||||
|| !qIsFinite(e.x()) || !qIsFinite(e.y()))) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
qWarning("QPainterPath::cubicTo: Adding point where x or y is NaN or Inf, ignoring call");
|
||||
#endif
|
||||
|
@ -802,7 +802,7 @@ void QPainterPath::quadTo(const QPointF &c, const QPointF &e)
|
|||
c.x(), c.y(), e.x(), e.y());
|
||||
#endif
|
||||
|
||||
if (!qIsFinite(c.x()) || !qIsFinite(c.y()) || !qIsFinite(e.x()) || !qIsFinite(e.y())) {
|
||||
if (Q_UNLIKELY(!qIsFinite(c.x()) || !qIsFinite(c.y()) || !qIsFinite(e.x()) || !qIsFinite(e.y()))) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
qWarning("QPainterPath::quadTo: Adding point where x or y is NaN or Inf, ignoring call");
|
||||
#endif
|
||||
|
@ -873,8 +873,8 @@ void QPainterPath::arcTo(const QRectF &rect, qreal startAngle, qreal sweepLength
|
|||
rect.x(), rect.y(), rect.width(), rect.height(), startAngle, sweepLength);
|
||||
#endif
|
||||
|
||||
if ((!qIsFinite(rect.x()) && !qIsFinite(rect.y())) || !qIsFinite(rect.width()) || !qIsFinite(rect.height())
|
||||
|| !qIsFinite(startAngle) || !qIsFinite(sweepLength)) {
|
||||
if (Q_UNLIKELY((!qIsFinite(rect.x()) && !qIsFinite(rect.y())) || !qIsFinite(rect.width()) || !qIsFinite(rect.height())
|
||||
|| !qIsFinite(startAngle) || !qIsFinite(sweepLength))) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
qWarning("QPainterPath::arcTo: Adding arc where a parameter is NaN or Inf, ignoring call");
|
||||
#endif
|
||||
|
@ -979,7 +979,7 @@ QPointF QPainterPath::currentPosition() const
|
|||
*/
|
||||
void QPainterPath::addRect(const QRectF &r)
|
||||
{
|
||||
if (!qIsFinite(r.x()) || !qIsFinite(r.y()) || !qIsFinite(r.width()) || !qIsFinite(r.height())) {
|
||||
if (Q_UNLIKELY(!qIsFinite(r.x()) || !qIsFinite(r.y()) || !qIsFinite(r.width()) || !qIsFinite(r.height()))) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
qWarning("QPainterPath::addRect: Adding rect where a parameter is NaN or Inf, ignoring call");
|
||||
#endif
|
||||
|
@ -1062,8 +1062,8 @@ void QPainterPath::addPolygon(const QPolygonF &polygon)
|
|||
*/
|
||||
void QPainterPath::addEllipse(const QRectF &boundingRect)
|
||||
{
|
||||
if (!qIsFinite(boundingRect.x()) || !qIsFinite(boundingRect.y())
|
||||
|| !qIsFinite(boundingRect.width()) || !qIsFinite(boundingRect.height())) {
|
||||
if (Q_UNLIKELY(!qIsFinite(boundingRect.x()) || !qIsFinite(boundingRect.y())
|
||||
|| !qIsFinite(boundingRect.width()) || !qIsFinite(boundingRect.height()))) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
qWarning("QPainterPath::addEllipse: Adding ellipse where a parameter is NaN or Inf, ignoring call");
|
||||
#endif
|
||||
|
@ -2391,7 +2391,7 @@ QDataStream &operator>>(QDataStream &s, QPainterPath &p)
|
|||
s >> x;
|
||||
s >> y;
|
||||
Q_ASSERT(type >= 0 && type <= 3);
|
||||
if (!qIsFinite(x) || !qIsFinite(y)) {
|
||||
if (Q_UNLIKELY(!qIsFinite(x) || !qIsFinite(y))) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
qWarning("QDataStream::operator>>: NaN or Inf element found in path, skipping it");
|
||||
#endif
|
||||
|
@ -2917,7 +2917,7 @@ static inline QBezier bezierAtT(const QPainterPath &path, qreal t, qreal *starti
|
|||
*/
|
||||
QPointF QPainterPath::pointAtPercent(qreal t) const
|
||||
{
|
||||
if (t < 0 || t > 1) {
|
||||
if (Q_UNLIKELY(t < 0 || t > 1)) {
|
||||
qWarning("QPainterPath::pointAtPercent accepts only values between 0 and 1");
|
||||
return QPointF();
|
||||
}
|
||||
|
@ -2951,7 +2951,7 @@ QPointF QPainterPath::pointAtPercent(qreal t) const
|
|||
*/
|
||||
qreal QPainterPath::angleAtPercent(qreal t) const
|
||||
{
|
||||
if (t < 0 || t > 1) {
|
||||
if (Q_UNLIKELY(t < 0 || t > 1)) {
|
||||
qWarning("QPainterPath::angleAtPercent accepts only values between 0 and 1");
|
||||
return 0;
|
||||
}
|
||||
|
@ -2979,7 +2979,7 @@ qreal QPainterPath::angleAtPercent(qreal t) const
|
|||
*/
|
||||
qreal QPainterPath::slopeAtPercent(qreal t) const
|
||||
{
|
||||
if (t < 0 || t > 1) {
|
||||
if (Q_UNLIKELY(t < 0 || t > 1)) {
|
||||
qWarning("QPainterPath::slopeAtPercent accepts only values between 0 and 1");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue