Fixed some warnings on GCC

Mozilla has recently made using NULL as integer an error (via -Werror=conversion-null GCC flag), which caused ANGLE to no longer compile on mingw in Mozilla tree. The ones that may not be obvious are removal of some <0 checks. They are not needed because they were done on unsigned types. Author: Jacek Caban http://codereview.appspot.com/6679049 git-svn-id: https://angleproject.googlecode.com/svn/trunk@1393 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent c663cbf6
#define MAJOR_VERSION 1 #define MAJOR_VERSION 1
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 1392 #define BUILD_REVISION 1393
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -95,9 +95,9 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node) ...@@ -95,9 +95,9 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
mTemporaryIndex = i + 1; mTemporaryIndex = i + 1;
} }
return false; return false;
} default:
return true; return true;
}
} }
bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node) bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
......
...@@ -257,7 +257,7 @@ bool Display::initialize() ...@@ -257,7 +257,7 @@ bool Display::initialize()
ConfigSet configSet; ConfigSet configSet;
for (int formatIndex = 0; formatIndex < sizeof(renderTargetFormats) / sizeof(D3DFORMAT); formatIndex++) for (unsigned int formatIndex = 0; formatIndex < sizeof(renderTargetFormats) / sizeof(D3DFORMAT); formatIndex++)
{ {
D3DFORMAT renderTargetFormat = renderTargetFormats[formatIndex]; D3DFORMAT renderTargetFormat = renderTargetFormats[formatIndex];
...@@ -265,7 +265,7 @@ bool Display::initialize() ...@@ -265,7 +265,7 @@ bool Display::initialize()
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
for (int depthStencilIndex = 0; depthStencilIndex < sizeof(depthStencilFormats) / sizeof(D3DFORMAT); depthStencilIndex++) for (unsigned int depthStencilIndex = 0; depthStencilIndex < sizeof(depthStencilFormats) / sizeof(D3DFORMAT); depthStencilIndex++)
{ {
D3DFORMAT depthStencilFormat = depthStencilFormats[depthStencilIndex]; D3DFORMAT depthStencilFormat = depthStencilFormats[depthStencilIndex];
HRESULT result = D3D_OK; HRESULT result = D3D_OK;
......
...@@ -43,7 +43,7 @@ const size_t g_shaderSize[] = ...@@ -43,7 +43,7 @@ const size_t g_shaderSize[] =
namespace gl namespace gl
{ {
Blit::Blit(Context *context) Blit::Blit(Context *context)
: mContext(context), mQuadVertexBuffer(NULL), mQuadVertexDeclaration(NULL), mSavedRenderTarget(NULL), mSavedDepthStencil(NULL), mSavedStateBlock(NULL) : mContext(context), mQuadVertexBuffer(NULL), mQuadVertexDeclaration(NULL), mSavedStateBlock(NULL), mSavedRenderTarget(NULL), mSavedDepthStencil(NULL)
{ {
initGeometry(); initGeometry();
memset(mCompiledShaders, 0, sizeof(mCompiledShaders)); memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
......
...@@ -289,7 +289,7 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface) ...@@ -289,7 +289,7 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
}; };
int max = 0; int max = 0;
for (int i = 0; i < sizeof(renderBufferFormats) / sizeof(D3DFORMAT); ++i) for (unsigned int i = 0; i < sizeof(renderBufferFormats) / sizeof(D3DFORMAT); ++i)
{ {
bool *multisampleArray = new bool[D3DMULTISAMPLE_16_SAMPLES + 1]; bool *multisampleArray = new bool[D3DMULTISAMPLE_16_SAMPLES + 1];
mDisplay->getMultiSampleSupport(renderBufferFormats[i], multisampleArray); mDisplay->getMultiSampleSupport(renderBufferFormats[i], multisampleArray);
...@@ -1683,7 +1683,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params) ...@@ -1683,7 +1683,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
break; break;
case GL_TEXTURE_BINDING_2D: case GL_TEXTURE_BINDING_2D:
{ {
if (mState.activeSampler < 0 || mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1) if (mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
{ {
error(GL_INVALID_OPERATION); error(GL_INVALID_OPERATION);
return false; return false;
...@@ -1694,7 +1694,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params) ...@@ -1694,7 +1694,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
break; break;
case GL_TEXTURE_BINDING_CUBE_MAP: case GL_TEXTURE_BINDING_CUBE_MAP:
{ {
if (mState.activeSampler < 0 || mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1) if (mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
{ {
error(GL_INVALID_OPERATION); error(GL_INVALID_OPERATION);
return false; return false;
...@@ -3185,7 +3185,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid ...@@ -3185,7 +3185,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
applyShaders(); applyShaders();
applyTextures(); applyTextures();
if (!getCurrentProgramBinary()->validateSamplers(false)) if (!getCurrentProgramBinary()->validateSamplers(NULL))
{ {
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
......
...@@ -1044,7 +1044,7 @@ ID3D10Blob *ProgramBinary::compileToBinary(InfoLog &infoLog, const char *hlsl, c ...@@ -1044,7 +1044,7 @@ ID3D10Blob *ProgramBinary::compileToBinary(InfoLog &infoLog, const char *hlsl, c
return NULL; return NULL;
} }
DWORD result = NOERROR; HRESULT result = S_OK;
UINT flags = 0; UINT flags = 0;
std::string sourceText; std::string sourceText;
if (perfActive()) if (perfActive())
......
...@@ -315,7 +315,7 @@ void Shader::uncompile() ...@@ -315,7 +315,7 @@ void Shader::uncompile()
void Shader::compileToHLSL(void *compiler) void Shader::compileToHLSL(void *compiler)
{ {
// ensure we don't pass a NULL source to the compiler // ensure we don't pass a NULL source to the compiler
char *source = "\0"; const char *source = "\0";
if (mSource) if (mSource)
{ {
source = mSource; source = mSource;
...@@ -504,7 +504,7 @@ void VertexShader::uncompile() ...@@ -504,7 +504,7 @@ void VertexShader::uncompile()
// set by ParseAttributes // set by ParseAttributes
mAttributes.clear(); mAttributes.clear();
}; }
void VertexShader::compile() void VertexShader::compile()
{ {
......
...@@ -230,7 +230,7 @@ void Image::createSurface() ...@@ -230,7 +230,7 @@ void Image::createSurface()
GLsizei requestHeight = mHeight; GLsizei requestHeight = mHeight;
MakeValidSize(true, IsCompressed(mInternalFormat), &requestWidth, &requestHeight, &levelToFetch); MakeValidSize(true, IsCompressed(mInternalFormat), &requestWidth, &requestHeight, &levelToFetch);
HRESULT result = getDevice()->CreateTexture(requestWidth, requestHeight, levelToFetch + 1, NULL, d3dFormat, HRESULT result = getDevice()->CreateTexture(requestWidth, requestHeight, levelToFetch + 1, 0, d3dFormat,
poolToUse, &newTexture, NULL); poolToUse, &newTexture, NULL);
if (FAILED(result)) if (FAILED(result))
...@@ -1265,10 +1265,10 @@ void GenerateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurfac ...@@ -1265,10 +1265,10 @@ void GenerateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurfac
} }
TextureStorage::TextureStorage(DWORD usage) TextureStorage::TextureStorage(DWORD usage)
: mD3DUsage(usage), : mLodOffset(0),
mD3DUsage(usage),
mD3DPool(getDisplay()->getTexturePool(usage)), mD3DPool(getDisplay()->getTexturePool(usage)),
mTextureSerial(issueTextureSerial()), mTextureSerial(issueTextureSerial())
mLodOffset(0)
{ {
} }
......
...@@ -116,6 +116,6 @@ inline bool isDeviceLostError(HRESULT errorCode) ...@@ -116,6 +116,6 @@ inline bool isDeviceLostError(HRESULT errorCode)
default: default:
return false; return false;
} }
}; }
#endif // LIBGLESV2_UTILITIES_H #endif // LIBGLESV2_UTILITIES_H
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