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

Merge pull request #72 from mfontanini/googletest-submodule

Googletest submodule
This commit is contained in:
Matias Fontanini
2015-04-25 18:57:57 -07:00
20 changed files with 127 additions and 90 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 search_option(RAPID_COMMIT) != NULL;
}
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 search_option(RECONF_ACCEPT) != NULL;
}
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

@@ -87,7 +87,7 @@ std::string IPv6Address::to_string() const {
#ifdef WIN32
// mingw on linux somehow doesn't have InetNtop
#ifdef _MSC_VER
if(InetNtopA(AF_INET6, (PVOID)address, buffer, sizeof(buffer)) != 0)
if(InetNtopA(AF_INET6, (PVOID)address, buffer, sizeof(buffer)) == 0)
throw malformed_address();
#else
ULONG sz = sizeof(buffer);

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(-50);
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 search_option(SACK_OK) != NULL;
}
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++;