Fix size_t to int cast warnings.

Several instances in Visual Studio 2015:

warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
This commit is contained in:
Jamie Madill 2016-12-13 17:30:58 -05:00
parent 20f01e7fd0
commit 3ec327c5a5
2 changed files with 6 additions and 6 deletions

View File

@ -2241,7 +2241,7 @@ bool TIntermediate::promoteAggregate(TIntermAggregate& node)
{
TOperator op = node.getOp();
TIntermSequence& args = node.getSequence();
const int numArgs = args.size();
const int numArgs = static_cast<int>(args.size());
// Presently, only hlsl does intrinsic promotions.
if (getSource() != EShSourceHlsl)

View File

@ -957,13 +957,13 @@ int HlslParseContext::addFlattenedMember(const TSourceLoc& loc,
if (flattenData.nextBinding != TQualifier::layoutBindingEnd)
memberVariable->getWritableType().getQualifier().layoutBinding = flattenData.nextBinding++;
flattenData.offsets.push_back(flattenData.members.size());
flattenData.offsets.push_back(static_cast<int>(flattenData.members.size()));
flattenData.members.push_back(memberVariable);
if (track)
trackLinkageDeferred(*memberVariable);
return flattenData.offsets.size()-1; // location of the member reference
return static_cast<int>(flattenData.offsets.size())-1; // location of the member reference
} else {
// Further recursion required
return flatten(loc, variable, type, flattenData, memberName);
@ -985,7 +985,7 @@ int HlslParseContext::flattenStruct(const TSourceLoc& loc, const TVariable& vari
auto members = *type.getStruct();
// Reserve space for this tree level.
int start = flattenData.offsets.size();
int start = static_cast<int>(flattenData.offsets.size());
int pos = start;
flattenData.offsets.resize(int(pos + members.size()), -1);
@ -1022,7 +1022,7 @@ int HlslParseContext::flattenArray(const TSourceLoc& loc, const TVariable& varia
name = variable.getName();
// Reserve space for this tree level.
int start = flattenData.offsets.size();
int start = static_cast<int>(flattenData.offsets.size());
int pos = start;
flattenData.offsets.resize(int(pos + size), -1);
@ -4977,7 +4977,7 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
return addConstructor(loc, initList, arrayType);
} else if (type.isStruct()) {
// lengthen list to be long enough
lengthenList(loc, initList->getSequence(), type.getStruct()->size());
lengthenList(loc, initList->getSequence(), static_cast<int>(type.getStruct()->size()));
if (type.getStruct()->size() != initList->getSequence().size()) {
error(loc, "wrong number of structure members", "initializer list", "");