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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 14 13:52:16 UTC 2021


 vcl/source/gdi/pdfextoutdevdata.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 32aae380b02de10a433e633186de7fcb85511530
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jan 14 10:17:30 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jan 14 14:51:31 2021 +0100

    cid#1471674 help coverity see that "Division or modulo by zero" is bogus
    
    Change-Id: I82fc94d242e446d434c257471e80a6db2536e8aa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109267
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index da7e78dcbcd9..8ba808e21579 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -839,7 +839,8 @@ bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic,
         // wanted.
         return false;
 
-    if (rGraphic.GetGfxLink().GetDataSize() == 0)
+    auto nSize = rGraphic.GetGfxLink().GetDataSize();
+    if (nSize == 0)
         return false;
 
     GfxLink aLink = rGraphic.GetGfxLink();
@@ -862,7 +863,7 @@ bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic,
 
     // FIXME: ideally we'd also pre-empt the DPI related scaling too.
     sal_Int32 nCurrentRatio = (100 * aSize.Width() * aSize.Height() * 4) /
-                               rGraphic.GetGfxLink().GetDataSize();
+                               nSize;
 
     static const struct {
         sal_Int32 mnQuality;


More information about the Libreoffice-commits mailing list