Blame SOURCES/0003-Correct-some-cppcheck-errors-change-code-to-avoid-ca.patch

b5c349
From ad5f5d5c5feaac3c1351609c79aaa7d2802d5a55 Mon Sep 17 00:00:00 2001
b5c349
From: osnola <alonso@loria.fr>
b5c349
Date: Mon, 4 Nov 2013 18:35:36 +0100
b5c349
Subject: [PATCH 3/8] Correct some cppcheck errors + change code to avoid
b5c349
 calling isfinite...
b5c349
b5c349
---
b5c349
 configure.ac                    | 10 -------
b5c349
 src/conv/csv/mwaw2csv.cpp       |  2 +-
b5c349
 src/conv/raw/mwaw2raw.cpp       |  2 +-
b5c349
 src/conv/text/mwaw2text.cpp     |  2 +-
b5c349
 src/lib/CWDbaseContent.cxx      | 19 +++++++------
b5c349
 src/lib/CWDbaseContent.hxx      |  6 ++--
b5c349
 src/lib/CWGraph.cxx             | 30 ++++++++++----------
b5c349
 src/lib/CWGraph.hxx             |  2 +-
b5c349
 src/lib/HMWKGraph.cxx           | 12 ++++----
b5c349
 src/lib/MSKGraph.cxx            |  2 +-
b5c349
 src/lib/MSKGraph.hxx            |  2 +-
b5c349
 src/lib/MSKParser.cxx           | 18 ++----------
b5c349
 src/lib/MSKParser.hxx           |  2 --
b5c349
 src/lib/MSWTextStyles.cxx       |  2 +-
b5c349
 src/lib/MWAWDocument.cxx        |  6 ++--
b5c349
 src/lib/MWAWInputStream.cxx     |  4 ++-
b5c349
 src/lib/MWAWInputStream.hxx     |  2 +-
b5c349
 src/lib/MWAWOLEParser.cxx       |  2 +-
b5c349
 src/lib/MWAWOLEStream.cxx       |  2 +-
b5c349
 src/lib/MWAWPropertyHandler.cxx | 63 +++++++++++++++++++++--------------------
b5c349
 20 files changed, 84 insertions(+), 106 deletions(-)
b5c349
b5c349
diff --git a/src/conv/csv/mwaw2csv.cpp b/src/conv/csv/mwaw2csv.cpp
b5c349
index 0937a46..ed3799d 100644
b5c349
--- a/src/conv/csv/mwaw2csv.cpp
b5c349
+++ b/src/conv/csv/mwaw2csv.cpp
b5c349
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
b5c349
 		CSVGenerator documentGenerator(output);
b5c349
 		error = MWAWDocument::parse(&input, &documentGenerator);
b5c349
 	}
b5c349
-	catch(MWAWDocument::Result err)
b5c349
+	catch(MWAWDocument::Result const &err)
b5c349
 	{
b5c349
 		error=err;
b5c349
 	}
b5c349
diff --git a/src/conv/raw/mwaw2raw.cpp b/src/conv/raw/mwaw2raw.cpp
b5c349
index 5e365f1..8e6a92c 100644
b5c349
--- a/src/conv/raw/mwaw2raw.cpp
b5c349
+++ b/src/conv/raw/mwaw2raw.cpp
b5c349
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
b5c349
 	{
b5c349
 		error=MWAWDocument::parse(&input, &documentGenerator);
b5c349
 	}
b5c349
-	catch (MWAWDocument::Result err)
b5c349
+	catch (MWAWDocument::Result const &err)
b5c349
 	{
b5c349
 		error=err;
b5c349
 	}
b5c349
diff --git a/src/conv/text/mwaw2text.cpp b/src/conv/text/mwaw2text.cpp
b5c349
index edb980d..2b561bf 100644
b5c349
--- a/src/conv/text/mwaw2text.cpp
b5c349
+++ b/src/conv/text/mwaw2text.cpp
b5c349
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
b5c349
 	{
b5c349
 		MWAWDocument::parse(&input, &documentGenerator);
b5c349
 	}
b5c349
-	catch (MWAWDocument::Result err)
b5c349
+	catch (MWAWDocument::Result const &err)
b5c349
 	{
b5c349
 		error=err;
b5c349
 	}
b5c349
diff --git a/src/lib/CWDbaseContent.cxx b/src/lib/CWDbaseContent.cxx
b5c349
index 7198103..2c2d971 100644
b5c349
--- a/src/lib/CWDbaseContent.cxx
b5c349
+++ b/src/lib/CWDbaseContent.cxx
b5c349
@@ -518,7 +518,7 @@ bool CWDbaseContent::readRecordSSV1(Vec2i const &id, long pos, CWDbaseContent::R
b5c349
         break;
b5c349
       }
b5c349
       record.m_resType=Record::R_Double;
