Fixing CS wrapper

This commit is contained in:
Erwan Croze 2017-09-26 11:04:44 +02:00
parent ddd0805222
commit 216d252c4d
2 changed files with 4 additions and 4 deletions

View file

@ -87,7 +87,7 @@ class CsharpTranslator(object):
return 'void'
elif _type.name == 'boolean':
if dllImport:
res = 'int' # In C the bool_t is an integer
res = 'char'
else:
res = 'bool'
elif _type.name == 'integer':
@ -223,7 +223,7 @@ class CsharpTranslator(object):
else:
methodDict['impl']['c_args'] += '(int)' + self.translate_argument_name(arg.name)
elif self.translate_type(arg.type, False, False) == "bool":
methodDict['impl']['c_args'] += self.translate_argument_name(arg.name) + " ? 1 : 0"
methodDict['impl']['c_args'] += self.translate_argument_name(arg.name) + " ? '1' : '0'"
elif self.get_class_array_type(self.translate_type(arg.type, False, False)) is not None:
listtype = self.get_class_array_type(self.translate_type(arg.type, False, False))
if listtype == 'string':

View file

@ -484,7 +484,7 @@ namespace Linphone
{{#exception}}if (exception_result != 0) throw new LinphoneException("{{property_name}} setter returned value " + exception_result);{{/exception}}
{{/is_string}}
{{#is_bool}}
{{#exception}}int exception_result = {{/exception}}{{setter_c_name}}({{setter_nativePtr}}value ? 1 : 0);
{{#exception}}int exception_result = {{/exception}}{{setter_c_name}}({{setter_nativePtr}}value ? '1' : '0');
{{#exception}}if (exception_result != 0) throw new LinphoneException("{{property_name}} setter returned value " + exception_result);{{/exception}}
{{/is_bool}}
{{#is_class}}
@ -525,7 +525,7 @@ namespace Linphone
return Marshal.PtrToStringAnsi(stringPtr);
{{/is_string}}
{{#is_bool}}
{{return}}{{c_name}}({{nativePtr}}{{c_args}}) == 0 ? false : true;
{{return}}{{c_name}}({{nativePtr}}{{c_args}}) == '0' ? false : true;
{{/is_bool}}
{{#is_class}}
IntPtr ptr = {{c_name}}({{nativePtr}}{{c_args}});