Reland Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data'
Additional warnings found with more testing and added C4267 warning disable only for angle_libpng
BUG=angleproject:1120
Change-Id: Ic403dcff5a8018056fa51a8c408e64207f3362eb
Reviewed-on: https://chromium-review.googlesource.com/293028
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/gl/ProgramGL.cpp b/src/libANGLE/renderer/gl/ProgramGL.cpp
index f92ad6e..bb3571d 100644
--- a/src/libANGLE/renderer/gl/ProgramGL.cpp
+++ b/src/libANGLE/renderer/gl/ProgramGL.cpp
@@ -132,7 +132,9 @@
GLsizei uniformNameLength = 0;
GLint uniformSize = 0;
GLenum uniformType = GL_NONE;
- mFunctions->getActiveUniform(mProgramID, i, uniformNameBuffer.size(), &uniformNameLength, &uniformSize, &uniformType, &uniformNameBuffer[0]);
+ mFunctions->getActiveUniform(mProgramID, i, static_cast<GLsizei>(uniformNameBuffer.size()),
+ &uniformNameLength, &uniformSize, &uniformType,
+ &uniformNameBuffer[0]);
size_t subscript = 0;
std::string uniformName = gl::ParseUniformName(std::string(&uniformNameBuffer[0], uniformNameLength), &subscript);
@@ -144,13 +146,15 @@
std::string locationName = uniformName;
if (isArray)
{
- locationName += "[" + Str(arrayIndex) + "]";
+ locationName += "[" + Str(static_cast<int>(arrayIndex)) + "]";
}
GLint location = mFunctions->getUniformLocation(mProgramID, locationName.c_str());
if (location >= 0)
{
- mUniformIndex[location] = gl::VariableLocation(uniformName, arrayIndex, static_cast<unsigned int>(mUniforms.size()));
+ mUniformIndex[location] =
+ gl::VariableLocation(uniformName, static_cast<unsigned int>(arrayIndex),
+ static_cast<unsigned int>(mUniforms.size()));
// If the uniform is a sampler, track it in the sampler bindings array
if (gl::IsSamplerType(uniformType))
@@ -192,7 +196,9 @@
GLsizei attributeNameLength = 0;
GLint attributeSize = 0;
GLenum attributeType = GL_NONE;
- mFunctions->getActiveAttrib(mProgramID, i, attributeNameBuffer.size(), &attributeNameLength, &attributeSize, &attributeType, &attributeNameBuffer[0]);
+ mFunctions->getActiveAttrib(mProgramID, i, static_cast<GLsizei>(attributeNameBuffer.size()),
+ &attributeNameLength, &attributeSize, &attributeType,
+ &attributeNameBuffer[0]);
std::string attributeName(&attributeNameBuffer[0], attributeNameLength);