HaxeFoundation / hxcpp

Runtime files for c++ backend for haxe
Other
298 stars 189 forks source link

String::create(wchar_t* ...) is broken on non Windows systems #1077

Open tobil4sk opened 10 months ago

tobil4sk commented 10 months ago

The wchar_t overload for String::create() assumes that wchar_t has a size of two bytes, which is only the case on Windows. On other systems it creates an invalid string if a valid wchar_t* is passed in.

https://github.com/HaxeFoundation/hxcpp/blob/master/src/String.cpp#L465-L519

String::create(wchar_t* ...) should be fixed to work properly on all systems. It might also be useful to have a alloc_string16 function to accompany alloc_string and alloc_wstring.