Fix Windows build
authorIgor Kulaychuk <igor.kulaychuk@gmail.com>
Wed, 10 Oct 2018 21:17:03 +0000 (00:17 +0300)
committerPetr Bred/AI Ecosystem Lab /SRR/Staff Engineer/삼성전자 <p.bred@samsung.com>
Sun, 14 Oct 2018 07:04:19 +0000 (10:04 +0300)
src/debug/netcoredbg/miprotocol.cpp
src/debug/netcoredbg/symbolreader.cpp

index 6243f2f1805b0a7299c5b12971d7454ddb03b5b5..f2a2ef89b5b36fdc809ad68cfc5a5d1e251e9dfd 100644 (file)
@@ -461,8 +461,6 @@ HRESULT MIProtocol::SetBreakpoint(
 
 HRESULT MIProtocol::SetBreakpointCondition(uint32_t id, const std::string &condition)
 {
-    HRESULT Status;
-
     // For each file
     for (auto &breakpointsIter : m_breakpoints)
     {
@@ -685,8 +683,6 @@ HRESULT MIProtocol::HandleCommand(std::string command,
         return S_OK;
     } },
     { "break-condition", [this](const std::vector<std::string> &args, std::string &output) -> HRESULT {
-        HRESULT Status;
-
         if (args.size() < 2)
         {
             output = "Command requires at least 2 arguments";
index f306d51901eca801b6c0b2d5188a3af490c3f453..d327d64081d9f021fe6b0b17bc46553628d6a3c6 100644 (file)
@@ -432,8 +432,6 @@ HRESULT SymbolReader::ParseExpression(
     std::string &data,
     std::string &errorText)
 {
-    HRESULT Status;
-
     PrepareSymbolReader();
 
     if (parseExpressionDelegate == nullptr)
@@ -466,8 +464,6 @@ HRESULT SymbolReader::ParseExpression(
 
 HRESULT SymbolReader::EvalExpression(const std::string &expr, std::string &result, int *typeId, ICorDebugValue **ppValue, GetChildCallback cb)
 {
-    HRESULT Status;
-
     PrepareSymbolReader();
 
     if (evalExpressionDelegate == nullptr)
@@ -527,7 +523,9 @@ PVOID SymbolReader::AllocString(const std::string &str)
     if (sysAllocStringLen == nullptr)
         return nullptr;
     auto wstr = to_utf16(str);
-    BSTR bstr = sysAllocStringLen(0, wstr.size());
+    if (wstr.size() > UINT_MAX)
+        return nullptr;
+    BSTR bstr = sysAllocStringLen(0, (UINT)wstr.size());
     if (sysStringLen(bstr) == 0)
         return nullptr;
     memmove(bstr, wstr.data(), wstr.size() * sizeof(decltype(wstr[0])));