Commit d42bc9ac authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixed issue in C# wrapper for methods returning a bctbx_list_t of string

parent c7d207c8
Pipeline #229 failed with stage
in 0 seconds
......@@ -194,17 +194,21 @@ namespace Linphone
return null;
}
internal static IEnumerable<string> MarshalStringArray(IntPtr arrayPtr)
internal static IEnumerable<string> MarshalStringArray(IntPtr listPtr)
{
if (arrayPtr != IntPtr.Zero)
if (listPtr != IntPtr.Zero)
{
IntPtr ptr = Marshal.ReadIntPtr(arrayPtr);
IntPtr ptr = listPtr;
while (ptr != IntPtr.Zero)
{
string key = Marshal.PtrToStringAnsi(ptr);
IntPtr dataPtr = bctbx_list_get_data(ptr);
if (dataPtr == IntPtr.Zero)
{
break;
}
string key = Marshal.PtrToStringAuto(dataPtr);
yield return key;
arrayPtr = new IntPtr(arrayPtr.ToInt64() + IntPtr.Size);
ptr = Marshal.ReadIntPtr(arrayPtr);
ptr = bctbx_list_next(ptr);
}
}
}
......@@ -391,7 +395,7 @@ namespace Linphone
{
get
{
return Marshal.PtrToStringUni(linphone_call_get_native_video_window_id(nativePtr));
return Marshal.PtrToStringAuto(linphone_call_get_native_video_window_id(nativePtr));
}
set
{
......@@ -406,7 +410,7 @@ namespace Linphone
{
get
{
return Marshal.PtrToStringUni(linphone_core_get_native_video_window_id(nativePtr));
return Marshal.PtrToStringAuto(linphone_core_get_native_video_window_id(nativePtr));
}
set
{
......@@ -419,7 +423,7 @@ namespace Linphone
{
get
{
return Marshal.PtrToStringUni(linphone_core_get_native_preview_window_id(nativePtr));
return Marshal.PtrToStringAuto(linphone_core_get_native_preview_window_id(nativePtr));
}
set
{
......@@ -448,7 +452,7 @@ namespace Linphone
{
{{#is_string}}
IntPtr stringPtr = {{getter_c_name}}({{getter_nativePtr}});
return Marshal.PtrToStringAnsi(stringPtr);
return Marshal.PtrToStringAuto(stringPtr);
{{/is_string}}
{{#is_bool}}
return {{getter_c_name}}({{getter_nativePtr}}) != 0;
......@@ -517,7 +521,7 @@ namespace Linphone
{
{{#is_string}}
IntPtr stringPtr = {{c_name}}({{nativePtr}}{{c_args}});
return Marshal.PtrToStringAnsi(stringPtr);
return Marshal.PtrToStringAuto(stringPtr);
{{/is_string}}
{{#is_bool}}
{{return}}{{c_name}}({{nativePtr}}{{c_args}}) == (char)0 ? false : true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment