mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-16 20:20:51 +01:00
Add standard argument checks as part of translator code generation.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@219 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
1f7a4b4566
commit
026193a513
@ -39,6 +39,17 @@ def make_cpptoc_impl_new(name, func, defined_names):
|
||||
|
||||
result += '\n // END DELETE BEFORE MODIFYING'
|
||||
|
||||
# NULL check all pointer arguments.
|
||||
if len(parts['args']) > 0:
|
||||
check = [];
|
||||
for arg in parts['args']:
|
||||
if arg.find('*') >= 0:
|
||||
argname = string.split(arg)[-1];
|
||||
result += '\n DCHECK('+argname+');'
|
||||
check.append('!'+argname);
|
||||
result += '\n if ('+string.join(check,' || ')+')'
|
||||
result += '\n return;'
|
||||
|
||||
result += '\n}\n\n'
|
||||
return result
|
||||
|
||||
|
@ -46,6 +46,9 @@ def make_ctocpp_impl_new(clsname, name, func):
|
||||
|
||||
result += '\n // END DELETE BEFORE MODIFYING'
|
||||
|
||||
result += '\n if (CEF_MEMBER_MISSING(struct_, '+func.get_capi_name()+'))'
|
||||
result += '\n return;'
|
||||
|
||||
result += '\n}\n\n'
|
||||
return result
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user