mirror of
https://github.com/fpagliughi/sockpp.git
synced 2026-01-12 00:04:45 +08:00
fixed not compiling on windows clang
This commit is contained in:
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"vector": "cpp"
|
||||
}
|
||||
}
|
||||
@@ -615,7 +615,7 @@ public:
|
||||
result<size_t> send_to(const void* buf, size_t n, int flags, const sock_address& addr) {
|
||||
#if defined(_WIN32)
|
||||
auto cbuf = reinterpret_cast<const char*>(buf);
|
||||
return check_res(
|
||||
return check_res<size_t>(
|
||||
::sendto(handle(), cbuf, int(n), flags, addr.sockaddr_ptr(), addr.size())
|
||||
);
|
||||
#else
|
||||
|
||||
@@ -118,7 +118,7 @@ socket socket::clone() const {
|
||||
if (::WSADuplicateSocketW(handle_, ::GetCurrentProcessId(), &protInfo) == 0)
|
||||
h = check_socket(
|
||||
::WSASocketW(AF_INET, SOCK_STREAM, 0, &protInfo, 0, WSA_FLAG_OVERLAPPED)
|
||||
);
|
||||
).value();
|
||||
#else
|
||||
h = ::dup(handle_);
|
||||
#endif
|
||||
|
||||
@@ -108,7 +108,7 @@ result<size_t> stream_socket::read(const std::vector<iovec> &ranges) {
|
||||
|
||||
auto ret = ::WSARecv(handle(), bufs.data(), nbuf, &nread, &flags, nullptr, nullptr);
|
||||
if (ret == SOCKET_ERROR)
|
||||
return result<>::from_last_error();
|
||||
return result<size_t>::from_last_error();
|
||||
return size_t(nread);
|
||||
#endif
|
||||
}
|
||||
@@ -170,7 +170,7 @@ result<size_t> stream_socket::write(const std::vector<iovec> &ranges) {
|
||||
if (::WSASend(handle(), bufs.data(), nmsg, &nwritten, 0, nullptr, nullptr) ==
|
||||
SOCKET_ERROR)
|
||||
return result<size_t>::from_last_error();
|
||||
return size_t(nread);
|
||||
return size_t(nwritten);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user