diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-02-11 20:37:52 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-02-25 12:31:17 -0800 |
commit | 09f5bb99699e0c31dc7ba9b02a29a1d78d26323e (patch) | |
tree | b41820fa3ea930bce7b7e8a17e5200d55894f35f /src/corelib/text | |
parent | 938dc34f94884466ab2f946b26fa3aff6025dd29 (diff) |
QString: make insert_helper take the insertee by const-ref
Not all callers pass a view-type object: there are several call points
passing a QVarLengthArray, which means the value ended up being copied.
Introduced in 67108ef8db0b134908a88e2da7a533be98f0c796. Found by
Coverity scan (CID 404702).
Change-Id: I9671dee8ceb64aa9b9cafffd1742f9cda2131752
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/text')
-rw-r--r-- | src/corelib/text/qstring.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 14cce79eed..b07e0f57fe 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -2943,7 +2943,7 @@ QString &QString::operator=(QChar ch) T is a view or a container on/of QChar, char16_t, or char */ template <typename T> -static void insert_helper(QString &str, qsizetype i, T toInsert) +static void insert_helper(QString &str, qsizetype i, const T &toInsert) { auto &str_d = str.data_ptr(); qsizetype difference = 0; |