зеркало из https://github.com/github/putty.git
testcrypt.py: look past 'opt_' prefix on argument types.
When testcrypt.h lists a function argument as 'opt_val_foo', it means that the argument is optional in the sense that the C function can take a null pointer in place of a valid foo, and so the Python wrapper module should accept None in the corresponding argument slot from the client code and translate it into the special string "NULL" in the wire protocol. This works fine at argument translation time, but the code that reads testcrypt.h wasn't looking at it, so if you said 'opt_val_foo_suffix' in place of 'opt_val_foo' (indicating that that argument is optional _and_ the C function expects it in a translated form), then the initial pass over testcrypt.h wouldn't strip the _suffix, and would set up data structures with mismatched type names.
This commit is contained in:
Родитель
5afefef798
Коммит
47ca2e98a5
|
@ -190,9 +190,13 @@ def _setup(scope):
|
|||
prefix, suffix = "FUNC(", ")"
|
||||
valprefix = "val_"
|
||||
outprefix = "out_"
|
||||
optprefix = "opt_"
|
||||
consprefix = "consumed_"
|
||||
|
||||
def trim_argtype(arg):
|
||||
if arg.startswith(optprefix):
|
||||
return optprefix + trim_argtype(arg[len(optprefix):])
|
||||
|
||||
if (arg.startswith(valprefix) and
|
||||
"_" in arg[len(valprefix):]):
|
||||
# Strip suffixes like val_string_asciz
|
||||
|
|
Загрузка…
Ссылка в новой задаче