Skip to content

Commit

Permalink
Merge pull request mfontanini#383 from laudrup/silence-msvc2017-warnings
Browse files Browse the repository at this point in the history
Fix compiler warnings from MSVC 2017
  • Loading branch information
mfontanini authored Feb 1, 2020
2 parents 28663b0 + 9e61286 commit a87c4a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/tins/icmpv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class TINS_API ICMPv6 : public PDU {

addr_list_type(const addresses_type& addresses = addresses_type())
: addresses(addresses) {
std::fill(reserved, reserved + sizeof(reserved), 0);
std::fill(reserved, reserved + sizeof(reserved), static_cast<uint8_t>(0));
}

static addr_list_type from_option(const option& opt);
Expand All @@ -199,7 +199,7 @@ class TINS_API ICMPv6 : public PDU {

naack_type(uint8_t code = 0, uint8_t status = 0)
: code(code), status(status) {
std::fill(reserved, reserved + 4, 0);
std::fill(reserved, reserved + 4, static_cast<uint8_t>(0));
}

static naack_type from_option(const option& opt);
Expand Down Expand Up @@ -323,7 +323,7 @@ class TINS_API ICMPv6 : public PDU {
* The key_hash member will be 0-initialized.
*/
rsa_sign_type() {
std::fill(key_hash, key_hash + sizeof(key_hash), 0);
std::fill(key_hash, key_hash + sizeof(key_hash), static_cast<uint8_t>(0));
}

static rsa_sign_type from_option(const option& opt);
Expand Down Expand Up @@ -489,7 +489,7 @@ class TINS_API ICMPv6 : public PDU {

timestamp_type(uint64_t timestamp = 0)
: timestamp(timestamp) {
std::fill(reserved, reserved + sizeof(reserved), 0);
std::fill(reserved, reserved + sizeof(reserved), static_cast<uint8_t>(0));
}

static timestamp_type from_option(const option& opt);
Expand Down
4 changes: 2 additions & 2 deletions include/tins/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ class TINS_API IP : public PDU {
option_identifier(OptionNumber number, OptionClass op_class,
small_uint<1> copied)
#if TINS_IS_LITTLE_ENDIAN
: number(number), op_class(op_class), copied(copied) {}
: number(static_cast<uint8_t>(number)), op_class(static_cast<uint8_t>(op_class)), copied(copied) {}
#else
: copied(copied), op_class(op_class), number(number) {}
: copied(copied), op_class(static_cast<uint8_t>(op_class)), number(static_cast<uint8_t>(number)) {}
#endif

/**
Expand Down
4 changes: 2 additions & 2 deletions include/tins/llc.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class TINS_API LLC : public PDU {
* \return The LLC frame format.
*/
uint8_t type() {
return type_;
return static_cast<uint8_t>(type_);
}

/**
Expand All @@ -245,7 +245,7 @@ class TINS_API LLC : public PDU {
* \return The sender send sequence number if format is INFORMATION else 0.
*/
uint8_t send_seq_number() {
return (type() == INFORMATION) ? (control_field.info.send_seq_num) : 0;
return static_cast<uint8_t>((type() == INFORMATION) ? (control_field.info.send_seq_num) : 0);
}

/**
Expand Down

0 comments on commit a87c4a6

Please sign in to comment.