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/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 23a414e..cecb777 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -470,7 +470,7 @@
return error;
}
- GLsizei streamLength = stream.length();
+ GLsizei streamLength = static_cast<GLsizei>(stream.length());
const void *streamData = stream.data();
if (streamLength > bufSize)
@@ -632,7 +632,7 @@
if (length)
{
- *length = strlen(name);
+ *length = static_cast<GLsizei>(strlen(name));
}
}
@@ -749,7 +749,7 @@
if (length)
{
- *length = strlen(name);
+ *length = static_cast<GLsizei>(strlen(name));
}
}
@@ -777,7 +777,7 @@
{
if (mLinked)
{
- return mProgram->getUniforms().size();
+ return static_cast<GLint>(mProgram->getUniforms().size());
}
else
{
@@ -791,7 +791,7 @@
if (mLinked)
{
- unsigned int numUniforms = mProgram->getUniforms().size();
+ unsigned int numUniforms = static_cast<unsigned int>(mProgram->getUniforms().size());
for (unsigned int uniformIndex = 0; uniformIndex < numUniforms; uniformIndex++)
{
if (!mProgram->getUniforms()[uniformIndex]->name.empty())
@@ -1030,7 +1030,7 @@
GLuint Program::getActiveUniformBlockCount()
{
- return mProgram->getUniformBlocks().size();
+ return static_cast<GLuint>(mProgram->getUniformBlocks().size());
}
void Program::getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const
@@ -1053,7 +1053,7 @@
if (length)
{
- *length = strlen(uniformBlockName);
+ *length = static_cast<GLsizei>(strlen(uniformBlockName));
}
}
}
@@ -1099,13 +1099,14 @@
if (mLinked)
{
- unsigned int numUniformBlocks = mProgram->getUniformBlocks().size();
+ unsigned int numUniformBlocks =
+ static_cast<unsigned int>(mProgram->getUniformBlocks().size());
for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < numUniformBlocks; uniformBlockIndex++)
{
const UniformBlock &uniformBlock = *mProgram->getUniformBlocks()[uniformBlockIndex];
if (!uniformBlock.name.empty())
{
- const int length = uniformBlock.name.length() + 1;
+ const int length = static_cast<int>(uniformBlock.name.length()) + 1;
// Counting in "[0]".
const int arrayLength = (uniformBlock.isArrayElement() ? 3 : 0);
@@ -1459,7 +1460,8 @@
<< "' between vertex and fragment shaders";
return false;
}
- const unsigned int numBlockMembers = vertexInterfaceBlock.fields.size();
+ const unsigned int numBlockMembers =
+ static_cast<unsigned int>(vertexInterfaceBlock.fields.size());
for (unsigned int blockMemberIndex = 0; blockMemberIndex < numBlockMembers; blockMemberIndex++)
{
const sh::InterfaceBlockField &vertexMember = vertexInterfaceBlock.fields[blockMemberIndex];
@@ -1505,7 +1507,7 @@
infoLog << "Structure lengths for " << variableName << " differ between vertex and fragment shaders";
return false;
}
- const unsigned int numMembers = vertexVariable.fields.size();
+ const unsigned int numMembers = static_cast<unsigned int>(vertexVariable.fields.size());
for (unsigned int memberIndex = 0; memberIndex < numMembers; memberIndex++)
{
const sh::ShaderVariable &vertexMember = vertexVariable.fields[memberIndex];