From a31c423d9e9e67ff56efd007f27b674884d817ac Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sun, 26 Feb 2017 21:31:53 +0100 Subject: [PATCH] Fix compiler warnings in QHttp library --- src/http/Protocol.cpp | 2 +- src/http/qhttp/http-parser/http_parser.h | 6 +++--- src/http/qhttp/private/httpreader.hxx | 2 +- src/http/qhttp/private/qhttpclient_private.hpp | 2 +- src/http/qhttp/private/qhttpserver_private.hpp | 2 +- src/http/qhttp/private/qhttpserverconnection_private.hpp | 2 +- src/http/qhttp/qhttpabstracts.cpp | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/http/Protocol.cpp b/src/http/Protocol.cpp index 40a1445c0..bcb30f0b1 100644 --- a/src/http/Protocol.cpp +++ b/src/http/Protocol.cpp @@ -110,7 +110,7 @@ static QByteArray encrypt2(const QByteArray & data, SymmetricCipherGcrypt & ciph //Encrypt QByteArray buffer = data + QByteArray(paddingSize, paddingSize); cipher.reset(); - cipher.processInPlace(buffer); + Q_UNUSED(cipher.processInPlace(buffer)); return buffer; } diff --git a/src/http/qhttp/http-parser/http_parser.h b/src/http/qhttp/http-parser/http_parser.h index 45c72a078..005db96ec 100644 --- a/src/http/qhttp/http-parser/http_parser.h +++ b/src/http/qhttp/http-parser/http_parser.h @@ -91,7 +91,7 @@ typedef int (*http_cb) (http_parser*); /* Status Codes */ -#define HTTP_STATUS_MAP(XX) \ +#define HTTPPARSER_HTTP_STATUS_MAP(XX) \ XX(100, CONTINUE, Continue) \ XX(101, SWITCHING_PROTOCOLS, Switching Protocols) \ XX(102, PROCESSING, Processing) \ @@ -150,12 +150,12 @@ typedef int (*http_cb) (http_parser*); XX(507, INSUFFICIENT_STORAGE, Insufficient Storage) \ XX(508, LOOP_DETECTED, Loop Detected) \ XX(510, NOT_EXTENDED, Not Extended) \ - XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required) \ + XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required) enum http_status { #define XX(num, name, string) HTTP_STATUS_##name = num, - HTTP_STATUS_MAP(XX) + HTTPPARSER_HTTP_STATUS_MAP(XX) #undef XX }; diff --git a/src/http/qhttp/private/httpreader.hxx b/src/http/qhttp/private/httpreader.hxx index 174b31a95..338ed2a2f 100644 --- a/src/http/qhttp/private/httpreader.hxx +++ b/src/http/qhttp/private/httpreader.hxx @@ -41,7 +41,7 @@ public: if ( !icollectRequired ) // not allowed to collect data return false; - int newLength = icollectedData.length() + (int) length; + int newLength = icollectedData.length() + static_cast(length); if ( icollectCapacity > 0 && newLength > icollectCapacity ) return false; // the capacity is full diff --git a/src/http/qhttp/private/qhttpclient_private.hpp b/src/http/qhttp/private/qhttpclient_private.hpp index 3206da5f3..9c6cd0989 100644 --- a/src/http/qhttp/private/qhttpclient_private.hpp +++ b/src/http/qhttp/private/qhttpclient_private.hpp @@ -112,7 +112,7 @@ protected: void onReadyRead() { while ( isocket.bytesAvailable() > 0 ) { char buffer[4097] = {0}; - size_t readLength = (size_t) isocket.readRaw(buffer, 4096); + size_t readLength = static_cast(isocket.readRaw(buffer, 4096)); parse(buffer, readLength); } diff --git a/src/http/qhttp/private/qhttpserver_private.hpp b/src/http/qhttp/private/qhttpserver_private.hpp index 93c96d2e1..e7c081af4 100644 --- a/src/http/qhttp/private/qhttpserver_private.hpp +++ b/src/http/qhttp/private/qhttpserver_private.hpp @@ -42,7 +42,7 @@ public: // if it's a QLocalServer virtual void incomingConnection(quintptr socketDescriptor) { - iserver->incomingConnection((qintptr) socketDescriptor); + iserver->incomingConnection(static_cast(socketDescriptor)); } }; diff --git a/src/http/qhttp/private/qhttpserverconnection_private.hpp b/src/http/qhttp/private/qhttpserverconnection_private.hpp index fd4475864..53b349fa9 100644 --- a/src/http/qhttp/private/qhttpserverconnection_private.hpp +++ b/src/http/qhttp/private/qhttpserverconnection_private.hpp @@ -83,7 +83,7 @@ public: void onReadyRead() { while ( isocket.bytesAvailable() > 0 ) { char buffer[4097] = {0}; - size_t readLength = (size_t) isocket.readRaw(buffer, 4096); + size_t readLength = static_cast(isocket.readRaw(buffer, 4096)); parse(buffer, readLength); } diff --git a/src/http/qhttp/qhttpabstracts.cpp b/src/http/qhttp/qhttpabstracts.cpp index 1b106e51f..a29a90b9f 100644 --- a/src/http/qhttp/qhttpabstracts.cpp +++ b/src/http/qhttp/qhttpabstracts.cpp @@ -8,7 +8,7 @@ namespace qhttp { # error "to compile QHttp classes, Qt 5.0 or later is needed." #endif -#define HTTP_STATUS_MAP(XX) \ +#define QHTTPABSTRACTS_HTTP_STATUS_MAP(XX) \ XX(100, "Continue") \ XX(101, "Switching Protocols") \ /* RFC 2518) obsoleted by RFC 4918 */ \ @@ -78,7 +78,7 @@ static struct { int code; const char* message; } g_status_codes[] { - HTTP_STATUS_MAP(PATCH_STATUS_CODES) + QHTTPABSTRACTS_HTTP_STATUS_MAP(PATCH_STATUS_CODES) }; #undef PATCH_STATUS_CODES