[Mesa-dev] [PATCH 2/2] glapi: work-around MSVC 65K string length limitation for enums.c

Brian Paul brianp at vmware.com
Tue Dec 1 12:04:32 PST 2015


String literals cannot exceed 65535 characters for MSVC.  Instead of
emiting a string, emit an array of characters.
---
 src/mapi/glapi/gen/gl_enums.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index 6e18f15..7c6c51f 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -156,14 +156,17 @@ _mesa_lookup_prim_by_nr(GLuint nr)
         print '# define LONGSTRING'
         print '#endif'
         print ''
-        print 'LONGSTRING static const char enum_string_table[] = '
+        print 'LONGSTRING static const char enum_string_table[] = {'
         for enum in sorted_enum_values:
             (name, pri) = self.enum_table[enum]
-            print '   "%s\\0"' % (name)
+            for ch in name:
+                print "'%c'," % ch,
+            print "'\\0',"
+
             string_offsets[ enum ] = i
             i += len(name) + 1
 
-        print '   ;'
+        print '};'
         print ''
 
 
-- 
1.9.1



More information about the mesa-dev mailing list