https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d9cbe7dc64773f88060da…
commit d9cbe7dc64773f88060da7ed9dbd2d731fe28ad8
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Feb 9 00:24:21 2020 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Feb 9 00:37:44 2020 +0100
[CONSRV] Fix the definitions of the Console[Input|Output]UnicodeToAnsiChar() and
Console[Input|Output]AnsiToUnicodeChar() macros.
---
win32ss/user/winsrv/consrv/condrv/text.c | 12 ++++++++----
win32ss/user/winsrv/consrv/coninput.c | 14 ++++++++++----
win32ss/user/winsrv/consrv/frontends/terminal.c | 12 ++++++++----
win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c | 6 ++++--
4 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/win32ss/user/winsrv/consrv/condrv/text.c
b/win32ss/user/winsrv/consrv/condrv/text.c
index 92a6f4dfcfa..0d20b94ab94 100644
--- a/win32ss/user/winsrv/consrv/condrv/text.c
+++ b/win32ss/user/winsrv/consrv/condrv/text.c
@@ -25,12 +25,16 @@
* ERROR_INVALID_PARAMETER."
*/
#define ConsoleOutputUnicodeToAnsiChar(Console, dChar, sWChar) \
- ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
- WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL,
NULL)
+do { \
+ ASSERT((ULONG_PTR)(dChar) != (ULONG_PTR)(sWChar)); \
+ WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL,
NULL); \
+} while (0)
#define ConsoleOutputAnsiToUnicodeChar(Console, dWChar, sChar) \
- ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
- MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1)
+do { \
+ ASSERT((ULONG_PTR)(dWChar) != (ULONG_PTR)(sChar)); \
+ MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1); \
+} while (0)
/* PRIVATE FUNCTIONS **********************************************************/
diff --git a/win32ss/user/winsrv/consrv/coninput.c
b/win32ss/user/winsrv/consrv/coninput.c
index 9c441577a07..d8f5b24d9db 100644
--- a/win32ss/user/winsrv/consrv/coninput.c
+++ b/win32ss/user/winsrv/consrv/coninput.c
@@ -19,9 +19,11 @@
#define ConSrvGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
ConSrvGetObject((ProcessData), (Handle), (PCONSOLE_IO_OBJECT*)(Ptr), NULL, \
(Access), (LockConsole), INPUT_BUFFER)
+
#define ConSrvGetInputBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access,
LockConsole) \
ConSrvGetObject((ProcessData), (Handle), (PCONSOLE_IO_OBJECT*)(Ptr), (Entry),
\
(Access), (LockConsole), INPUT_BUFFER)
+
#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked) \
ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
@@ -33,12 +35,16 @@
* ERROR_INVALID_PARAMETER."
*/
#define ConsoleInputUnicodeToAnsiChar(Console, dChar, sWChar) \
- ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
- WideCharToMultiByte((Console)->InputCodePage, 0, (sWChar), 1, (dChar), 1, NULL,
NULL)
+do { \
+ ASSERT((ULONG_PTR)(dChar) != (ULONG_PTR)(sWChar)); \
+ WideCharToMultiByte((Console)->InputCodePage, 0, (sWChar), 1, (dChar), 1, NULL,
NULL); \
+} while (0)
#define ConsoleInputAnsiToUnicodeChar(Console, dWChar, sChar) \
- ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
- MultiByteToWideChar((Console)->InputCodePage, 0, (sChar), 1, (dWChar), 1)
+do { \
+ ASSERT((ULONG_PTR)(dWChar) != (ULONG_PTR)(sChar)); \
+ MultiByteToWideChar((Console)->InputCodePage, 0, (sChar), 1, (dWChar), 1); \
+} while (0)
typedef struct _GET_INPUT_INFO
diff --git a/win32ss/user/winsrv/consrv/frontends/terminal.c
b/win32ss/user/winsrv/consrv/frontends/terminal.c
index bae13a880a2..e6f048215a3 100644
--- a/win32ss/user/winsrv/consrv/frontends/terminal.c
+++ b/win32ss/user/winsrv/consrv/frontends/terminal.c
@@ -34,12 +34,16 @@
* ERROR_INVALID_PARAMETER."
*/
#define ConsoleInputUnicodeCharToAnsiChar(Console, dChar, sWChar) \
- ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
- WideCharToMultiByte((Console)->InputCodePage, 0, (sWChar), 1, (dChar), 1, NULL,
NULL)
+do { \
+ ASSERT((ULONG_PTR)(dChar) != (ULONG_PTR)(sWChar)); \
+ WideCharToMultiByte((Console)->InputCodePage, 0, (sWChar), 1, (dChar), 1, NULL,
NULL); \
+} while (0)
#define ConsoleInputAnsiCharToUnicodeChar(Console, dWChar, sChar) \
- ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
- MultiByteToWideChar((Console)->InputCodePage, 0, (sChar), 1, (dWChar), 1)
+do { \
+ ASSERT((ULONG_PTR)(dWChar) != (ULONG_PTR)(sChar)); \
+ MultiByteToWideChar((Console)->InputCodePage, 0, (sChar), 1, (dWChar), 1); \
+} while (0)
/* PRIVATE FUNCTIONS **********************************************************/
diff --git a/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c
b/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c
index e4874b10df6..fd58595ff69 100644
--- a/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c
+++ b/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c
@@ -29,8 +29,10 @@
/* GLOBALS ********************************************************************/
#define ConsoleOutputUnicodeToAnsiChar(Console, dChar, sWChar) \
- ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
- WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL,
NULL)
+do { \
+ ASSERT((ULONG_PTR)(dChar) != (ULONG_PTR)(sWChar)); \
+ WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL,
NULL); \
+} while (0)
/* TUI Console Window Class name */
#define TUI_CONSOLE_WINDOW_CLASS L"TuiConsoleWindowClass"