aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobin@lunarg.com>2014-12-18 09:29:58 -0700
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-02-04 17:58:05 -0700
commitc78ab5fdd02798fa1719081c1997ab733c455161 (patch)
tree3d49b21f45ea8e2f1bc88c536f5367fc70fffb86
parent827e83cabc30729428d3fa7f635f77c616947312 (diff)
downloadusermoji-c78ab5fdd02798fa1719081c1997ab733c455161.tar.xz
layers: Validate structs embedded in structs
-rwxr-xr-xxgl_helper.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/xgl_helper.py b/xgl_helper.py
index 4965121a..73bc07d1 100755
--- a/xgl_helper.py
+++ b/xgl_helper.py
@@ -891,8 +891,11 @@ class StructWrapperGen:
if is_type(self.struct_dict[s][m]['type'], 'enum'):
sh_funcs.append(' if (!validate_%s(pStruct->%s))\n return 0;' % (self.struct_dict[s][m]['type'], self.struct_dict[s][m]['name']))
# TODO : Need a little refinement to this code to make sure type of struct matches expected input (ptr, const...)
- #if is_type(self.struct_dict[s][m]['type'], 'struct'):
- # sh_funcs.append(' if (!%s((%s)pStruct->%s))\n return 0;' % (self._get_vh_func_name(self.struct_dict[s][m]['type']), self.struct_dict[s][m]['full_type'], self.struct_dict[s][m]['name']))
+ if is_type(self.struct_dict[s][m]['type'], 'struct'):
+ if (self.struct_dict[s][m]['ptr']):
+ sh_funcs.append(' if (!%s((const %s*)pStruct->%s))\n return 0;' % (self._get_vh_func_name(self.struct_dict[s][m]['type']), self.struct_dict[s][m]['type'], self.struct_dict[s][m]['name']))
+ else:
+ sh_funcs.append(' if (!%s((const %s*)&pStruct->%s))\n return 0;' % (self._get_vh_func_name(self.struct_dict[s][m]['type']), self.struct_dict[s][m]['type'], self.struct_dict[s][m]['name']))
sh_funcs.append(" return 1;\n}")
return "\n".join(sh_funcs)