[PATCH] EMF+ fixes

Chris Sherlock (via Code Review) gerrit at gerrit.libreoffice.org
Sat May 11 18:51:21 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3861

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/61/3861/1

EMF+ fixes

A number of fixes have been made:
* Missing redirect in SAL_WARN - only gets picked up when DBG_LEVEL > 1
* Some errant newlines in SAL_INFO

Change-Id: I059ba24964dd428a56a31d100109cfec938a8a49
---
M cppcanvas/source/mtfrenderer/emfplus.cxx
M vcl/source/filter/wmf/enhwmf.cxx
2 files changed, 17 insertions(+), 9 deletions(-)



diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index c0f9172..a4a709b 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -226,7 +226,7 @@
                     }
                 }
 
-                if (polygon.count ())
+                if (polygon.count ()) {
                     aPolygon.append (polygon);
 
 #if OSL_DEBUG_LEVEL > 1
@@ -238,15 +238,16 @@
                             SAL_INFO ("cppcanvas.emf", "point: " << point.getX() << "," << point.getY());
                             if (polygon.isPrevControlPointUsed(j)) {
                                 point = polygon.getPrevControlPoint(j);
-                                SAL_INFO ("cppcanvas.emf", "prev: " << point.getX() "," << point.getY());
+                                SAL_INFO ("cppcanvas.emf", "prev: " << point.getX() << "," << point.getY());
                             }
                             if (polygon.isNextControlPointUsed(j)) {
                                 point = polygon.getNextControlPoint(j);
-                                SAL_INFO ("cppcanvas.emf", "next: " << point.getX() "," << point.getY());
+                                SAL_INFO ("cppcanvas.emf", "next: " << point.getX() << "," << point.getY());
                             }
                         }
                     }
 #endif
+                }
 
                 return aPolygon;
             }
@@ -370,7 +371,8 @@
 
                 s >> header >> type;
 
-                SAL_INFO ("cppcanvas.emf", "EMF+\tbrush\nEMF+\theader: 0x" << std::hex << header << " type: " << type << std::dec);
+                SAL_INFO ("cppcanvas.emf", "EMF+\tbrush");
+                SAL_INFO ("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " type: " << type << std::dec);
 
                 switch (type) {
                 case 0:
@@ -618,7 +620,8 @@
 
                 s >> header >> unknown >> penFlags >> unknown2 >> width;
 
-                SAL_INFO("cppcanvas.emf", "EMF+\tpen\nEMF+\theader: 0x" << std::hex << header << " unknown: 0x" << unknown <<
+                SAL_INFO("cppcanvas.emf", "EMF+\tpen");
+                SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " unknown: 0x" << unknown <<
                             " additional flags: 0x" << penFlags << " unknown: 0x" << unknown2 << " width: " << std::dec << width );
 
                 if (penFlags & 1)
@@ -760,7 +763,7 @@
 
                         mfStream >> file;
                         file.Flush();
-                        file.Close()
+                        file.Close();
 #endif
                 }
             }
@@ -1263,6 +1266,10 @@
                 rMF >> type >> flags >> size >> dataSize;
 
                 next = rMF.Tell() + ( size - 12 );
+
+                if (size < 12) {
+                    SAL_INFO("cppcanvas.emf", "Size field is less than 12 bytes");
+                }
 
                 SAL_INFO("cppcanvas.emf", "EMF+ record size: " << size << " type: " << type << " flags: " << flags << " data size: " << dataSize);
 
@@ -1911,10 +1918,10 @@
                         }
 
                         break;
-                                                            }
+                    }
                     default:
                         SAL_INFO("cppcanvas.emf", "EMF+ unhandled record type: " << type);
-                        SAL_INFO("cppcanvas.emf", "EMF+\tTODO\n");
+                        SAL_INFO("cppcanvas.emf", "EMF+\tTODO");
                     }
                 }
 
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index 9857c4c..e0e69cf 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -466,7 +466,8 @@
 
             *pWMF >> length;
 
-            SAL_INFO("vcl.emf", "\tGDI comment\n\t\tlength: " << length);
+            SAL_INFO("vcl.emf", "\tGDI comment");
+            SAL_INFO("vcl.emf", "\t\tlength: " << length);
 
             if( pWMF->good() && length >= 4 ) {
                 sal_uInt32 id;

-- 
To view, visit https://gerrit.libreoffice.org/3861
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I059ba24964dd428a56a31d100109cfec938a8a49
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Chris Sherlock <chris.sherlock79 at gmail.com>



More information about the LibreOffice mailing list