Not not allow the app to query uniform locations of basic types with "[0]" appended to the uniform name.

TRAC #22865

Signed-off-by: Geoff Lang
Signed-off-by: Shannon Woods
Author: Jamie Madill

git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2295 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp
index cf188ec..21c778f 100644
--- a/src/libGLESv2/ProgramBinary.cpp
+++ b/src/libGLESv2/ProgramBinary.cpp
@@ -223,7 +223,7 @@
 
 GLint ProgramBinary::getUniformLocation(std::string name)
 {
-    unsigned int subscript = 0;
+    unsigned int subscript = GL_INVALID_INDEX;
 
     // Strip any trailing array operator and retrieve the subscript
     size_t open = name.find_last_of('[');
@@ -237,10 +237,16 @@
     unsigned int numUniforms = mUniformIndex.size();
     for (unsigned int location = 0; location < numUniforms; location++)
     {
-        if (mUniformIndex[location].name == name &&
-            mUniformIndex[location].element == subscript)
+        if (mUniformIndex[location].name == name)
         {
-            return location;
+            const int index = mUniformIndex[location].index;
+            const bool isArray = mUniforms[index]->isArray();
+
+            if ((isArray && mUniformIndex[location].element == subscript) || 
+                (subscript == GL_INVALID_INDEX))
+            {
+                return location;
+            }
         }
     }