r21975 by craig - Coverity 1361813: Fix initialisation of uz variable

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 22 16:59:22 UTC 2017


Author: craig
Date: Sat Apr 22 16:59:22 2017
New Revision: 21975

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21975
Log:
Coverity 1361813: Fix initialisation of uz variable

Modified:
    trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp

Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21975&path=/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp	Sat Apr 22 16:59:22 2017
@@ -48,6 +48,7 @@
 
 ODTIm::ODTIm(QString fileName, PageItem *textItem, bool textOnly, bool prefix, bool append)
 {
+	uz=NULL;
 	m_Doc = textItem->doc();
 	m_item = textItem;
 	m_prefixName = prefix;
@@ -59,7 +60,7 @@
 		QByteArray f;
 		loadRawText(fileName, f);
 		QDomDocument designMapDom;
-		QString errorMsg = "";
+		QString errorMsg;
 		int errorLine = 0;
 		int errorColumn = 0;
 		if (!designMapDom.setContent(f, &errorMsg, &errorLine, &errorColumn))
@@ -75,53 +76,56 @@
 	else
 	{
 		uz = new ScZipHandler();
-		if (!uz->open(fileName))
-		{
-			delete uz;
-			QByteArray f;
-			loadRawText(fileName, f);
-			QDomDocument designMapDom;
-			QString errorMsg = "";
-			int errorLine = 0;
-			int errorColumn = 0;
-			if (designMapDom.setContent(f, &errorMsg, &errorLine, &errorColumn))
+		if (uz)
+		{
+			if (!uz->open(fileName))
+			{
+				delete uz;
+				QByteArray f;
+				loadRawText(fileName, f);
+				QDomDocument designMapDom;
+				QString errorMsg;
+				int errorLine = 0;
+				int errorColumn = 0;
+				if (designMapDom.setContent(f, &errorMsg, &errorLine, &errorColumn))
+				{
+					if (textOnly)
+						parseRawDocReferenceXML(designMapDom);
+					else
+						parseDocReferenceXML(designMapDom);
+				}
+				else
+				{
+					qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
+					return;
+				}
+			}
+			else
 			{
 				if (textOnly)
-					parseRawDocReferenceXML(designMapDom);
+				{
+					if (uz->contains("content.xml"))
+						parseRawDocReference("content.xml");
+				}
 				else
-					parseDocReferenceXML(designMapDom);
-			}
-			else
-			{
-				qDebug() << "Error loading File" << errorMsg << "at Line" << errorLine << "Column" << errorColumn;
-				return;
-			}
-		}
-		else
-		{
-			if (textOnly)
-			{
-				if (uz->contains("content.xml"))
-					parseRawDocReference("content.xml");
-			}
-			else
-			{
-				if (uz->contains("styles.xml"))
-				{
-					if (parseStyleSheets("styles.xml"))
+				{
+					if (uz->contains("styles.xml"))
+					{
+						if (parseStyleSheets("styles.xml"))
+						{
+							if (uz->contains("content.xml"))
+								parseDocReference("content.xml");
+						}
+					}
+					else
 					{
 						if (uz->contains("content.xml"))
 							parseDocReference("content.xml");
 					}
 				}
-				else
-				{
-					if (uz->contains("content.xml"))
-						parseDocReference("content.xml");
-				}
-			}
-			uz->close();
-			delete uz;
+				uz->close();
+				delete uz;
+			}
 		}
 	}
 	textItem->itemText.trim();




More information about the scribus-commit mailing list