fixed compilation in new getpass method

This commit is contained in:
csoler 2019-09-06 22:51:10 +02:00
parent af65ac1aa8
commit f182b358f4
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 10 additions and 2 deletions

View File

@ -20,12 +20,15 @@
#ifndef __ANDROID__ #ifndef __ANDROID__
#include <util/rskbdinput.h>
#ifdef WINDOWS_SYS #ifdef WINDOWS_SYS
#include <conio.h> #include <conio.h>
#include <stdio.h> #include <stdio.h>
#define PASS_MAX 512 #define PASS_MAX 512
namespace RsUtil {
std::string rs_getpass(const std::string& prompt,bool no_echo) std::string rs_getpass(const std::string& prompt,bool no_echo)
{ {
static char getpassbuf [PASS_MAX + 1]; static char getpassbuf [PASS_MAX + 1];
@ -60,6 +63,7 @@ std::string rs_getpass(const std::string& prompt,bool no_echo)
return std::string(getpassbuf); return std::string(getpassbuf);
} }
}
#else #else
#include <stdio.h> #include <stdio.h>
@ -84,7 +88,9 @@ static int getch()
return ch; return ch;
} }
std::string rs_getpass(const char *prompt, bool no_echo) namespace RsUtil {
std::string rs_getpass(const std::string& prompt, bool no_echo)
{ {
const char BACKSPACE=127; const char BACKSPACE=127;
const char RETURN=10; const char RETURN=10;
@ -118,6 +124,6 @@ std::string rs_getpass(const char *prompt, bool no_echo)
return std::string(password); return std::string(password);
} }
}
#endif #endif
#endif #endif

View File

@ -18,6 +18,8 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include <string>
namespace RsUtil { namespace RsUtil {
std::string rs_getpass(const std::string& prompt,bool no_echo=true) ; std::string rs_getpass(const std::string& prompt,bool no_echo=true) ;