Demo: use locally defined strdup because compilers/standard librairies are an annoyance (#520)

This commit is contained in:
ocornut
2016-02-08 08:44:45 +01:00
parent 2c6bc95dd5
commit dafedc3246
2 changed files with 10 additions and 9 deletions

View File

@ -830,10 +830,9 @@ int ImStrnicmp(const char* str1, const char* str2, int count)
char* ImStrdup(const char *str)
{
char *buff = (char*)ImGui::MemAlloc(strlen(str) + 1);
IM_ASSERT(buff);
strcpy(buff, str);
return buff;
size_t len = strlen(str) + 1;
void* buff = ImGui::MemAlloc(len);
return (char*)memcpy(buff, (const void*)str, len);
}
int ImStrlenW(const ImWchar* str)