Merge pull request #79 from raoulh/fix_warning

Fix -Wc++11-narrowing error/warning
This commit is contained in:
Michele Caini 2017-01-17 17:23:39 +01:00 committed by GitHub
commit 133dc09965

View File

@ -108,12 +108,12 @@ class UDPHandle final: public Handle<UDPHandle, uv_udp_t> {
if(nread > 0) {
// data available (can be truncated)
udp.publish(UDPDataEvent{details::address<I>(aptr), std::move(data), nread, flags & UV_UDP_PARTIAL});
udp.publish(UDPDataEvent{details::address<I>(aptr), std::move(data), static_cast<std::size_t>(nread), static_cast<bool>(flags & UV_UDP_PARTIAL)});
} else if(nread == 0 && addr == nullptr) {
// no more data to be read, doing nothing is fine
} else if(nread == 0 && addr != nullptr) {
// empty udp packet
udp.publish(UDPDataEvent{details::address<I>(aptr), std::move(data), nread, false});
udp.publish(UDPDataEvent{details::address<I>(aptr), std::move(data), static_cast<std::size_t>(nread), false});
} else {
// transmission error
udp.publish(ErrorEvent(nread));