b5c349
-      if (input->readDouble(record.m_resDouble))
b5c349
+      if (input->readDouble(record.m_resDouble, record.m_resDoubleNaN))
b5c349
         f << record.m_resDouble << ",";
b5c349
       else {
b5c349
         MWAW_DEBUG_MSG(("CWDbaseContent::readRecordSSV1: can not read a float\n"));
b5c349
@@ -572,7 +572,7 @@ bool CWDbaseContent::readRecordSSV1(Vec2i const &id, long pos, CWDbaseContent::R
b5c349
         f << "###int" << rType << "[res],";
b5c349
         break;
b5c349
       case 2:
b5c349
-        if (input->checkPosition(resPos+10) && input->readDouble(record.m_resDouble)) {
b5c349
+        if (input->checkPosition(resPos+10) && input->readDouble(record.m_resDouble, record.m_resDoubleNaN)) {
b5c349
           record.m_resType=Record::R_Double;
b5c349
           f << "=" << record.m_resDouble << ",";
b5c349
           break;
b5c349
@@ -674,7 +674,7 @@ bool CWDbaseContent::readRecordSS(Vec2i const &id, long pos, CWDbaseContent::Rec
b5c349
       break;
b5c349
     }
b5c349
     record.m_resType=Record::R_Double;
b5c349
-    if (input->readDouble(record.m_resDouble))
b5c349
+    if (input->readDouble(record.m_resDouble, record.m_resDoubleNaN))
b5c349
       f << record.m_resDouble << ",";
b5c349
     else {
b5c349
       MWAW_DEBUG_MSG(("CWDbaseContent::readRecordSS: can not read a float\n"));
b5c349
@@ -736,7 +736,7 @@ bool CWDbaseContent::readRecordSS(Vec2i const &id, long pos, CWDbaseContent::Rec
b5c349
       f << "###int" << rType << "[res],";
b5c349
       break;
b5c349
     case 2:
b5c349
-      if (remainSz>=10 && input->readDouble(record.m_resDouble)) {
b5c349
+      if (remainSz>=10 && input->readDouble(record.m_resDouble, record.m_resDoubleNaN)) {
b5c349
         record.m_resType=Record::R_Double;
b5c349
         f << "=" << record.m_resDouble << ",";
b5c349
         break;
b5c349
@@ -858,7 +858,7 @@ bool CWDbaseContent::readRecordDB(Vec2i const &id, long pos, CWDbaseContent::Rec
b5c349
       f << "###";
b5c349
       break;
b5c349
     }
b5c349
-    if (input->readDouble(record.m_resDouble)) {
b5c349
+    if (input->readDouble(record.m_resDouble, record.m_resDoubleNaN)) {
b5c349
       record.m_resType=Record::R_Double;
b5c349
       f << record.m_resDouble << ",";
b5c349
     } else {
b5c349
@@ -929,7 +929,7 @@ bool CWDbaseContent::send(Vec2i const &pos)
b5c349
   switch(record.m_resType) {
b5c349
   case Record::R_Long:
b5c349
     if (format.m_format)
b5c349
-      send(double(record.m_resLong), format);
b5c349
+      send(double(record.m_resLong), false, format);
b5c349
     else {
b5c349
       std::stringstream s;
b5c349
       s << record.m_resLong;
b5c349
@@ -937,7 +937,7 @@ bool CWDbaseContent::send(Vec2i const &pos)
b5c349
     }
b5c349
     break;
b5c349
   case Record::R_Double:
b5c349
-    send(record.m_resDouble, format);
b5c349
+    send(record.m_resDouble, record.m_resDoubleNaN, format);
b5c349
     break;
b5c349
   case Record::R_String:
b5c349
     if (record.m_resString.valid()) {
b5c349
@@ -959,7 +959,7 @@ bool CWDbaseContent::send(Vec2i const &pos)
b5c349
   return true;
b5c349
 }
b5c349
 
b5c349
-void CWDbaseContent::send(double val, CWStyleManager::CellFormat const &format)
b5c349
+void CWDbaseContent::send(double val, bool isNotANumber, CWStyleManager::CellFormat const &format)
b5c349
 {
b5c349
   MWAWContentListenerPtr listener=m_parserState->m_listener;
b5c349
   if (!listener)
b5c349
@@ -970,7 +970,8 @@ void CWDbaseContent::send(double val, CWStyleManager::CellFormat const &format)
b5c349
     if (type>=10&&type<=11) type += 4;
b5c349
     else if (type>=14) type=16;
b5c349
   }
b5c349
-  if (type <= 0 || type >=16 || type==10 || type==11 || !boost::math::isfinite(val)) {
b5c349
+  // note: if val*0!=0, val is a NaN so better so simply print NaN
b5c349
+  if (type <= 0 || type >=16 || type==10 || type==11 || isNotANumber) {
b5c349
     s << val;
b5c349
     listener->insertUnicodeString(s.str().c_str());
b5c349
     return;
b5c349
diff --git a/src/lib/CWDbaseContent.hxx b/src/lib/CWDbaseContent.hxx
b5c349
index 36596e9..04177fe 100644
b5c349
--- a/src/lib/CWDbaseContent.hxx
b5c349
+++ b/src/lib/CWDbaseContent.hxx
b5c349
@@ -78,7 +78,7 @@ protected:
b5c349
     //! different result type
b5c349
     enum Type { R_Unknown, R_Long, R_Double, R_String };
b5c349
     //! contructor
b5c349
-    Record() : m_style(-1), m_resType(R_Unknown), m_resLong(0), m_resDouble(0), m_resString(), m_format(0), m_font(3,9), m_justify(0), m_borders(0) {
b5c349
+    Record() : m_style(-1), m_resType(R_Unknown), m_resLong(0), m_resDouble(0), m_resDoubleNaN(false), m_resString(), m_format(0), m_font(3,9), m_justify(0), m_borders(0) {
b5c349
     }
b5c349
 
b5c349
     //! the style if known
b5c349
@@ -89,6 +89,8 @@ protected:
b5c349
     long m_resLong;
b5c349
     //! the result id double
b5c349
     double m_resDouble;
b5c349
+    //! a flag to know if a double result is nan or not
b5c349
+    bool m_resDoubleNaN;
b5c349
     //! the result entry if string
b5c349
     MWAWEntry m_resString;
b5c349
     //! the format ( in a v1-3 spreadsheet)
b5c349
@@ -123,7 +125,7 @@ protected:
b5c349
   bool readRecordDB(Vec2i const &where, long pos, Record &record);
b5c349
 
b5c349
   //! send a double with a corresponding cell format
b5c349
-  void send(double val, CWStyleManager::CellFormat const &format);
b5c349
+  void send(double val, bool isNotaNumber, CWStyleManager::CellFormat const &format);
b5c349
 
b5c349
   //! the file version
b5c349
   int m_version;
b5c349
diff --git a/src/lib/CWGraph.cxx b/src/lib/CWGraph.cxx
b5c349
index 6f34628..01109f6 100644
b5c349
--- a/src/lib/CWGraph.cxx
b5c349
+++ b/src/lib/CWGraph.cxx
b5c349
@@ -311,7 +311,7 @@ struct ZonePict : public Zone {
b5c349
 struct Bitmap : public CWStruct::DSET {
b5c349
   //! constructor
b5c349
   Bitmap(CWStruct::DSET const &dset = CWStruct::DSET()) :
b5c349
-    DSET(dset), m_bitmapType(-1), m_size(0,0), m_entry(), m_colorMap() {
b5c349
+    DSET(dset), m_bitmapType(-1), m_bitmapSize(0,0), m_entry(), m_colorMap() {
b5c349
   }
b5c349
 
b5c349
   //! operator<<
b5c349
@@ -324,7 +324,7 @@ struct Bitmap : public CWStruct::DSET {
b5c349
   //! the bitmap type
b5c349
   int m_bitmapType;
b5c349
   //! the bitmap size
b5c349
-  Vec2i m_size;
b5c349
+  Vec2i m_bitmapSize;
b5c349
   //! the bitmap entry
b5c349
   MWAWEntry m_entry;
b5c349
   //! the color map
b5c349
@@ -666,7 +666,7 @@ void CWGraph::askToSend(int number, bool asGraphic, MWAWPosition const& pos)
b5c349
 ////////////////////////////////////////////////////////////
b5c349
 // Intermediate level
b5c349
 ////////////////////////////////////////////////////////////
b5c349
-bool CWGraph::getSurfaceColor(CWGraphInternal::Style const style, MWAWColor &col) const
b5c349
+bool CWGraph::getSurfaceColor(CWGraphInternal::Style const &style, MWAWColor &col) const
b5c349
 {
b5c349
   if (!style.hasSurfaceColor())
b5c349
     return false;
b5c349
@@ -814,7 +814,7 @@ shared_ptr<CWStruct::DSET> CWGraph::readBitmapZone
b5c349
       dim[j] = (int) input->readLong(2);
b5c349
     f << "sz=" << dim[1] << "x" << dim[0] << ",";
b5c349
     if (dim[0] > 0 && dim[1] > 0) {
b5c349
-      bitmap->m_size = Vec2i(dim[1]+2, dim[0]+2);
b5c349
+      bitmap->m_bitmapSize = Vec2i(dim[1]+2, dim[0]+2);
b5c349
       sizeSet = true;
b5c349
     }
b5c349
     ascFile.addDelimiter(input->tell(),']');
b5c349
@@ -852,7 +852,7 @@ shared_ptr<CWStruct::DSET> CWGraph::readBitmapZone
b5c349
     for (int j = 0; j < 2; j++)
b5c349
       dim[j] = (int) input->readLong(2);
b5c349
     if (i == N-1 && !sizeSet)
b5c349
-      bitmap->m_size = Vec2i(dim[0]+2, dim[1]+2);
b5c349
+      bitmap->m_bitmapSize = Vec2i(dim[0]+2, dim[1]+2);
b5c349
 
b5c349
     f << "dim?=" << dim[0] << "x" << dim[1] << ",";
b5c349
     for (int j = 3; j < 6; j++) {
b5c349
@@ -1993,18 +1993,18 @@ bool CWGraph::readBitmapData(CWGraphInternal::Bitmap &zone)
b5c349
     return false;
b5c349
   }
b5c349
   /* Fixme: this code can not works for the packed bitmap*/
b5c349
-  long numColors = zone.m_size[0]*zone.m_size[1];
b5c349
+  long numColors = zone.m_bitmapSize[0]*zone.m_bitmapSize[1];
b5c349
   int numBytes = numColors ? int(sz/numColors) : 0;
b5c349
   if (sz != numBytes*numColors) {
b5c349
     // check for different row alignement: 2 and 4
b5c349
     for (int align=2; align <= 4; align*=2) {
b5c349
-      int diffToAlign=align-(zone.m_size[0]%align);
b5c349
+      int diffToAlign=align-(zone.m_bitmapSize[0]%align);
b5c349
       if (diffToAlign==align) continue;
b5c349
-      numColors = (zone.m_size[0]+diffToAlign)*zone.m_size[1];
b5c349
+      numColors = (zone.m_bitmapSize[0]+diffToAlign)*zone.m_bitmapSize[1];
b5c349
       numBytes = numColors ? int(sz/numColors) : 0;
b5c349
       if (sz == numBytes*numColors) {
b5c349
-        zone.m_size[0]+=diffToAlign;
b5c349
-        MWAW_DEBUG_MSG(("CWGraph::readBitmapData: increase width to %d\n",zone.m_size[0]));
b5c349
+        zone.m_bitmapSize[0]+=diffToAlign;
b5c349
+        MWAW_DEBUG_MSG(("CWGraph::readBitmapData: increase width to %d\n",zone.m_bitmapSize[0]));
b5c349
         break;
b5c349
       }
b5c349
     }
b5c349
@@ -2048,7 +2048,7 @@ void CWGraph::checkNumberAccrossPages(CWGraphInternal::Group &group) const
b5c349
 
b5c349
 void CWGraph::updateInformation(CWGraphInternal::Group &group) const
b5c349
 {
b5c349
-  if (group.m_blockToSendList.size() || group.m_idLinkedZonesMap.size())
b5c349
+  if (!group.m_blockToSendList.empty() || !group.m_idLinkedZonesMap.empty())
b5c349
     return;
b5c349
   std::set<int> forbiddenZone;
b5c349
 
b5c349
@@ -2633,19 +2633,19 @@ bool CWGraph::sendBitmap(CWGraphInternal::Bitmap &bitmap, bool asGraphic, MWAWPo
b5c349
   MWAWPictBitmapColor *bmapColor = 0;
b5c349
   bool indexed = false;
b5c349
   if (numColors > 2) {
b5c349
-    bmapIndexed =  new MWAWPictBitmapIndexed(bitmap.m_size);
b5c349
+    bmapIndexed =  new MWAWPictBitmapIndexed(bitmap.m_bitmapSize);
b5c349
     bmapIndexed->setColors(bitmap.m_colorMap);
b5c349
     bmap.reset(bmapIndexed);
b5c349
     indexed = true;
b5c349
   } else
b5c349
-    bmap.reset((bmapColor=new MWAWPictBitmapColor(bitmap.m_size)));
b5c349
+    bmap.reset((bmapColor=new MWAWPictBitmapColor(bitmap.m_bitmapSize)));
b5c349
 
b5c349
   //! let go
b5c349
   int fSz = bitmap.m_bitmapType;
b5c349
   MWAWInputStreamPtr &input= m_parserState->m_input;
b5c349
   input->seek(bitmap.m_entry.begin(), WPX_SEEK_SET);
b5c349
-  for (int r = 0; r < bitmap.m_size[1]; r++) {
b5c349
-    for (int c = 0; c < bitmap.m_size[0]; c++) {
b5c349
+  for (int r = 0; r < bitmap.m_bitmapSize[1]; r++) {
b5c349
+    for (int c = 0; c < bitmap.m_bitmapSize[0]; c++) {
b5c349
       long val = (long) input->readULong(fSz);
b5c349
       if (indexed) {
b5c349
         bmapIndexed->set(c,r,(int)val);
b5c349
diff --git a/src/lib/CWGraph.hxx b/src/lib/CWGraph.hxx
b5c349
index 0655464..bdb2bd5 100644
b5c349
--- a/src/lib/CWGraph.hxx
b5c349
+++ b/src/lib/CWGraph.hxx
b5c349
@@ -98,7 +98,7 @@ public:
b5c349
   (CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
b5c349
 
b5c349
   //! return the surface color which corresponds to some ids (if possible)
b5c349
-  bool getSurfaceColor(CWGraphInternal::Style const style, MWAWColor &col) const;
b5c349
+  bool getSurfaceColor(CWGraphInternal::Style const &style, MWAWColor &col) const;
b5c349
 protected:
b5c349
   //! set the slide list ( for presentation )
b5c349
   void setSlideList(std::vector<int> const &slideList);
b5c349
diff --git a/src/lib/HMWKGraph.cxx b/src/lib/HMWKGraph.cxx
b5c349
index 2ad56d2..ab8b904 100644
b5c349
--- a/src/lib/HMWKGraph.cxx
b5c349
+++ b/src/lib/HMWKGraph.cxx
b5c349
@@ -292,7 +292,7 @@ std::string Group::print() const
b5c349
 //! Internal: the picture of a HMWKGraph
b5c349
 struct PictureFrame : public Frame {
b5c349
   //! constructor
b5c349
-  PictureFrame(Frame const &orig) : Frame(orig), m_type(0), m_dim(0,0), m_borderDim(0,0) {
b5c349
+  PictureFrame(Frame const &orig) : Frame(orig), m_pictureType(0), m_dim(0,0), m_borderDim(0,0) {
b5c349
     for (int i = 0; i < 7; ++i) m_values[i] = 0;
b5c349
   }
b5c349
   //! destructor
b5c349
@@ -307,7 +307,7 @@ struct PictureFrame : public Frame {
b5c349
   //! print local data
b5c349
   std::string print() const {
b5c349
     std::stringstream s;
b5c349
-    if (m_type) s << "type?=" << m_type << ",";
b5c349
+    if (m_pictureType) s << "type?=" << m_pictureType << ",";
b5c349
     if (m_dim[0] || m_dim[1])
b5c349
       s << "dim?=" << m_dim << ",";
b5c349
     if (m_borderDim[0] > 0 || m_borderDim[1] > 0)
b5c349
@@ -319,7 +319,7 @@ struct PictureFrame : public Frame {
b5c349
   }
b5c349
 
b5c349
   //! a type
b5c349
-  int m_type;
b5c349
+  int m_pictureType;
b5c349
   //! a dim?
b5c349
   Vec2i m_dim;
b5c349
   //! the border dim?
b5c349
@@ -422,7 +422,7 @@ private:
b5c349
 //! Internal: the textbox of a HMWKGraph
b5c349
 struct TextBox : public Frame {
b5c349
   //! constructor
b5c349
-  TextBox(Frame const &orig, bool isComment) : Frame(orig), m_commentBox(isComment), m_textFileId(-1), m_linkedIdList(), m_isLinked(false), m_extra("") {
b5c349
+  TextBox(Frame const &orig, bool isComment) : Frame(orig), m_commentBox(isComment), m_textFileId(-1), m_linkedIdList(), m_isLinked(false) {
b5c349
     for (int i = 0; i < 2; ++i) m_dim[i] = 0;
b5c349
   }
b5c349
   //! destructor
b5c349
@@ -517,8 +517,6 @@ struct TextBox : public Frame {
b5c349
   std::vector<long> m_linkedIdList;
b5c349
   //! a flag to know if this textbox is linked to a previous box
b5c349
   bool m_isLinked;
b5c349
-  //! extra data
b5c349
-  std::string m_extra;
b5c349
 };
b5c349
 
b5c349
 bool TableCell::sendContent(MWAWContentListenerPtr, MWAWTable &table)
b5c349
@@ -1603,7 +1601,7 @@ shared_ptr<HMWKGraphInternal::PictureFrame> HMWKGraph::readPictureFrame(shared_p
b5c349
   picture.reset(new HMWKGraphInternal::PictureFrame(header));
b5c349
   libmwaw::DebugFile &asciiFile = zone->ascii();
b5c349
   libmwaw::DebugStream f;
b5c349
-  picture->m_type = (int) input->readLong(2); // 0 or 4 : or maybe wrapping
b5c349
+  picture->m_pictureType = (int) input->readLong(2); // 0 or 4 : or maybe wrapping
b5c349
   for (int i = 0; i < 5; ++i) // always 0
b5c349
     picture->m_values[i] =  (int) input->readLong(2);
b5c349
   float bDim[2];
b5c349
diff --git a/src/lib/MSKGraph.cxx b/src/lib/MSKGraph.cxx
b5c349
index fa876a1..dd873c1 100644
b5c349
--- a/src/lib/MSKGraph.cxx
b5c349
+++ b/src/lib/MSKGraph.cxx
b5c349
@@ -2729,7 +2729,7 @@ void MSKGraph::sendAll(int zoneId, bool mainZone)
b5c349
   }
b5c349
 }
b5c349
 
b5c349
-void MSKGraph::sendObjects(MSKGraph::SendData what)
b5c349
+void MSKGraph::sendObjects(MSKGraph::SendData const &what)
b5c349
 {
b5c349
   MWAWContentListenerPtr listener=m_parserState->m_listener;
b5c349
   if (!listener) {
b5c349
diff --git a/src/lib/MSKGraph.hxx b/src/lib/MSKGraph.hxx
b5c349
index 29ee53a..f9518e4 100644
b5c349
--- a/src/lib/MSKGraph.hxx
b5c349
+++ b/src/lib/MSKGraph.hxx
b5c349
@@ -110,7 +110,7 @@ public:
b5c349
     Vec2i m_size;
b5c349
   };
b5c349
   /** sends all the object of a page, frame, ...  */
b5c349
-  void sendObjects(SendData const what);
b5c349
+  void sendObjects(SendData const &what);
b5c349
 
b5c349
   /** try to update positions knowing pages and lines height */
b5c349
   void computePositions(int zoneId, std::vector<int> &linesHeight, std::vector<int> &pagesHeight);
b5c349
diff --git a/src/lib/MSKParser.cxx b/src/lib/MSKParser.cxx
b5c349
index 16b7d84..c527e90 100644
b5c349
--- a/src/lib/MSKParser.cxx
b5c349
+++ b/src/lib/MSKParser.cxx
b5c349
@@ -36,27 +36,13 @@
b5c349
 
b5c349
 #include "MSKParser.hxx"
b5c349
 
b5c349
-/** Internal: the structures of a MSKParser */
b5c349
-namespace MSKParserInternal
b5c349
-{
b5c349
-////////////////////////////////////////
b5c349
-//! Internal: the state of a MSK3Parser
b5c349
-struct State {
b5c349
-  //! constructor
b5c349
-  State() {
b5c349
-  }
b5c349
-};
b5c349
-}
b5c349
-
b5c349
 MSKParser::MSKParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header) :
b5c349
-  MWAWParser(input, rsrcParser, header), m_state(new MSKParserInternal::State),
b5c349
-  m_input(input), m_asciiFile(input)
b5c349
+  MWAWParser(input, rsrcParser, header), m_input(input), m_asciiFile(input)
b5c349
 {
b5c349
 }
b5c349
 
b5c349
 MSKParser::MSKParser(MWAWInputStreamPtr input, MWAWParserStatePtr parserState) :
b5c349
-  MWAWParser(parserState), m_state(new MSKParserInternal::State),
b5c349
-  m_input(input), m_asciiFile(input)
b5c349
+  MWAWParser(parserState), m_input(input), m_asciiFile(input)
b5c349
 {
b5c349
 }
b5c349
 
b5c349
diff --git a/src/lib/MSKParser.hxx b/src/lib/MSKParser.hxx
b5c349
index eb29d1b..88244b9 100644
b5c349
--- a/src/lib/MSKParser.hxx
b5c349
+++ b/src/lib/MSKParser.hxx
b5c349
@@ -94,8 +94,6 @@ public:
b5c349
     return m_asciiFile;
b5c349
   }
b5c349
 protected:
b5c349
-  //! the state
b5c349
-  shared_ptr<MSKParserInternal::State> m_state;
b5c349
   //! the input which can be an OLE in MSWorks 4 file
b5c349
   MWAWInputStreamPtr m_input;
b5c349
   //! the debug file of the actual input
b5c349
diff --git a/src/lib/MSWTextStyles.cxx b/src/lib/MSWTextStyles.cxx
b5c349
index 93a6e62..2bba921 100644
b5c349
--- a/src/lib/MSWTextStyles.cxx
b5c349
+++ b/src/lib/MSWTextStyles.cxx
b5c349
@@ -386,6 +386,7 @@ bool MSWTextStyles::readParagraph(MSWStruct::Paragraph &para, int dataSz)
b5c349
   int const vers = version();
b5c349
   libmwaw::DebugFile &ascFile = m_parserState->m_asciiFile;
b5c349
   libmwaw::DebugStream f;
b5c349
+  int numFont=0;
b5c349
   while (long(input->tell()) < endPos) {
b5c349
     long actPos = input->tell();
b5c349
     /* 5-16: basic paragraph properties
b5c349
@@ -403,7 +404,6 @@ bool MSWTextStyles::readParagraph(MSWStruct::Paragraph &para, int dataSz)
b5c349
     }
b5c349
     bool done = false;
b5c349
     long dSz = endPos-actPos;
b5c349
-    int numFont=0;
b5c349
     switch(wh) {
b5c349
     case 0:
b5c349
       done = (actPos+1==endPos||(dataSz==2 && actPos+2==endPos));
b5c349
diff --git a/src/lib/MWAWDocument.cxx b/src/lib/MWAWDocument.cxx
b5c349
index ef9d280..182de89 100644
b5c349
--- a/src/lib/MWAWDocument.cxx
b5c349
+++ b/src/lib/MWAWDocument.cxx
b5c349
@@ -522,9 +522,9 @@ void GraphicExporter::endElement(const char *psName)
b5c349
     m_output->endTextObject();
b5c349
 #ifdef DEBUG
b5c349
   else if (strcmp(psName, "SetStyle") && strcmp(psName, "Rectangle") &&
b5c349
-           strcmp(psName, "Rectangle") && strcmp(psName, "Ellipse") &&
b5c349
-           strcmp(psName, "Polygon") && strcmp(psName, "Polyline") &&
b5c349
-           strcmp(psName, "Path") && strcmp(psName, "GraphicObject")) {
b5c349
+           strcmp(psName, "Ellipse") && strcmp(psName, "Polygon") &&
b5c349
+           strcmp(psName, "Polyline") && strcmp(psName, "Path") &&
b5c349
+           strcmp(psName, "GraphicObject")) {
b5c349
     MWAW_DEBUG_MSG(("GraphicExporter::endElement: called with unexpected name %s\n", psName));
b5c349
   }
b5c349
 #endif
b5c349
diff --git a/src/lib/MWAWInputStream.cxx b/src/lib/MWAWInputStream.cxx
b5c349
index c4dc2b6..9b2e28c 100644
b5c349
--- a/src/lib/MWAWInputStream.cxx
b5c349
+++ b/src/lib/MWAWInputStream.cxx
b5c349
@@ -229,7 +229,7 @@ uint8_t MWAWInputStream::readU8(WPXInputStream *stream)
b5c349
   return *(uint8_t const *)(p);
b5c349
 }
b5c349
 
b5c349
-bool MWAWInputStream::readDouble(double &res)
b5c349
+bool MWAWInputStream::readDouble(double &res, bool &isNotANumber)
b5c349
 {
b5c349
   if (!m_stream) return false;
b5c349
   long pos=tell();
b5c349
@@ -244,6 +244,7 @@ bool MWAWInputStream::readDouble(double &res)
b5c349
   }
b5c349
   exp -= 0x3fff;
b5c349
 
b5c349
+  isNotANumber=false;
b5c349
   unsigned long mantisse = (unsigned long) readULong(4);
b5c349
   if ((mantisse & 0x80000000) == 0) {
b5c349
     if (readULong(4) != 0) return false;
b5c349
@@ -251,6 +252,7 @@ bool MWAWInputStream::readDouble(double &res)
b5c349
     if (exp == -0x3fff && mantisse == 0) return true; // ok zero
b5c349
     if (exp == 0x4000 && (mantisse & 0xFFFFFFL)==0) { // ok Nan
b5c349
       res=std::numeric_limits<double>::quiet_NaN();
b5c349
+      isNotANumber = true;
b5c349
       return true;
b5c349
     }
b5c349
     return false;
b5c349
diff --git a/src/lib/MWAWInputStream.hxx b/src/lib/MWAWInputStream.hxx
b5c349
index 818451a..bc29165 100644
b5c349
--- a/src/lib/MWAWInputStream.hxx
b5c349
+++ b/src/lib/MWAWInputStream.hxx
b5c349
@@ -139,7 +139,7 @@ public:
b5c349
   //! return a int8, int16, int32 readed from actualPos
b5c349
   long readLong(int num);
b5c349
   //! try to read a double (ppc)
b5c349
-  bool readDouble(double &res;;
b5c349
+  bool readDouble(double &res, bool &isNotANumber);
b5c349
 
b5c349
   /**! reads numbytes data, WITHOUT using any endian or section consideration
b5c349
    * \return a pointer to the read elements
b5c349
diff --git a/src/lib/MWAWOLEParser.cxx b/src/lib/MWAWOLEParser.cxx
b5c349
index a14aee1..70d6dd6 100644
b5c349
--- a/src/lib/MWAWOLEParser.cxx
b5c349
+++ b/src/lib/MWAWOLEParser.cxx
b5c349
@@ -622,7 +622,7 @@ bool MWAWOLEParser::readCompObj(MWAWInputStreamPtr ip, std::string const &oleNam
b5c349
     if (clsName)
b5c349
       f << "'" << clsName << "'";
b5c349
     else {
b5c349
-      MWAW_DEBUG_MSG(("MWAWOLEParser::readCompObj: unknown clsid=%ld\n", clsData[0]));
b5c349
+      MWAW_DEBUG_MSG(("MWAWOLEParser::readCompObj: unknown clsid=%ld\n", (long) clsData[0]));
b5c349
       f << "unknCLSID='" << std::hex << clsData[0] << "'";
b5c349
     }
b5c349
   } else {
b5c349
diff --git a/src/lib/MWAWOLEStream.cxx b/src/lib/MWAWOLEStream.cxx
b5c349
index 6ffebea..9abdd90 100644
b5c349
--- a/src/lib/MWAWOLEStream.cxx
b5c349
+++ b/src/lib/MWAWOLEStream.cxx
b5c349
@@ -454,7 +454,7 @@ void DirEntry::load( unsigned char *buffer, unsigned len )
b5c349
     m_name="R";
b5c349
     m_macRootEntry=true;
b5c349
   } else {
b5c349
-    for( unsigned j=0; ( buffer[j]) && (j
b5c349
+    for( unsigned j=0; j
b5c349
       m_name.append( 1, char(buffer[j]) );
b5c349
   }
b5c349
 
b5c349
diff --git a/src/lib/MWAWPropertyHandler.cxx b/src/lib/MWAWPropertyHandler.cxx
b5c349
index a81f5fe..e4737f4 100644
b5c349
--- a/src/lib/MWAWPropertyHandler.cxx
b5c349
+++ b/src/lib/MWAWPropertyHandler.cxx
b5c349
@@ -410,39 +410,40 @@ protected:
b5c349
     if (!readString(input, key)) return false;
b5c349
     if (!readString(input, val)) return false;
b5c349
 
b5c349
-    // check if the val can be a double, ...
b5c349
-    if (!val.empty() && (val[0]=='-' || val[0]=='.' || (val[0]>='0' && val[0]<='9'))) {
b5c349
-      std::istringstream iss(val);
b5c349
-      double res = 0.0;
b5c349
-      iss >> res;
b5c349
-      if (!iss.fail()) {
b5c349
-        if (iss.eof() || iss.peek() == std::char_traits<char>::eof()) {
b5c349
-          list.insert(key.c_str(), res);
b5c349
-          return true;
b5c349
-        }
b5c349
-        std::string remain;
b5c349
-        iss >> remain;
b5c349
-        if (iss.peek() == std::char_traits<char>::eof()) {
b5c349
-          if (remain=="pt") {
b5c349
-            list.insert(key.c_str(), res/72., WPX_INCH);
b5c349
-            return true;
b5c349
-          }
b5c349
-          if (remain=="in") {
b5c349
-            list.insert(key.c_str(), res, WPX_INCH);
b5c349
-            return true;
b5c349
-          }
b5c349
-          if (remain=="%") {
b5c349
-            list.insert(key.c_str(), res/100., WPX_PERCENT);
b5c349
-            return true;
b5c349
-          }
b5c349
-          if (remain=="*") {
b5c349
-            list.insert(key.c_str(), res/1440., WPX_INCH);
b5c349
-            return true;
b5c349
-          }
b5c349
-        }
b5c349
+    std::string number(""), remain("");
b5c349
+    // check if the val can be a double, first isolate the potential numbering part ...
b5c349
+    for (size_t s=0; s
b5c349
+      char c=(char) val[s];
b5c349
+      if (c=='-' || c=='.' || c=='e' || c=='E' || (c>='0' && c<='9')) {
b5c349
+        number+=c;
b5c349
+        continue;
b5c349
       }
b5c349
+      remain=val.substr(s);
b5c349
+      break;
b5c349
+    }
b5c349
+    if (number.empty()) {
b5c349
+      list.insert(key.c_str(), val.c_str());
b5c349
+      return true;
b5c349
+    }
b5c349
+    std::istringstream iss(number);
b5c349
+    double res = 0.0;
b5c349
+    iss >> res;
b5c349
+    if (iss.fail() || iss.peek()!=std::char_traits<char>::eof()) {
b5c349
+      list.insert(key.c_str(), val.c_str());
b5c349
+      return true;
b5c349
     }
b5c349
-    list.insert(key.c_str(), val.c_str());
b5c349
+    if (remain.empty())
b5c349
+      list.insert(key.c_str(), res);
b5c349
+    else if (remain=="pt")
b5c349
+      list.insert(key.c_str(), res/72., WPX_INCH);
b5c349
+    else if (remain=="in")
b5c349
+      list.insert(key.c_str(), res, WPX_INCH);
b5c349
+    else if (remain=="%")
b5c349
+      list.insert(key.c_str(), res/100., WPX_PERCENT);
b5c349
+    else if (remain=="*")
b5c349
+      list.insert(key.c_str(), res/1440., WPX_INCH);
b5c349
+    else
b5c349
+      list.insert(key.c_str(), val.c_str());
b5c349
     return true;
b5c349
   }
b5c349
 
b5c349
-- 
b5c349
1.9.0
b5c349