Handle all MSVC warnings

Summary: related to T13409

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27152
This commit is contained in:
Korina Šimičević
2024-01-02 11:40:53 +01:00
parent 7c0b9042d1
commit 794c72cb44
21 changed files with 43 additions and 33 deletions

View File

@@ -223,7 +223,7 @@ private:
_write_queue.begin(), _write_queue.end(),
[](const auto& op) { return !op.throttled(); }
);
uint16_t dist = std::distance(throttled_ptr, _write_queue.end());
uint16_t dist = static_cast<uint16_t>(std::distance(throttled_ptr, _write_queue.end()));
uint16_t throttled_num = std::min(dist, _quota);
_quota -= throttled_num;
throttled_ptr += throttled_num;

View File

@@ -212,7 +212,7 @@ public:
client_service(
const executor_type& ex,
const std::string& cnf,
const std::string& /* cnf */,
tls_context_type tls_context = {}
) :
_stream_context(std::move(tls_context)),

View File

@@ -351,7 +351,7 @@ inline std::string encode_pingreq() {
basic::flag<4>(0);
auto remaining_len_ =
basic::byte_(0);
basic::byte_(uint8_t(0));
auto ping_req_ = packet_type_ & remaining_len_;
@@ -364,7 +364,7 @@ inline std::string encode_pingresp() {
basic::flag<4>(0);
auto remaining_len_ =
basic::byte_(0);
basic::byte_(uint8_t(0));
auto ping_resp_ = packet_type_ & remaining_len_;

View File

@@ -279,7 +279,7 @@ public:
}
void on_connack(byte_citer first, byte_citer last) {
auto packet_length = std::distance(first, last);
auto packet_length = static_cast<uint32_t>(std::distance(first, last));
auto rv = decoders::decode_connack(packet_length, first);
if (!rv.has_value())
return complete(client::error::malformed_packet);
@@ -313,7 +313,7 @@ public:
}
void on_auth(byte_citer first, byte_citer last) {
auto packet_length = std::distance(first, last);
auto packet_length = static_cast<uint32_t>(std::distance(first, last));
auto rv = decoders::decode_auth(packet_length, first);
if (!rv.has_value())
return complete(client::error::malformed_packet);

View File

@@ -141,7 +141,7 @@ public:
if (ec)
return;
auto pubrel = decoders::decode_pubrel(std::distance(first, last), first);
auto pubrel = decoders::decode_pubrel(static_cast<uint32_t>(std::distance(first, last)), first);
if (!pubrel.has_value()) {
on_malformed_packet("Malformed PUBREL received: cannot decode");
return wait_pubrel(packet_id);

View File

@@ -205,7 +205,9 @@ public:
ec, reason_codes::empty, packet_id, puback_props {}
);
auto puback = decoders::decode_puback(std::distance(first, last), first);
auto puback = decoders::decode_puback(
static_cast<uint32_t>(std::distance(first, last)), first
);
if (!puback.has_value()) {
on_malformed_packet("Malformed PUBACK: cannot decode");
return send_publish(std::move(publish.set_dup()));
@@ -239,7 +241,9 @@ public:
ec, reason_codes::empty, packet_id, pubcomp_props {}
);
auto pubrec = decoders::decode_pubrec(std::distance(first, last), first);
auto pubrec = decoders::decode_pubrec(
static_cast<uint32_t>(std::distance(first, last)), first
);
if (!pubrec.has_value()) {
on_malformed_packet("Malformed PUBREC: cannot decode");
return send_publish(std::move(publish.set_dup()));
@@ -317,7 +321,9 @@ public:
ec, reason_codes::empty, packet_id, pubcomp_props {}
);
auto pubcomp = decoders::decode_pubcomp(std::distance(first, last), first);
auto pubcomp = decoders::decode_pubcomp(
static_cast<uint32_t>(std::distance(first, last)), first
);
if (!pubcomp.has_value()) {
on_malformed_packet("Malformed PUBCOMP: cannot decode");
return send_pubrel(std::move(pubrel), true);

View File

@@ -88,7 +88,7 @@ private:
switch (code) {
case control_code_e::publish: {
auto msg = decoders::decode_publish(
control_byte, std::distance(first, last), first
control_byte, static_cast<uint32_t>(std::distance(first, last)), first
);
if (!msg.has_value())
return on_malformed_packet(
@@ -105,7 +105,7 @@ private:
break;
case control_code_e::auth: {
auto rv = decoders::decode_auth(
std::distance(first, last), first
static_cast<uint32_t>(std::distance(first, last)), first
);
if (!rv.has_value())
return on_malformed_packet(

View File

@@ -134,7 +134,9 @@ public:
if (ec)
return complete(ec, packet_id, {}, {});
auto suback = decoders::decode_suback(std::distance(first, last), first);
auto suback = decoders::decode_suback(
static_cast<uint32_t>(std::distance(first, last)), first
);
if (!suback.has_value()) {
on_malformed_packet("Malformed SUBACK: cannot decode");
return send_subscribe(std::move(packet));

View File

@@ -131,7 +131,7 @@ public:
return complete(ec, packet_id, {}, {});
auto unsuback = decoders::decode_unsuback(
std::distance(first, last), first
static_cast<uint32_t>(std::distance(first, last)), first
);
if (!unsuback.has_value()) {
on_malformed_packet("Malformed UNSUBACK: cannot decode");