RegistryAccess: Fix deprecation warning

warning C4996: 'QString::fromUtf16': Use char16_t* overload.

Change-Id: I44d2dcb50bf45dc175230fb93e2b704a6b52e5b7
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Alessandro Portale
2021-06-10 13:15:31 +02:00
parent fc85c52b99
commit 961d0a4da6
2 changed files with 3 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ namespace RegistryAccess {
static QString winErrorMessage(unsigned long error)
{
QString rc = QString::fromLatin1("#%1: ").arg(error);
ushort *lpMsgBuf;
char16_t *lpMsgBuf;
const int len = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
@@ -90,7 +90,7 @@ bool registryReadStringKey(HKEY handle, // HKEY_LOCAL_MACHINE, etc.
return false;
data += '\0';
data += '\0';
*s = QString::fromUtf16(reinterpret_cast<const unsigned short*>(data.data()));
*s = QString::fromUtf16(reinterpret_cast<const char16_t *>(data.data()));
return true;
}

View File

@@ -49,7 +49,7 @@ static const WCHAR *autoRegistryValueNameC = L"Auto";
static inline QString wCharToQString(const WCHAR *w)
{
return QString::fromUtf16(reinterpret_cast<const ushort *>(w));
return QString::fromUtf16(reinterpret_cast<const char16_t *>(w));
}
QString msgFunctionFailed(const char *f, unsigned long error);