Commit d39bf998 by Nicolas Capens

Fix potentially uninitialized variable warning.

Change-Id: I29172c0c5423750db2665c350746b82fd2a34653 Reviewed-on: https://swiftshader-review.googlesource.com/5181Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent ab752790
...@@ -20,8 +20,8 @@ namespace es2 ...@@ -20,8 +20,8 @@ namespace es2
{ {
Query::Query(GLuint name, GLenum type) : NamedObject(name) Query::Query(GLuint name, GLenum type) : NamedObject(name)
{ {
mQuery = NULL; mQuery = nullptr;
mStatus = GL_FALSE; mStatus = GL_FALSE;
mResult = GL_FALSE; mResult = GL_FALSE;
mType = type; mType = type;
...@@ -29,7 +29,7 @@ Query::Query(GLuint name, GLenum type) : NamedObject(name) ...@@ -29,7 +29,7 @@ Query::Query(GLuint name, GLenum type) : NamedObject(name)
Query::~Query() Query::~Query()
{ {
if(mQuery != NULL) if(mQuery)
{ {
delete mQuery; delete mQuery;
} }
...@@ -37,7 +37,7 @@ Query::~Query() ...@@ -37,7 +37,7 @@ Query::~Query()
void Query::begin() void Query::begin()
{ {
if(mQuery == NULL) if(!mQuery)
{ {
sw::Query::Type type; sw::Query::Type type;
switch(mType) switch(mType)
...@@ -50,7 +50,8 @@ void Query::begin() ...@@ -50,7 +50,8 @@ void Query::begin()
type = sw::Query::TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN; type = sw::Query::TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN;
break; break;
default: default:
ASSERT(false); UNREACHABLE(mType);
return;
} }
mQuery = new sw::Query(type); mQuery = new sw::Query(type);
...@@ -81,7 +82,7 @@ void Query::begin() ...@@ -81,7 +82,7 @@ void Query::begin()
void Query::end() void Query::end()
{ {
if(mQuery == NULL) if(!mQuery)
{ {
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
...@@ -109,7 +110,7 @@ void Query::end() ...@@ -109,7 +110,7 @@ void Query::end()
GLuint Query::getResult() GLuint Query::getResult()
{ {
if(mQuery != NULL) if(mQuery)
{ {
while(!testQuery()) while(!testQuery())
{ {
...@@ -122,11 +123,11 @@ GLuint Query::getResult() ...@@ -122,11 +123,11 @@ GLuint Query::getResult()
GLboolean Query::isResultAvailable() GLboolean Query::isResultAvailable()
{ {
if(mQuery != NULL) if(mQuery)
{ {
testQuery(); testQuery();
} }
return mStatus; return mStatus;
} }
...@@ -137,7 +138,7 @@ GLenum Query::getType() const ...@@ -137,7 +138,7 @@ GLenum Query::getType() const
GLboolean Query::testQuery() GLboolean Query::testQuery()
{ {
if(mQuery != NULL && mStatus != GL_TRUE) if(mQuery != nullptr && mStatus != GL_TRUE)
{ {
if(!mQuery->building && mQuery->reference == 0) if(!mQuery->building && mQuery->reference == 0)
{ {
...@@ -157,10 +158,10 @@ GLboolean Query::testQuery() ...@@ -157,10 +158,10 @@ GLboolean Query::testQuery()
ASSERT(false); ASSERT(false);
} }
} }
return mStatus; return mStatus;
} }
return GL_TRUE; // Prevent blocking when query is null return GL_TRUE; // Prevent blocking when query is nullptr
} }
} }
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