Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data'

BUG=angleproject:1120

Change-Id: I01ef10bea7f487c2b394d030c76628f38d2ea645
Reviewed-on: https://chromium-review.googlesource.com/292780
Tested-by: Cooper Partin <coopp@microsoft.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/CallDAG.cpp b/src/compiler/translator/CallDAG.cpp
index ef57b39..eb6c031 100644
--- a/src/compiler/translator/CallDAG.cpp
+++ b/src/compiler/translator/CallDAG.cpp
@@ -71,10 +71,10 @@
             record.callees.reserve(data.callees.size());
             for (auto &callee : data.callees)
             {
-                record.callees.push_back(callee->index);
+                record.callees.push_back(static_cast<int>(callee->index));
             }
 
-            (*idToIndex)[data.node->getFunctionId()] = data.index;
+            (*idToIndex)[data.node->getFunctionId()] = static_cast<int>(data.index);
         }
     }
 
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index 396b390..3e9a0b6 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -544,7 +544,7 @@
             infoSink.info << "Call stack too deep (larger than " << maxCallStackDepth
                           << ") with the following call chain: " << record.name;
 
-            int currentFunction = i;
+            int currentFunction = static_cast<int>(i);
             int currentDepth = depth;
 
             while (currentFunction != -1)
@@ -574,7 +574,7 @@
 bool TCompiler::tagUsedFunctions()
 {
     // Search from main, starting from the end of the DAG as it usually is the root.
-    for (int i = mCallDag.size(); i-- > 0;)
+    for (size_t i = mCallDag.size(); i-- > 0;)
     {
         if (mCallDag.getRecordFromIndex(i).name == "main(")
         {
diff --git a/src/compiler/translator/IntermNode.cpp b/src/compiler/translator/IntermNode.cpp
index a4a6f70..1d26947 100644
--- a/src/compiler/translator/IntermNode.cpp
+++ b/src/compiler/translator/IntermNode.cpp
@@ -1875,7 +1875,7 @@
 {
     TOperator op = aggregate->getOp();
     TIntermSequence *sequence = aggregate->getSequence();
-    unsigned int paramsCount = sequence->size();
+    unsigned int paramsCount = static_cast<unsigned int>(sequence->size());
     std::vector<TConstantUnion *> unionArrays(paramsCount);
     std::vector<size_t> objectSizes(paramsCount);
     size_t maxObjectSize = 0;
@@ -2256,7 +2256,7 @@
             {
                 // Perform component-wise matrix multiplication.
                 resultArray = new TConstantUnion[maxObjectSize];
-                size_t size = (*sequence)[0]->getAsTyped()->getNominalSize();
+                int size = (*sequence)[0]->getAsTyped()->getNominalSize();
                 angle::Matrix<float> result =
                     GetMatrix(unionArrays[0], size).compMult(GetMatrix(unionArrays[1], size));
                 SetUnionArrayFromMatrix(result, resultArray);
@@ -2272,7 +2272,8 @@
                 size_t numCols = (*sequence)[1]->getAsTyped()->getType().getObjectSize();
                 resultArray = new TConstantUnion[numRows * numCols];
                 angle::Matrix<float> result =
-                    GetMatrix(unionArrays[0], 1, numCols).outerProduct(GetMatrix(unionArrays[1], numRows, 1));
+                    GetMatrix(unionArrays[0], 1, static_cast<int>(numCols))
+                        .outerProduct(GetMatrix(unionArrays[1], static_cast<int>(numRows), 1));
                 SetUnionArrayFromMatrix(result, resultArray);
             }
             else
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 3700a9c..dd77b63 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -599,7 +599,7 @@
     {
         if (type->isUnsizedArray())
         {
-            type->setArraySize(function.getParamCount());
+            type->setArraySize(static_cast<int>(function.getParamCount()));
         }
         else if (static_cast<size_t>(type->getArraySize()) != function.getParamCount())
         {
diff --git a/src/compiler/translator/Types.h b/src/compiler/translator/Types.h
index 9147de9..2302ad7 100644
--- a/src/compiler/translator/Types.h
+++ b/src/compiler/translator/Types.h
@@ -124,7 +124,7 @@
         return mDeepestNesting;
     }
     bool containsArrays() const;
-    bool containsType(TBasicType type) const;
+    bool containsType(TBasicType t) const;
     bool containsSamplers() const;
 
     bool equals(const TStructure &other) const;
diff --git a/src/compiler/translator/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
index d61dc40..8e1c008 100644
--- a/src/compiler/translator/VariableInfo.cpp
+++ b/src/compiler/translator/VariableInfo.cpp
@@ -55,7 +55,8 @@
     {
         if (variable.isArray())
         {
-            for (size_t elementIndex = 0; elementIndex < variable.elementCount(); elementIndex++)
+            for (unsigned int elementIndex = 0; elementIndex < variable.elementCount();
+                 elementIndex++)
             {
                 std::string lname = name + ::ArrayString(elementIndex);
                 std::string lmappedName = mappedName + ::ArrayString(elementIndex);
diff --git a/src/compiler/translator/blocklayout.cpp b/src/compiler/translator/blocklayout.cpp
index 7c74105..ba63228 100644
--- a/src/compiler/translator/blocklayout.cpp
+++ b/src/compiler/translator/blocklayout.cpp
@@ -27,7 +27,10 @@
 
     getBlockLayoutInfo(type, arraySize, isRowMajorMatrix, &arrayStride, &matrixStride);
 
-    const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
+    const BlockMemberInfo memberInfo(static_cast<int>(mCurrentOffset * BytesPerComponent),
+                                     static_cast<int>(arrayStride * BytesPerComponent),
+                                     static_cast<int>(matrixStride * BytesPerComponent),
+                                     isRowMajorMatrix);
 
     advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride);