X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Fportability%2FSockets.cpp;h=b5f0b7d517de83ef1e410f13362ecb2fb6111e79;hb=c8aadaad37770dc4d1caf2bff239c604b51a6132;hp=5af387507ee153e732a3d3dffbd8db6c8ef045f7;hpb=210b566437cfaf9b5ddeaebe8efddcf456285638;p=folly.git diff --git a/folly/portability/Sockets.cpp b/folly/portability/Sockets.cpp index 5af38750..b5f0b7d5 100755 --- a/folly/portability/Sockets.cpp +++ b/folly/portability/Sockets.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -134,7 +134,7 @@ int inet_aton(const char* cp, struct in_addr* inp) { } const char* inet_ntop(int af, const void* src, char* dst, socklen_t size) { - return ::inet_ntop(af, (char*)src, dst, size); + return ::inet_ntop(af, (char*)src, dst, size_t(size)); } int listen(int s, int backlog) { @@ -144,7 +144,7 @@ int listen(int s, int backlog) { int poll(struct pollfd fds[], nfds_t nfds, int timeout) { // TODO: Allow both file descriptors and SOCKETs in this. for (int i = 0; i < nfds; i++) { - fds[i].fd = fd_to_socket(fds[i].fd); + fds[i].fd = fd_to_socket((int)fds[i].fd); } return ::WSAPoll(fds, (ULONG)nfds, timeout); } @@ -192,7 +192,7 @@ ssize_t recvfrom( WSABUF wBuf{}; wBuf.buf = (CHAR*)buf; - wBuf.len = len; + wBuf.len = (ULONG)len; WSAMSG wMsg{}; wMsg.dwBufferCount = 1; wMsg.lpBuffers = &wBuf; @@ -256,7 +256,7 @@ ssize_t recvfrom( return recvfrom(s, (void*)buf, (size_t)len, flags, from, fromlen); } -ssize_t recvmsg(int s, struct msghdr* message, int fl) { +ssize_t recvmsg(int s, struct msghdr* message, int /* flags */) { SOCKET h = fd_to_socket(s); // Don't currently support the name translation. @@ -313,7 +313,7 @@ ssize_t send(int s, const void* buf, int len, int flags) { return send(s, (const void*)buf, (size_t)len, flags); } -ssize_t sendmsg(int s, const struct msghdr* message, int fl) { +ssize_t sendmsg(int s, const struct msghdr* message, int /* flags */) { SOCKET h = fd_to_socket(s); // Unfortunately, WSASendMsg requires the socket to have been opened @@ -337,7 +337,7 @@ ssize_t sendmsg(int s, const struct msghdr* message, int fl) { (int)message->msg_iov[i].iov_len, message->msg_flags); } - if (r == -1 || r != message->msg_iov[i].iov_len) { + if (r == -1 || size_t(r) != message->msg_iov[i].iov_len) { errno = translate_wsa_error(WSAGetLastError()); if (WSAGetLastError() == WSAEWOULDBLOCK && bytesSent > 0) { return bytesSent;