Merge pull request #396 from SHADE-DP/SP3-6-c-scripting
Fixed issue with ImGui corrupting strings passed to managed data
This commit is contained in:
commit
29d33d45ad
|
@ -308,7 +308,7 @@ namespace SHADE
|
||||||
const bool CHANGED = ImGui::InputText("##", &buffer[0], TEXT_FIELD_MAX_LENGTH);
|
const bool CHANGED = ImGui::InputText("##", &buffer[0], TEXT_FIELD_MAX_LENGTH);
|
||||||
if (CHANGED)
|
if (CHANGED)
|
||||||
{
|
{
|
||||||
value = std::string(buffer.data(), buffer.data() + TEXT_FIELD_MAX_LENGTH);
|
value = std::string(buffer.data(), buffer.data() + std::strlen(buffer.data()));
|
||||||
}
|
}
|
||||||
return CHANGED;
|
return CHANGED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,12 +91,17 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
if (str == nullptr)
|
if (str == nullptr)
|
||||||
return "";
|
return "";
|
||||||
return msclr::interop::marshal_as<std::string>(str);
|
std::string s = msclr::interop::marshal_as<std::string>(str);
|
||||||
|
s.substr(0, str->Length);
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
System::String^ Convert::ToCLI(const std::string& str)
|
System::String^ Convert::ToCLI(const std::string& str)
|
||||||
{
|
{
|
||||||
return msclr::interop::marshal_as<System::String^>(str);
|
if (str.empty())
|
||||||
|
return "";
|
||||||
|
|
||||||
|
return msclr::interop::marshal_as<System::String^>(str)->Substring(0, str.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in New Issue