Fix compiler warnings in QHttp library

This commit is contained in:
Janek Bevendorff 2017-02-26 21:31:53 +01:00 committed by Jonathan White
parent 04b3b3dbc5
commit a31c423d9e
7 changed files with 10 additions and 10 deletions

View File

@ -110,7 +110,7 @@ static QByteArray encrypt2(const QByteArray & data, SymmetricCipherGcrypt & ciph
//Encrypt //Encrypt
QByteArray buffer = data + QByteArray(paddingSize, paddingSize); QByteArray buffer = data + QByteArray(paddingSize, paddingSize);
cipher.reset(); cipher.reset();
cipher.processInPlace(buffer); Q_UNUSED(cipher.processInPlace(buffer));
return buffer; return buffer;
} }

View File

@ -91,7 +91,7 @@ typedef int (*http_cb) (http_parser*);
/* Status Codes */ /* Status Codes */
#define HTTP_STATUS_MAP(XX) \ #define HTTPPARSER_HTTP_STATUS_MAP(XX) \
XX(100, CONTINUE, Continue) \ XX(100, CONTINUE, Continue) \
XX(101, SWITCHING_PROTOCOLS, Switching Protocols) \ XX(101, SWITCHING_PROTOCOLS, Switching Protocols) \
XX(102, PROCESSING, Processing) \ XX(102, PROCESSING, Processing) \
@ -150,12 +150,12 @@ typedef int (*http_cb) (http_parser*);
XX(507, INSUFFICIENT_STORAGE, Insufficient Storage) \ XX(507, INSUFFICIENT_STORAGE, Insufficient Storage) \
XX(508, LOOP_DETECTED, Loop Detected) \ XX(508, LOOP_DETECTED, Loop Detected) \
XX(510, NOT_EXTENDED, Not Extended) \ 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 enum http_status
{ {
#define XX(num, name, string) HTTP_STATUS_##name = num, #define XX(num, name, string) HTTP_STATUS_##name = num,
HTTP_STATUS_MAP(XX) HTTPPARSER_HTTP_STATUS_MAP(XX)
#undef XX #undef XX
}; };

View File

@ -41,7 +41,7 @@ public:
if ( !icollectRequired ) // not allowed to collect data if ( !icollectRequired ) // not allowed to collect data
return false; return false;
int newLength = icollectedData.length() + (int) length; int newLength = icollectedData.length() + static_cast<int>(length);
if ( icollectCapacity > 0 && newLength > icollectCapacity ) if ( icollectCapacity > 0 && newLength > icollectCapacity )
return false; // the capacity is full return false; // the capacity is full

View File

@ -112,7 +112,7 @@ protected:
void onReadyRead() { void onReadyRead() {
while ( isocket.bytesAvailable() > 0 ) { while ( isocket.bytesAvailable() > 0 ) {
char buffer[4097] = {0}; char buffer[4097] = {0};
size_t readLength = (size_t) isocket.readRaw(buffer, 4096); size_t readLength = static_cast<size_t>(isocket.readRaw(buffer, 4096));
parse(buffer, readLength); parse(buffer, readLength);
} }

View File

@ -42,7 +42,7 @@ public:
// if it's a QLocalServer // if it's a QLocalServer
virtual void incomingConnection(quintptr socketDescriptor) { virtual void incomingConnection(quintptr socketDescriptor) {
iserver->incomingConnection((qintptr) socketDescriptor); iserver->incomingConnection(static_cast<qintptr>(socketDescriptor));
} }
}; };

View File

@ -83,7 +83,7 @@ public:
void onReadyRead() { void onReadyRead() {
while ( isocket.bytesAvailable() > 0 ) { while ( isocket.bytesAvailable() > 0 ) {
char buffer[4097] = {0}; char buffer[4097] = {0};
size_t readLength = (size_t) isocket.readRaw(buffer, 4096); size_t readLength = static_cast<size_t>(isocket.readRaw(buffer, 4096));
parse(buffer, readLength); parse(buffer, readLength);
} }

View File

@ -8,7 +8,7 @@ namespace qhttp {
# error "to compile QHttp classes, Qt 5.0 or later is needed." # error "to compile QHttp classes, Qt 5.0 or later is needed."
#endif #endif
#define HTTP_STATUS_MAP(XX) \ #define QHTTPABSTRACTS_HTTP_STATUS_MAP(XX) \
XX(100, "Continue") \ XX(100, "Continue") \
XX(101, "Switching Protocols") \ XX(101, "Switching Protocols") \
/* RFC 2518) obsoleted by RFC 4918 */ \ /* RFC 2518) obsoleted by RFC 4918 */ \
@ -78,7 +78,7 @@ static struct {
int code; int code;
const char* message; const char* message;
} g_status_codes[] { } g_status_codes[] {
HTTP_STATUS_MAP(PATCH_STATUS_CODES) QHTTPABSTRACTS_HTTP_STATUS_MAP(PATCH_STATUS_CODES)
}; };
#undef PATCH_STATUS_CODES #undef PATCH_STATUS_CODES