- Revert: Change index parameter types from int to size_t to make 0-based range implicit.

- Add checks that index values are >= 0.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@409 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-12-08 10:22:15 +00:00
parent 64e08c2918
commit ef64033467
15 changed files with 137 additions and 51 deletions

View File

@ -118,7 +118,15 @@ def make_ctocpp_function_impl_new(clsname, name, func):
result += comment+\
'\n DCHECK(!'+arg_name+'.empty());'\
'\n if ('+arg_name+'.empty())'\
'\n return'+retval_default+';'
'\n return'+retval_default+';'
# check index params
index_params = arg.parent.get_attrib_list('index_param')
if not index_params is None and arg_name in index_params:
result += comment+\
'\n DCHECK('+arg_name+' >= 0);'\
'\n if ('+arg_name+' < 0)'\
'\n return'+retval_default+';'
if len(optional) > 0:
result += '\n // Unverified params: '+string.join(optional,', ')