X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;ds=inline;f=src%2Fapps%2FPswGen%2FCLI%2Fcli.cpp;h=b27fa8a712b905d92f7d7c3383b21493991c5c36;hb=HEAD;hp=56a49fbaed94fa684806b3f92220d0bf94e0cb90;hpb=36bd93cf4263b118366b3db2d26e8efb1ac1b690;p=evaf
diff --git a/src/apps/PswGen/CLI/cli.cpp b/src/apps/PswGen/CLI/cli.cpp
index 56a49fb..b27fa8a 100644
--- a/src/apps/PswGen/CLI/cli.cpp
+++ b/src/apps/PswGen/CLI/cli.cpp
@@ -3,7 +3,7 @@
* @brief Command line interface for the PswGen application
* @author Enar Vaikene
*
- * Copyright (c) 2011-2012 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
@@ -32,7 +32,7 @@
#include
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
# include
# include
#endif
@@ -53,8 +53,8 @@ int const Module::DefaultPasswordLength = 16;
Module::Module()
: Plugins::iPlugin()
, mReady(false)
- , mGenerator(0)
- , mStorage(0)
+ , mGenerator(nullptr)
+ , mStorage(nullptr)
, mEvReady(0)
{
setObjectName(QString("%1-Module").arg(VER_MODULE_NAME_STR));
@@ -68,10 +68,10 @@ Module::~Module()
bool Module::init(QString const & args)
{
- Q_UNUSED(args);
+ Q_UNUSED(args)
// Get the iGenerator interface
- EVAF_TEST_X((mGenerator = evafQueryInterface("iGenerator")), "No iGenerator interface");
+ EVAF_TEST_X((mGenerator = evafQueryInterface("iGenerator")), "No iGenerator interface")
// Get the optional iStorage interface
mStorage = evafQueryInterface("iStorage");
@@ -80,10 +80,10 @@ bool Module::init(QString const & args)
// Get the iEventQueue interface and subscribe to the 'ready' event
Common::iEventQueue * eventQueue = evafQueryInterface("iEventQueue");
- EVAF_TEST_X(eventQueue, "No iEventQueue interface");
+ EVAF_TEST_X(eventQueue, "No iEventQueue interface")
// Subscribe to the 'ready' event
- EVAF_TEST_X((mEvReady = eventQueue->subscribeEvent(eventQueue->queryEvent(Common::iApp::EV_READY), this)), "No 'ready' event");
+ EVAF_TEST_X((mEvReady = eventQueue->subscribeEvent(eventQueue->queryEvent(Common::iApp::EV_READY), this)), "No 'ready' event")
mReady = true;
@@ -122,7 +122,7 @@ bool Module::event(QEvent * e)
QString Module::readPassword()
{
bool noEcho = false;
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
termios oldt;
tcgetattr(STDIN_FILENO, &oldt);
termios newt = oldt;
@@ -145,7 +145,7 @@ QString Module::readPassword()
cout << endl;
}
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
#elif defined Q_OS_WIN32
SetConsoleMode(hStdin, mode);