emfio/inc/emfreader.hxx           |    2 +-
 emfio/source/reader/emfreader.cxx |   17 +++++------------
 2 files changed, 6 insertions(+), 13 deletions(-)

New commits:
commit 4f4c5b43f0c69385aa2738cbac7f7c898af1972f
Author:     Bartosz Kosiorek <gan...@poczta.onet.pl>
AuthorDate: Sat May 22 19:19:12 2021 +0200
Commit:     Bartosz Kosiorek <gan...@poczta.onet.pl>
CommitDate: Sat May 22 20:08:11 2021 +0200

    tdf#55007 EMF Allow negatives values for Start Point and End Point
    
    With previous inplementation, the ARC, ARCTO, CHORD and PIE
    records were get Start Point and End Point only with
    positive values. It was causing display issues.
    
    This patch fix that according to [MS-EMF] specification
    
    Change-Id: Ie1d90a904e840674380b81af0dfe21260374587d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115994
    Tested-by: Jenkins
    Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

diff --git a/emfio/inc/emfreader.hxx b/emfio/inc/emfreader.hxx
index e580835fc083..a09ad6fa2c20 100644
--- a/emfio/inc/emfreader.hxx
+++ b/emfio/inc/emfreader.hxx
@@ -27,7 +27,7 @@ namespace emfio
     class EmfReader : public MtfTools
     {
     private:
-        sal_Int32   mnRecordCount;
+        sal_uInt32   mnRecordCount;
 
         bool        mbRecordPath : 1;
         bool        mbEMFPlus : 1;
diff --git a/emfio/source/reader/emfreader.cxx 
b/emfio/source/reader/emfreader.cxx
index e9a3afec3f19..9a8784c7e631 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1369,8 +1369,8 @@ namespace emfio
                     case EMR_ARCTO :
                     case EMR_CHORD :
                     {
-                        sal_uInt32 nStartX, nStartY, nEndX, nEndY;
-                        mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 
).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadUInt32( nStartX ).ReadUInt32( nStartY 
).ReadUInt32( nEndX ).ReadUInt32( nEndY );
+                        sal_Int32 nStartX, nStartY, nEndX, nEndY;
+                        mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 
).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadInt32( nStartX ).ReadInt32( nStartY 
).ReadInt32( nEndX ).ReadInt32( nEndY );
                         SAL_INFO( "emfio", "\t\t Bounds: " << nX32 << ":" << 
nY32 << ", " << nx32 << ":" << ny32 << ", Start: " << nStartX << ":" << nStartY 
<< ", End: " << nEndX << ":" << nEndY );
                         tools::Polygon aPoly( ReadRectangle( nX32, nY32, nx32, 
ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), PolyStyle::Arc );
                         if ( nRecType == EMR_CHORD )
@@ -1382,8 +1382,8 @@ namespace emfio
 
                     case EMR_PIE :
                     {
-                        sal_uInt32 nStartX, nStartY, nEndX, nEndY;
-                        mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 
).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadUInt32( nStartX ).ReadUInt32( nStartY 
).ReadUInt32( nEndX ).ReadUInt32( nEndY );
+                        sal_Int32 nStartX, nStartY, nEndX, nEndY;
+                        mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 
).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadInt32( nStartX ).ReadInt32( nStartY 
).ReadInt32( nEndX ).ReadInt32( nEndY );
                         tools::Polygon aPoly( ReadRectangle( nX32, nY32, nx32, 
ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), PolyStyle::Pie );
                         DrawPolygon( aPoly, mbRecordPath );
                     }
@@ -2153,16 +2153,9 @@ namespace emfio
             mnEndPos = nActualFileSize;
         }
 
-        mpInputStream->ReadInt32(mnRecordCount);
+        mpInputStream->ReadUInt32(mnRecordCount);
         SAL_INFO("emfio", "\tRecords: " << mnRecordCount);
 
-        if (mnRecordCount <= 0)
-        {
-            SAL_WARN("emfio", "EMF\t\tEMF Header object shows record counter 
as <= 0! This shouldn't "
-                                "be possible... indicator of possible file 
corruption?");
-            return false;
-        }
-
         // the number of "handles", or graphics objects used in the metafile
 
         sal_uInt16 nHandlesCount;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to