[Libreoffice-commits] core.git: vcl/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Feb 22 12:52:14 UTC 2017


 vcl/source/filter/ipdf/pdfread.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit af8c0696e56395d48f8d8d75a37ced1c58a5be17
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Feb 22 09:49:58 2017 +0100

    vcl: use auto when initializing with a cast in pdfread
    
    Change-Id: Ic785ef3f767cf529dc51e4d49234145fc8d14f97
    Reviewed-on: https://gerrit.libreoffice.org/34535
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index d7de71e..12d41af 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -62,8 +62,8 @@ bool generatePreview(SvStream& rStream, Graphic& rGraphic)
         return false;
 
     // Returned unit is points, convert that to pixel.
-    int nPageWidth = pointToPixel(FPDF_GetPageWidth(pPdfPage));
-    int nPageHeight = pointToPixel(FPDF_GetPageHeight(pPdfPage));
+    size_t nPageWidth = pointToPixel(FPDF_GetPageWidth(pPdfPage));
+    size_t nPageHeight = pointToPixel(FPDF_GetPageHeight(pPdfPage));
     FPDF_BITMAP pPdfBitmap = FPDFBitmap_Create(nPageWidth, nPageHeight, /*alpha=*/1);
     if (!pPdfBitmap)
         return false;
@@ -76,17 +76,17 @@ bool generatePreview(SvStream& rStream, Graphic& rGraphic)
     Bitmap aBitmap(Size(nPageWidth, nPageHeight), 32);
     {
         Bitmap::ScopedWriteAccess pWriteAccess(aBitmap);
-        const char* pPdfBuffer = static_cast<const char*>(FPDFBitmap_GetBuffer(pPdfBitmap));
+        auto pPdfBuffer = static_cast<const char*>(FPDFBitmap_GetBuffer(pPdfBitmap));
 #ifndef MACOSX
         std::memcpy(pWriteAccess->GetBuffer(), pPdfBuffer, nPageWidth * nPageHeight * 4);
 #else
         // ARGB -> BGRA
-        for (int nRow = 0; nRow < nPageHeight; ++nRow)
+        for (size_t nRow = 0; nRow < nPageHeight; ++nRow)
         {
             int nStride = FPDFBitmap_GetStride(pPdfBitmap);
             const char* pPdfLine = pPdfBuffer + (nStride * nRow);
             Scanline pRow = pWriteAccess->GetBuffer() + (nPageWidth * nRow * 4);
-            for (int nCol = 0; nCol < nPageWidth; ++nCol)
+            for (size_t nCol = 0; nCol < nPageWidth; ++nCol)
             {
                 pRow[nCol * 4] = pPdfLine[(nCol * 4) + 3];
                 pRow[(nCol * 4) + 1] = pPdfLine[(nCol * 4) + 2];


More information about the Libreoffice-commits mailing list