Use fromUtf8() instead of fromLatin1() for QT_RESTRICTED_CAST_FROM_ASCII

The change does not change legally observable behavior as the result
of using QT_RESTRICTED_CAST_FROM_ASCII is only defined for (a part of)
the 7-bit range where Latin1 and UTF-8 are the same.

This change does not intend to lift the 7-bit restriction on string
literals for which the use of QT_RESTRICTED_CAST_FROM_ASCII is
well-defined even though in practice it works now for any UTF-8,
which is the presumed encoding outside that range nowadays.

Change-Id: If9a4199235396a43f8f26d7591907b21120823ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
hjk 2017-03-20 17:25:46 +01:00
parent 8a3e8856e5
commit 5707528be0

View File

@ -677,7 +677,7 @@ public:
{}
template <int N>
inline QString &operator=(const char (&ch)[N])
{ return (*this = fromLatin1(ch, N - 1)); }
{ return (*this = fromUtf8(ch, N - 1)); }
#endif
#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
inline QT_ASCII_CAST_WARN QString(const char *ch)