discord / discord-rpc

https://discordapp.com/developers
MIT License
1.06k stars 329 forks source link

Broken vsnwprintf() #274

Open IceNinjaman opened 5 years ago

IceNinjaman commented 5 years ago

https://github.com/discordapp/discord-rpc/blob/c59fd6df20c6904ab39f026e87af1dd90fcac7ff/src/discord_register_win.cpp#L10

Including this headerfile "cwchar" on compiler MinGW-w64-i686-5.3.0-win32-dwarf will break vsnwprintf(). Including wchar.h instead of it will fix this issue.

msciotti commented 5 years ago

Sure, we can do that. As long as it doesn't break other stuff. If you'd like to PR that, it'd be very helpful!

janisozaur commented 5 years ago

I'm curious why exactly does it break and how come including the other header fixes that? Can you provide relevant error message and header contents?

IceNinjaman commented 5 years ago

I have no idea why it behaves like it does. I can only see the symptoms. The main symptom is: wchar_t protocolName = L"discord-4353453"; StringCbPrintfW(keyName, sizeof(keyName), L"Software\Classes\%s", protocolName);

Will result in the following output string: "Software\Classes\d" %s is truncate to first character.

What side effect including wchar.h instead of cwchar for other compilers have is beyond my knowledge