[Libreoffice-commits] online.git: 2 commits - net/FakeSocket.cpp net/FakeSocket.hpp net/ServerSocket.hpp test/fakesockettest.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 1 19:38:24 UTC 2018
net/FakeSocket.cpp | 28 ++++++++++++++--------------
net/FakeSocket.hpp | 2 +-
net/ServerSocket.hpp | 2 +-
test/fakesockettest.cpp | 4 ++--
4 files changed, 18 insertions(+), 18 deletions(-)
New commits:
commit f8a0fb4c321fadc6f0afcb4535aca63363a925cc
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Nov 1 21:29:40 2018 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Nov 1 21:34:16 2018 +0200
WaE: -Werror=unused-parameter
Change-Id: Icadfcb19ce1fff2b5009d42acf33297cda6e36f2
diff --git a/net/FakeSocket.cpp b/net/FakeSocket.cpp
index 0deb85558..a0e86f2a3 100644
--- a/net/FakeSocket.cpp
+++ b/net/FakeSocket.cpp
@@ -370,7 +370,7 @@ int fakeSocketConnect(int fd1, int fd2)
return 0;
}
-int fakeSocketAccept4(int fd, int flags)
+int fakeSocketAccept4(int fd)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
diff --git a/net/FakeSocket.hpp b/net/FakeSocket.hpp
index 0f80e0a23..11470f6da 100644
--- a/net/FakeSocket.hpp
+++ b/net/FakeSocket.hpp
@@ -34,7 +34,7 @@ int fakeSocketListen(int fd);
int fakeSocketConnect(int fd1, int fd2);
-int fakeSocketAccept4(int fd, int flags);
+int fakeSocketAccept4(int fd);
int fakeSocketPeer(int fd);
diff --git a/net/ServerSocket.hpp b/net/ServerSocket.hpp
index 7799d8c73..7606e86ce 100644
--- a/net/ServerSocket.hpp
+++ b/net/ServerSocket.hpp
@@ -69,7 +69,7 @@ public:
socklen_t addrlen = sizeof(clientInfo);
const int rc = ::accept4(getFD(), (struct sockaddr *)&clientInfo, &addrlen, SOCK_NONBLOCK);
#else
- const int rc = fakeSocketAccept4(getFD(), SOCK_NONBLOCK);
+ const int rc = fakeSocketAccept4(getFD());
#endif
LOG_DBG("Accepted socket #" << rc << ", creating socket object.");
try
diff --git a/test/fakesockettest.cpp b/test/fakesockettest.cpp
index 8ae3542b3..5d7efc2c4 100644
--- a/test/fakesockettest.cpp
+++ b/test/fakesockettest.cpp
@@ -102,8 +102,8 @@ void FakeSocketTest::testBasic()
std::thread t0([&] {
// Cannot use CPPUNIT_ASSERT here as that throws and this thread has no Cppunit
// exception handler. We check below after joining this thread.
- s3 = fakeSocketAccept4(s0, 0);
- s4 = fakeSocketAccept4(s0, 0);
+ s3 = fakeSocketAccept4(s0);
+ s4 = fakeSocketAccept4(s0);
});
// Connect s1 and s2 to s0 (that is, to the sockets produced by accepting connections to
commit 9a0decc406b535bae5787f2fdef795a814702d90
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Nov 1 21:26:13 2018 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Nov 1 21:30:16 2018 +0200
WaE: -Werror=sign-compare
Change-Id: Iaac48bd91864d44ce9442dd68aa26ec74fb5507a
diff --git a/net/FakeSocket.cpp b/net/FakeSocket.cpp
index 0a4419110..0deb85558 100644
--- a/net/FakeSocket.cpp
+++ b/net/FakeSocket.cpp
@@ -192,7 +192,7 @@ static bool checkForPoll(std::vector<FakeSocketPair>& fds, struct pollfd *pollfd
const int K = ((pollfds[i].fd)&1);
const int N = 1 - K;
- if (pollfds[i].fd < 0 || pollfds[i].fd/2 >= fds.size())
+ if (pollfds[i].fd < 0 || static_cast<unsigned>(pollfds[i].fd/2) >= fds.size())
{
pollfds[i].revents = POLLNVAL;
retval = true;
@@ -292,7 +292,7 @@ int fakeSocketListen(int fd)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- if (fd < 0 || fd/2 >= fds.size() || fds[fd/2].fd[fd&1] == -1)
+ if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size() || fds[fd/2].fd[fd&1] == -1)
{
loggingBuffer << "FakeSocket EBADF: Listening on #" << fd << flush();
errno = EBADF;
@@ -327,7 +327,7 @@ int fakeSocketConnect(int fd1, int fd2)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- if (fd1 < 0 || fd2 < 0 || fd1/2 >= fds.size() || fd2/2 >= fds.size())
+ if (fd1 < 0 || fd2 < 0 || static_cast<unsigned>(fd1/2) >= fds.size() || static_cast<unsigned>(fd2/2) >= fds.size())
{
loggingBuffer << "FakeSocket EBADF: Connect #" << fd1 << " to #" << fd2 << flush();
errno = EBADF;
@@ -374,7 +374,7 @@ int fakeSocketAccept4(int fd, int flags)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- if (fd < 0 || fd/2 >= fds.size())
+ if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
loggingBuffer << "FakeSocket EBADF: Accept #" << fd << flush();
errno = EBADF;
@@ -401,7 +401,7 @@ int fakeSocketAccept4(int fd, int flags)
theCV.wait(lock);
assert(pair.connectingFd >= 0);
- assert(pair.connectingFd/2 < fds.size());
+ assert(static_cast<unsigned>(pair.connectingFd/2) < fds.size());
assert((pair.connectingFd&1) == 0);
FakeSocketPair& pair2 = fds[pair.connectingFd/2];
@@ -424,7 +424,7 @@ int fakeSocketPeer(int fd)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- if (fd < 0 || fd/2 >= fds.size())
+ if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
loggingBuffer << "FakeSocket EBADF: Peer of #" << fd << flush();
errno = EBADF;
@@ -445,7 +445,7 @@ ssize_t fakeSocketAvailableDataLength(int fd)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- if (fd < 0 || fd/2 >= fds.size())
+ if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
errno = EBADF;
return -1;
@@ -476,7 +476,7 @@ ssize_t fakeSocketRead(int fd, void *buf, size_t nbytes)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- if (fd < 0 || fd/2 >= fds.size())
+ if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
loggingBuffer << "FakeSocket EBADF: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
errno = EBADF;
@@ -516,7 +516,7 @@ ssize_t fakeSocketRead(int fd, void *buf, size_t nbytes)
// These sockets are record-oriented. It won't work to read less than the whole record in
// turn to be read.
result = pair.buffer[K][0].size();
- if (nbytes < result)
+ if (nbytes < static_cast<unsigned>(result))
{
loggingBuffer << "FakeSocket EAGAIN: Read from #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
errno = EAGAIN; // Not the right errno, but what would be?
@@ -544,7 +544,7 @@ ssize_t fakeSocketWrite(int fd, const void *buf, size_t nbytes)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- if (fd < 0 || fd/2 >= fds.size())
+ if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
loggingBuffer << "FakeSocket EBADF: Write to #" << fd << ", " << nbytes << (nbytes == 1 ? " byte" : " bytes") << flush();
errno = EBADF;
@@ -587,7 +587,7 @@ int fakeSocketShutdown(int fd)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- if (fd < 0 || fd/2 >= fds.size())
+ if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
loggingBuffer << "FakeSocket EBADF: Shutdown #" << fd << flush();
errno = EBADF;
@@ -625,7 +625,7 @@ int fakeSocketClose(int fd)
{
std::vector<FakeSocketPair>& fds = getFds();
std::unique_lock<std::mutex> lock(theMutex);
- if (fd < 0 || fd/2 >= fds.size())
+ if (fd < 0 || static_cast<unsigned>(fd/2) >= fds.size())
{
loggingBuffer << "FakeSocket EBADF: Close #" << fd << flush();
errno = EBADF;
@@ -663,7 +663,7 @@ void fakeSocketDumpState()
std::unique_lock<std::mutex> lock(theMutex);
loggingBuffer << "FakeSocket open sockets:" << flush();
- for (int i = 0; i < fds.size(); i++)
+ for (int i = 0; i < static_cast<int>(fds.size()); i++)
{
if (fds[i].fd[0] != -1)
{
More information about the Libreoffice-commits
mailing list