[Libreoffice-commits] .: 4 commits - src/lib
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Dec 16 01:35:58 PST 2012
src/lib/VDXParser.cpp | 13 -------
src/lib/VSDTypes.h | 1
src/lib/VSDXMLParserBase.cpp | 20 +++++------
src/lib/VSDXParser.cpp | 2 -
src/lib/VisioDocument.cpp | 75 ++++++++++++++++++++++++-------------------
5 files changed, 56 insertions(+), 55 deletions(-)
New commits:
commit bf00f969aa16573f29ff6dac0d234f838009ee11
Author: David Tardon <dtardon at redhat.com>
Date: Sun Dec 16 10:31:14 2012 +0100
coverity: copying uninitialized value
diff --git a/src/lib/VSDTypes.h b/src/lib/VSDTypes.h
index ef1db44..0b0d299 100644
--- a/src/lib/VSDTypes.h
+++ b/src/lib/VSDTypes.h
@@ -65,6 +65,7 @@ struct XForm
// Utilities
struct ChunkHeader
{
+ ChunkHeader() : chunkType(0), id(0), list(0), dataLength(0), level(0), unknown(0), trailer(0) {}
unsigned chunkType; // 4 bytes
unsigned id; // 4 bytes
unsigned list; // 4 bytes
commit dddcceca764a1b557405c8dbc61d357d05e56344
Author: David Tardon <dtardon at redhat.com>
Date: Sun Dec 16 10:26:36 2012 +0100
coverity: do not let VisioDocument::parse throw
diff --git a/src/lib/VisioDocument.cpp b/src/lib/VisioDocument.cpp
index 1392a9e..03f0a8d 100644
--- a/src/lib/VisioDocument.cpp
+++ b/src/lib/VisioDocument.cpp
@@ -164,47 +164,58 @@ static bool parseBinaryVisioDocument(WPXInputStream *input, libwpg::WPGPaintInte
docStream->seek(0x1A, WPX_SEEK_SET);
- unsigned char version = libvisio::readU8(docStream);
libvisio::VSDParser *parser = 0;
- switch(version)
+ try
{
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- parser = new libvisio::VSD5Parser(docStream, painter);
- break;
- case 6:
- parser = new libvisio::VSD6Parser(docStream, painter);
- break;
- case 11:
- parser = new libvisio::VSDParser(docStream, painter);
- break;
- default:
- break;
- }
+ unsigned char version = libvisio::readU8(docStream);
+ switch(version)
+ {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ parser = new libvisio::VSD5Parser(docStream, painter);
+ break;
+ case 6:
+ parser = new libvisio::VSD6Parser(docStream, painter);
+ break;
+ case 11:
+ parser = new libvisio::VSDParser(docStream, painter);
+ break;
+ default:
+ break;
+ }
- bool retValue = false;
- if (parser)
- {
- if (isStencilExtraction)
- retValue = parser->extractStencils();
- else if (!isStencilExtraction)
- retValue = parser->parseMain();
+ bool retValue = false;
+ if (parser)
+ {
+ if (isStencilExtraction)
+ retValue = parser->extractStencils();
+ else if (!isStencilExtraction)
+ retValue = parser->parseMain();
+ }
+ else
+ {
+ if (docStream != input)
+ delete docStream;
+ return false;
+ }
+
+ delete parser;
+ if (docStream != input)
+ delete docStream;
+
+ return retValue;
}
- else
+ catch (...)
{
+ delete parser;
if (docStream != input)
delete docStream;
- return false;
}
- delete parser;
- if (docStream != input)
- delete docStream;
-
- return retValue;
+ return false;
}
static bool isOpcVisioDocument(WPXInputStream *input)
commit 8b38ba731cfebefcf7d3c7ab1769c0b2e0f1e7b2
Author: David Tardon <dtardon at redhat.com>
Date: Sun Dec 16 10:18:15 2012 +0100
coverity: drop duplicated code
diff --git a/src/lib/VDXParser.cpp b/src/lib/VDXParser.cpp
index 2c99b80..96d5166 100644
--- a/src/lib/VDXParser.cpp
+++ b/src/lib/VDXParser.cpp
@@ -783,17 +783,6 @@ void libvisio::VDXParser::readTextBlock(xmlTextReaderPtr reader)
}
while ((XML_TEXTBLOCK != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret);
- if (bgClrId < 0)
- bgClrId = 0;
- if (bgClrId)
- {
- std::map<unsigned, Colour>::const_iterator iter = m_colours.find(bgClrId-1);
- if (iter != m_colours.end())
- bgColour = iter->second;
- else
- bgColour = Colour();
- }
-
if (m_isInStyles)
m_collector->collectTextBlockStyle(level, leftMargin, rightMargin, topMargin, bottomMargin,
verticalAlign, !!bgClrId, bgColour, defaultTabStop, textDirection);
commit f8cdb0f948457a2183d117a438dee5ca3f603c4e
Author: David Tardon <dtardon at redhat.com>
Date: Sun Dec 16 10:10:40 2012 +0100
coverity: consistently check ret. value of read*Data
diff --git a/src/lib/VDXParser.cpp b/src/lib/VDXParser.cpp
index 6ff9cdf..2c99b80 100644
--- a/src/lib/VDXParser.cpp
+++ b/src/lib/VDXParser.cpp
@@ -342,7 +342,7 @@ void libvisio::VDXParser::readLine(xmlTextReaderPtr reader)
break;
case XML_LINECOLOR:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readExtendedColourData(colour, reader);
+ ret = readExtendedColourData(colour, reader);
break;
case XML_LINEPATTERN:
if (XML_READER_TYPE_ELEMENT == tokenType)
diff --git a/src/lib/VSDXMLParserBase.cpp b/src/lib/VSDXMLParserBase.cpp
index 1f8c9f2..e18c8bb 100644
--- a/src/lib/VSDXMLParserBase.cpp
+++ b/src/lib/VSDXMLParserBase.cpp
@@ -1264,7 +1264,7 @@ void libvisio::VSDXMLParserBase::readCharIX(xmlTextReaderPtr reader)
break;
case XML_COLOR:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readExtendedColourData(fontColour, reader);
+ ret = readExtendedColourData(fontColour, reader);
break;
case XML_STYLE:
if (XML_READER_TYPE_ELEMENT == tokenType)
@@ -1337,7 +1337,7 @@ void libvisio::VSDXMLParserBase::readCharIX(xmlTextReaderPtr reader)
break;
case XML_SIZE:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readDoubleData(fontSize, reader);
+ ret = readDoubleData(fontSize, reader);
break;
case XML_DBLUNDERLINE:
if (XML_READER_TYPE_ELEMENT == tokenType)
@@ -1430,34 +1430,34 @@ void libvisio::VSDXMLParserBase::readParaIX(xmlTextReaderPtr reader)
tokenType = xmlTextReaderNodeType(reader);
switch (tokenId)
- {
+ {
case XML_INDFIRST:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readDoubleData(indFirst, reader);
+ ret = readDoubleData(indFirst, reader);
break;
case XML_INDLEFT:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readDoubleData(indLeft, reader);
+ ret = readDoubleData(indLeft, reader);
break;
case XML_INDRIGHT:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readDoubleData(indRight, reader);
+ ret = readDoubleData(indRight, reader);
break;
case XML_SPLINE:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readDoubleData(spLine, reader);
+ ret = readDoubleData(spLine, reader);
break;
case XML_SPBEFORE:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readDoubleData(spBefore, reader);
+ ret = readDoubleData(spBefore, reader);
break;
case XML_SPAFTER:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readDoubleData(spAfter, reader);
+ ret = readDoubleData(spAfter, reader);
break;
case XML_HORZALIGN:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readByteData(align, reader);
+ ret = readByteData(align, reader);
break;
case XML_BULLET:
break;
diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp
index 112a1a1..a6aa3ad 100644
--- a/src/lib/VSDXParser.cpp
+++ b/src/lib/VSDXParser.cpp
@@ -760,7 +760,7 @@ void libvisio::VSDXParser::readStyleProperties(xmlTextReaderPtr reader)
break;
case XML_LINECOLOR:
if (XML_READER_TYPE_ELEMENT == tokenType)
- readExtendedColourData(strokeColour, reader);
+ ret = readExtendedColourData(strokeColour, reader);
break;
case XML_LINEPATTERN:
if (XML_READER_TYPE_ELEMENT == tokenType)
More information about the Libreoffice-commits
mailing list