From 6d239915254db21a3b2b18cab0eba8a988ce5546 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 23 Jan 2022 12:38:48 +0200 Subject: [PATCH] mark warning cases in QFont as unlikely Signed-off-by: Ivailo Monev --- src/gui/text/qfont.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 4164b6631..6e46c5e30 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -650,7 +650,7 @@ QFont::HintingPreference QFont::hintingPreference() const */ void QFont::setPointSize(int pointSize) { - if (pointSize <= 0) { + if (Q_UNLIKELY(pointSize <= 0)) { qWarning("QFont::setPointSize: Point size <= 0 (%d), must be greater than 0", pointSize); return; } @@ -672,7 +672,7 @@ void QFont::setPointSize(int pointSize) */ void QFont::setPointSizeF(qreal pointSize) { - if (pointSize <= 0) { + if (Q_UNLIKELY(pointSize <= 0)) { qWarning("QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0", pointSize); return; } @@ -707,7 +707,7 @@ qreal QFont::pointSizeF() const */ void QFont::setPixelSize(int pixelSize) { - if (pixelSize <= 0) { + if (Q_UNLIKELY(pixelSize <= 0)) { qWarning("QFont::setPixelSize: Pixel size <= 0 (%d)", pixelSize); return; } @@ -1007,7 +1007,7 @@ int QFont::stretch() const */ void QFont::setStretch(int factor) { - if (factor < 1 || factor > 4000) { + if (Q_UNLIKELY(factor < 1 || factor > 4000)) { qWarning("QFont::setStretch: Parameter '%d' out of range", factor); return; } @@ -1244,7 +1244,7 @@ bool QFont::fromString(const QString &descrip) QStringList l(descrip.split(QLatin1Char(','))); int count = l.count(); - if (!count || count > 8) { + if (Q_UNLIKELY(!count || count > 8)) { qWarning("QFont::fromString: Invalid description '%s'", descrip.isEmpty() ? "(empty)" : descrip.toLatin1().data()); return false; -- 2.11.0