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

Tor Lillqvist tml at collabora.com
Fri Apr 15 11:14:28 UTC 2016


 loolwsd/MasterProcessSession.cpp |    6 ++++--
 loolwsd/TileCache.hpp            |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 5782e0b04c628f2a04d54004bd90bf25a6ae2420
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 15 14:06:00 2016 +0300

    TileCache::lookupTile() already returns non-null only if the stream is open
    
    No need to test at call sites. We can assert() as a sanity check
    though.

diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 280e19c..63b32eb 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -593,8 +593,9 @@ void MasterProcessSession::sendTile(const char *buffer, int length, StringTokeni
     std::memcpy(output.data(), response.data(), response.size());
 
     std::unique_ptr<std::fstream> cachedTile = _docBroker->tileCache().lookupTile(part, width, height, tilePosX, tilePosY, tileWidth, tileHeight);
-    if (cachedTile && cachedTile->is_open())
+    if (cachedTile)
     {
+        assert(cachedTile->is_open());
         cachedTile->seekg(0, std::ios_base::end);
         size_t pos = output.size();
         std::streamsize size = cachedTile->tellg();
@@ -674,8 +675,9 @@ void MasterProcessSession::sendCombinedTiles(const char* /*buffer*/, int /*lengt
 
         std::unique_ptr<std::fstream> cachedTile = _docBroker->tileCache().lookupTile(part, pixelWidth, pixelHeight, x, y, tileWidth, tileHeight);
 
-        if (cachedTile && cachedTile->is_open())
+        if (cachedTile)
         {
+            assert(cachedTile->is_open());
             std::ostringstream oss;
             oss << "tile: part=" << part
                 << " width=" << pixelWidth
commit ecaaab6e9085737d06842e1ddfaf0de3a884b066
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 15 13:17:16 2016 +0300

    Default values for bool parameters make the code harder to read
    
    In this case we always passed the parameter anyway.

diff --git a/loolwsd/TileCache.hpp b/loolwsd/TileCache.hpp
index 70beabc..d656da3 100644
--- a/loolwsd/TileCache.hpp
+++ b/loolwsd/TileCache.hpp
@@ -47,7 +47,7 @@ public:
     void documentSaved();
 
     /// Notify whether we need to use the Editing cache.
-    void setEditing(bool editing = true);
+    void setEditing(bool editing);
 
     // The parameter is a message
     void saveTextFile(const std::string& text, std::string fileName);


More information about the Libreoffice-commits mailing list