From 4867a49618e0d6a476e0549aeca5134b2e3c5892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sun, 18 Oct 2015 15:14:33 +0100 Subject: Use QStringRef in a bunch of places. Done automatically with clazy static analyzer. Change-Id: Ia0cf8fa24331ab102a3c3c30c2aa92ef1ba772e2 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4globalobject.cpp | 2 +- src/qml/qml/qqmlstringconverters.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/qml') diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 110a2c9089..b4733356ac 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -302,7 +302,7 @@ static QString decode(const QString &input, DecodeMode decodeMode, bool *ok) ++r; } if (*r) - output.append(input.mid(start, i - start + 1)); + output.append(input.midRef(start, i - start + 1)); else output.append(QChar(b)); } else { diff --git a/src/qml/qml/qqmlstringconverters.cpp b/src/qml/qml/qqmlstringconverters.cpp index eb0afda927..6a5c0736cf 100644 --- a/src/qml/qml/qqmlstringconverters.cpp +++ b/src/qml/qml/qqmlstringconverters.cpp @@ -137,8 +137,8 @@ QPointF QQmlStringConverters::pointFFromString(const QString &s, bool *ok) bool xGood, yGood; int index = s.indexOf(QLatin1Char(',')); - qreal xCoord = s.left(index).toDouble(&xGood); - qreal yCoord = s.mid(index+1).toDouble(&yGood); + qreal xCoord = s.leftRef(index).toDouble(&xGood); + qreal yCoord = s.midRef(index+1).toDouble(&yGood); if (!xGood || !yGood) { if (ok) *ok = false; @@ -161,8 +161,8 @@ QSizeF QQmlStringConverters::sizeFFromString(const QString &s, bool *ok) bool wGood, hGood; int index = s.indexOf(QLatin1Char('x')); - qreal width = s.left(index).toDouble(&wGood); - qreal height = s.mid(index+1).toDouble(&hGood); + qreal width = s.leftRef(index).toDouble(&wGood); + qreal height = s.midRef(index+1).toDouble(&hGood); if (!wGood || !hGood) { if (ok) *ok = false; @@ -185,12 +185,12 @@ QRectF QQmlStringConverters::rectFFromString(const QString &s, bool *ok) bool xGood, yGood, wGood, hGood; int index = s.indexOf(QLatin1Char(',')); - qreal x = s.left(index).toDouble(&xGood); + qreal x = s.leftRef(index).toDouble(&xGood); int index2 = s.indexOf(QLatin1Char(','), index+1); - qreal y = s.mid(index+1, index2-index-1).toDouble(&yGood); + qreal y = s.midRef(index+1, index2-index-1).toDouble(&yGood); index = s.indexOf(QLatin1Char('x'), index2+1); - qreal width = s.mid(index2+1, index-index2-1).toDouble(&wGood); - qreal height = s.mid(index+1).toDouble(&hGood); + qreal width = s.midRef(index2+1, index-index2-1).toDouble(&wGood); + qreal height = s.midRef(index+1).toDouble(&hGood); if (!xGood || !yGood || !wGood || !hGood) { if (ok) *ok = false; -- cgit v1.2.3