Use an unsigned variable to avoid comparison problems (#14001)
authorDavid Wrighton <davidwr@microsoft.com>
Thu, 14 Sep 2017 23:36:24 +0000 (16:36 -0700)
committerGitHub <noreply@github.com>
Thu, 14 Sep 2017 23:36:24 +0000 (16:36 -0700)
src/vm/methodtable.cpp

index 0adba6a..1b19a33 100644 (file)
@@ -7074,7 +7074,7 @@ BOOL MethodTable::FindDefaultInterfaceImplementation(
     InterfaceMapIterator it = this->IterateInterfaceMap();
 
     CQuickArray<MatchCandidate> candidates;
-    int candidatesCount = 0;
+    unsigned candidatesCount = 0;
     candidates.AllocThrows(this->GetNumInterfaces());
     
     //
@@ -7193,7 +7193,7 @@ BOOL MethodTable::FindDefaultInterfaceImplementation(
 
                     // We need to maintain the invariant that the candidates are always the most specific
                     // in all path scaned so far. There might be multiple incompatible candidates 
-                    for (int i = 0; i < candidatesCount; ++i)
+                    for (unsigned i = 0; i < candidatesCount; ++i)
                     {
                         MethodTable *pCandidateMT = candidates[i].pMT;
                         if (pCandidateMT == NULL)
@@ -7255,7 +7255,7 @@ BOOL MethodTable::FindDefaultInterfaceImplementation(
     // scan to see if there are any conflicts
     MethodTable *pBestCandidateMT = NULL;
     MethodDesc *pBestCandidateMD = NULL;
-    for (int i = 0; i < candidatesCount; ++i)
+    for (unsigned i = 0; i < candidatesCount; ++i)
     {
         if (candidates[i].pMT == NULL)
             continue;