Skip to content

Commit 711ab48

Browse files
committed
Remove occurrences of ssize_t
Since apparently it's a POSIX-extension. For portability reasons use auto instead, then always use an explicit cast on the result to silence warnings.
1 parent 8541c34 commit 711ab48

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/common/PlaintextConnection.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ bool PlaintextConnection::connect(const std::string &hostname, uint16_t port)
7373

7474
size_t PlaintextConnection::read(char *buffer, size_t size)
7575
{
76-
ssize_t read = ::recv(fd, buffer, size, 0);
76+
auto read = ::recv(fd, buffer, size, 0);
7777
if (read < 0)
7878
read = 0;
79-
return read;
79+
return static_cast<size_t>(read);
8080
}
8181

8282
size_t PlaintextConnection::write(const char *buffer, size_t size)
8383
{
84-
ssize_t written = ::send(fd, buffer, size, 0);
84+
auto written = ::send(fd, buffer, size, 0);
8585
if (written < 0)
8686
written = 0;
87-
return written;
87+
return static_cast<size_t>(written);
8888
}
8989

9090
void PlaintextConnection::close()

0 commit comments

Comments
 (0)