QCollator: port compare(ptr, n, ptr, n) to qsizetype
While the function is inline, the class is exported wholesale, so the function forms part of the ABI on Windows (but not Unix), so we must overload, can't replace. To avoid ambiguities where users pass different integer types as the lengths of the LHS and RHS strings, QT_REMOVED_SINCE the old overload. Since the removed function has an inline definition, it suffices to just include the header into the corresponding QT_REMOVED_SINCE section of the removed_api.cpp file, to elegantly solve the BiC problem only for those platforms (MSVC) where it matters. Pick-to: 6.4 Task-number: QTBUG-103531 Change-Id: I74d446f08fcd6247a2ec44575b8afef8d014c3b5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
16c453069f
commit
749b2df889
@ -169,6 +169,8 @@ QCalendar::QCalendar(QStringView name)
|
||||
QCalendar::QCalendar(QLatin1StringView name)
|
||||
: QCalendar(QAnyStringView{name}) {}
|
||||
|
||||
#include "qcollator.h" // inline function compare(ptr, n, ptr, n) (for MSVC)
|
||||
|
||||
#if QT_CONFIG(future)
|
||||
|
||||
#include "qfutureinterface.h"
|
||||
|
@ -320,7 +320,7 @@ bool QCollator::ignorePunctuation() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) const
|
||||
\fn int QCollator::compare(const QChar *s1, qsizetype len1, const QChar *s2, qsizetype len2) const
|
||||
\overload
|
||||
\since 5.2
|
||||
|
||||
@ -329,6 +329,9 @@ bool QCollator::ignorePunctuation() const
|
||||
|
||||
Returns an integer less than, equal to, or greater than zero depending on
|
||||
whether \a s1 sorts before, with or after \a s2.
|
||||
|
||||
\note In Qt versions prior to 6.4, the length arguments were of type
|
||||
\c{int}, not \c{qsizetype}.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -67,8 +67,12 @@ public:
|
||||
|
||||
int compare(const QString &s1, const QString &s2) const
|
||||
{ return compare(QStringView(s1), QStringView(s2)); }
|
||||
#if QT_CORE_REMOVED_SINCE(6, 4) && QT_POINTER_SIZE != 4
|
||||
int compare(const QChar *s1, int len1, const QChar *s2, int len2) const
|
||||
{ return compare(QStringView(s1, len1), QStringView(s2, len2)); }
|
||||
#endif
|
||||
int compare(const QChar *s1, qsizetype len1, const QChar *s2, qsizetype len2) const
|
||||
{ return compare(QStringView(s1, len1), QStringView(s2, len2)); }
|
||||
|
||||
bool operator()(const QString &s1, const QString &s2) const
|
||||
{ return compare(s1, s2) < 0; }
|
||||
|
Loading…
Reference in New Issue
Block a user