1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Fix compilation warnings on Windows.

This commit is contained in:
Matias Fontanini
2015-04-25 18:44:38 -07:00
parent 5c8fdd2b6c
commit c108f6e4e6
9 changed files with 22 additions and 16 deletions

View File

@@ -201,7 +201,7 @@ DHCPv6::status_code_type DHCPv6::status_code() const {
}
bool DHCPv6::has_rapid_commit() const {
return search_option(RAPID_COMMIT);
return static_cast<bool>(search_option(RAPID_COMMIT));
}
DHCPv6::user_class_type DHCPv6::user_class() const {
@@ -225,7 +225,7 @@ uint8_t DHCPv6::reconfigure_msg() const {
}
bool DHCPv6::has_reconfigure_accept() const {
return search_option(RECONF_ACCEPT);
return static_cast<bool>(search_option(RECONF_ACCEPT));
}
DHCPv6::duid_type DHCPv6::client_id() const {

View File

@@ -87,7 +87,7 @@ uint16_t IPv4Stream::extract_offset(const IP *ip) {
}
bool IPv4Stream::extract_more_frag(const IP *ip) {
return ip->frag_off() & 0x2000;
return (ip->frag_off() & 0x2000) != 0;
}
} // namespace Internals

View File

@@ -70,11 +70,7 @@ bool OfflinePacketFilter::matches_filter(const uint8_t* buffer,
pcap_pkthdr header = {};
header.len = total_sz;
header.caplen = total_sz;
return pcap_offline_filter(
&filter,
&header,
buffer
);
return pcap_offline_filter(&filter, &header, buffer) != 0;
}
bool OfflinePacketFilter::matches_filter(PDU& pdu) const

View File

@@ -384,7 +384,7 @@ PDU *PacketSender::recv_match_loop(const std::vector<int>& sockets, PDU &pdu, st
#endif
timeout.tv_sec = _timeout;
end_time.tv_sec = time(0) + _timeout;
end_time.tv_sec = static_cast<long>(time(0) + _timeout);
end_time.tv_usec = timeout.tv_usec = _timeout_usec;
while(true) {
FD_ZERO(&readfds);

View File

@@ -178,7 +178,7 @@ void RadioTap::init() {
channel(Utils::channel_to_mhz(1), 0xa0);
flags(FCS);
tsft(0);
dbm_signal(0xce);
dbm_signal(static_cast<int8_t>(0xce));
rx_flags(0);
antenna(0);
}

View File

@@ -147,7 +147,7 @@ void TCP::sack_permitted() {
}
bool TCP::has_sack_permitted() const {
return bool(search_option(SACK_OK));
return static_cast<bool>(search_option(SACK_OK));
}
void TCP::sack(const sack_type &edges) {
@@ -286,7 +286,7 @@ void TCP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *par
buffer = write_option(*it, buffer);
if(_options_size < _total_options_size) {
uint8_t padding = _options_size;
uint16_t padding = _options_size;
while(padding < _total_options_size) {
*(buffer++) = 1;
padding++;