summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-12-06 07:58:49 +1100
committer Vas Crabb <vas@vastheman.com>2023-12-06 07:58:49 +1100
commit79bef1e23049fdac25f1fefd132e0b6c7d2cc3a1 (patch)
tree643e9313fe86f583c4022c338677cbc12b761df7 /3rdparty/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp
parent512ccf0c7c9b4f08e41038b2ed2de220e140385b (diff)
3rdparty/lzma: Updated to version 23.01.
Diffstat (limited to '3rdparty/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp')
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/3rdparty/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp b/3rdparty/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp
index 93f60eb291a..04d675e6f83 100644
--- a/3rdparty/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp
@@ -73,19 +73,26 @@ static bool GetPassword(CStdOutStream *outStream, UString &psw)
#ifdef MY_DISABLE_ECHO
- HANDLE console = GetStdHandle(STD_INPUT_HANDLE);
+ const HANDLE console = GetStdHandle(STD_INPUT_HANDLE);
+
+ /*
+ GetStdHandle() returns
+ INVALID_HANDLE_VALUE: If the function fails.
+ NULL : If an application does not have associated standard handles,
+ such as a service running on an interactive desktop,
+ and has not redirected them. */
bool wasChanged = false;
DWORD mode = 0;
- if (console != INVALID_HANDLE_VALUE && console != 0)
+ if (console != INVALID_HANDLE_VALUE && console != NULL)
if (GetConsoleMode(console, &mode))
wasChanged = (SetConsoleMode(console, mode & ~(DWORD)ENABLE_ECHO_INPUT) != 0);
- bool res = g_StdIn.ScanUStringUntilNewLine(psw);
+ const bool res = g_StdIn.ScanUStringUntilNewLine(psw);
if (wasChanged)
SetConsoleMode(console, mode);
#else
- bool res = g_StdIn.ScanUStringUntilNewLine(psw);
+ const bool res = g_StdIn.ScanUStringUntilNewLine(psw);
#endif