Commit 91c2fadf by Corentin Wallez

Fix more warnings in samples and tests

These warnings are currently disabled because these files are not with angle_code set to 1 in the gyp files to avoid gtest's code warnings. We hope to either fix warnings in gtest or change our build system to not use warnings for gtest. BUG=angleproject:1003 Change-Id: I281781b77f92ef8c394dd53fbbd50d525e4da5c9 Reviewed-on: https://chromium-review.googlesource.com/271412Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent bc99bb6b
......@@ -51,17 +51,17 @@ GLuint CreateSimpleTextureCubemap()
GLubyte pixels[6][3] =
{
// Face 0 - Red
255, 0, 0,
{ 255, 0, 0 },
// Face 1 - Green,
0, 255, 0,
{ 0, 255, 0 },
// Face 3 - Blue
0, 0, 255,
{ 0, 0, 255 },
// Face 4 - Yellow
255, 255, 0,
{ 255, 255, 0 },
// Face 5 - Purple
255, 0, 255,
{ 255, 0, 255 },
// Face 6 - White
255, 255, 255
{ 255, 255, 255 }
};
for (size_t i = 0; i < 6; i++)
......@@ -84,9 +84,9 @@ GLuint CreateMipMappedTexture2D()
std::array<GLubyte, width * height * 3> pixels;
const size_t checkerSize = 8;
for (GLsizei y = 0; y < height; y++)
for (size_t y = 0; y < height; y++)
{
for (GLsizei x = 0; x < width; x++)
for (size_t x = 0; x < width; x++)
{
GLubyte rColor = 0;
GLubyte bColor = 0;
......
......@@ -13,7 +13,7 @@
#include <string>
TGAImage::TGAImage()
: data(0), width(0), height(0)
: width(0), height(0), data(0)
{
}
......
......@@ -48,7 +48,7 @@ class TexRedefBenchSample : public SampleApplication
public:
TexRedefBenchSample()
: SampleApplication("Microbench", 1280, 1280),
mFrameCount(0), mPixelsResize(NULL), mPixelsNewTex(NULL), mTimeFrame(false)
mPixelsResize(NULL), mPixelsNewTex(NULL), mTimeFrame(false), mFrameCount(0)
{
}
......@@ -269,8 +269,6 @@ class TexRedefBenchSample : public SampleApplication
Timer *mNewTexDefineTimer;
bool mTimeFrame;
unsigned int mFrameCount;
unsigned int mTriTotalTime;
unsigned int mFanTotalTime;
};
int main(int argc, char **argv)
......
......@@ -92,11 +92,11 @@ class TriangleFanBenchSample : public SampleApplication
mNumTriVerts = numTriVertices;
for (int i = 0; i < slices; ++i)
for (unsigned int i = 0; i < slices; ++i)
{
memcpy(triPointer, fanVertices, 3 * sizeof(GLfloat)); // copy center point as first vertex for this slice
triPointer += 3;
for (int j = 1; j < 3; ++j)
for (unsigned int j = 1; j < 3; ++j)
{
GLfloat *vertex = &(fanVertices[(i + j) * 3]); // copy two outer vertices for this point
memcpy(triPointer, vertex, 3 * sizeof(GLfloat));
......@@ -109,11 +109,11 @@ class TriangleFanBenchSample : public SampleApplication
xOffset = xMin;
yOffset = yMin;
for (int i = 0; i < mNumSquares; ++i)
for (unsigned int i = 0; i < mNumSquares; ++i)
{
triPointer = triVertices;
GLfloat tempVerts[triFloats];
for (int j = 0; j < numTriVertices; ++j)
for (unsigned int j = 0; j < numTriVertices; ++j)
{
tempVerts[j * 3] = triPointer[0] + xOffset;
tempVerts[j * 3 + 1] = triPointer[1] + yOffset;
......@@ -193,7 +193,7 @@ class TriangleFanBenchSample : public SampleApplication
// Draw using triangle fans, stored in VBO
mFanTimer->start();
for (int i = 0; i < mNumSquares; ++i)
for (unsigned i = 0; i < mNumSquares; ++i)
{
glBindBuffer(GL_ARRAY_BUFFER, mFanBufId[i]);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
......@@ -208,7 +208,7 @@ class TriangleFanBenchSample : public SampleApplication
// Draw using triangles, stored in VBO
mTriTimer->start();
for (int i = 1; i < mNumSquares; ++i)
for (unsigned i = 1; i < mNumSquares; ++i)
{
glBindBuffer(GL_ARRAY_BUFFER, mTriBufId[i]);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
......
......@@ -6,8 +6,6 @@
#include "test_utils/ANGLETest.h"
#include <array>
using namespace angle;
template <typename IndexType, GLenum IndexTypeName>
......@@ -67,7 +65,7 @@ class IndexedPointsTest : public ANGLETest
FAIL() << "shader compilation failed.";
}
std::array<GLfloat, mPointCount * 2> vertices =
const GLfloat vertices[] =
{
getIndexPositionX(0), getIndexPositionY(0),
getIndexPositionX(1), getIndexPositionY(1),
......@@ -76,12 +74,12 @@ class IndexedPointsTest : public ANGLETest
};
glGenBuffers(1, &mVertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer);
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(GLfloat), &vertices[0], GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), &vertices[0], GL_STATIC_DRAW);
std::array<IndexType, mPointCount> indices = { 0, 1, 2, 3 };
const IndexType indices[] = { 0, 1, 2, 3 };
glGenBuffers(1, &mIndexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(IndexType), &indices[0], GL_STATIC_DRAW);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), &indices[0], GL_STATIC_DRAW);
}
virtual void TearDown()
......
......@@ -44,9 +44,9 @@ EGLPlatformParameters::EGLPlatformParameters(EGLint renderer, EGLint majorVersio
EGLWindow::EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &platform)
: mSurface(EGL_NO_SURFACE),
: mDisplay(EGL_NO_DISPLAY),
mSurface(EGL_NO_SURFACE),
mContext(EGL_NO_CONTEXT),
mDisplay(EGL_NO_DISPLAY),
mClientVersion(glesMajorVersion),
mPlatform(platform),
mWidth(width),
......
......@@ -19,7 +19,7 @@ std::string GetExecutablePath()
char path[4096];
ssize_t result = readlink("/proc/self/exe", path, sizeof(path) - 1);
if (result < 0 || result >= sizeof(path) - 1)
if (result < 0 || static_cast<size_t>(result) >= sizeof(path) - 1)
{
return "";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment