v2: Use == not is for equality testing (Dylan Baker)
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
# FIXME adds some extra diffs to the generated
# FIXME code.
# FIXME adds some extra diffs to the generated
# FIXME code.
- size_string = size_string + " + __GLX_PAD(%s)" % (p.size_string(1))
+ size_string = size_string + " + safe_pad(%s)" % (p.size_string(1))
print '#include "indirect_util.h"'
print '#include "singlesize.h"'
print ''
print '#include "indirect_util.h"'
print '#include "singlesize.h"'
print ''
- print '#define __GLX_PAD(x) (((x) + 3) & ~3)'
- print ''
print 'typedef struct {'
print ' __GLX_PIXEL_3D_HDR;'
print '} __GLXpixel3DHeader;'
print 'typedef struct {'
print ' __GLX_PIXEL_3D_HDR;'
print '} __GLXpixel3DHeader;'
print '#include <xcb/glx.h>'
print '#include <limits.h>'
print '#include <xcb/glx.h>'
print '#include <limits.h>'
- print ''
- print '#define __GLX_PAD(n) (((n) + 3) & ~3)'
print ''
self.printFastcall()
self.printNoinline()
print ''
self.printFastcall()
self.printNoinline()
print ''
print ' compsize = __gl%s_size(%s);' % (f.name, string.join(f.count_parameter_list, ","))
p = f.variable_length_parameter()
print ''
print ' compsize = __gl%s_size(%s);' % (f.name, string.join(f.count_parameter_list, ","))
p = f.variable_length_parameter()
- print ' return __GLX_PAD(%s);' % (p.size_string())
+ print ' return safe_pad(%s);' % (p.size_string())
def printBody(self, api):
for func in api.functionIterateGlx():
if not func.ignore and func.has_variable_size_request():
def printBody(self, api):
for func in api.functionIterateGlx():
if not func.ignore and func.has_variable_size_request():
- print 'extern PURE _X_HIDDEN int __glX%sReqSize(const GLbyte *pc, Bool swap);' % (func.name)
+ print 'extern PURE _X_HIDDEN int __glX%sReqSize(const GLbyte *pc, Bool swap, int reqlen);' % (func.name)
class PrintGlxReqSize_c(PrintGlxReqSize_common):
class PrintGlxReqSize_c(PrintGlxReqSize_common):
print '#include "indirect_size.h"'
print '#include "indirect_reqsize.h"'
print ''
print '#include "indirect_size.h"'
print '#include "indirect_reqsize.h"'
print ''
- print '#define __GLX_PAD(x) (((x) + 3) & ~3)'
- print ''
print '#if defined(__CYGWIN__) || defined(__MINGW32__)'
print '# undef HAVE_ALIAS'
print '#endif'
print '#ifdef HAVE_ALIAS'
print '# define ALIAS2(from,to) \\'
print '#if defined(__CYGWIN__) || defined(__MINGW32__)'
print '# undef HAVE_ALIAS'
print '#endif'
print '#ifdef HAVE_ALIAS'
print '# define ALIAS2(from,to) \\'
- print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \\'
+ print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \\'
print ' __attribute__ ((alias( # to )));'
print '# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize )'
print '#else'
print '# define ALIAS(from,to) \\'
print ' __attribute__ ((alias( # to )));'
print '# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize )'
print '#else'
print '# define ALIAS(from,to) \\'
- print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \\'
- print ' { return __glX ## to ## ReqSize( pc, swap ); }'
+ print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \\'
+ print ' { return __glX ## to ## ReqSize( pc, swap, reqlen ); }'
print '#endif'
print ''
print ''
print '#endif'
print ''
print ''
def common_func_print_just_header(self, f):
print 'int'
def common_func_print_just_header(self, f):
print 'int'
- print '__glX%sReqSize( const GLbyte * pc, Bool swap )' % (f.name)
+ print '__glX%sReqSize( const GLbyte * pc, Bool swap, int reqlen )' % (f.name)
offset = 0
fixup = []
params = []
offset = 0
fixup = []
params = []
size = ''
param_offsets = {}
size = ''
param_offsets = {}
if s == 0: s = 1
sig += "(%u,%u)" % (f.offset_of(p.counter), s)
if s == 0: s = 1
sig += "(%u,%u)" % (f.offset_of(p.counter), s)
- size += '%s%s' % (plus, p.size_string())
- plus = ' + '
-
+ if size == '':
+ size = p.size_string()
+ else:
+ size = "safe_add(%s, %s)" % (size, p.size_string())
# If the calculated signature matches a function that has
# already be emitted, don't emit this function. Instead, add
# If the calculated signature matches a function that has
# already be emitted, don't emit this function. Instead, add
self.common_emit_fixups(fixup)
print ''
self.common_emit_fixups(fixup)
print ''
- print ' return __GLX_PAD(%s);' % (size)
+ print ' return safe_pad(%s);' % (size)
list.append( str(s) )
if len(list) > 1 and use_parens :
list.append( str(s) )
if len(list) > 1 and use_parens :
- return "(%s)" % (string.join(list, " * "))
+ return "safe_mul(%s)" % (string.join(list, ", "))
else:
return string.join(list, " * ")
else:
return string.join(list, " * ")