Fix type casts
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Wed, 22 Aug 2018 15:02:20 +0000 (18:02 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Fri, 24 Aug 2018 15:36:22 +0000 (18:36 +0300)
src/debug/netcoredbg/expr.cpp
src/debug/netcoredbg/main.cpp
src/debug/netcoredbg/manageddebugger.cpp
src/debug/netcoredbg/modules.cpp
src/debug/netcoredbg/symbolreader.cpp
src/debug/netcoredbg/symbolreader.h
src/debug/netcoredbg/valuewalk.cpp

index 4788544..a8579d0 100644 (file)
@@ -82,7 +82,7 @@ HRESULT Evaluator::GetFieldOrPropertyWithName(ICorDebugThread *pThread,
             return E_FAIL;
 
         ToRelease<ICorDebugValue> pArrayElement;
-        return pArrayVal->GetElement(indices.size(), indices.data(), ppResultValue);
+        return pArrayVal->GetElement(static_cast<uint32_t>(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<LPCWSTR>(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<ICorDebugType> pType;
-    IfFailRet(pClass2->GetParameterizedType(et, types.size(), (ICorDebugType **)types.data(), &pType));
+    IfFailRet(pClass2->GetParameterizedType(et, static_cast<uint32_t>(types.size()), (ICorDebugType **)types.data(), &pType));
 
     *ppType = pType.Detach();
     if (ppModule)
index 968402c..dbfe063 100644 (file)
@@ -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<uint16_t>(strtoul(argv[i] + strlen("--server="), &err, 10));
             if (*err != 0)
             {
                 fprintf(stderr, "Error: Missing process id\n");
index f72234b..757fdfc 100644 (file)
@@ -1101,7 +1101,8 @@ HRESULT ManagedDebugger::RunProcess(std::string fileExec, std::vector<std::strin
     m_clrPath.clear();
 
     HANDLE resumeHandle; // Fake thread handle for the process resume
-    IfFailRet(g_dbgshim.CreateProcessForLaunch(const_cast<LPWSTR>(to_utf16(ss.str()).c_str()),
+
+    IfFailRet(g_dbgshim.CreateProcessForLaunch(reinterpret_cast<LPWSTR>(const_cast<WCHAR*>(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<LPCWSTR>(to_utf16(m_clrPath).c_str()),
         pBuffer,
         _countof(pBuffer),
         &dwLength));
index dcf3eae..d920357 100644 (file)
@@ -171,7 +171,7 @@ HRESULT Modules::GetFrameILAndSequencePoint(
 
     for (auto &p : points)
     {
-        if (p.offset < ilOffset)
+        if (p.offset < static_cast<int32_t>(ilOffset))
         {
             nearestPoint = p;
             continue;
index 9359ba5..1776a23 100644 (file)
@@ -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;
 
index 9bc98c9..d401937 100644 (file)
@@ -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<SequencePoint> &points);
 };
index 84a7c65..5e3d6ee 100644 (file)
@@ -130,7 +130,7 @@ HRESULT Evaluator::EvalFunction(
 
     IfFailRet(pEval2->CallParameterizedFunction(
         pFunc,
-        typeParams.size(),
+        static_cast<uint32_t>(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<uint32_t>(typeParams.size()),
         (ICorDebugType **)typeParams.data()
     ));
 
@@ -290,7 +290,7 @@ HRESULT Evaluator::ObjectToString(
 
     IfFailRet(pEval2->CallParameterizedFunction(
         pFunc,
-        typeParams.size(),
+        static_cast<uint32_t>(typeParams.size()),
         (ICorDebugType **)typeParams.data(),
         1,
         &pValue
@@ -320,7 +320,7 @@ HRESULT Evaluator::ObjectToString(
 
 static void IncIndicies(std::vector<ULONG32> &ind, const std::vector<ULONG32> &dims)
 {
-    int i = ind.size() - 1;
+    int i = static_cast<int32_t>(ind.size()) - 1;
 
     while (i >= 0)
     {