[Libreoffice-commits] online.git: 2 commits - loolwsd/Util.cpp loolwsd/Util.hpp

Tor Lillqvist tml at collabora.com
Tue Mar 1 15:17:59 UTC 2016


 loolwsd/Util.cpp |    2 +-
 loolwsd/Util.hpp |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit a959e9900420b86728ce3823366f966d5852a919
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Mar 1 17:17:10 2016 +0200

    Make declaration of writeFIFO() match definition

diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp
index 481fe3e..0d4f5d2 100644
--- a/loolwsd/Util.hpp
+++ b/loolwsd/Util.hpp
@@ -75,9 +75,9 @@ namespace Util
     /// Call WebSocket::shutdown() ignoring Poco::IOException.
     void shutdownWebSocket(std::shared_ptr<Poco::Net::WebSocket> ws);
 
-    ssize_t writeFIFO(const int pipe, const char* buffer, ssize_t size);
+    ssize_t writeFIFO(int pipe, const char* buffer, ssize_t size);
     inline
-    ssize_t writeFIFO(const int pipe, const std::string& message)
+    ssize_t writeFIFO(int pipe, const std::string& message)
     {
         return writeFIFO(pipe, message.c_str(), message.size());
     }
commit 8bc05765bfca5b5bf5ec7f1c1a77714cccbd1660
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Mar 1 17:10:13 2016 +0200

    Make writeFIFO() return total number of bytes written if successful
    
    That is probably what was the intent. As originally written, in case
    the function encountered partial writers, and had to do several
    write() calls, only the number of bytes written by the last one was
    returned.
    
    Luckily the actual return value of writeFIFO() is not used
    anywhere. It is just tested for being negative.
    
    Still there is the problem that if at first one or several write()
    calls succeed but don't write the whole buffer, and then a write()
    fails, the caller has no way to know that the buffer has been
    partially written. But that is hopefully highly theoretical and there
    is no sane way to handle such a situation anyway.

diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index 05d8032..5a2c864 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -365,7 +365,7 @@ namespace Util
             }
             else
             {
-                count = bytes;
+                count += bytes;
                 break;
             }
         }


More information about the Libreoffice-commits mailing list