Port QUtf8BaseTraits to qsizetype

It's unclear why the the char8_t overloads have int sizes. At the time
60aa0d0868 added these, the uchar
overloads were already using qsizetype.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103531
Change-Id: I8ed4c5462de29a7d48255e440e34bcd5114755fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Marc Mutz 2022-07-22 16:15:41 +02:00
parent 4ed2c92bf4
commit ab512adf12

View File

@ -44,7 +44,7 @@ struct QUtf8BaseTraits
static uchar peekByte(const uchar *ptr, qsizetype n = 0)
{ return ptr[n]; }
static uchar peekByte(const char8_t *ptr, int n = 0)
static uchar peekByte(const char8_t *ptr, qsizetype n = 0)
{ return ptr[n]; }
static qptrdiff availableBytes(const uchar *ptr, const uchar *end)
@ -56,7 +56,7 @@ struct QUtf8BaseTraits
static void advanceByte(const uchar *&ptr, qsizetype n = 1)
{ ptr += n; }
static void advanceByte(const char8_t *&ptr, int n = 1)
static void advanceByte(const char8_t *&ptr, qsizetype n = 1)
{ ptr += n; }
static void appendUtf16(char16_t *&ptr, char16_t uc)