From e0206fe9d47bfbf18a0d4c2e5e780504305f72e7 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 9 Aug 2021 19:00:56 +0200 Subject: [PATCH] Get rid of QByteArray::nulTerminated() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is private and was not called by anything inline, even in 5.15, so can safely be removed without causing binary incompatibilities, now that it is no longer used even out-of-line. Task-number: QTBUG-74286 Change-Id: Iaec3877079746bd9ba7d1a39efbfb2711e7c00a5 Reviewed-by: Thiago Macieira Reviewed-by: MÃ¥rten Nordheim --- src/corelib/text/qbytearray.cpp | 20 -------------------- src/corelib/text/qbytearray.h | 3 +-- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 7795fd7f11..5bb63bbbb2 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -1821,26 +1821,6 @@ void QByteArray::expand(qsizetype i) resize(qMax(i + 1, size())); } -/*! - \internal - Return a QByteArray that is sure to be '\\0'-terminated. - - By default, all QByteArray have an extra NUL at the end, - guaranteeing that assumption. However, if QByteArray::fromRawData - is used, then the NUL is there only if the user put it there. We - can't be sure. -*/ -QByteArray QByteArray::nulTerminated() const -{ - // is this fromRawData? - if (d.isMutable()) - return *this; // no, then we're sure we're zero terminated - - QByteArray copy(*this); - copy.detach(); - return copy; -} - /*! \fn QByteArray &QByteArray::prepend(QByteArrayView ba) diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 5a6dc354ba..f3c167d217 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -485,7 +485,6 @@ private: void reallocData(qsizetype alloc, QArrayData::AllocationOption option); void reallocGrowData(qsizetype n); void expand(qsizetype i); - QByteArray nulTerminated() const; static QByteArray toLower_helper(const QByteArray &a); static QByteArray toLower_helper(QByteArray &a);