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() ...@@ -51,17 +51,17 @@ GLuint CreateSimpleTextureCubemap()
GLubyte pixels[6][3] = GLubyte pixels[6][3] =
{ {
// Face 0 - Red // Face 0 - Red
255, 0, 0, { 255, 0, 0 },
// Face 1 - Green, // Face 1 - Green,
0, 255, 0, { 0, 255, 0 },
// Face 3 - Blue // Face 3 - Blue
0, 0, 255, { 0, 0, 255 },
// Face 4 - Yellow // Face 4 - Yellow
255, 255, 0, { 255, 255, 0 },
// Face 5 - Purple // Face 5 - Purple
255, 0, 255, { 255, 0, 255 },
// Face 6 - White // Face 6 - White
255, 255, 255 { 255, 255, 255 }
}; };
for (size_t i = 0; i < 6; i++) for (size_t i = 0; i < 6; i++)
...@@ -84,9 +84,9 @@ GLuint CreateMipMappedTexture2D() ...@@ -84,9 +84,9 @@ GLuint CreateMipMappedTexture2D()
std::array<GLubyte, width * height * 3> pixels; std::array<GLubyte, width * height * 3> pixels;
const size_t checkerSize = 8; 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 rColor = 0;
GLubyte bColor = 0; GLubyte bColor = 0;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <string> #include <string>
TGAImage::TGAImage() TGAImage::TGAImage()
: data(0), width(0), height(0) : width(0), height(0), data(0)
{ {
} }
......
...@@ -48,7 +48,7 @@ class TexRedefBenchSample : public SampleApplication ...@@ -48,7 +48,7 @@ class TexRedefBenchSample : public SampleApplication
public: public:
TexRedefBenchSample() TexRedefBenchSample()
: SampleApplication("Microbench", 1280, 1280), : 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 ...@@ -269,8 +269,6 @@ class TexRedefBenchSample : public SampleApplication
Timer *mNewTexDefineTimer; Timer *mNewTexDefineTimer;
bool mTimeFrame; bool mTimeFrame;
unsigned int mFrameCount; unsigned int mFrameCount;
unsigned int mTriTotalTime;
unsigned int mFanTotalTime;
}; };
int main(int argc, char **argv) int main(int argc, char **argv)
......
...@@ -92,11 +92,11 @@ class TriangleFanBenchSample : public SampleApplication ...@@ -92,11 +92,11 @@ class TriangleFanBenchSample : public SampleApplication
mNumTriVerts = numTriVertices; 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 memcpy(triPointer, fanVertices, 3 * sizeof(GLfloat)); // copy center point as first vertex for this slice
triPointer += 3; 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 GLfloat *vertex = &(fanVertices[(i + j) * 3]); // copy two outer vertices for this point
memcpy(triPointer, vertex, 3 * sizeof(GLfloat)); memcpy(triPointer, vertex, 3 * sizeof(GLfloat));
...@@ -109,11 +109,11 @@ class TriangleFanBenchSample : public SampleApplication ...@@ -109,11 +109,11 @@ class TriangleFanBenchSample : public SampleApplication
xOffset = xMin; xOffset = xMin;
yOffset = yMin; yOffset = yMin;
for (int i = 0; i < mNumSquares; ++i) for (unsigned int i = 0; i < mNumSquares; ++i)
{ {
triPointer = triVertices; triPointer = triVertices;
GLfloat tempVerts[triFloats]; 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] = triPointer[0] + xOffset;
tempVerts[j * 3 + 1] = triPointer[1] + yOffset; tempVerts[j * 3 + 1] = triPointer[1] + yOffset;
...@@ -193,7 +193,7 @@ class TriangleFanBenchSample : public SampleApplication ...@@ -193,7 +193,7 @@ class TriangleFanBenchSample : public SampleApplication
// Draw using triangle fans, stored in VBO // Draw using triangle fans, stored in VBO
mFanTimer->start(); mFanTimer->start();
for (int i = 0; i < mNumSquares; ++i) for (unsigned i = 0; i < mNumSquares; ++i)
{ {
glBindBuffer(GL_ARRAY_BUFFER, mFanBufId[i]); glBindBuffer(GL_ARRAY_BUFFER, mFanBufId[i]);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
...@@ -208,7 +208,7 @@ class TriangleFanBenchSample : public SampleApplication ...@@ -208,7 +208,7 @@ class TriangleFanBenchSample : public SampleApplication
// Draw using triangles, stored in VBO // Draw using triangles, stored in VBO
mTriTimer->start(); mTriTimer->start();
for (int i = 1; i < mNumSquares; ++i) for (unsigned i = 1; i < mNumSquares; ++i)
{ {
glBindBuffer(GL_ARRAY_BUFFER, mTriBufId[i]); glBindBuffer(GL_ARRAY_BUFFER, mTriBufId[i]);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
#include "test_utils/ANGLETest.h" #include "test_utils/ANGLETest.h"
#include <array>
using namespace angle; using namespace angle;
template <typename IndexType, GLenum IndexTypeName> template <typename IndexType, GLenum IndexTypeName>
...@@ -67,7 +65,7 @@ class IndexedPointsTest : public ANGLETest ...@@ -67,7 +65,7 @@ class IndexedPointsTest : public ANGLETest
FAIL() << "shader compilation failed."; FAIL() << "shader compilation failed.";
} }
std::array<GLfloat, mPointCount * 2> vertices = const GLfloat vertices[] =
{ {
getIndexPositionX(0), getIndexPositionY(0), getIndexPositionX(0), getIndexPositionY(0),
getIndexPositionX(1), getIndexPositionY(1), getIndexPositionX(1), getIndexPositionY(1),
...@@ -76,12 +74,12 @@ class IndexedPointsTest : public ANGLETest ...@@ -76,12 +74,12 @@ class IndexedPointsTest : public ANGLETest
}; };
glGenBuffers(1, &mVertexBuffer); glGenBuffers(1, &mVertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, 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); glGenBuffers(1, &mIndexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 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() virtual void TearDown()
......
...@@ -44,9 +44,9 @@ EGLPlatformParameters::EGLPlatformParameters(EGLint renderer, EGLint majorVersio ...@@ -44,9 +44,9 @@ EGLPlatformParameters::EGLPlatformParameters(EGLint renderer, EGLint majorVersio
EGLWindow::EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &platform) 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), mContext(EGL_NO_CONTEXT),
mDisplay(EGL_NO_DISPLAY),
mClientVersion(glesMajorVersion), mClientVersion(glesMajorVersion),
mPlatform(platform), mPlatform(platform),
mWidth(width), mWidth(width),
......
...@@ -19,7 +19,7 @@ std::string GetExecutablePath() ...@@ -19,7 +19,7 @@ std::string GetExecutablePath()
char path[4096]; char path[4096];
ssize_t result = readlink("/proc/self/exe", path, sizeof(path) - 1); 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 ""; 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