Fix marshalling of string arrays.

* Affects only ImGui.Combo and ListBox.
internals
Eric Mellino 6 years ago
parent 2e31c95fa0
commit 1eef5c8131
  1. 2
      src/CodeGenerator/Program.cs
  2. 8
      src/ImGui.NET/Generated/ImGui.gen.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("}");

@ -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];

Loading…
Cancel
Save