From 31350a2c2b7308a87c1ca2239a67e93261f56cc8 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Wed, 22 Aug 2018 18:02:20 +0300 Subject: [PATCH] Fix type casts --- src/debug/netcoredbg/expr.cpp | 6 +++--- src/debug/netcoredbg/main.cpp | 2 +- src/debug/netcoredbg/manageddebugger.cpp | 5 +++-- src/debug/netcoredbg/modules.cpp | 2 +- src/debug/netcoredbg/symbolreader.cpp | 2 +- src/debug/netcoredbg/symbolreader.h | 2 +- src/debug/netcoredbg/valuewalk.cpp | 8 ++++---- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/debug/netcoredbg/expr.cpp b/src/debug/netcoredbg/expr.cpp index 4788544..a8579d0 100644 --- a/src/debug/netcoredbg/expr.cpp +++ b/src/debug/netcoredbg/expr.cpp @@ -82,7 +82,7 @@ HRESULT Evaluator::GetFieldOrPropertyWithName(ICorDebugThread *pThread, return E_FAIL; ToRelease pArrayElement; - return pArrayVal->GetElement(indices.size(), indices.data(), ppResultValue); + return pArrayVal->GetElement(static_cast(indices.size()), indices.data(), ppResultValue); } IfFailRet(WalkMembers(pInputValue, pThread, pILFrame, [&]( @@ -130,7 +130,7 @@ HRESULT Evaluator::GetFieldOrPropertyWithName(ICorDebugThread *pThread, static mdTypeDef GetTypeTokenForName(IMetaDataImport *pMD, mdTypeDef tkEnclosingClass, const std::string &name) { mdTypeDef typeToken = mdTypeDefNil; - pMD->FindTypeDefByName(to_utf16(name).c_str(), tkEnclosingClass, &typeToken); + pMD->FindTypeDefByName(reinterpret_cast(to_utf16(name).c_str()), tkEnclosingClass, &typeToken); return typeToken; } @@ -569,7 +569,7 @@ HRESULT Evaluator::FindType( CorElementType et = isValueType ? ELEMENT_TYPE_VALUETYPE : ELEMENT_TYPE_CLASS; ToRelease pType; - IfFailRet(pClass2->GetParameterizedType(et, types.size(), (ICorDebugType **)types.data(), &pType)); + IfFailRet(pClass2->GetParameterizedType(et, static_cast(types.size()), (ICorDebugType **)types.data(), &pType)); *ppType = pType.Detach(); if (ppModule) diff --git a/src/debug/netcoredbg/main.cpp b/src/debug/netcoredbg/main.cpp index 968402c..dbfe063 100644 --- a/src/debug/netcoredbg/main.cpp +++ b/src/debug/netcoredbg/main.cpp @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) else if (strstr(argv[i], "--server=") == argv[i]) { char *err; - serverPort = strtoul(argv[i] + strlen("--server="), &err, 10); + serverPort = static_cast(strtoul(argv[i] + strlen("--server="), &err, 10)); if (*err != 0) { fprintf(stderr, "Error: Missing process id\n"); diff --git a/src/debug/netcoredbg/manageddebugger.cpp b/src/debug/netcoredbg/manageddebugger.cpp index f72234b..757fdfc 100644 --- a/src/debug/netcoredbg/manageddebugger.cpp +++ b/src/debug/netcoredbg/manageddebugger.cpp @@ -1101,7 +1101,8 @@ HRESULT ManagedDebugger::RunProcess(std::string fileExec, std::vector(to_utf16(ss.str()).c_str()), + + IfFailRet(g_dbgshim.CreateProcessForLaunch(reinterpret_cast(const_cast(to_utf16(ss.str()).c_str())), /* Suspend process */ TRUE, /* Current environment */ NULL, /* Current working directory */ NULL, @@ -1216,7 +1217,7 @@ HRESULT ManagedDebugger::AttachToProcess(DWORD pid) DWORD dwLength; IfFailRet(g_dbgshim.CreateVersionStringFromModule( pid, - to_utf16(m_clrPath).c_str(), + reinterpret_cast(to_utf16(m_clrPath).c_str()), pBuffer, _countof(pBuffer), &dwLength)); diff --git a/src/debug/netcoredbg/modules.cpp b/src/debug/netcoredbg/modules.cpp index dcf3eae..d920357 100644 --- a/src/debug/netcoredbg/modules.cpp +++ b/src/debug/netcoredbg/modules.cpp @@ -171,7 +171,7 @@ HRESULT Modules::GetFrameILAndSequencePoint( for (auto &p : points) { - if (p.offset < ilOffset) + if (p.offset < static_cast(ilOffset)) { nearestPoint = p; continue; diff --git a/src/debug/netcoredbg/symbolreader.cpp b/src/debug/netcoredbg/symbolreader.cpp index 9359ba5..1776a23 100644 --- a/src/debug/netcoredbg/symbolreader.cpp +++ b/src/debug/netcoredbg/symbolreader.cpp @@ -302,7 +302,7 @@ HRESULT SymbolReader::GetLineByILOffset( return E_FAIL; } -HRESULT SymbolReader::GetStepRangesFromIP(ULONG64 ip, mdMethodDef MethodToken, ULONG32 *ilStartOffset, ULONG32 *ilEndOffset) +HRESULT SymbolReader::GetStepRangesFromIP(ULONG32 ip, mdMethodDef MethodToken, ULONG32 *ilStartOffset, ULONG32 *ilEndOffset) { HRESULT Status = S_OK; diff --git a/src/debug/netcoredbg/symbolreader.h b/src/debug/netcoredbg/symbolreader.h index 9bc98c9..d401937 100644 --- a/src/debug/netcoredbg/symbolreader.h +++ b/src/debug/netcoredbg/symbolreader.h @@ -95,6 +95,6 @@ public: HRESULT GetLineByILOffset(mdMethodDef MethodToken, ULONG64 IlOffset, ULONG *pLinenum, WCHAR* pwszFileName, ULONG cchFileName); HRESULT GetNamedLocalVariableAndScope(ICorDebugILFrame * pILFrame, mdMethodDef methodToken, ULONG localIndex, WCHAR* paramName, ULONG paramNameLen, ICorDebugValue **ppValue, ULONG32* pIlStart, ULONG32* pIlEnd); HRESULT ResolveSequencePoint(const char *filename, ULONG32 lineNumber, TADDR mod, mdMethodDef* pToken, ULONG32* pIlOffset); - HRESULT GetStepRangesFromIP(ULONG64 ip, mdMethodDef MethodToken, ULONG32 *ilStartOffset, ULONG32 *ilEndOffset); + HRESULT GetStepRangesFromIP(ULONG32 ip, mdMethodDef MethodToken, ULONG32 *ilStartOffset, ULONG32 *ilEndOffset); HRESULT GetSequencePoints(mdMethodDef methodToken, std::vector &points); }; diff --git a/src/debug/netcoredbg/valuewalk.cpp b/src/debug/netcoredbg/valuewalk.cpp index 84a7c65..5e3d6ee 100644 --- a/src/debug/netcoredbg/valuewalk.cpp +++ b/src/debug/netcoredbg/valuewalk.cpp @@ -130,7 +130,7 @@ HRESULT Evaluator::EvalFunction( IfFailRet(pEval2->CallParameterizedFunction( pFunc, - typeParams.size(), + static_cast(typeParams.size()), (ICorDebugType **)typeParams.data(), pArgValue ? 1 : 0, pArgValue ? &pArgValue : nullptr @@ -172,7 +172,7 @@ HRESULT Evaluator::EvalObjectNoConstructor( IfFailRet(pEval2->NewParameterizedObjectNoConstructor( pClass, - typeParams.size(), + static_cast(typeParams.size()), (ICorDebugType **)typeParams.data() )); @@ -290,7 +290,7 @@ HRESULT Evaluator::ObjectToString( IfFailRet(pEval2->CallParameterizedFunction( pFunc, - typeParams.size(), + static_cast(typeParams.size()), (ICorDebugType **)typeParams.data(), 1, &pValue @@ -320,7 +320,7 @@ HRESULT Evaluator::ObjectToString( static void IncIndicies(std::vector &ind, const std::vector &dims) { - int i = ind.size() - 1; + int i = static_cast(ind.size()) - 1; while (i >= 0) { -- 2.7.4