Skip to content

Commit

Permalink
QString: replace homebrew toString() with the Real Deal™
Browse files Browse the repository at this point in the history
QLatin1StringView has had a toString() since Qt 6.0. Remove the
wrapper.

Pick-to: 6.7 6.5
Task-number: QTBUG-124365
Change-Id: I91e1cc9a2be2d01f309d681b5abcaf417fa584da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
  • Loading branch information
marcmutz committed May 22, 2024
1 parent 3f3be9d commit 23dfacb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/corelib/text/qstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9241,9 +9241,6 @@ static qsizetype resolveStringRefsAndReturnTotalSize(ParseResult &parts, const A

} // unnamed namespace

Q_ALWAYS_INLINE QString to_string(QLatin1StringView s) noexcept { return s; }
Q_ALWAYS_INLINE QString to_string(QStringView s) noexcept { return s.toString(); }

template <typename StringView>
static QString argToQStringImpl(StringView pattern, size_t numArgs, const QtPrivate::ArgBase **args)
{
Expand All @@ -9257,7 +9254,7 @@ static QString argToQStringImpl(StringView pattern, size_t numArgs, const QtPriv
argIndexToPlaceholderMap.resize(qsizetype(numArgs));
else if (Q_UNLIKELY(static_cast<size_t>(argIndexToPlaceholderMap.size()) < numArgs)) // 3b
qWarning("QString::arg: %d argument(s) missing in %ls",
int(numArgs - argIndexToPlaceholderMap.size()), qUtf16Printable(to_string(pattern)));
int(numArgs - argIndexToPlaceholderMap.size()), qUtf16Printable(pattern.toString()));

// 5
const qsizetype totalSize = resolveStringRefsAndReturnTotalSize(parts, argIndexToPlaceholderMap, args);
Expand Down

0 comments on commit 23dfacb

Please sign in to comment.