[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp

Miklos Vajna vmiklos at collabora.co.uk
Wed Jul 20 07:54:26 UTC 2016


 loolwsd/LOOLKit.cpp |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 97207e21caab0bfc622db40117af5904cffdca1a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 20 09:53:32 2016 +0200

    LOOLKit: avoid loss of precision
    
    '4 * pixmapWidth * pixmapHeight' was calculated using int precision, and
    then (implicitly) casted to long.

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 569fb2b..bde9f50 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -228,8 +228,8 @@ class Connection: public Runnable
 public:
     Connection(std::shared_ptr<ChildSession> session,
                std::shared_ptr<WebSocket> ws) :
-        _session(session),
-        _ws(ws),
+        _session(std::move(session)),
+        _ws(std::move(ws)),
         _stop(false),
         _joined(false)
     {
@@ -643,10 +643,10 @@ public:
             tileRecs.push_back(rectangle);
         }
 
-        const int tilesByX = renderArea.getWidth() / tileCombined.getTileWidth();
-        const int tilesByY = renderArea.getHeight() / tileCombined.getTileHeight();
-        const int pixmapWidth = tilesByX * tileCombined.getWidth();
-        const int pixmapHeight = tilesByY * tileCombined.getHeight();
+        const size_t tilesByX = renderArea.getWidth() / tileCombined.getTileWidth();
+        const size_t tilesByY = renderArea.getHeight() / tileCombined.getTileHeight();
+        const size_t pixmapWidth = tilesByX * tileCombined.getWidth();
+        const size_t pixmapHeight = tilesByY * tileCombined.getHeight();
         const size_t pixmapSize = 4 * pixmapWidth * pixmapHeight;
         std::vector<unsigned char> pixmap(pixmapSize, 0);
 


More information about the Libreoffice-commits mailing list