diff options
author | Erik Faye-Lund <[email protected]> | 2020-06-01 17:23:46 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-20 06:51:54 +0000 |
commit | eda684142050cf54b86f62e147edee921c65fa7e (patch) | |
tree | 953478b1590c38790b04dd267a7b82c55774df96 /src/gallium/auxiliary | |
parent | 04f77595f0bb5adc31e9e0ff2114c1ed5b60371d (diff) |
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5497>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/os/os_process.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/os/os_process.c b/src/gallium/auxiliary/os/os_process.c index a2c859b78b3..f2721a0fb52 100644 --- a/src/gallium/auxiliary/os/os_process.c +++ b/src/gallium/auxiliary/os/os_process.c @@ -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 |