summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp7
-rw-r--r--src/corelib/tools/qeasingcurve.cpp2
-rw-r--r--src/corelib/tools/qlocale_unix.cpp2
-rw-r--r--src/corelib/tools/qringbuffer.cpp12
-rw-r--r--src/corelib/tools/qtimezoneprivate_mac.mm2
5 files changed, 13 insertions, 12 deletions
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp
index 6587d900d2..a7ab8b9e70 100644
--- a/src/corelib/tools/qcommandlineparser.cpp
+++ b/src/corelib/tools/qcommandlineparser.cpp
@@ -887,7 +887,8 @@ QStringList QCommandLineParser::values(const QString &optionName) const
bool QCommandLineParser::isSet(const QCommandLineOption &option) const
{
// option.names() might be empty if the constructor failed
- return !option.names().isEmpty() && isSet(option.names().first());
+ const auto names = option.names();
+ return !names.isEmpty() && isSet(names.first());
}
/*!
@@ -905,7 +906,7 @@ bool QCommandLineParser::isSet(const QCommandLineOption &option) const
*/
QString QCommandLineParser::value(const QCommandLineOption &option) const
{
- return value(option.names().first());
+ return value(option.names().constFirst());
}
/*!
@@ -923,7 +924,7 @@ QString QCommandLineParser::value(const QCommandLineOption &option) const
*/
QStringList QCommandLineParser::values(const QCommandLineOption &option) const
{
- return values(option.names().first());
+ return values(option.names().constFirst());
}
/*!
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 2851dc81d6..4b5f5e7830 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -444,7 +444,7 @@ struct BezierEase : public QEasingCurveFunction
void init()
{
- if (_bezierCurves.last() == QPointF(1.0, 1.0)) {
+ if (_bezierCurves.constLast() == QPointF(1.0, 1.0)) {
_init = true;
_curveCount = _bezierCurves.count() / 3;
diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp
index 9b0d338e46..095001e0a3 100644
--- a/src/corelib/tools/qlocale_unix.cpp
+++ b/src/corelib/tools/qlocale_unix.cpp
@@ -122,7 +122,7 @@ QLocale QSystemLocale::fallbackUiLocale() const
// the first part of LANGUAGE if LANGUAGE is set and has a first part:
QByteArray language = qgetenv("LANGUAGE");
if (!language.isEmpty()) {
- language = language.split(':').first();
+ language = language.split(':').constFirst();
if (!language.isEmpty())
return QLocale(QString::fromLatin1(language));
}
diff --git a/src/corelib/tools/qringbuffer.cpp b/src/corelib/tools/qringbuffer.cpp
index db2004dfd9..4a2dfdec2b 100644
--- a/src/corelib/tools/qringbuffer.cpp
+++ b/src/corelib/tools/qringbuffer.cpp
@@ -74,14 +74,14 @@ void QRingBuffer::free(qint64 bytes)
Q_ASSERT(bytes <= bufferSize);
while (bytes > 0) {
- const qint64 blockSize = buffers.first().size() - head;
+ const qint64 blockSize = buffers.constFirst().size() - head;
if (tailBuffer == 0 || blockSize > bytes) {
// keep a single block around if it does not exceed
// the basic block size, to avoid repeated allocations
// between uses of the buffer
if (bufferSize <= bytes) {
- if (buffers.first().size() <= basicBlockSize) {
+ if (buffers.constFirst().size() <= basicBlockSize) {
bufferSize = 0;
head = tail = 0;
} else {
@@ -114,8 +114,8 @@ char *QRingBuffer::reserve(qint64 bytes)
} else {
const qint64 newSize = bytes + tail;
// if need buffer reallocation
- if (newSize > buffers.last().size()) {
- if (newSize > buffers.last().capacity() && (tail >= basicBlockSize
+ if (newSize > buffers.constLast().size()) {
+ if (newSize > buffers.constLast().capacity() && (tail >= basicBlockSize
|| newSize >= MaxByteArraySize)) {
// shrink this buffer to its current size
buffers.last().resize(tail);
@@ -180,7 +180,7 @@ void QRingBuffer::chop(qint64 bytes)
// the basic block size, to avoid repeated allocations
// between uses of the buffer
if (bufferSize <= bytes) {
- if (buffers.first().size() <= basicBlockSize) {
+ if (buffers.constFirst().size() <= basicBlockSize) {
bufferSize = 0;
head = tail = 0;
} else {
@@ -198,7 +198,7 @@ void QRingBuffer::chop(qint64 bytes)
bytes -= tail;
buffers.removeLast();
--tailBuffer;
- tail = buffers.last().size();
+ tail = buffers.constLast().size();
}
}
diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm
index 14b0523ca7..3a665c2b00 100644
--- a/src/corelib/tools/qtimezoneprivate_mac.mm
+++ b/src/corelib/tools/qtimezoneprivate_mac.mm
@@ -243,7 +243,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec
}
}
if (secsList.size() >= 1)
- return data(qint64(secsList.last()) * 1000);
+ return data(qint64(secsList.constLast()) * 1000);
else
return invalidData();
}