[Piglit] [PATCH 13/29] glapi: Make non integer enums to have zero int value

Pauli Nieminen pauli.nieminen at linux.intel.com
Mon May 21 11:08:48 PDT 2012


EGL has enums with type cast. We could try to parse the type cats to
real integer value but those are very few so it makes more sense to
short them first with int value zero.

Signed-off-by: Pauli Nieminen <pauli.nieminen at linux.intel.com>
---
 glapi/parse_glspec.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/glapi/parse_glspec.py b/glapi/parse_glspec.py
index 16842a6..d2be059 100644
--- a/glapi/parse_glspec.py
+++ b/glapi/parse_glspec.py
@@ -153,7 +153,10 @@ def decode_enum_value(value_str):
         if value_str.endswith(suffix):
             value_str = value_str[:-len(suffix)]
             break
-    return int(value_str, 0)
+    try:
+	return int(value_str, 0)
+    except:
+	return 0
 
 
 # Convert an object to a form that can be serialized to JSON.  Python
-- 
1.7.5.4



More information about the Piglit mailing list