Fix signed compare warnings
authorSinan Kaya <sinan.kaya@microsoft.com>
Thu, 7 Mar 2019 02:25:21 +0000 (02:25 +0000)
committerSinan Kaya <sinan.kaya@microsoft.com>
Thu, 7 Mar 2019 20:17:42 +0000 (20:17 +0000)
warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

conversions

Update src/ToolBox/superpmi/mcs/verbdumptoc.cpp

Co-Authored-By: franksinankaya <41809318+franksinankaya@users.noreply.github.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/5a97d8e9f14763a4ff90d14d045f0173e8d4b944

45 files changed:
src/coreclr/src/ToolBox/SOS/Strike/disasm.cpp
src/coreclr/src/ToolBox/SOS/Strike/strike.cpp
src/coreclr/src/ToolBox/SOS/Strike/util.cpp
src/coreclr/src/ToolBox/superpmi/mcs/verbdumptoc.cpp
src/coreclr/src/ToolBox/superpmi/superpmi-shared/compileresult.cpp
src/coreclr/src/ToolBox/superpmi/superpmi-shared/lightweightmap.h
src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
src/coreclr/src/ToolBox/superpmi/superpmi-shared/tocfile.cpp
src/coreclr/src/ToolBox/superpmi/superpmi/neardiffer.cpp
src/coreclr/src/classlibnative/bcltype/system.cpp
src/coreclr/src/debug/daccess/dacdbiimpl.cpp
src/coreclr/src/debug/daccess/nidump.cpp
src/coreclr/src/debug/daccess/request.cpp
src/coreclr/src/debug/di/module.cpp
src/coreclr/src/debug/di/rsclass.cpp
src/coreclr/src/debug/di/rstype.cpp
src/coreclr/src/debug/inc/dacdbistructures.h
src/coreclr/src/debug/inc/dacdbistructures.inl
src/coreclr/src/debug/shared/dbgtransportsession.cpp
src/coreclr/src/gc/gc.cpp
src/coreclr/src/gc/unix/gcenv.unix.cpp
src/coreclr/src/gcdump/gcdumpnonx86.cpp
src/coreclr/src/utilcode/util.cpp
src/coreclr/src/vm/amd64/profiler.cpp
src/coreclr/src/vm/argdestination.h
src/coreclr/src/vm/callhelpers.cpp
src/coreclr/src/vm/codeman.cpp
src/coreclr/src/vm/codeversion.cpp
src/coreclr/src/vm/codeversion.h
src/coreclr/src/vm/comdelegate.cpp
src/coreclr/src/vm/dllimport.cpp
src/coreclr/src/vm/exceptionhandling.cpp
src/coreclr/src/vm/genericdict.cpp
src/coreclr/src/vm/i386/stublinkerx86.cpp
src/coreclr/src/vm/jithelpers.cpp
src/coreclr/src/vm/jithost.cpp
src/coreclr/src/vm/jitinterface.cpp
src/coreclr/src/vm/methodtablebuilder.cpp
src/coreclr/src/vm/readytoruninfo.cpp
src/coreclr/src/vm/rejit.cpp
src/coreclr/src/vm/yieldprocessornormalized.cpp
src/coreclr/src/zap/zapcode.cpp
src/coreclr/src/zap/zapimage.cpp
src/coreclr/src/zap/zapimport.cpp
src/coreclr/src/zap/zapinfo.cpp

index f82c38a..ceb0fed 100644 (file)
@@ -530,7 +530,7 @@ INT_PTR ParseHexNumber (__in_z char *ptr, ___out char **endptr)
         endptr1 = endptr2;
     }
     // if the hex number was specified as 000006fbf9b70f50, an overflow occurred
