summaryrefslogtreecommitdiffstats
path: root/src/corelib/compat/removed_api.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-01-15 23:48:52 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-01-18 01:31:33 +0100
commit9ffcab65629539c0335c78d9896153d9c31f475e (patch)
tree5276bfbe28dc2dcb5db1eba15051adf370ebfc32 /src/corelib/compat/removed_api.cpp
parent1a440e557b0efa9758f7d41112f09016ad385bab (diff)
QVersionNumber: port fromString() to QAnyStringView
We can handle the UTF-8 case by reinterpreting it as Latin-1. This way, the suffixIndex stays valid as a return value. As a drive-by, optimize away toLatin1() calls by using a QVLA. We really need a better way of converting UTF-16 -> L1 than qt_to_latin1()... [ChangeLog][QtCore][QVersionNumber] fromString() now takes QAnyStringView (was: QString, QStringView, QLatin1String) and a qsizetype pointer (was: int pointer). Change-Id: I86abaadba2792658fbf93ccd1e0b86e3302c697c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/compat/removed_api.cpp')
-rw-r--r--src/corelib/compat/removed_api.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp
index 61d3842e64..5f59cf047a 100644
--- a/src/corelib/compat/removed_api.cpp
+++ b/src/corelib/compat/removed_api.cpp
@@ -114,38 +114,30 @@ QByteArray QtPrivate::QByteArrayList_join(const QByteArrayList *that, const char
}
#endif // QT_REMOVED_SINCE(6, 3)
+
#if QT_REMOVED_SINCE(6, 4)
#include "qversionnumber.h"
-# if QT_POINTER_SIZE != 4
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
QVersionNumber QVersionNumber::fromString(const QString &string, int *suffixIndex)
{
- qsizetype si;
- QVersionNumber r = fromString(QLatin1String(string.toLatin1()), &si);
- if (suffixIndex)
- *suffixIndex = si;
- return r;
+ return fromString(qToAnyStringViewIgnoringNull(string), suffixIndex);
}
QVersionNumber QVersionNumber::fromString(QStringView string, int *suffixIndex)
{
- qsizetype si;
- QVersionNumber r = fromString(QLatin1String(string.toLatin1()), &si);
- if (suffixIndex)
- *suffixIndex = si;
- return r;
+ return fromString(QAnyStringView{string}, suffixIndex);
}
QVersionNumber QVersionNumber::fromString(QLatin1String string, int *suffixIndex)
{
- qsizetype si;
- QVersionNumber r = fromString(string, &si);
- if (suffixIndex)
- *suffixIndex = si;
- return r;
+ return fromString(QAnyStringView{string}, suffixIndex);
}
-# endif // QT_POINTER_SIZE != 4
+
+QT_WARNING_POP
// #include <qotherheader.h>
// // implement removed functions from qotherheader.h