]> sigrok.org Git - libserialport.git/commit - serialport.c
windows: Use correct variant of FormatMessage.
authorMartin Ling <redacted>
Fri, 24 Jan 2020 04:30:22 +0000 (04:30 +0000)
committerMartin Ling <redacted>
Fri, 24 Jan 2020 05:39:16 +0000 (05:39 +0000)
commitbf40b1cea9eb2e13d13f05118fe11b43be621485
treed25d332a1bce0fd1b2eb25a2613431af7cf512fc
parente47c7dcbffa04583d1e94d9c359784fc14a59d88
windows: Use correct variant of FormatMessage.

When built with MSVC and unicode enabled, using 'message' gave:

warning C4133: 'initializing': incompatible types - from 'TCHAR *' to 'char *'

FormatMessage expands to either FormatMessageA or FormatMessageW
depending if unicode is enabled, and generates either a char (8-bit)
or WCHAR (UTF-16) string accordingly.

Since sp_last_error_message() returns char *, we must use the 8-bit
variant. The message will be encoded in the current code page.
serialport.c