-    else if (ULONG_MAX == value1 && errno == ERANGE)
+    else if ((INT_PTR)ULONG_MAX == value1 && errno == ERANGE)
     {
         if (!strncmp(ptr, "0x", 2))
             ptr += 2;
index f85957e..b25d340 100644 (file)
@@ -2157,7 +2157,7 @@ DECLARE_API(DumpDelegate)
                                     DacpObjectData objData;
                                     if (objData.Request(g_sos, invocationList) == S_OK &&
                                         objData.ObjectType == OBJ_ARRAY &&
-                                        invocationCount <= objData.dwNumComponents)
+                                        invocationCount <= (int)objData.dwNumComponents)
                                     {
                                         for (int i = 0; i < invocationCount; i++)
                                         {
@@ -2363,7 +2363,7 @@ Done:
 // Overload that mirrors the code above when the ExceptionObjectData was already retrieved from LS
 BOOL IsAsyncException(const DacpExceptionObjectData & excData)
 {
-    if (excData.XCode != EXCEPTION_COMPLUS)
+    if ((DWORD)excData.XCode != EXCEPTION_COMPLUS)
         return TRUE;
 
     HRESULT ehr = excData.HResult;
@@ -4605,7 +4605,7 @@ DECLARE_API(DumpAsync)
                             DacpObjectData objData;
                             if (objData.Request(g_sos, TO_CDADDR(listItemsPtr)) == S_OK && objData.ObjectType == OBJ_ARRAY)
                             {
-                                for (int i = 0; i < objData.dwNumComponents; i++)
+                                for (SIZE_T i = 0; i < objData.dwNumComponents; i++)
                                 {
                                     CLRDATA_ADDRESS elementPtr;
                                     MOVE(elementPtr, TO_CDADDR(objData.ArrayDataPtr + (i * objData.dwComponentSize)));
@@ -15544,7 +15544,7 @@ GetStackFrame(CONTEXT* context, ULONG numNativeFrames)
     if (FAILED(hr))
     {
         PDEBUG_STACK_FRAME frame = &g_Frames[0];
-        for (int i = 0; i < numNativeFrames; i++, frame++) {
+        for (unsigned int i = 0; i < numNativeFrames; i++, frame++) {
             if (frame->InstructionOffset == context->Rip)
             {
                 if ((i + 1) >= numNativeFrames) {
index 7098cc8..0a286d2 100644 (file)
@@ -1726,7 +1726,7 @@ int GetValueFieldOffset(CLRDATA_ADDRESS cdaMT, __in_z LPCWSTR wszFieldName, Dacp
     if (dmtd.ParentMethodTable)
     {
         DWORD retVal = GetValueFieldOffset(dmtd.ParentMethodTable, wszFieldName, pDacpFieldDescData);
-        if (retVal != NOT_FOUND)
+        if (retVal != (DWORD)NOT_FOUND)
         {
             // Return in case of error or success. Fall through for field-not-found.
             return retVal;
index f9cc69e..a236622 100644 (file)
@@ -20,7 +20,7 @@ int verbDumpToc::DoWork(const char* nameOfInput)
         const TOCElement* te = tf.GetElementPtr(i);
         printf("%4u: %016llX ", te->Number, te->Offset);
 
-        for (int j = 0; j < sizeof(te->Hash); j++)
+        for (size_t j = 0; j < sizeof(te->Hash); j++)
         {
             printf("%02x ", te->Hash[j]);
         }
index 70f54d2..251666a 100644 (file)
@@ -1043,7 +1043,7 @@ bool CompileResult::fndRecordCallSiteSigInfo(ULONG instrOffset, CORINFO_SIG_INFO
 
     Agnostic_RecordCallSite value = RecordCallSite->Get(instrOffset);
 
-    if (value.callSig.callConv == -1)
+    if (value.callSig.callConv == (DWORD)-1)
         return false;
 
     pCallSig->callConv               = (CorInfoCallConv)value.callSig.callConv;
index 3a42512..069287c 100644 (file)
@@ -345,7 +345,7 @@ public:
                 return false; // found it. return position /////
         }
         insert = first;
-        if (insert != first)
+        if (insert != (unsigned int)first)
         {
             LogDebug("index = %u f %u mid = %u l %u***************************", insert, first, mid, last);
             __debugbreak();
index 96ecb8d..a6b2844 100644 (file)
@@ -3547,7 +3547,7 @@ void MethodContext::recGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE* gcPtrs,
 void MethodContext::dmpGetClassGClayout(DWORDLONG key, const Agnostic_GetClassGClayout& value)
 {
     printf("GetClassGCLayout key %016llX, value len %u cnt %u {", key, value.len, value.valCount);
-    if (value.gcPtrs_Index != -1)
+    if (value.gcPtrs_Index != (DWORD)-1)
     {
         BYTE* ptr = (BYTE*)GetClassGClayout->GetBuffer(value.gcPtrs_Index);
         for (unsigned int i = 0; i < value.len; i++)
@@ -3572,7 +3572,7 @@ unsigned MethodContext::repGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE* gcPt
     unsigned int len   = (unsigned int)value.len;
     unsigned int index = (unsigned int)value.gcPtrs_Index;
 
-    if (index != -1)
+    if (index != (unsigned int)-1)
     {
         BYTE* ptr = (BYTE*)GetClassGClayout->GetBuffer(index);
         for (unsigned int i = 0; i < len; i++)
index f0979fc..1994a3b 100644 (file)
@@ -47,7 +47,7 @@ void TOCFile::LoadToc(const char* inputFileName, bool validate)
 
     // Get the last 4 byte token (more abuse of LARGE_INTEGER)
     if (!ReadFile(hIndex, &val.u.HighPart, sizeof(DWORD), &read, nullptr) || (read != sizeof(DWORD)) ||
-        (val.u.LowPart != val.u.HighPart))
+        (val.u.LowPart != (DWORD)val.u.HighPart))
     {
         CloseHandle(hIndex);
         this->Clear();
index aa1722e..bb0c67f 100644 (file)
@@ -330,7 +330,7 @@ bool NearDiffer::compareOffsets(
 
     // VSD calling case.
     size_t Offset1 = (ipRelOffset1 - 8);
-    if (data->cr->CallTargetTypes->GetIndex((DWORDLONG)Offset1) != (DWORD)-1)
+    if (data->cr->CallTargetTypes->GetIndex((DWORDLONG)Offset1) != -1)
     {
         // This logging is too noisy, so disable it.
         // LogVerbose("Found VSD callsite, did softer compare than ideal");
@@ -340,13 +340,13 @@ bool NearDiffer::compareOffsets(
     // x86 VSD calling cases.
     size_t Offset1b = (size_t)offset1 - 4;
     size_t Offset2b = (size_t)offset2;
-    if (data->cr->CallTargetTypes->GetIndex((DWORDLONG)Offset1b) != (DWORD)-1)
+    if (data->cr->CallTargetTypes->GetIndex((DWORDLONG)Offset1b) != -1)
     {
         // This logging is too noisy, so disable it.
         // LogVerbose("Found VSD callsite, did softer compare than ideal");
         return true;
     }
-    if (data->cr->CallTargetTypes->GetIndex((DWORDLONG)Offset2b) != (DWORD)-1)
+    if (data->cr->CallTargetTypes->GetIndex((DWORDLONG)Offset2b) != -1)
     {
         // This logging is too noisy, so disable it.
         // LogVerbose("Found VSD callsite, did softer compare than ideal");
@@ -368,7 +368,7 @@ bool NearDiffer::compareOffsets(
         return true;
 
     realTargetAddr = (size_t)data->cr->searchAddressMap((void*)(gOffset2));
-    if (realTargetAddr != -1) // we know this was passed out as a bbloc
+    if (realTargetAddr != (size_t)-1) // we know this was passed out as a bbloc
         return true;
 
     return false;
index 37c8b11..8f3b428 100644 (file)
@@ -346,7 +346,7 @@ INT32 QCALLTYPE SystemNative::GetProcessorCount()
 #ifdef FEATURE_PAL
     uint32_t cpuLimit;
 
-    if (PAL_GetCpuLimit(&cpuLimit) && cpuLimit < processorCount)
+    if (PAL_GetCpuLimit(&cpuLimit) && cpuLimit < (uint32_t)processorCount)
         processorCount = cpuLimit;
 #endif
 
index a008dc1..a68a50d 100644 (file)
@@ -1734,7 +1734,7 @@ void DacDbiInterfaceImpl::CollectFields(TypeHandle                   thExact,
                                           FALSE);  // don't fixup EnC (we can't, we're stopped)
 
     PTR_FieldDesc pCurrentFD;
-    int index = 0;
+    unsigned int index = 0;
     while (((pCurrentFD = fdIterator.Next()) != NULL) && (index < pFieldList->Count()))
     {
         // fill in the pCurrentEntry structure
@@ -3097,7 +3097,7 @@ TypeHandle DacDbiInterfaceImpl::GetExactFnPtrTypeHandle(ArgInfoList * pArgInfo)
 
     // convert the type information for each parameter to its corresponding type handle
     // and store it in the list
-    for (int i = 0; i < pArgInfo->Count(); i++)
+    for (unsigned int i = 0; i < pArgInfo->Count(); i++)
     {
         pInst[i] = BasicTypeInfoToTypeHandle(&((*pArgInfo)[i]));
     }
@@ -3316,7 +3316,7 @@ void DacDbiInterfaceImpl::GetTypeHandleParams(VMPTR_AppDomain  vmAppDomain,
     pParams->Alloc(typeHandle.GetNumGenericArgs());
     
     // collect type information for each type parameter
-    for (int i = 0; i < pParams->Count(); ++i)
+    for (unsigned int i = 0; i < pParams->Count(); ++i)
     {
         VMPTR_TypeHandle thInst = VMPTR_TypeHandle::NullPtr();
         thInst.SetDacTargetPtr(typeHandle.GetInstantiation()[i].AsTAddr());
@@ -3597,7 +3597,7 @@ void DacDbiInterfaceImpl::GetCachedWinRTTypesForIIDs(
     {
         pTypes->Alloc(iids.Count());
 
-        for (int i = 0; i < iids.Count(); ++i)
+        for (unsigned int i = 0; i < iids.Count(); ++i)
         {
             // There is the possiblity that we'll get this far with a dump and not fail, but still
             // not be able to get full info for a particular param.
index 37de104..d7d9041 100644 (file)
@@ -2462,7 +2462,7 @@ const NativeImageDumper::Dependency *NativeImageDumper::GetDependencyForFixup(RV
     {
         unsigned idx = DacSigUncompressData(sig);
 
-        _ASSERTE(idx >= 0 && idx < (int)m_numImports);
+        _ASSERTE(idx >= 0 && idx < m_numImports);
         return OpenImport(idx)->dependency;
     }
 
index 995cfca..167069a 100644 (file)
@@ -2854,7 +2854,7 @@ ClrDataAccess::GetGCHeapList(unsigned int count, CLRDATA_ADDRESS heaps[], unsign
 #if !defined(FEATURE_SVR_GC)
         _ASSERTE(0);
 #else // !defined(FEATURE_SVR_GC)
-        int heapCount = GCHeapCount();
+        unsigned int heapCount = GCHeapCount();
         if (pNeeded)
             *pNeeded = heapCount;
 
index 1263e71..5fb335e 100644 (file)
@@ -4460,7 +4460,7 @@ HRESULT CordbNativeCode::EnumerateVariableHomes(ICorDebugVariableHomeEnum **ppEn
         const DacDbiArrayList<ICorDebugInfo::NativeVarInfo> *pOffsetInfoList = m_nativeVarData.GetOffsetInfoList();
         _ASSERTE(pOffsetInfoList != NULL);
         DWORD countHomes = 0;
-        for (int i = 0; i < pOffsetInfoList->Count(); i++)
+        for (unsigned int i = 0; i < pOffsetInfoList->Count(); i++)
         {
             const ICorDebugInfo::NativeVarInfo *pNativeVarInfo = &((*pOffsetInfoList)[i]);
             _ASSERTE(pNativeVarInfo != NULL);
@@ -4477,7 +4477,7 @@ HRESULT CordbNativeCode::EnumerateVariableHomes(ICorDebugVariableHomeEnum **ppEn
         rsHomes = new RSSmartPtr<CordbVariableHome>[countHomes];
 
         DWORD varHomeInd = 0;
-        for (int i = 0; i < pOffsetInfoList->Count(); i++)
+        for (unsigned int i = 0; i < pOffsetInfoList->Count(); i++)
         {
             const ICorDebugInfo::NativeVarInfo *pNativeVarInfo = &((*pOffsetInfoList)[i]);
 
index bfd02c7..662e2c0 100644 (file)
@@ -808,7 +808,7 @@ void CordbClass::Init(ClassLoadLevel desiredLoadLevel)
 BOOL CordbClass::GotUnallocatedStatic(DacDbiArrayList<FieldData> * pFieldList)
 {
     BOOL fGotUnallocatedStatic = FALSE;
-    int count = 0;
+    unsigned int count = 0;
     while ((count < pFieldList->Count()) && !fGotUnallocatedStatic )
     {
         if ((*pFieldList)[count].OkToGetOrSetStaticAddress() &&
@@ -1145,7 +1145,7 @@ HRESULT CordbClass::SearchFieldInfo(
     FieldData **ppFieldData
 )
 {
-    int i;
+    unsigned int i;
 
     IMetaDataImport * pImport = pModule->GetMetaDataImporter(); // throws      
 
index f180982..a85ab0d 100644 (file)
@@ -1382,7 +1382,7 @@ HRESULT CordbType::InstantiateFromTypeHandle(CordbAppDomain * pAppDomain,
         // means it will simply assert IsNeutered.
         DacDbiArrayList<CordbType *> typeList;
         typeList.Alloc(params.Count());
-        for (int i = 0; i < params.Count(); ++i)
+        for (unsigned int i = 0; i < params.Count(); ++i)
         {
             IfFailThrow(TypeDataToType(pAppDomain, &(params[i]), &(typeList[i])));
         }
index fc894f3..285537d 100644 (file)
@@ -99,7 +99,7 @@ public:
 
 
     // returns the number of elements in the list
-    int Count() const;
+    unsigned int Count() const;
 
     // @dbgtodo  Mac - cleaner way to expose this for serialization?
     void PrepareForDeserialize()
index 58166c1..fe1ff98 100644 (file)
@@ -154,7 +154,7 @@ T & DacDbiArrayList<T>::operator [](int i)
 // get the number of elements in the list
 template<class T> 
 inline
-int DacDbiArrayList<T>::Count() const
+unsigned int DacDbiArrayList<T>::Count() const
 {
     return m_nEntries;
 }
@@ -392,7 +392,7 @@ inline
 void SequencePoints::CopyAndSortSequencePoints(const ICorDebugInfo::OffsetMapping  mapCopy[])
 {
     // copy information to pSeqPoint and set end offsets
-    int i;
+    unsigned int i;
 
     ULONG32 lastILOffset = 0;
 
@@ -405,7 +405,7 @@ void SequencePoints::CopyAndSortSequencePoints(const ICorDebugInfo::OffsetMappin
         if (i < m_map.Count() - 1)
         {
             // We need to not use CALL_INSTRUCTION's IL start offset.
-            int j = i + 1;
+            unsigned int j = i + 1;
             while ((mapCopy[j].source & call_inst) == call_inst && j < m_map.Count()-1)
                 j++;
             
index f42d259..e4dd78c 100644 (file)
@@ -836,7 +836,7 @@ bool DbgTransportSession::SendBlock(PBYTE pbBuffer, DWORD cbBuffer)
     if (DBG_TRANSPORT_SHOULD_INJECT_FAULT(Send))
         fSuccess = false;
     else
-        fSuccess = (m_pipe.Write(pbBuffer, cbBuffer) == cbBuffer);
+        fSuccess = ((DWORD)m_pipe.Write(pbBuffer, cbBuffer) == cbBuffer);
 
     if (!fSuccess)
     {
@@ -867,7 +867,7 @@ bool DbgTransportSession::ReceiveBlock(PBYTE pbBuffer, DWORD cbBuffer)
     if (DBG_TRANSPORT_SHOULD_INJECT_FAULT(Receive))
         fSuccess = false;
     else
-        fSuccess = (m_pipe.Read(pbBuffer, cbBuffer) == cbBuffer);
+        fSuccess = ((DWORD)m_pipe.Read(pbBuffer, cbBuffer) == cbBuffer);
 
     if (!fSuccess)
     {
index 95fe21c..316c0b6 100644 (file)
@@ -24385,7 +24385,7 @@ void gc_heap::relocate_shortened_survivor_helper (uint8_t* plug, uint8_t* plug_e
 
     while (x < plug_end)
     {
-        if (check_short_obj_p && ((plug_end - x) < min_pre_pin_obj_size))
+        if (check_short_obj_p && ((plug_end - x) < (DWORD)min_pre_pin_obj_size))
         {
             dprintf (3, ("last obj %Ix is short", x));
 
index 693cfa8..8148f6f 100644 (file)
@@ -485,7 +485,7 @@ bool GCToOSInterface::GetCurrentProcessAffinityMask(uintptr_t* processAffinityMa
     {
         uintptr_t processMask = 0;
 
-        for (int i = 0; i < g_logicalCpuCount; i++)
+        for (unsigned int i = 0; i < g_logicalCpuCount; i++)
         {
             if (CPU_ISSET(i, &cpuSet))
             {
@@ -536,7 +536,7 @@ uint32_t GCToOSInterface::GetCurrentProcessCpuCount()
 
     pmask &= smask;
 
-    int count = 0;
+    unsigned int count = 0;
     while (pmask)
     {
         pmask &= (pmask - 1);
index 83624c7..5707926 100644 (file)
@@ -213,7 +213,7 @@ BOOL StackSlotStateChangeCallback (
         if (pState->fAnythingPrinted)
             pState->pfnPrintf("\n");
 
-        if ((CodeOffset == -2) && !pState->fAnythingPrinted)
+        if ((CodeOffset == (UINT32)-2) && !pState->fAnythingPrinted)
             pState->pfnPrintf("Untracked:");
         else
             pState->pfnPrintf("%08x", CodeOffset);
index 9ebc401..acf041a 100644 (file)
@@ -1208,7 +1208,7 @@ int GetCurrentProcessCpuCount()
     if (cCPUs != 0)
         return cCPUs;
 
-    int count = 0;
+    unsigned int count = 0;
     DWORD_PTR pmask, smask;
 
     if (!GetProcessAffinityMask(GetCurrentProcess(), &pmask, &smask))
index d43df94..7dc1780 100644 (file)
@@ -248,7 +248,7 @@ LPVOID ProfileArgIterator::GetNextArgAddr()
     }
 
     // if we're here we have an enregistered argument
-    int regStructOfs = (argOffset - TransitionBlock::GetOffsetOfArgumentRegisters());
+    unsigned int regStructOfs = (argOffset - TransitionBlock::GetOffsetOfArgumentRegisters());
     _ASSERTE(regStructOfs < ARGUMENTREGISTERS_SIZE);
 
     CorElementType t = m_argIterator.GetArgType();
index 439761b..386ba57 100644 (file)
@@ -126,7 +126,7 @@ public:
         // This function is used rarely and so the overhead of reading the zeros from
         // the stack is negligible.
         long long zeros[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS] = {};
-        _ASSERTE(sizeof(zeros) >= fieldBytes);
+        _ASSERTE(sizeof(zeros) >= (size_t)fieldBytes);
 
         CopyStructToRegisters(zeros, fieldBytes, 0);
     }
index e194161..5124560 100644 (file)
@@ -408,7 +408,7 @@ void MethodDescCallSite::CallTargetWorker(const ARG_SLOT *pArguments, ARG_SLOT *
                 TypeHandle thReturnValueType;
                 if (m_methodSig.GetReturnTypeNormalized(&thReturnValueType) == ELEMENT_TYPE_VALUETYPE)
                 {
-                    _ASSERTE(cbReturnValue >= thReturnValueType.GetSize());
+                    _ASSERTE((DWORD)cbReturnValue >= thReturnValueType.GetSize());
                 }
             }
 #endif // UNIX_AMD64_ABI
@@ -611,7 +611,7 @@ void MethodDescCallSite::CallTargetWorker(const ARG_SLOT *pArguments, ARG_SLOT *
 
     if (pReturnValue != NULL)
     {
-        _ASSERTE(cbReturnValue <= sizeof(callDescrData.returnValue));
+        _ASSERTE((DWORD)cbReturnValue <= sizeof(callDescrData.returnValue));
         memcpyNoGCRefs(pReturnValue, &callDescrData.returnValue, cbReturnValue);
 
 #if !defined(_WIN64) && BIGENDIAN
index 97b6a38..4188658 100644 (file)
@@ -302,8 +302,8 @@ void UnwindInfoTable::AddToUnwindInfoTable(UnwindInfoTable** unwindInfoPtr, PT_R
     // We could imagine being much more efficient for 'bulk' updates, but we don't try
     // because we assume that this is rare and we want to keep the code simple
 
-    int usedSpace = unwindInfo->cTableCurCount - unwindInfo->cDeletedEntries;
-    int desiredSpace = usedSpace * 5 / 4 + 1;        // Increase by 20%
+    ULONG usedSpace = unwindInfo->cTableCurCount - unwindInfo->cDeletedEntries;
+    ULONG desiredSpace = usedSpace * 5 / 4 + 1;        // Increase by 20%
     // Be more aggresive if we used all of our space; 
     if (usedSpace == unwindInfo->cTableMaxCount)
         desiredSpace = usedSpace * 3 / 2 + 1;        // Increase by 50%
index 5286815..e5e8a75 100644 (file)
@@ -47,7 +47,7 @@ bool NativeCodeVersion::operator!=(const NativeCodeVersion & rhs) const { return
 // it is a bug. Corerror.xml has a comment in it reserving this value for our use but it doesn't
 // appear in the public headers.
 
-#define CORPROF_E_RUNTIME_SUSPEND_REQUIRED 0x80131381
+#define CORPROF_E_RUNTIME_SUSPEND_REQUIRED _HRESULT_TYPEDEF_(0x80131381L)
 
 #ifndef DACCESS_COMPILE
 NativeCodeVersionNode::NativeCodeVersionNode(
@@ -1308,7 +1308,7 @@ HRESULT MethodDescVersioningState::JumpStampNativeCode(PCODE pCode /* = NULL */)
     // revert.
     if (GetJumpStampState() == JumpStampNone)
     {
-        for (int i = 0; i < sizeof(m_rgSavedCode); i++)
+        for (unsigned int i = 0; i < sizeof(m_rgSavedCode); i++)
         {
             m_rgSavedCode[i] = *FirstCodeByteAddr(pbCode + i, DebuggerController::GetPatchTable()->GetPatch((CORDB_ADDRESS_TYPE *)(pbCode + i)));
         }
@@ -1413,7 +1413,7 @@ HRESULT MethodDescVersioningState::UpdateJumpTarget(BOOL fEESuspended, PCODE pRe
     // revert.
     if (GetJumpStampState() == JumpStampNone)
     {
-        for (int i = 0; i < sizeof(m_rgSavedCode); i++)
+        for (unsigned int i = 0; i < sizeof(m_rgSavedCode); i++)
         {
             m_rgSavedCode[i] = *FirstCodeByteAddr(pbCode + i, DebuggerController::GetPatchTable()->GetPatch((CORDB_ADDRESS_TYPE *)(pbCode + i)));
         }
@@ -1640,7 +1640,7 @@ HRESULT MethodDescVersioningState::UpdateJumpStampHelper(BYTE* pbCode, INT64 i64
 
         // PERF: we might still want a faster path through here if we aren't debugging that doesn't do
         // all the patch checks
-        for (int i = 0; i < MethodDescVersioningState::JumpStubSize; i++)
+        for (unsigned int i = 0; i < MethodDescVersioningState::JumpStubSize; i++)
         {
             *FirstCodeByteAddr(pbCode + i, DebuggerController::GetPatchTable()->GetPatch(pbCode + i)) = ((BYTE*)&i64NewValue)[i];
         }
index f29f67e..dee4ac3 100644 (file)
@@ -33,7 +33,7 @@ typedef DPTR(class CodeVersionManager) PTR_CodeVersionManager;
 
 // This HRESULT is only used as a private implementation detail. Corerror.xml has a comment in it
 //  reserving this value for our use but it doesn't appear in the public headers.
-#define CORPROF_E_RUNTIME_SUSPEND_REQUIRED 0x80131381
+#define CORPROF_E_RUNTIME_SUSPEND_REQUIRED _HRESULT_TYPEDEF_(0x80131381L)
 
 #endif
 
index e2660a2..42f457f 100644 (file)
@@ -479,7 +479,7 @@ VOID GenerateShuffleArray(MethodDesc* pInvoke, MethodDesc *pTargetMeth, SArray<S
         {
             filledSlots[i] = false;
         }
-        for (int i = 0; i < pShuffleEntryArray->GetCount(); i++)
+        for (unsigned int i = 0; i < pShuffleEntryArray->GetCount(); i++)
         {
             entry = (*pShuffleEntryArray)[i];
 
@@ -487,7 +487,7 @@ VOID GenerateShuffleArray(MethodDesc* pInvoke, MethodDesc *pTargetMeth, SArray<S
             // of the entry that filled it in.
             if (filledSlots[GetNormalizedArgumentSlotIndex(entry.srcofs)])
             {
-                int j;
+                unsigned int j;
                 for (j = i; (*pShuffleEntryArray)[j].dstofs != entry.srcofs; j--)
                     (*pShuffleEntryArray)[j] = (*pShuffleEntryArray)[j - 1];
 
index 7dedce6..6fb16c5 100644 (file)
@@ -867,13 +867,13 @@ public:
         // </NOTE>
 
 #if defined(PROFILING_SUPPORTED)
-        DWORD dwMethodDescLocalNum = -1;
+        DWORD dwMethodDescLocalNum = (DWORD)-1;
 
         // Notify the profiler of call out of the runtime
         if (!SF_IsReverseCOMStub(m_dwStubFlags) && (CORProfilerTrackTransitions() || SF_IsNGENedStubForProfiling(m_dwStubFlags)))
         {
             dwMethodDescLocalNum = m_slIL.EmitProfilerBeginTransitionCallback(pcsDispatch, m_dwStubFlags);
-            _ASSERTE(dwMethodDescLocalNum != -1);
+            _ASSERTE(dwMethodDescLocalNum != (DWORD)-1);
         }
 #endif // PROFILING_SUPPORTED
 
@@ -930,7 +930,7 @@ public:
 
 #if defined(PROFILING_SUPPORTED)
         // Notify the profiler of return back into the runtime
-        if (dwMethodDescLocalNum != -1)
+        if (dwMethodDescLocalNum != (DWORD)-1)
         {
             m_slIL.EmitProfilerEndTransitionCallback(pcsDispatch, m_dwStubFlags, dwMethodDescLocalNum);
         }
index c5b78c2..838450b 100644 (file)
@@ -901,7 +901,7 @@ ProcessCLRException(IN     PEXCEPTION_RECORD   pExceptionRecord
     {
         DWORD exceptionCode = pExceptionRecord->ExceptionCode;
 
-        if (exceptionCode == STATUS_UNWIND)
+        if ((NTSTATUS)exceptionCode == STATUS_UNWIND)
             // If exceptionCode is STATUS_UNWIND, RtlUnwind is called with a NULL ExceptionRecord,
             // therefore OS uses a faked ExceptionRecord with STATUS_UNWIND code.  Then we need to
             // look at our saved exception code.
index 22453c7..687ae2f 100644 (file)
@@ -1233,7 +1233,7 @@ Dictionary::PopulateEntry(
         ULONG slotIndex;
         if (isReadyToRunModule)
         {
-            _ASSERT(dictionaryIndexAndSlot != -1);
+            _ASSERT(dictionaryIndexAndSlot != (DWORD)-1);
             slotIndex = (ULONG)(dictionaryIndexAndSlot & 0xFFFF);
         }
         else
index 742e2fc..c1fbd4d 100644 (file)
@@ -1414,7 +1414,7 @@ VOID StubLinkerCPU::X86EmitSPIndexPush(__int32 ofs)
         // The offset can be expressed in a byte (can use the byte
         // form of the push esp instruction)
 
-        BYTE code[] = {0xff, 0x74, 0x24, (BYTE)(ofs8 & 0xFF)};
+        BYTE code[] = {0xff, 0x74, 0x24, (BYTE)ofs8};
         EmitBytes(code, sizeof(code));   
     }
     else
index 0144d96..dad2f48 100644 (file)
@@ -3834,7 +3834,7 @@ CORINFO_GENERIC_HANDLE JIT_GenericHandleWorker(MethodDesc * pMD, MethodTable * p
         {
 #ifdef _DEBUG
             // Only in R2R mode are the module, dictionary index and dictionary slot provided as an input
-            _ASSERTE(dictionaryIndexAndSlot != -1);
+            _ASSERTE(dictionaryIndexAndSlot != (DWORD)-1);
             _ASSERT(ExecutionManager::FindReadyToRunModule(dac_cast<TADDR>(signature)) == pModule);
 #endif
             dictionaryIndex = (dictionaryIndexAndSlot >> 16);
@@ -3853,7 +3853,7 @@ CORINFO_GENERIC_HANDLE JIT_GenericHandleWorker(MethodDesc * pMD, MethodTable * p
             // prepare for every possible derived type of the type containing the method). So instead we have to locate the exactly
             // instantiated (non-shared) super-type of the class passed in.
 
-            _ASSERTE(dictionaryIndexAndSlot == -1);
+            _ASSERTE(dictionaryIndexAndSlot == (DWORD)-1);
             IfFailThrow(ptr.GetData(&dictionaryIndex));
         }
 
index ff31041..a037af4 100644 (file)
@@ -27,7 +27,7 @@ int JitHost::getIntConfigValue(const wchar_t* name, int defaultValue)
     WRAPPER_NO_CONTRACT;
 
     // Translate JIT call into runtime configuration query
-    CLRConfig::ConfigDWORDInfo info{ name, static_cast<DWORD>(defaultValue), CLRConfig::EEConfig_default };
+    CLRConfig::ConfigDWORDInfo info{ name, (DWORD)defaultValue, CLRConfig::EEConfig_default };
 
     // Perform a CLRConfig look up on behalf of the JIT.
     return CLRConfig::GetConfigValue(info);
index 42975b6..6e4b288 100644 (file)
@@ -7040,7 +7040,7 @@ bool getILIntrinsicImplementation(MethodDesc * ftn,
             // Call CompareTo method on the primitive type
             int tokCompareTo = pCompareToMD->GetMemberDef();
 
-            int index = (et - ELEMENT_TYPE_I1);
+            unsigned int index = (et - ELEMENT_TYPE_I1);
             _ASSERTE(index < _countof(ilcode));
 
             ilcode[index][0] = CEE_LDARGA_S;
index d004541..568a231 100644 (file)
@@ -6326,7 +6326,7 @@ MethodTableBuilder::WriteMethodImplData(
             // binary search later
             for (DWORD i = 0; i < cSlots; i++)
             {
-                int min = i;
+                unsigned int min = i;
                 for (DWORD j = i + 1; j < cSlots; j++)
                 {
                     if (rgSlots[j] < rgSlots[min])
index 378ce2a..c855fd1 100644 (file)
@@ -685,7 +685,7 @@ PCODE ReadyToRunInfo::GetEntryPoint(MethodDesc * pMD, PrepareCodeConfig* pConfig
 
         NativeHashtable::Enumerator lookup = m_instMethodEntryPoints.Lookup(GetVersionResilientMethodHashCode(pMD));
         NativeParser entryParser;
-        offset = -1;
+        offset = (uint)-1;
         while (lookup.GetNext(entryParser))
         {
             PCCOR_SIGNATURE pBlob = (PCCOR_SIGNATURE)entryParser.GetBlob();
@@ -702,7 +702,7 @@ PCODE ReadyToRunInfo::GetEntryPoint(MethodDesc * pMD, PrepareCodeConfig* pConfig
             }
         }
 
-        if (offset == -1)
+        if (offset == (uint)-1)
             return NULL;
     }
     else
index d074284..9735df0 100644 (file)
 
 // This HRESULT is only used as a private implementation detail. Corerror.xml has a comment in it
 //  reserving this value for our use but it doesn't appear in the public headers.
-#define CORPROF_E_RUNTIME_SUSPEND_REQUIRED 0x80131381
+#define CORPROF_E_RUNTIME_SUSPEND_REQUIRED _HRESULT_TYPEDEF_(0x80131381L)
 
 // This is just used as a unique id. Overflow is OK. If we happen to have more than 4+Billion rejits
 // and somehow manage to not run out of memory, we'll just have to redefine ReJITID as size_t.
index 79d983e..33fe113 100644 (file)
@@ -72,7 +72,7 @@ static void InitializeYieldProcessorNormalized()
     {
         yieldsPerNormalizedYield = 1;
     }
-    _ASSERTE(yieldsPerNormalizedYield <= MinNsPerNormalizedYield);
+    _ASSERTE(yieldsPerNormalizedYield <= (int)MinNsPerNormalizedYield);
 
     // Calculate the maximum number of yields that would be optimal for a late spin iteration. Typically, we would not want to
     // spend excessive amounts of time (thousands of cycles) doing only YieldProcessor, as SwitchToThread/Sleep would do a
index 1c3cd83..91cf716 100644 (file)
@@ -1788,7 +1788,7 @@ DWORD ZapLazyHelperThunk::SaveWorker(ZapWriter * pZapWriter)
     PORTABILITY_ASSERT("ZapLazyHelperThunk::Save");
 #endif
 
-    _ASSERTE(p - buffer <= sizeof(buffer));
+    _ASSERTE((DWORD)(p - buffer) <= sizeof(buffer));
 
     if (pZapWriter != NULL)
         pZapWriter->Write(&buffer, (int)(p - buffer));
index 7a849fb..59a9e12 100644 (file)
@@ -2177,7 +2177,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h
             // We skip the compilation of such methods and we don't want to
             // issue a warning or error
             //
-            if ((hrException == E_NOTIMPL) || (hrException == IDS_CLASSLOAD_GENERAL))
+            if ((hrException == E_NOTIMPL) || (hrException == (HRESULT)IDS_CLASSLOAD_GENERAL))
             {
                 result = NOT_COMPILED;
                 level = CORZAP_LOGLEVEL_INFO;
index 8879964..d84ea79 100644 (file)
@@ -2205,7 +2205,7 @@ DWORD ZapIndirectHelperThunk::SaveWorker(ZapWriter * pZapWriter)
     PORTABILITY_ASSERT("ZapIndirectHelperThunk::SaveWorker");
 #endif
 
-    _ASSERTE(p - buffer <= sizeof(buffer));
+    _ASSERTE((DWORD)(p - buffer) <= sizeof(buffer));
 
     if (pZapWriter != NULL)
         pZapWriter->Write(&buffer, (int)(p - buffer));
index ccb796d..560400b 100644 (file)
@@ -549,7 +549,7 @@ class MethodCodeComparer
         if (k1 == k2)
             return TRUE;
 
-        for (int i = 0; i < _countof(equivalentNodes); i++)
+        for (unsigned int i = 0; i < _countof(equivalentNodes); i++)
         {
             if (k1 == equivalentNodes[i][0] && k2 == equivalentNodes[i][1])
                 return TRUE;