diff --git a/share/qtcreator/qtcdebugger/main.cpp b/share/qtcreator/qtcdebugger/main.cpp index ec4b5c71ed3b5034cbac9bca4181ea333998a860..2f1e648647a65bef04566dba1dcbf341bfbc5d01 100644 --- a/share/qtcreator/qtcdebugger/main.cpp +++ b/share/qtcreator/qtcdebugger/main.cpp @@ -61,11 +61,9 @@ static const WCHAR *debuggerRegistryDefaultValueNameC = L"Debugger.Default"; static const char *linkC = "http://msdn.microsoft.com/en-us/library/cc266343.aspx"; +static inline QString wCharToQString(const WCHAR *w) { return QString::fromUtf16(reinterpret_cast<const ushort *>(w)); } #ifdef __GNUC__ -static inline QString wCharToQString(const WCHAR *w) { return QString::fromUtf16(reinterpret_cast<const ushort*>(w)); } #define RRF_RT_ANY 0x0000ffff // no type restriction -#else -static inline QString wCharToQString(const WCHAR *w) { return QString::fromUtf16(w); } #endif diff --git a/src/plugins/debugger/cdb/cdbassembler.cpp b/src/plugins/debugger/cdb/cdbassembler.cpp index c23b3b628aa0c751b9bfd92e2503c368d5bdce5c..f69417ed67a48ee446b5800eb400598366a31513 100644 --- a/src/plugins/debugger/cdb/cdbassembler.cpp +++ b/src/plugins/debugger/cdb/cdbassembler.cpp @@ -65,7 +65,7 @@ bool getRegisters(CIDebugControl *ctl, return false; } Register reg; - reg.name = QString::fromUtf16(wszBuf); + reg.name = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); registers->push_back(reg); } // get values diff --git a/src/plugins/debugger/cdb/cdbbreakpoint.cpp b/src/plugins/debugger/cdb/cdbbreakpoint.cpp index 4418fad1e204d63d7f78dbb36c7a4f3dcd8da0cc..3c5491c307661198f59c637d754bdfd36a3f0e4e 100644 --- a/src/plugins/debugger/cdb/cdbbreakpoint.cpp +++ b/src/plugins/debugger/cdb/cdbbreakpoint.cpp @@ -156,7 +156,7 @@ bool CDBBreakPoint::apply(CIDebugBreakpoint *ibp, QString *errorMessage) const const QString expr = expression(); if (debugCDB) qDebug() << Q_FUNC_INFO << *this << expr; - const HRESULT hr = ibp->SetOffsetExpressionWide(expr.utf16()); + const HRESULT hr = ibp->SetOffsetExpressionWide(reinterpret_cast<PCWSTR>(expr.utf16())); if (FAILED(hr)) { *errorMessage = QString::fromLatin1("Unable to set breakpoint '%1' : %2"). arg(expr, msgComFailed("SetOffsetExpressionWide", hr)); @@ -238,7 +238,7 @@ bool CDBBreakPoint::retrieve(CIDebugBreakpoint *ibp, QString *errorMessage) ibp->GetFlags(&flags); oneShot = (flags & DEBUG_BREAKPOINT_ONE_SHOT); enabled = (flags & DEBUG_BREAKPOINT_ENABLED); - const QString expr = QString::fromUtf16(wszBuf); + const QString expr = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); if (!parseExpression(expr)) { *errorMessage = QString::fromLatin1("Parsing of '%1' failed.").arg(expr); return false; diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index c6ae43bacff96749c64ef09b33a232ce573cc3e6..20f93aff20b1545c7fde25786439e47767eb7708 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp @@ -618,7 +618,7 @@ bool CdbDebugEngine::startDebuggerWithExecutable(DebuggerStartMode sm, QString * qDebug() << Q_FUNC_INFO <<filename; const QFileInfo fi(filename); - m_d->m_cif.debugSymbols->AppendImagePathWide(QDir::toNativeSeparators(fi.absolutePath()).utf16()); + m_d->m_cif.debugSymbols->AppendImagePathWide(reinterpret_cast<PCWSTR>(QDir::toNativeSeparators(fi.absolutePath()).utf16())); //m_cif.debugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); m_d->m_cif.debugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); //m_cif.debugSymbols->AddSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS | SYMOPT_NO_IMAGE_SEARCH); @@ -634,10 +634,10 @@ bool CdbDebugEngine::startDebuggerWithExecutable(DebuggerStartMode sm, QString * env = reinterpret_cast<PCWSTR>(envData.data()); } const HRESULT hr = m_d->m_cif.debugClient->CreateProcess2Wide(NULL, - const_cast<PWSTR>(cmd.utf16()), + reinterpret_cast<PWSTR>(const_cast<ushort *>(cmd.utf16())), &dbgopts, sizeof(dbgopts), - sp->workingDir.utf16(), + reinterpret_cast<PCWSTR>(sp->workingDir.utf16()), env); if (FAILED(hr)) { *errorMessage = tr("Unable to create a process '%1': %2").arg(cmd, msgDebugEngineComResult(hr)); @@ -1149,7 +1149,7 @@ void CdbDebugEngine::executeDebuggerCommand(const QString &command) bool CdbDebugEnginePrivate::executeDebuggerCommand(CIDebugControl *ctrl, const QString &command, QString *errorMessage) { // output to all clients, else we do not see anything - const HRESULT hr = ctrl->ExecuteWide(DEBUG_OUTCTL_ALL_CLIENTS, command.utf16(), 0); + const HRESULT hr = ctrl->ExecuteWide(DEBUG_OUTCTL_ALL_CLIENTS, reinterpret_cast<PCWSTR>(command.utf16()), 0); if (debugCDB) qDebug() << "executeDebuggerCommand" << command << SUCCEEDED(hr); if (FAILED(hr)) { @@ -1184,7 +1184,7 @@ bool CdbDebugEnginePrivate::evaluateExpression(CIDebugControl *ctrl, // Original syntax must be restored, else setting breakpoints will fail. SyntaxSetter syntaxSetter(ctrl, DEBUG_EXPR_CPLUSPLUS); ULONG errorPosition = 0; - const HRESULT hr = ctrl->EvaluateWide(expression.utf16(), + const HRESULT hr = ctrl->EvaluateWide(reinterpret_cast<PCWSTR>(expression.utf16()), DEBUG_VALUE_INVALID, debugValue, &errorPosition); if (FAILED(hr)) { @@ -1616,7 +1616,7 @@ QStringList CdbDebugEnginePrivate::sourcePaths() const { WCHAR wszBuf[MAX_PATH]; if (SUCCEEDED(m_cif.debugSymbols->GetSourcePathWide(wszBuf, MAX_PATH, 0))) - return QString::fromUtf16(wszBuf).split(QLatin1Char(';')); + return QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)).split(QLatin1Char(';')); return QStringList(); } @@ -1637,7 +1637,7 @@ static inline QString pathString(const QStringList &s) bool CdbDebugEnginePrivate::setSourcePaths(const QStringList &s, QString *errorMessage) { - const HRESULT hr = m_cif.debugSymbols->SetSourcePathWide(pathString(s).utf16()); + const HRESULT hr = m_cif.debugSymbols->SetSourcePathWide(reinterpret_cast<PCWSTR>(pathString(s).utf16())); if (FAILED(hr)) { if (errorMessage) *errorMessage = msgComFailed("SetSourcePathWide", hr); @@ -1650,13 +1650,13 @@ QStringList CdbDebugEnginePrivate::symbolPaths() const { WCHAR wszBuf[MAX_PATH]; if (SUCCEEDED(m_cif.debugSymbols->GetSymbolPathWide(wszBuf, MAX_PATH, 0))) - return QString::fromUtf16(wszBuf).split(QLatin1Char(';')); + return QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)).split(QLatin1Char(';')); return QStringList(); } bool CdbDebugEnginePrivate::setSymbolPaths(const QStringList &s, QString *errorMessage) { - const HRESULT hr = m_cif.debugSymbols->SetSymbolPathWide(pathString(s).utf16()); + const HRESULT hr = m_cif.debugSymbols->SetSymbolPathWide(reinterpret_cast<PCWSTR>(pathString(s).utf16())); if (FAILED(hr)) { if (errorMessage) *errorMessage = msgComFailed("SetSymbolPathWide", hr); diff --git a/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp b/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp index 68a62bf33cb1f064265e656505e791631824601f..41954b4739be219ebc45b0625bd831168eadcb9a 100644 --- a/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp +++ b/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp @@ -342,7 +342,7 @@ STDMETHODIMP CdbDebugEventCallback::LoadModule( Q_UNUSED(TimeDateStamp) if (debugCDB > 1) qDebug() << Q_FUNC_INFO << ModuleName; - m_pEngine->m_d->handleModuleLoad(QString::fromUtf16(ModuleName)); + m_pEngine->m_d->handleModuleLoad(QString::fromUtf16(reinterpret_cast<const ushort *>(ModuleName))); return S_OK; } diff --git a/src/plugins/debugger/cdb/cdbdebugoutput.cpp b/src/plugins/debugger/cdb/cdbdebugoutput.cpp index 020812b7e0b851c390eaf20314d7dee9f9b1ea73..e9c2dbe4b29ea9b8784d480ec56a1dbfb75cc109 100644 --- a/src/plugins/debugger/cdb/cdbdebugoutput.cpp +++ b/src/plugins/debugger/cdb/cdbdebugoutput.cpp @@ -80,7 +80,7 @@ STDMETHODIMP CdbDebugOutputBase::Output( IN PCWSTR text ) { - const QString msg = QString::fromUtf16(text); + const QString msg = QString::fromUtf16(reinterpret_cast<const ushort *>(text)); output(mask, msg.trimmed()); return S_OK; } diff --git a/src/plugins/debugger/cdb/cdbdumperhelper.cpp b/src/plugins/debugger/cdb/cdbdumperhelper.cpp index 51031cf0d3093271962ee615eaf96dccba030609..e74342d4207bc2e325d8306950bc6b05f1cf478f 100644 --- a/src/plugins/debugger/cdb/cdbdumperhelper.cpp +++ b/src/plugins/debugger/cdb/cdbdumperhelper.cpp @@ -384,7 +384,7 @@ static inline bool getSymbolAddress(CIDebugSymbols *sg, QString *errorMessage) { // Get address - HRESULT hr = sg->GetOffsetByNameWide(name.utf16(), address); + HRESULT hr = sg->GetOffsetByNameWide(reinterpret_cast<PCWSTR>(name.utf16()), address); if (FAILED(hr)) { *errorMessage = msgComFailed("GetOffsetByNameWide", hr); return false; diff --git a/src/plugins/debugger/cdb/cdbmodules.cpp b/src/plugins/debugger/cdb/cdbmodules.cpp index 8aef06ae03f4066740714946febe3cda867dc819..cb9cca83a5ad18858efd8f1db0159406148bab94 100644 --- a/src/plugins/debugger/cdb/cdbmodules.cpp +++ b/src/plugins/debugger/cdb/cdbmodules.cpp @@ -59,7 +59,7 @@ bool getModuleNameList(CIDebugSymbols *syms, QStringList *modules, QString *erro WCHAR wszBuf[MAX_PATH]; for (ULONG m = 0; m < count; m++) if (SUCCEEDED(syms->GetModuleNameStringWide(DEBUG_MODNAME_IMAGE, m, 0, wszBuf, MAX_PATH - 1, 0))) - modules->push_back(QString::fromUtf16(wszBuf)); + modules->push_back(QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf))); return true; } @@ -94,7 +94,7 @@ bool getModuleList(CIDebugSymbols *syms, QList<Module> *modules, QString *errorM *errorMessage= msgComFailed("GetModuleNameStringWide", hr); return false; } - module.moduleName = QString::fromUtf16(wszBuf); + module.moduleName = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); modules->push_back(module); } } @@ -109,7 +109,7 @@ bool searchSymbols(CIDebugSymbols *syms, const QString &pattern, ULONG64 handle = 0; // E_NOINTERFACE means "no match". Apparently, it does not always // set handle. - HRESULT hr = syms->StartSymbolMatchWide(pattern.utf16(), &handle); + HRESULT hr = syms->StartSymbolMatchWide(reinterpret_cast<PCWSTR>(pattern.utf16()), &handle); if (hr == E_NOINTERFACE) { if (handle) syms->EndSymbolMatch(handle); @@ -125,7 +125,7 @@ bool searchSymbols(CIDebugSymbols *syms, const QString &pattern, if (hr == E_NOINTERFACE) break; if (hr == S_OK) - matches->push_back(QString::fromUtf16(wszBuf)); + matches->push_back(QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf))); } syms->EndSymbolMatch(handle); if (matches->empty()) @@ -217,7 +217,7 @@ bool getModuleSymbols(CIDebugSymbols *syms, const QString &moduleName, Symbol symbol; symbol.name = name; ULONG64 offset = 0; - if (SUCCEEDED(syms->GetOffsetByNameWide(name.utf16(), &offset))) + if (SUCCEEDED(syms->GetOffsetByNameWide(reinterpret_cast<PCWSTR>(name.utf16()), &offset))) symbol.address = hexPrefix + QString::number(offset, 16); symbols->push_back(symbol); } diff --git a/src/plugins/debugger/cdb/cdbstacktracecontext.cpp b/src/plugins/debugger/cdb/cdbstacktracecontext.cpp index 8b842639346563faa7402db1a083f2d0983d6a05..1b3afc60741b0388bf61b1cce111f1b3fd036745 100644 --- a/src/plugins/debugger/cdb/cdbstacktracecontext.cpp +++ b/src/plugins/debugger/cdb/cdbstacktracecontext.cpp @@ -102,7 +102,7 @@ bool CdbStackTraceContext::init(unsigned long frameCount, QString * /*errorMessa frame.address = QString::fromLatin1("0x%1").arg(instructionOffset, 0, 16); m_cif->debugSymbols->GetNameByOffsetWide(instructionOffset, wszBuf, MAX_PATH, 0, 0); - frame.function = QString::fromUtf16(wszBuf); + frame.function = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); ULONG ulLine; ULONG64 ul64Displacement; @@ -111,7 +111,7 @@ bool CdbStackTraceContext::init(unsigned long frameCount, QString * /*errorMessa frame.line = ulLine; // Vitally important to use canonical file that matches editormanager, // else the marker will not show. - frame.file = CDBBreakPoint::canonicalSourceFile(QString::fromUtf16(wszBuf)); + frame.file = CDBBreakPoint::canonicalSourceFile(QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf))); } m_frames.push_back(frame); } diff --git a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp index 2fa25c1c12e9fb1e26b80c9ab42a91f2a670f9a9..06fe24fe5a754b2067c43ec65d08c69e0b2c0730 100644 --- a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp +++ b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp @@ -91,7 +91,7 @@ static inline QString getSymbolString(IDebugSymbolGroup2 *sg, const HRESULT hr = (sg->*wsf)(index, nameBuffer, MAX_PATH, &nameLength); if (SUCCEEDED(hr)) { nameBuffer[nameLength] = 0; - return QString::fromUtf16(nameBuffer); + return QString::fromUtf16(reinterpret_cast<const ushort *>(nameBuffer)); } return QString(); } @@ -411,7 +411,7 @@ bool CdbSymbolGroupContext::assignValue(const QString &iname, const QString &val return false; } const unsigned long index = it.value(); - const HRESULT hr = m_symbolGroup->WriteSymbolWide(index, value.utf16()); + const HRESULT hr = m_symbolGroup->WriteSymbolWide(index, reinterpret_cast<PCWSTR>(value.utf16())); if (FAILED(hr)) { *errorMessage = QString::fromLatin1("Unable to assign '%1' to '%2': %3"). arg(value, iname, msgComFailed("WriteSymbolWide", hr));