summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-08-13 15:30:59 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-08-28 21:29:29 +0200
commit429985b53aeb930ec3fdd14ccb429992a3539629 (patch)
tree81d26bbfca1b2bc162cca08a8fc59cc5528ed195 /src/corelib/text
parent34a095848d946d11d367ff9fcbfc26b6b26c7507 (diff)
Convert QStringView::toWCharArray() to return qsizetype
As requested in a ### Qt6 comment. Task-number: QTBUG-85700 Change-Id: I28a02bf49f4a6455a21a6032179318ce2915b8ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text')
-rw-r--r--src/corelib/text/qstring.h6
-rw-r--r--src/corelib/text/qstringview.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index a8a1211ff5..04a333aefa 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -1079,14 +1079,14 @@ inline qsizetype QString::toWCharArray(wchar_t *array) const
return qToStringViewIgnoringNull(*this).toWCharArray(array);
}
-int QStringView::toWCharArray(wchar_t *array) const
+qsizetype QStringView::toWCharArray(wchar_t *array) const
{
if (sizeof(wchar_t) == sizeof(QChar)) {
if (auto src = data())
memcpy(array, src, sizeof(QChar) * size());
- return int(size()); // ### q6sizetype
+ return size();
} else {
- return QString::toUcs4_helper(reinterpret_cast<const ushort *>(data()), int(size()),
+ return QString::toUcs4_helper(reinterpret_cast<const ushort *>(data()), size(),
reinterpret_cast<uint *>(array));
}
}
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index a59a24f8a5..f88871ff5d 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -358,7 +358,7 @@ public:
Q_REQUIRED_RESULT Q_CORE_EXPORT float toFloat(bool *ok = nullptr) const;
Q_REQUIRED_RESULT Q_CORE_EXPORT double toDouble(bool *ok = nullptr) const;
- Q_REQUIRED_RESULT inline int toWCharArray(wchar_t *array) const; // defined in qstring.h
+ Q_REQUIRED_RESULT inline qsizetype toWCharArray(wchar_t *array) const; // defined in qstring.h
Q_REQUIRED_RESULT Q_CORE_EXPORT