diff options
Diffstat (limited to 'src/client/vnc/vncserver.cpp')
-rw-r--r-- | src/client/vnc/vncserver.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/client/vnc/vncserver.cpp b/src/client/vnc/vncserver.cpp index 165ba6d..a016f08 100644 --- a/src/client/vnc/vncserver.cpp +++ b/src/client/vnc/vncserver.cpp @@ -12,7 +12,7 @@ #include "vncserver.h" #include "../util/util.h" -VncServer* VncServer::me = NULL; +VncServer* VncServer::me = nullptr; /***************************************************************************//** * @brief VncServer::instance @@ -20,7 +20,7 @@ VncServer* VncServer::me = NULL; */ VncServer* VncServer::instance() { - if (me == NULL) + if (me == nullptr) me = new VncServer(); return me; } @@ -32,10 +32,10 @@ VncServer* VncServer::instance() */ static QString makePassword(int len = 10) { - char pass[len]; + QString ret(len, Qt::Uninitialized); for (int i = 0; i < len; ++i) - pass[i] = (char)(43 + qrand() % 80); - return QString::fromUtf8(pass, len); + ret[i] = QChar(43 + qrand() % 80); + return ret; } /***************************************************************************//** @@ -48,7 +48,7 @@ struct Sleeper : public QThread { /***************************************************************************//** * @brief VncServer::VncServer */ -VncServer::VncServer() : _process(NULL), _port(0), _timerId(0) {} +VncServer::VncServer() : _process(nullptr), _port(0), _timerId(0) {} /***************************************************************************//** * @brief VncServer::~VncServer @@ -73,7 +73,7 @@ QSharedPointer<QFile> VncServer::createPwFile(const QDir& dir) void VncServer::start() { // Keep things clean - if (_process != NULL) { + if (_process != nullptr) { disconnect(_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError))); disconnect(_process, SIGNAL(finished(int)), this, SLOT(onFinished(int))); } @@ -138,13 +138,13 @@ void VncServer::stop() killTimer(_timerId); _timerId = 0; } - if (_process == NULL) + if (_process == nullptr) return; qDebug("Stopping old VNC server."); disconnect(_process, SIGNAL(readyReadStandardOutput()), this, SLOT(onStdOut())); disconnect(_process, SIGNAL(readyReadStandardError()), this, SLOT(onStdErr())); QProcess *process = _process; - _process = NULL; + _process = nullptr; _port = 0; process->terminate(); for (int i = 0; i < 10 && process->state() != QProcess::NotRunning; ++i) @@ -185,7 +185,7 @@ void VncServer::timerEvent(QTimerEvent * /* event */ ) */ void VncServer::onStdOut() { - if (_process == NULL) { + if (_process == nullptr) { qDebug("VncServer::onStdOut() called in bad state."); return; } @@ -211,7 +211,7 @@ void VncServer::onStdOut() */ void VncServer::onStdErr() { - if (_process == NULL) { + if (_process == nullptr) { qDebug("VncServer::onStdErr() called in bad state."); return; } |