From 1cce2cceffed30c3300ceffe85c0aba201064979 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 8 Oct 2023 20:56:22 -0700 Subject: [PATCH] QString/QByteArray: make the sliced(pos) overload call the other sliced MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complements 00c1c04bd536aa3db8f0d2ee33261cb4d2a79002. Change-Id: I8f3ce163ccc5408cac39fffd178c543d594cf64f Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Ahmad Samir --- src/corelib/text/qbytearray.h | 2 +- src/corelib/text/qstring.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 4251e6e20e..b5278dbba9 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -167,7 +167,7 @@ public: [[nodiscard]] QByteArray last(qsizetype n) const & { verify(0, n); return sliced(size() - n, n); } [[nodiscard]] QByteArray sliced(qsizetype pos) const & - { verify(pos, 0); return QByteArray(data() + pos, size() - pos); } + { verify(pos, 0); return sliced(pos, size() - pos); } [[nodiscard]] QByteArray sliced(qsizetype pos, qsizetype n) const & { verify(pos, n); return QByteArray(d.data() + pos, n); } [[nodiscard]] QByteArray chopped(qsizetype len) const & diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index e2f5d99d90..411430a189 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -347,7 +347,7 @@ public: [[nodiscard]] QString last(qsizetype n) const & { verify(0, n); return sliced(size() - n, n); } [[nodiscard]] QString sliced(qsizetype pos) const & - { verify(pos, 0); return QString(data() + pos, size() - pos); } + { verify(pos, 0); return sliced(pos, size() - pos); } [[nodiscard]] QString sliced(qsizetype pos, qsizetype n) const & { verify(pos, n); return QString(begin() + pos, n); } [[nodiscard]] QString chopped(qsizetype n) const &