Module: wine Branch: master Commit: 2ecb8713109225db8e009bbf08e16716365c05e1 URL: https://source.winehq.org/git/wine.git/?a=commit;h=2ecb8713109225db8e009bbf0...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Dec 1 17:25:25 2020 +0100
cmd: Don't use WCMD_is_console_handle.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
programs/cmd/batch.c | 5 ++--- programs/cmd/wcmd.h | 4 ---- programs/cmd/wcmdmain.c | 5 ++--- 3 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c index 37cdff42188..2ff8e3ba9be 100644 --- a/programs/cmd/batch.c +++ b/programs/cmd/batch.c @@ -249,7 +249,7 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h) /* We can't use the native f* functions because of the filename syntax differences between DOS and Unix. Also need to lose the LF (or CRLF) from the line. */
- if (!WCMD_is_console_handle(h)) { + if (!ReadConsoleW(h, buf, noChars, &charsRead, NULL)) { LARGE_INTEGER filepos; char *bufA; UINT cp; @@ -282,8 +282,7 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h) heap_free(bufA); } else { - status = WCMD_ReadFile(h, buf, noChars, &charsRead); - if (!status || charsRead == 0) return NULL; + if (!charsRead) return NULL;
/* Find first EOL */ for (i = 0; i < charsRead; i++) { diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h index 65a89ac26d7..468a29102d7 100644 --- a/programs/cmd/wcmd.h +++ b/programs/cmd/wcmd.h @@ -105,10 +105,6 @@ void WCMD_version (void); int WCMD_volume (BOOL set_label, const WCHAR *args); void WCMD_mklink(WCHAR *args);
-static inline BOOL WCMD_is_console_handle(HANDLE h) -{ - return (((DWORD_PTR)h) & 3) == 3; -} WCHAR *WCMD_fgets (WCHAR *buf, DWORD n, HANDLE stream); WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **start, BOOL raw, BOOL wholecmdline); WCHAR *WCMD_parameter_with_delims (WCHAR *s, int n, WCHAR **start, BOOL raw, diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index cacb7ea7751..fbe8475d8a9 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -221,9 +221,8 @@ BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars, LPDWO DWORD numRead; char *buffer;
- if (WCMD_is_console_handle(hIn)) - /* Try to read from console as Unicode */ - return ReadConsoleW(hIn, intoBuf, maxChars, charsRead, NULL); + /* Try to read from console as Unicode */ + if (ReadConsoleW(hIn, intoBuf, maxChars, charsRead, NULL)) return TRUE;
/* We assume it's a file handle and read then convert from assumed OEM codepage */ if (!(buffer = get_file_buffer()))