diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-06-30 01:22:05 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-06-30 01:22:05 +0200 |
commit | 96974169199d347172fc5d4a2924f092d602b3de (patch) | |
tree | 627633460b7e830d7a4dcb58de37733d84742e46 /src/Main/TextUserInterface.cpp | |
parent | 1e7d6948c991e8c0153fdbf06d82844595c138f8 (diff) | |
download | VeraCrypt-96974169199d347172fc5d4a2924f092d602b3de.tar.gz VeraCrypt-96974169199d347172fc5d4a2924f092d602b3de.zip |
Linux: Make the C++ code compatible with old compilers (g++ 4.4.7 on CentOS 6)
Diffstat (limited to 'src/Main/TextUserInterface.cpp')
-rw-r--r-- | src/Main/TextUserInterface.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index 3346ee3e..46559dfa 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -30,6 +30,27 @@ namespace VeraCrypt { + class AdminPasswordRequestHandler : public GetStringFunctor + { + public: + AdminPasswordRequestHandler (TextUserInterface *userInterface) : UI (userInterface) { } + virtual void operator() (string &passwordStr) + { + UI->ShowString (_("Enter your user password or administrator password: ")); + + TextUserInterface::SetTerminalEcho (false); + finally_do ({ TextUserInterface::SetTerminalEcho (true); }); + + wstring wPassword (UI->ReadInputStreamLine()); + finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); }); + + UI->ShowString (L"\n"); + + StringConverter::ToSingle (wPassword, passwordStr); + } + TextUserInterface *UI; + }; + TextUserInterface::TextUserInterface () { #ifdef TC_UNIX @@ -1095,26 +1116,6 @@ namespace VeraCrypt shared_ptr <GetStringFunctor> TextUserInterface::GetAdminPasswordRequestHandler () { - struct AdminPasswordRequestHandler : public GetStringFunctor - { - AdminPasswordRequestHandler (TextUserInterface *userInterface) : UI (userInterface) { } - virtual void operator() (string &passwordStr) - { - UI->ShowString (_("Enter your user password or administrator password: ")); - - TextUserInterface::SetTerminalEcho (false); - finally_do ({ TextUserInterface::SetTerminalEcho (true); }); - - wstring wPassword (UI->ReadInputStreamLine()); - finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); }); - - UI->ShowString (L"\n"); - - StringConverter::ToSingle (wPassword, passwordStr); - } - TextUserInterface *UI; - }; - return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler (this)); } |