gallium/os: call "ANSI" version of GetCommandLine
The GetCommandLine API comes in two versions, GetCommandLineA (which
returns "ANSI" results), and GetCommandLineW which returns UTF-16
("WIDE") results. Then finally, windows.h provides a wrapper-macro that
defines GetCommandLine to either of the two, based on the setting of
the UNICODE macro.
More information about this mechanism can be found here:
https://docs.microsoft.com/en-us/windows/win32/intl/unicode-in-the-windows-api
For some reason, the UNICODE macro is set during build, even if we're
not explicitly setting it. This leads to us trying to cast a UTF-16
result to a char-pointer, which is obviously not going to do the right
thing.
So let's be defensive, and just call GetCommandLineA directly instead.
This avoids us depending on the setting of the UNICODE-macro in the
first place.
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5497>
This commit is contained in:
committed by
Marge Bot
parent
04f77595f0
commit
eda6841420
@@ -113,7 +113,7 @@ boolean
|
||||
os_get_command_line(char *cmdline, size_t size)
|
||||
{
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
const char *args = GetCommandLine();
|
||||
const char *args = GetCommandLineA();
|
||||
if (args) {
|
||||
strncpy(cmdline, args, size);
|
||||
// make sure we terminate the string
|
||||
|
||||
Reference in New Issue
Block a user