discord-rpc icon indicating copy to clipboard operation
discord-rpc copied to clipboard

Broken vsnwprintf()

Open IceNinjaman opened this issue 6 years ago • 3 comments

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.

IceNinjaman avatar Feb 21 '19 23:02 IceNinjaman

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!

msciotti avatar Feb 22 '19 16:02 msciotti

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?

janisozaur avatar Feb 22 '19 18:02 janisozaur

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

IceNinjaman avatar Feb 28 '19 12:02 IceNinjaman