vrclient: Allocate memory for every path conversion.

CW-Bug-Id: #22729
This commit is contained in:
Rémi Bernon
2023-09-24 15:30:59 +02:00
committed by Arkadiusz Hiler
parent 1e11264606
commit 87a65c1993
10 changed files with 192 additions and 176 deletions

View File

@ -514,8 +514,7 @@ def handle_method_c(klass, method, winclassname, cppname, out):
path_conv_wtou = PATH_CONV_METHODS_WTOU.get(f'{klass.spelling}_{method.spelling}', {})
for name in filter(lambda x: x in names, sorted(path_conv_wtou)):
out(f' char lin_{name}[PATH_MAX];\n')
out(f' vrclient_dos_path_to_unix_path({name}, lin_{name});\n')
out(f' const char *u_{name} = vrclient_dos_to_unix_path( {name} );\n')
out(u' TRACE("%p\\n", _this);\n')
@ -533,7 +532,7 @@ def handle_method_c(klass, method, winclassname, cppname, out):
def param_call(param, name):
if name == '_this': return '_this->u_iface'
if name in path_conv_wtou: return f'{name} ? lin_{name} : NULL'
if name in path_conv_wtou: return f'u_{name}'
return name
params = ['_this'] + list(method.get_arguments())
@ -547,6 +546,9 @@ def handle_method_c(klass, method, winclassname, cppname, out):
out(u'_ret = ')
out(f'vrclient_unix_path_to_dos_path(_ret, {name}, {name}, {conv["len"]});\n')
for name in filter(lambda x: x in names, sorted(path_conv_wtou)):
out(f' vrclient_free_path( u_{name} );\n')
if not returns_void:
out(u' return _ret;\n')
out(u'}\n\n')