summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorSimon Rettberg2016-11-15 12:13:40 +0100
committerSimon Rettberg2016-11-15 12:13:40 +0100
commiteaebc23452813a8709d2bbb4d17fddb1b4f29d91 (patch)
tree956155fc2fc5b58498a4c494cc59b7adc68bc76a /src/server
parent[server] Rewrite positioning logic of connection frames (diff)
downloadpvs2-eaebc23452813a8709d2bbb4d17fddb1b4f29d91.tar.gz
pvs2-eaebc23452813a8709d2bbb4d17fddb1b4f29d91.tar.xz
pvs2-eaebc23452813a8709d2bbb4d17fddb1b4f29d91.zip
Increase compiler warnings, fix a lot of those instances
- Add explicit casts - Comment out unused params - Remove ignored const return types
Diffstat (limited to 'src/server')
-rw-r--r--src/server/clicklabel/clicklabel.cpp2
-rw-r--r--src/server/connectionframe/connectionframe.cpp2
-rw-r--r--src/server/connectionframe/connectionframe.h4
-rw-r--r--src/server/mainwindow/mainwindow.cpp14
-rw-r--r--src/server/net/certmanager.cpp2
-rw-r--r--src/server/net/client.cpp7
-rw-r--r--src/server/net/client.h20
-rw-r--r--src/server/net/discoverylistener.cpp17
-rw-r--r--src/server/net/sslserver.cpp4
9 files changed, 37 insertions, 35 deletions
diff --git a/src/server/clicklabel/clicklabel.cpp b/src/server/clicklabel/clicklabel.cpp
index d4b25ee..d771e63 100644
--- a/src/server/clicklabel/clicklabel.cpp
+++ b/src/server/clicklabel/clicklabel.cpp
@@ -17,7 +17,7 @@ ClickLabel::ClickLabel(QWidget *parent) : QLabel(parent)
* Emit Signal clicked().
* @param e
*/
-void ClickLabel::mouseReleaseEvent(QMouseEvent* e)
+void ClickLabel::mouseReleaseEvent(QMouseEvent* /* e */ )
{
emit clicked();
}
diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp
index 205433b..85d2e32 100644
--- a/src/server/connectionframe/connectionframe.cpp
+++ b/src/server/connectionframe/connectionframe.cpp
@@ -319,7 +319,7 @@ void ConnectionFrame::paintEvent(QPaintEvent *event)
* Handle timer event.
* @param event
*/
-void ConnectionFrame::timerEvent(QTimerEvent* event)
+void ConnectionFrame::timerEvent(QTimerEvent* /* event */ )
{
if (_client == NULL)
return;
diff --git a/src/server/connectionframe/connectionframe.h b/src/server/connectionframe/connectionframe.h
index 2549ae8..7f338a8 100644
--- a/src/server/connectionframe/connectionframe.h
+++ b/src/server/connectionframe/connectionframe.h
@@ -61,13 +61,13 @@ public:
const QPixmap& getFramePixmap() const { return _remoteScreen; }
void assignClient(Client *client);
void setSelection(bool selected);
- const inline bool isSelected() const { return _isSelected; }
+ inline bool isSelected() { return _isSelected; }
const QString& computerId() const { return _computerId; }
void setComputerId(QString computerId) { if (_client != NULL) return; _computerId = computerId; updateLabels(); }
Client* client() const { return _client; }
- inline const bool isTutor() const { return _isTutor; }
+ inline bool isTutor() { return _isTutor; }
void setTutor(bool b);
protected:
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index 87ecca4..0a77240 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -228,10 +228,10 @@ int distance(QPoint a, QPoint b)
int distance(QPointF a, QPointF b)
{
- const int dx = a.x() - b.x();
- const int dy = a.y() - b.y();
- const int sum = dx * dx + dy * dy;
- return sum;
+ const qreal dx = a.x() - b.x();
+ const qreal dy = a.y() - b.y();
+ const qreal sum = dx * dx + dy * dy;
+ return (int)sum;
}
/***************************************************************************//**
@@ -300,12 +300,12 @@ endLoop: ;
}
endSearch: ;
/* among all the free positions, find the closest */
- float min_distance = 1000000;
+ int min_distance = 1000000;
QPoint bestPosition = QPoint(0, 0);
for (QPoint freePos : freePositions) {
const QPoint freePosPx( freePos.x() * getTileWidthPx(), freePos.y() * getTileHeightPx() );
- const float dist = distance(freePosPx, preferredPixels);
+ const int dist = distance(freePosPx, preferredPixels);
if (dist < min_distance) {
min_distance = dist;
bestPosition = freePos;
@@ -478,7 +478,7 @@ AspectStatus checkAspectRatio(const QSize& frameSize, const QSize& gridSize)
* Resize event.
* @param e
*/
-void MainWindow::resizeEvent(QResizeEvent* e)
+void MainWindow::resizeEvent(QResizeEvent* /* e */ )
{
if (ui->frmRoom->size().width() < 100 || ui->frmRoom->size().height() < 100) {
return;
diff --git a/src/server/net/certmanager.cpp b/src/server/net/certmanager.cpp
index 0121538..0f885da 100644
--- a/src/server/net/certmanager.cpp
+++ b/src/server/net/certmanager.cpp
@@ -42,7 +42,7 @@ bool getPrivateKeyAndCert(const QString &name, QSslKey &key, QSslCertificate &ce
}
QString certDir = QDir::homePath().append("/").append(CERTSTORAGE);
if (!QDir::root().mkpath(certDir)) {
- certDir = QString("/tmp/") + qrand() + "-" + qrand() + "/";
+ certDir = QString("/tmp/") + QString::number(qrand()) + "-" + QString::number(qrand()) + "/";
QDir::root().mkpath(certDir);
}
QString certFile = certDir.append(name);
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp
index 836d49b..1b0bbdb 100644
--- a/src/server/net/client.cpp
+++ b/src/server/net/client.cpp
@@ -43,8 +43,9 @@ Client::Client(QSslSocket* socket) : _socket(socket)
this, SLOT(onDataArrival()));
// Send challenge
_challenge.resize(CHALLENGE_LEN);
- for (int i = 0; i < CHALLENGE_LEN; ++i)
- _challenge[i] = qrand() & 0xff;
+ for (int i = 0; i < CHALLENGE_LEN; ++i) {
+ _challenge[i] = (char)(qrand() & 0xff);
+ }
NetworkMessage msgChlng;
msgChlng.setField(_ID, _CHALLENGE);
msgChlng.setField(_CHALLENGE, _challenge);
@@ -169,7 +170,7 @@ void Client::handleMsg()
const int port = _fromClient.getFieldString("PORT").toInt();
if (port <= 0) {
if (_vncPort <= 0) {
- qDebug() << "Starting VNC server on client" << _name << " (" << _socket->peerAddress().toString() + _vncPort << ") failed.";
+ qDebug() << "Starting VNC server on client" << _name << " (" << _socket->peerAddress().toString() << ":" << QString::number(_vncPort) << ") failed.";
} else {
qDebug() << "Client " << _name << " stopped its VNC server";
}
diff --git a/src/server/net/client.h b/src/server/net/client.h
index 81f5346..9bbc23f 100644
--- a/src/server/net/client.h
+++ b/src/server/net/client.h
@@ -30,19 +30,19 @@ public:
~Client();
// Getters
- inline const bool isAuthed() const { return _authed == 2; }
+ inline bool isAuthed() { return _authed == 2; }
inline const QString& name() const { return _name; }
inline const QString& host() const { return _host; }
inline const QString ip() const { return _socket->peerAddress().toString(); }
- inline const int id() const { return _id; }
- inline const bool isActiveVncClient() const { return _isActiveVncClient; }
- inline const bool isActiveVncServer() const { return _vncPort > 0; }
- inline const bool isLocked() const { return _locked; }
- inline const int desiredProjectionSource() { return _desiredSource; }
- inline const int projectionSource() const { return _projectionSource; }
- inline const int isExamMode() const { return _isExamMode; }
- inline const bool wantsAttention() const { return _wantsAttention; }
- inline const void removeAttention() { if (!_wantsAttention) return; removeAttentionInternal(); }
+ inline int id() { return _id; }
+ inline bool isActiveVncClient() { return _isActiveVncClient; }
+ inline bool isActiveVncServer() { return _vncPort > 0; }
+ inline bool isLocked() { return _locked; }
+ inline int desiredProjectionSource() { return _desiredSource; }
+ inline int projectionSource() { return _projectionSource; }
+ inline int isExamMode() { return _isExamMode; }
+ inline bool wantsAttention() { return _wantsAttention; }
+ inline void removeAttention() { if (!_wantsAttention) return; removeAttentionInternal(); }
// Setters
inline void setTutor(bool enable) { _isTutor = enable; }
diff --git a/src/server/net/discoverylistener.cpp b/src/server/net/discoverylistener.cpp
index e8d286d..e37c81e 100644
--- a/src/server/net/discoverylistener.cpp
+++ b/src/server/net/discoverylistener.cpp
@@ -79,14 +79,14 @@ static quint16 hash(const QHostAddress& host)
} else {
// Durr?
len = 2;
- data[0] = (quint16)qrand();
- data[1] = (quint16)qrand();
+ data[0] = (quint8)qrand();
+ data[1] = (quint8)qrand();
}
quint16 result = 0;
quint16 mod = seed1;
for (quint8 i = 0; i < len; ++i) {
- result = ((result << 1) + data[i]) ^ mod; // because of the shift this algo is not suitable for len(input) > 8
- mod += seed2 + data[i];
+ result = (quint16)(((result << 1) + data[i]) ^ mod); // because of the shift this algo is not suitable for len(input) > 8
+ mod = (quint16)(mod + seed2 + data[i]);
}
return result;
}
@@ -99,15 +99,16 @@ static quint16 hash(const QHostAddress& host)
* @brief Decrease packet counters per source IP in our "spam protection" table.
* @param event
*/
-void DiscoveryListener::timerEvent(QTimerEvent* event)
+void DiscoveryListener::timerEvent(QTimerEvent* /* event */ )
{
for (int i = 0; i < SPAM_MODERATE_AT_ONCE; ++i) {
if (++_counterResetPos >= SD_PACKET_TABLE_SIZE)
_counterResetPos = 0;
- if (_packetCounter[_counterResetPos] > 10)
- _packetCounter[_counterResetPos] -= 10;
- else if (_packetCounter[_counterResetPos] != 0)
+ if (_packetCounter[_counterResetPos] > 10) {
+ _packetCounter[_counterResetPos] = (quint8)(_packetCounter[_counterResetPos] - 10);
+ } else if (_packetCounter[_counterResetPos] != 0) {
_packetCounter[_counterResetPos] = 0;
+ }
}
}
diff --git a/src/server/net/sslserver.cpp b/src/server/net/sslserver.cpp
index f75f174..966ec5d 100644
--- a/src/server/net/sslserver.cpp
+++ b/src/server/net/sslserver.cpp
@@ -56,12 +56,12 @@ void SslServer::incomingConnection(int socketDescriptor)
}
}
-void SslServer::sslErrors(const QList<QSslError> & errors)
+void SslServer::sslErrors(const QList<QSslError> & /* errors */ )
{
//qDebug("FIXME: SSL ERRORS on SERVER: %s", qPrintable(errors.begin()->errorString()));
}
-void SslServer::timerEvent(QTimerEvent* event)
+void SslServer::timerEvent(QTimerEvent* /* event */ )
{
// Remove all sockets marked for deletion
while (!_delete.isEmpty()) {