[Libreoffice-commits] online.git: 3 commits - common/Png.hpp kit/ChildSession.cpp kit/Kit.cpp test/httpwstest.cpp test/TileCacheTests.cpp tools/KitClient.cpp

Tor Lillqvist tml at collabora.com
Wed Jan 4 12:49:28 UTC 2017


 common/Png.hpp          |    4 +---
 kit/ChildSession.cpp    |    4 ++--
 kit/Kit.cpp             |    6 +++---
 test/TileCacheTests.cpp |    2 +-
 test/httpwstest.cpp     |    4 ++--
 tools/KitClient.cpp     |    2 +-
 6 files changed, 10 insertions(+), 12 deletions(-)

New commits:
commit b837f588144a793ed2f3aac22c254aecb03a448b
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Jan 4 14:36:42 2017 +0200

    Bin superfluous assert()
    
    Change-Id: Ie50b44e0681e9fd7c33e125476e1aafda1010f34

diff --git a/common/Png.hpp b/common/Png.hpp
index 00ac4b0..b3c0863 100644
--- a/common/Png.hpp
+++ b/common/Png.hpp
@@ -192,8 +192,6 @@ void readTileData(png_structp png_ptr, png_bytep data, png_size_t length)
 {
     png_voidp io_ptr = png_get_io_ptr(png_ptr);
     assert(io_ptr);
-
-    assert(io_ptr != nullptr);
     std::stringstream& streamTile = *static_cast<std::stringstream*>(io_ptr);
     streamTile.read(reinterpret_cast<char*>(data), length);
 }
commit 674fbc3f425e57cc1978df1828bd82666e527a52
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Jan 4 13:57:39 2017 +0200

    This variable can be const
    
    Change-Id: Ie8b271c2383c2742b83139a43c90ba9272373d2f

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index d4c5236..cb08f0a 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -398,7 +398,7 @@ bool ChildSession::sendFontRendering(const char* /*buffer*/, int /*length*/, Str
         return false;
     }
 
-    std::string response = "renderfont: " + Poco::cat(std::string(" "), tokens.begin() + 1, tokens.end()) + "\n";
+    const std::string response = "renderfont: " + Poco::cat(std::string(" "), tokens.begin() + 1, tokens.end()) + "\n";
 
     std::vector<char> output;
     output.resize(response.size());
commit a36d4b0fc3addb9cee42fe2761bb812ef9fd562f
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Jan 4 13:35:26 2017 +0200

    Reanme png namespace to Png for consistency
    
    As far as I see, we tend to use the same namespace name as the
    basename of the corresponding include file, and this stuff is defined
    in a file called Png.hpp.
    
    Change-Id: Id859e13e94568abd9f1d5b4ef3bfbbb0c156db11

diff --git a/common/Png.hpp b/common/Png.hpp
index 395da6a..00ac4b0 100644
--- a/common/Png.hpp
+++ b/common/Png.hpp
@@ -52,7 +52,7 @@
 
 #include "SpookyV2.h"
 
-namespace png
+namespace Png
 {
 
 // Callback functions for libpng
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 611731b..d4c5236 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -423,7 +423,7 @@ bool ChildSession::sendFontRendering(const char* /*buffer*/, int /*length*/, Str
         return sendTextFrame(output.data(), output.size());
     }
 
-    if (png::encodeBufferToPNG(ptrFont, width, height, output, LOK_TILEMODE_RGBA))
+    if (Png::encodeBufferToPNG(ptrFont, width, height, output, LOK_TILEMODE_RGBA))
     {
         bSuccess = sendTextFrame(output.data(), output.size());
     }
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index fb1464a..82a5783 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -353,7 +353,7 @@ class PngCache
     {
         LOG_DBG("PNG cache with hash " << hash << " missed.");
         CacheEntry newEntry(bufferWidth * bufferHeight * 1);
-        if (png::encodeSubBufferToPNG(pixmap, startX, startY, width, height,
+        if (Png::encodeSubBufferToPNG(pixmap, startX, startY, width, height,
                                       bufferWidth, bufferHeight,
                                       *newEntry._data, mode))
         {
@@ -384,7 +384,7 @@ public:
     bool encodeBufferToPNG(unsigned char* pixmap, int width, int height,
                            std::vector<char>& output, LibreOfficeKitTileMode mode)
     {
-        const uint64_t hash = png::hashBuffer(pixmap, width, height);
+        const uint64_t hash = Png::hashBuffer(pixmap, width, height);
         if (cacheTest(hash, output))
         {
             return true;
@@ -399,7 +399,7 @@ public:
                               int bufferWidth, int bufferHeight,
                               std::vector<char>& output, LibreOfficeKitTileMode mode)
     {
-        const uint64_t hash = png::hashSubBuffer(pixmap, startX, startY, width, height,
+        const uint64_t hash = Png::hashSubBuffer(pixmap, startX, startY, width, height,
                                                  bufferWidth, bufferHeight);
         if (cacheTest(hash, output))
         {
diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp
index 4acd29e..17bf6da 100644
--- a/test/TileCacheTests.cpp
+++ b/test/TileCacheTests.cpp
@@ -627,7 +627,7 @@ void TileCacheTests::checkBlackTile(std::stringstream& tile)
     png_uint_32 width = 0;
     png_uint_32 rowBytes = 0;
 
-    auto rows = png::decodePNG(tile, height, width, rowBytes);
+    auto rows = Png::decodePNG(tile, height, width, rowBytes);
 
     png_uint_32 black = 0;
     for (png_uint_32 itRow = 0; itRow < height; ++itRow)
diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp
index 4f1a8d7..02e66d1 100644
--- a/test/httpwstest.cpp
+++ b/test/httpwstest.cpp
@@ -1543,7 +1543,7 @@ void HTTPWSTest::testCalcEditRendering()
     png_uint_32 height = 0;
     png_uint_32 width = 0;
     png_uint_32 rowBytes = 0;
-    auto rows = png::decodePNG(streamRes, height, width, rowBytes);
+    auto rows = Png::decodePNG(streamRes, height, width, rowBytes);
 
     const std::vector<char> exp = readDataFromFile("calc_render_0_512x512.3840,0.7680x7680.png");
     std::stringstream streamExp;
@@ -1552,7 +1552,7 @@ void HTTPWSTest::testCalcEditRendering()
     png_uint_32 heightExp = 0;
     png_uint_32 widthExp = 0;
     png_uint_32 rowBytesExp = 0;
-    auto rowsExp = png::decodePNG(streamExp, heightExp, widthExp, rowBytesExp);
+    auto rowsExp = Png::decodePNG(streamExp, heightExp, widthExp, rowBytesExp);
 
     CPPUNIT_ASSERT_EQUAL(heightExp, height);
     CPPUNIT_ASSERT_EQUAL(widthExp, width);
diff --git a/tools/KitClient.cpp b/tools/KitClient.cpp
index 9264a54..30cffbe 100644
--- a/tools/KitClient.cpp
+++ b/tools/KitClient.cpp
@@ -178,7 +178,7 @@ protected:
                 std::vector<char> png;
                 const auto mode = static_cast<LibreOfficeKitTileMode>(loKitDocument->pClass->getTileMode(loKitDocument));
 
-                png::encodeBufferToPNG(pixmap.data(), canvasWidth, canvasHeight, png, mode);
+                Png::encodeBufferToPNG(pixmap.data(), canvasWidth, canvasHeight, png, mode);
 
                 TemporaryFile pngFile;
                 std::ofstream pngStream(pngFile.path(), std::ios::binary);


More information about the Libreoffice-commits mailing list