From 91e0d689bb17a9f852a673a3a898d6bbe382eb31 Mon Sep 17 00:00:00 2001 From: bjovke Date: Mon, 28 Aug 2017 15:03:46 +0200 Subject: [PATCH] Problem: Inconsistent size_t/int usage. Solution: types corrected. --- src/mechanism_base.cpp | 2 +- src/mechanism_base.hpp | 2 +- src/plain_server.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mechanism_base.cpp b/src/mechanism_base.cpp index bcc9f1b3..93a6f4f9 100644 --- a/src/mechanism_base.cpp +++ b/src/mechanism_base.cpp @@ -53,7 +53,7 @@ int zmq::mechanism_base_t::check_basic_command_structure (msg_t *msg_) } void zmq::mechanism_base_t::handle_error_reason (const char *error_reason, - int error_reason_len) + size_t error_reason_len) { if (error_reason_len == 3 && error_reason[1] == '0' && error_reason[2] == '0' && error_reason[0] >= '3' diff --git a/src/mechanism_base.hpp b/src/mechanism_base.hpp index 620b6fa7..e09a3a1a 100644 --- a/src/mechanism_base.hpp +++ b/src/mechanism_base.hpp @@ -44,7 +44,7 @@ class mechanism_base_t : public mechanism_t int check_basic_command_structure (msg_t *msg_); - void handle_error_reason (const char *error_reason, int error_reason_len); + void handle_error_reason (const char *error_reason, size_t error_reason_len); }; } diff --git a/src/plain_server.cpp b/src/plain_server.cpp index 5eaf58aa..421d0e5a 100644 --- a/src/plain_server.cpp +++ b/src/plain_server.cpp @@ -112,7 +112,7 @@ int zmq::plain_server_t::process_hello (msg_t *msg_) return -1; const unsigned char *ptr = static_cast (msg_->data ()); - int bytes_left = msg_->size (); + size_t bytes_left = msg_->size (); if (bytes_left < 6 || memcmp (ptr, "\x05HELLO", 6)) { session->get_socket ()->event_handshake_failed_protocol ( @@ -133,7 +133,7 @@ int zmq::plain_server_t::process_hello (msg_t *msg_) const uint8_t username_length = *ptr++; bytes_left -= 1; - if (bytes_left < (int)username_length) { + if (bytes_left < username_length) { // PLAIN I: invalid PLAIN client, sent malformed username session->get_socket ()->event_handshake_failed_protocol ( session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO); @@ -153,7 +153,7 @@ int zmq::plain_server_t::process_hello (msg_t *msg_) const uint8_t password_length = *ptr++; bytes_left -= 1; - if (bytes_left < (int)password_length) { + if (bytes_left < password_length) { // PLAIN I: invalid PLAIN client, sent malformed password session->get_socket ()->event_handshake_failed_protocol ( session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO);