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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 20 12:27:52 UTC 2018


 include/vcl/graphicfilter.hxx        |    2 
 vcl/source/filter/graphicfilter2.cxx |   94 ++++++++++++++++-------------------
 2 files changed, 46 insertions(+), 50 deletions(-)

New commits:
commit f0edf93fce53a726fec5167139513bc8420728e7
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 19 14:31:59 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 20 14:27:32 2018 +0200

    ImpDetectPCX 2nd arg always overwritten
    
    Change-Id: I0ec1e71d40c34f021003330c4dd0a8d5ee2b6ce2
    Reviewed-on: https://gerrit.libreoffice.org/62018
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index d14ee7754699..fe084136ce5a 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -152,7 +152,7 @@ class VCL_DLLPUBLIC GraphicDescriptor final
     bool            ImpDetectGIF( SvStream& rStm, bool bExtendedInfo );
     bool            ImpDetectJPG( SvStream& rStm, bool bExtendedInfo );
     bool            ImpDetectPCD( SvStream& rStm, bool bExtendedInfo );
-    bool            ImpDetectPCX( SvStream& rStm, bool bExtendedInfo );
+    bool            ImpDetectPCX( SvStream& rStm );
     bool            ImpDetectPNG( SvStream& rStm, bool bExtendedInfo );
     bool            ImpDetectTIF( SvStream& rStm, bool bExtendedInfo );
     bool            ImpDetectXBM( SvStream& rStm, bool bExtendedInfo );
diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx
index 32ad4b51947a..17b16f69abcb 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -67,7 +67,7 @@ bool GraphicDescriptor::Detect( bool bExtendedInfo )
         else if ( ImpDetectBMP( rStm, bExtendedInfo ) ) bRet = true;
         else if ( ImpDetectPNG( rStm, bExtendedInfo ) ) bRet = true;
         else if ( ImpDetectTIF( rStm, bExtendedInfo ) ) bRet = true;
-        else if ( ImpDetectPCX( rStm, bExtendedInfo ) ) bRet = true;
+        else if ( ImpDetectPCX( rStm ) ) bRet = true;
         else if ( ImpDetectDXF( rStm, bExtendedInfo ) ) bRet = true;
         else if ( ImpDetectMET( rStm, bExtendedInfo ) ) bRet = true;
         else if ( ImpDetectSVM( rStm, bExtendedInfo ) ) bRet = true;
@@ -433,13 +433,12 @@ bool GraphicDescriptor::ImpDetectPCD( SvStream& rStm, bool )
     return bRet;
 }
 
-bool GraphicDescriptor::ImpDetectPCX( SvStream& rStm, bool bExtendedInfo )
+bool GraphicDescriptor::ImpDetectPCX( SvStream& rStm )
 {
     // ! Because 0x0a can be interpreted as LF too ...
     // we can't be sure that this special sign represent a PCX file only.
     // Every Ascii file is possible here :-(
     // We must detect the whole header.
-    bExtendedInfo = true;
 
     bool    bRet = false;
     sal_uInt8   cByte = 0;
@@ -453,61 +452,58 @@ bool GraphicDescriptor::ImpDetectPCX( SvStream& rStm, bool bExtendedInfo )
         nFormat = GraphicFileFormat::PCX;
         bRet = true;
 
-        if ( bExtendedInfo )
-        {
-            sal_uInt16  nTemp16;
-            sal_uInt16  nXmin;
-            sal_uInt16  nXmax;
-            sal_uInt16  nYmin;
-            sal_uInt16  nYmax;
-            sal_uInt16  nDPIx;
-            sal_uInt16  nDPIy;
+        sal_uInt16  nTemp16;
+        sal_uInt16  nXmin;
+        sal_uInt16  nXmax;
+        sal_uInt16  nYmin;
+        sal_uInt16  nYmax;
+        sal_uInt16  nDPIx;
+        sal_uInt16  nDPIy;
 
-            rStm.SeekRel( 1 );
+        rStm.SeekRel( 1 );
 
-            // compression
-            rStm.ReadUChar( cByte );
+        // compression
+        rStm.ReadUChar( cByte );
 
-            bRet = (cByte==0 || cByte ==1);
-            if (bRet)
-            {
-                // Bits/Pixel
-                rStm.ReadUChar( cByte );
-                nBitsPerPixel = cByte;
+        bRet = (cByte==0 || cByte ==1);
+        if (bRet)
+        {
+            // Bits/Pixel
+            rStm.ReadUChar( cByte );
+            nBitsPerPixel = cByte;
 
-                // image dimensions
-                rStm.ReadUInt16( nTemp16 );
-                nXmin = nTemp16;
-                rStm.ReadUInt16( nTemp16 );
-                nYmin = nTemp16;
-                rStm.ReadUInt16( nTemp16 );
-                nXmax = nTemp16;
-                rStm.ReadUInt16( nTemp16 );
-                nYmax = nTemp16;
+            // image dimensions
+            rStm.ReadUInt16( nTemp16 );
+            nXmin = nTemp16;
+            rStm.ReadUInt16( nTemp16 );
+            nYmin = nTemp16;
+            rStm.ReadUInt16( nTemp16 );
+            nXmax = nTemp16;
+            rStm.ReadUInt16( nTemp16 );
+            nYmax = nTemp16;
 
-                aPixSize.setWidth( nXmax - nXmin + 1 );
-                aPixSize.setHeight( nYmax - nYmin + 1 );
+            aPixSize.setWidth( nXmax - nXmin + 1 );
+            aPixSize.setHeight( nYmax - nYmin + 1 );
 
-                // resolution
-                rStm.ReadUInt16( nTemp16 );
-                nDPIx = nTemp16;
-                rStm.ReadUInt16( nTemp16 );
-                nDPIy = nTemp16;
+            // resolution
+            rStm.ReadUInt16( nTemp16 );
+            nDPIx = nTemp16;
+            rStm.ReadUInt16( nTemp16 );
+            nDPIy = nTemp16;
 
-                // set logical size
-                MapMode aMap( MapUnit::MapInch, Point(),
-                              Fraction( 1, nDPIx ), Fraction( 1, nDPIy ) );
-                aLogSize = OutputDevice::LogicToLogic( aPixSize, aMap,
-                                                       MapMode( MapUnit::Map100thMM ) );
+            // set logical size
+            MapMode aMap( MapUnit::MapInch, Point(),
+                          Fraction( 1, nDPIx ), Fraction( 1, nDPIy ) );
+            aLogSize = OutputDevice::LogicToLogic( aPixSize, aMap,
+                                                   MapMode( MapUnit::Map100thMM ) );
 
-                // number of color planes
-                cByte = 5; // Illegal value in case of EOF.
-                rStm.SeekRel( 49 );
-                rStm.ReadUChar( cByte );
-                nPlanes = cByte;
+            // number of color planes
+            cByte = 5; // Illegal value in case of EOF.
+            rStm.SeekRel( 49 );
+            rStm.ReadUChar( cByte );
+            nPlanes = cByte;
 
-                bRet = (nPlanes<=4);
-            }
+            bRet = (nPlanes<=4);
         }
     }
 


More information about the Libreoffice-commits mailing list