From a9cf11c57fcc05fc071636b4f4d6b14e157657f8 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Tue, 13 Jul 2010 14:58:53 +0200
Subject: [PATCH] MSVC: Fix compilation with new mkspecs.

See Qt Merge-request: 727, change a9c8decc741d8c2b340f38d7a854ef206672ab3e,
which makes wchar_t a native type. QString::toUtf16() no longer is
a WCHAR.
---
 .../coreplugin/progressmanager/progressmanager_win.cpp    | 2 +-
 src/plugins/debugger/cdb/breakpoint.cpp                   | 8 ++++----
 src/plugins/debugger/cdb/coreengine.cpp                   | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp b/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp
index 05fc9dacd47..882a642ba50 100644
--- a/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp
+++ b/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp
@@ -95,7 +95,7 @@ void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &
         font.setPointSize(font.pointSize()-2);
         p.setFont(font);
         p.drawText(QRect(QPoint(0,0), pix.size()), Qt::AlignHCenter|Qt::AlignCenter, text);
-        pITask->SetOverlayIcon(winId, pix.toWinHICON(), text.utf16());
+        pITask->SetOverlayIcon(winId, pix.toWinHICON(), (wchar_t*)text.utf16());
     }
 }
 
diff --git a/src/plugins/debugger/cdb/breakpoint.cpp b/src/plugins/debugger/cdb/breakpoint.cpp
index 469d39e5835..7e1fd4aad6c 100644
--- a/src/plugins/debugger/cdb/breakpoint.cpp
+++ b/src/plugins/debugger/cdb/breakpoint.cpp
@@ -237,9 +237,9 @@ static bool mapDeviceToDriveLetter(QString *s)
     for (const TCHAR *driveLetter = driveLetters; *driveLetter; driveLetter++) {
         szDrive[0] = *driveLetter; // Look up each device name
         if (QueryDosDevice(szDrive, driveName, MAX_PATH)) {
-            const QString deviceName = QString::fromUtf16(driveName);
+            const QString deviceName = QString::fromWCharArray(driveName);
             if (s->startsWith(deviceName)) {
-                s->replace(0, deviceName.size(), QString::fromUtf16(szDrive));
+                s->replace(0, deviceName.size(), QString::fromWCharArray(szDrive));
                 return true;
             }
         }
@@ -255,7 +255,7 @@ static bool mapDeviceToDriveLetter(QString *s)
 
 static inline QString normalizeFileNameCaseHelper(const QString &f)
 {
-    HANDLE hFile = CreateFile(f.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+    HANDLE hFile = CreateFile((const wchar_t*)f.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
     if(hFile == INVALID_HANDLE_VALUE)
         return f;
     // Get the file size. We need a non-empty file to map it.
@@ -285,7 +285,7 @@ static inline QString normalizeFileNameCaseHelper(const QString &f)
     pszFilename[0] = 0;
     // Get a file name of the form "/Device/HarddiskVolume1/file.cpp"
     if (GetMappedFileName (GetCurrentProcess(), pMem, pszFilename, MAX_PATH)) {
-        rc = QString::fromUtf16(pszFilename);
+        rc = QString::fromWCharArray(pszFilename);
         if (!mapDeviceToDriveLetter(&rc))
             rc.clear();
     }
diff --git a/src/plugins/debugger/cdb/coreengine.cpp b/src/plugins/debugger/cdb/coreengine.cpp
index 152e9de26d4..30aba9547ac 100644
--- a/src/plugins/debugger/cdb/coreengine.cpp
+++ b/src/plugins/debugger/cdb/coreengine.cpp
@@ -296,7 +296,7 @@ bool CoreEngine::init(const QString &dllEnginePath, QString *errorMessage)
         *errorMessage = msgComFailed("GetImagePathWide", hr);
         return false;
     }
-    m_baseImagePath = QString::fromUtf16(buf);
+    m_baseImagePath = QString::fromWCharArray(buf);
 
     hr = lib.debugCreate( __uuidof(IDebugRegisters2), reinterpret_cast<void**>(&m_cif.debugRegisters));
     if (FAILED(hr)) {
@@ -447,7 +447,7 @@ bool CoreEngine::startDebuggerWithExecutable(const QString &workingDirectory,
     PCWSTR workingDirC = 0;
     const QString workingDirN = workingDirectory.isEmpty() ? QString() : QDir::toNativeSeparators(workingDirectory);
     if (!workingDirN.isEmpty())
-        workingDirC = workingDirN.utf16();
+        workingDirC = (PCWSTR)workingDirN.utf16();
     hr = m_cif.debugClient->CreateProcess2Wide(NULL,
                                                reinterpret_cast<PWSTR>(const_cast<ushort *>(cmd.utf16())),
                                                &dbgopts, sizeof(dbgopts),
@@ -820,7 +820,7 @@ quint64 CoreEngine::getSourceLineAddress(const QString &file,
 {
     ULONG64 rc = 0;
     const HRESULT hr = m_cif.debugSymbols->GetOffsetByLineWide(line,
-                                                               const_cast<ushort*>(file.utf16()),
+                                                               (wchar_t*)(file.utf16()),
                                                                &rc);
     if (FAILED(hr)) {
         *errorMessage = QString::fromLatin1("Unable to determine address of %1:%2 : %3").
-- 
GitLab