From 1eef5c8131ccd94199c16de18904932527fc3161 Mon Sep 17 00:00:00 2001 From: Eric Mellino Date: Sat, 17 Nov 2018 15:30:26 -0800 Subject: [PATCH] Fix marshalling of string arrays. * Affects only ImGui.Combo and ListBox. --- src/CodeGenerator/Program.cs | 2 +- src/ImGui.NET/Generated/ImGui.gen.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CodeGenerator/Program.cs b/src/CodeGenerator/Program.cs index 718d479..5711383 100644 --- a/src/CodeGenerator/Program.cs +++ b/src/CodeGenerator/Program.cs @@ -660,8 +660,8 @@ namespace CodeGenerator preCallLines.Add($" fixed (char* sPtr = s)"); preCallLines.Add(" {"); preCallLines.Add($" offset += Encoding.UTF8.GetBytes(sPtr, s.Length, {nativeArgName}_data + offset, {correctedIdentifier}_byteCounts[i]);"); - preCallLines.Add($" offset += 1;"); preCallLines.Add($" {nativeArgName}_data[offset] = 0;"); + preCallLines.Add($" offset += 1;"); preCallLines.Add(" }"); preCallLines.Add("}"); diff --git a/src/ImGui.NET/Generated/ImGui.gen.cs b/src/ImGui.NET/Generated/ImGui.gen.cs index 327d4c5..28a413c 100644 --- a/src/ImGui.NET/Generated/ImGui.gen.cs +++ b/src/ImGui.NET/Generated/ImGui.gen.cs @@ -77,8 +77,8 @@ namespace ImGuiNET fixed (char* sPtr = s) { offset += Encoding.UTF8.GetBytes(sPtr, s.Length, native_items_data + offset, items_byteCounts[i]); - offset += 1; native_items_data[offset] = 0; + offset += 1; } } byte** native_items = stackalloc byte*[items.Length]; @@ -126,8 +126,8 @@ namespace ImGuiNET fixed (char* sPtr = s) { offset += Encoding.UTF8.GetBytes(sPtr, s.Length, native_items_data + offset, items_byteCounts[i]); - offset += 1; native_items_data[offset] = 0; + offset += 1; } } byte** native_items = stackalloc byte*[items.Length]; @@ -4901,8 +4901,8 @@ namespace ImGuiNET fixed (char* sPtr = s) { offset += Encoding.UTF8.GetBytes(sPtr, s.Length, native_items_data + offset, items_byteCounts[i]); - offset += 1; native_items_data[offset] = 0; + offset += 1; } } byte** native_items = stackalloc byte*[items.Length]; @@ -4950,8 +4950,8 @@ namespace ImGuiNET fixed (char* sPtr = s) { offset += Encoding.UTF8.GetBytes(sPtr, s.Length, native_items_data + offset, items_byteCounts[i]); - offset += 1; native_items_data[offset] = 0; + offset += 1; } } byte** native_items = stackalloc byte*[items.Length];