[Libreoffice-commits] libvisio.git: src/lib

Fridrich Å trba fridrich.strba at bluewin.ch
Tue Apr 16 08:41:15 PDT 2013


 src/lib/VSDContentCollector.cpp |   20 ++++++++++----------
 src/lib/VSDParser.cpp           |    2 +-
 src/lib/VSDXMLParserBase.cpp    |    2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit ee46486937222c9715b9a7c2c6ceddd116a79296
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Tue Apr 16 17:40:50 2013 +0200

    Don't collect empty foreign data

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 2d2fb1d..eb1e2d3 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -1161,22 +1161,22 @@ void libvisio::VSDContentCollector::_handleForeignData(const WPXBinaryData &bina
     {
     case 0:
     case 255:
-      filename.sprintf("binarydump%i.bmp", bitmapId++);
+      filename.sprintf("binarydump%08u.bmp", bitmapId++);
       break;
     case 1:
-      filename.sprintf("binarydump%i.jpeg", bitmapId++);
+      filename.sprintf("binarydump%08u.jpeg", bitmapId++);
       break;
     case 2:
-      filename.sprintf("binarydump%i.gif", bitmapId++);
+      filename.sprintf("binarydump%08u.gif", bitmapId++);
       break;
     case 3:
-      filename.sprintf("binarydump%i.tiff", bitmapId++);
+      filename.sprintf("binarydump%08u.tiff", bitmapId++);
       break;
     case 4:
-      filename.sprintf("binarydump%i.png", bitmapId++);
+      filename.sprintf("binarydump%08u.png", bitmapId++);
       break;
     default:
-      filename.sprintf("binarydump%i.bin", bitmapId++);
+      filename.sprintf("binarydump%08u.bin", bitmapId++);
       break;
     }
   }
@@ -1185,14 +1185,14 @@ void libvisio::VSDContentCollector::_handleForeignData(const WPXBinaryData &bina
     const unsigned char *tmpBinData = m_currentForeignData.getDataBuffer();
     // Check for EMF signature
     if (m_currentForeignData.size() > 0x2B && tmpBinData[0x28] == 0x20 && tmpBinData[0x29] == 0x45 && tmpBinData[0x2A] == 0x4D && tmpBinData[0x2B] == 0x46)
-      filename.sprintf("binarydump%i.emf", bitmapId++);
+      filename.sprintf("binarydump%08u.emf", bitmapId++);
     else
-      filename.sprintf("binarydump%i.wmf", bitmapId++);
+      filename.sprintf("binarydump%08u.wmf", bitmapId++);
   }
   else if (m_foreignType == 2)
-    filename.sprintf("binarydump%i.ole", bitmapId++);
+    filename.sprintf("binarydump%08u.ole", bitmapId++);
   else
-    filename.sprintf("binarydump%i.bin", bitmapId++);
+    filename.sprintf("binarydump%08u.bin", bitmapId++);
 
   FILE *f = fopen(filename.cstr(), "wb");
   if (f)
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index 4232e5a..083e7c9 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -619,7 +619,7 @@ void libvisio::VSDParser::_flushShape()
   for (std::map<unsigned, VSDName>::const_iterator iterName = m_shape.m_names.begin(); iterName != m_shape.m_names.end(); ++iterName)
     m_collector->collectName(iterName->first, m_currentShapeLevel+2, iterName->second.m_data, iterName->second.m_format);
 
-  if (m_shape.m_foreign)
+  if (m_shape.m_foreign && m_shape.m_foreign->data.size())
     m_collector->collectForeignData(m_currentShapeLevel+1, m_shape.m_foreign->data);
 
   if (!m_shape.m_fields.empty())
diff --git a/src/lib/VSDXMLParserBase.cpp b/src/lib/VSDXMLParserBase.cpp
index 2e76ec4..287df0a 100644
--- a/src/lib/VSDXMLParserBase.cpp
+++ b/src/lib/VSDXMLParserBase.cpp
@@ -1765,7 +1765,7 @@ void libvisio::VSDXMLParserBase::_flushShape()
     }
   }
 
-  if (m_shape.m_foreign)
+  if (m_shape.m_foreign && m_shape.m_foreign->data.size())
     m_collector->collectForeignData(m_currentShapeLevel+1, m_shape.m_foreign->data);
 
   if (!m_shape.m_fields.empty())


More information about the Libreoffice-commits mailing list