Fix checking for invalid query enums.

Change-Id: I4cca0f1cf0cc2cd95502769d9653939d6999b8e1
Reviewed-on: https://swiftshader-review.googlesource.com/4507
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libGLES_CM/libGLES_CM.cpp b/src/OpenGL/libGLES_CM/libGLES_CM.cpp
index 98ce971..62b8962 100644
--- a/src/OpenGL/libGLES_CM/libGLES_CM.cpp
+++ b/src/OpenGL/libGLES_CM/libGLES_CM.cpp
@@ -1895,7 +1895,7 @@
 	{

 		if(!(context->getBooleanv(pname, params)))

 		{

-			unsigned int numParams = context->getQueryParameterNum(pname);

+			int numParams = context->getQueryParameterNum(pname);

 

 			if(numParams < 0)

 			{

@@ -1914,7 +1914,7 @@
 

 				context->getFloatv(pname, floatParams);

 

-				for(unsigned int i = 0; i < numParams; ++i)

+				for(int i = 0; i < numParams; ++i)

 				{

 					if(floatParams[i] == 0.0f)

 						params[i] = GL_FALSE;

@@ -1931,7 +1931,7 @@
 

 				context->getIntegerv(pname, intParams);

 

-				for(unsigned int i = 0; i < numParams; ++i)

+				for(int i = 0; i < numParams; ++i)

 				{

 					if(intParams[i] == 0)

 						params[i] = GL_FALSE;

@@ -2027,7 +2027,7 @@
 	{

 		if(!(context->getFloatv(pname, params)))

 		{

-			unsigned int numParams = context->getQueryParameterNum(pname);

+			int numParams = context->getQueryParameterNum(pname);

 

 			if(numParams < 0)

 			{

@@ -2046,7 +2046,7 @@
 

 				context->getBooleanv(pname, boolParams);

 

-				for(unsigned int i = 0; i < numParams; ++i)

+				for(int i = 0; i < numParams; ++i)

 				{

 					if(boolParams[i] == GL_FALSE)

 						params[i] = 0.0f;

@@ -2063,7 +2063,7 @@
 

 				context->getIntegerv(pname, intParams);

 

-				for(unsigned int i = 0; i < numParams; ++i)

+				for(int i = 0; i < numParams; ++i)

 				{

 					params[i] = (GLfloat)intParams[i];

 				}

@@ -2168,7 +2168,7 @@
 	{

 		if(!(context->getIntegerv(pname, params)))

 		{

-			unsigned int numParams = context->getQueryParameterNum(pname);

+			int numParams = context->getQueryParameterNum(pname);

 

 			if(numParams < 0)

 			{

@@ -2187,7 +2187,7 @@
 

 				context->getBooleanv(pname, boolParams);

 

-				for(unsigned int i = 0; i < numParams; ++i)

+				for(int i = 0; i < numParams; ++i)

 				{

 					if(boolParams[i] == GL_FALSE)

 						params[i] = 0;

@@ -2204,7 +2204,7 @@
 

 				context->getFloatv(pname, floatParams);

 

-				for(unsigned int i = 0; i < numParams; ++i)

+				for(int i = 0; i < numParams; ++i)

 				{

 					if(pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE)

 					{