[Libreoffice-commits] online.git: net/FakeSocket.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 25 18:58:31 UTC 2018
net/FakeSocket.cpp | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
New commits:
commit a4b4f6bf36ad97672f89d9d841051d30746c8a98
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Oct 25 21:53:34 2018 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Oct 25 21:57:44 2018 +0300
Fix fakeSocketAvailableDataLength() when peer socket is closed
Also bin a few lines of unnecessary code.
diff --git a/net/FakeSocket.cpp b/net/FakeSocket.cpp
index 5562e20ca..ecbcdc33e 100644
--- a/net/FakeSocket.cpp
+++ b/net/FakeSocket.cpp
@@ -463,9 +463,13 @@ ssize_t fakeSocketAvailableDataLength(int fd)
return -1;
}
- loggingBuffer << "FakeSocket Available data on #" << fd << ": " << pair.buffer[K][0].size() << flush();
+ ssize_t result = 0;
+ if (pair.buffer[K].size() > 0)
+ result = pair.buffer[K][0].size();
- return pair.buffer[K][0].size();
+ loggingBuffer << "FakeSocket Available data on #" << fd << ": " << result << flush();
+
+ return result;
}
ssize_t fakeSocketRead(int fd, void *buf, size_t nbytes)
@@ -516,9 +520,6 @@ ssize_t fakeSocketRead(int fd, void *buf, size_t nbytes)
return -1;
}
- if (pair.buffer[K].size() == 0)
- return 0;
-
memmove(buf, pair.buffer[K][0].data(), result);
pair.buffer[K].erase(pair.buffer[K].begin());
More information about the Libreoffice-commits
mailing list