r21984 by craig - Coverity 1350054: Unchecked return value but Scribus150Format::readColor only ever returns true so stop returning anything

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 23 09:42:28 UTC 2017


Author: craig
Date: Sun Apr 23 09:42:28 2017
New Revision: 21984

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21984
Log:
Coverity 1350054: Unchecked return value but Scribus150Format::readColor only ever returns true so stop returning anything

Modified:
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21984&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	Sun Apr 23 09:42:28 2017
@@ -252,10 +252,7 @@
 		}
 		// 10/25/2004 pv - None is "reserved" color. cannot be defined in any file...
 		if (tagName == "COLOR" && attrs.valueAsString("NAME") != CommonStrings::None)
-		{
-			success = readColor(m_Doc->PageColors, attrs);
-			if (!success) break;
-		}
+			readColor(m_Doc->PageColors, attrs);
 		if (tagName == "Gradient")
 		{
 			VGradient gra;
@@ -774,10 +771,7 @@
 		}
 		// 10/25/2004 pv - None is "reserved" color. cannot be defined in any file...
 		if (tagName == "COLOR" && attrs.valueAsString("NAME") != CommonStrings::None)
-		{
-			success = readColor(m_Doc->PageColors, attrs);
-			if (!success) break;
-		}
+			readColor(m_Doc->PageColors, attrs);
 		if (tagName == "Gradient")
 		{
 			VGradient gra;
@@ -1357,10 +1351,7 @@
 		}
 		// 10/25/2004 pv - None is "reserved" color. cannot be defined in any file...
 		if (tagName == "COLOR" && attrs.valueAsString("NAME") != CommonStrings::None)
-		{
-			success = readColor(m_Doc->PageColors, attrs);
-			if (!success) break;
-		}
+			readColor(m_Doc->PageColors, attrs);
 		if (tagName == "Gradient")
 		{
 			VGradient gra;
@@ -1370,9 +1361,7 @@
 				break;
 			gra.setRepeatMethod((VGradient::VGradientRepeatMethod)(attrs.valueAsInt("Ext", VGradient::pad)));
 			if (!grName.isEmpty())
-			{
 				m_Doc->docGradients.insert(grName, gra);
-			}
 		}
 		if (tagName == "STYLE")
 		{
@@ -2377,7 +2366,7 @@
 	return true;
 }
 
-bool Scribus150Format::readColor(ColorList& colors, ScXmlStreamAttributes& attrs)
+void Scribus150Format::readColor(ColorList& colors, ScXmlStreamAttributes& attrs)
 {
 	ScColor color;
 	if (attrs.hasAttribute("CMYK"))
@@ -2393,7 +2382,7 @@
 	}
 	color.setSpotColor( attrs.valueAsBool("Spot", false) );
 	color.setRegistrationColor( attrs.valueAsBool("Register", false) );
-	QString name = attrs.valueAsString("NAME", color.name());
+	QString name(attrs.valueAsString("NAME", color.name()));
 	if (name == "All")
 	{
 		color.setSpotColor(true);
@@ -2405,7 +2394,6 @@
 	// colors.tryAddColor(name, color);
 	if (name.length() > 0 && !colors.contains(name))
 		colors.insert(name, color);
-	return true;
 }
 
 bool Scribus150Format::readGradient(ScribusDoc *doc, VGradient &gra, ScXmlStreamReader& reader)
@@ -6018,10 +6006,7 @@
 		}
 
 		if (tagName == "COLOR" && attrs.valueAsString("NAME") != CommonStrings::None)
-		{
-			success = readColor(m_Doc->PageColors, attrs);
-			if (!success) break;
-		}
+			readColor(m_Doc->PageColors, attrs);
 		if (tagName == "Gradient" && attrs.valueAsString("Name") != CommonStrings::None)
 		{
 			VGradient gra;
@@ -6739,9 +6724,7 @@
 		{
 			attrs = reader.scAttributes();
 			if (attrs.valueAsString("NAME") != CommonStrings::None)
-			{
 				readColor(colors, attrs);
-			}
 		}
 	}
 	return success;

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21984&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h	Sun Apr 23 09:42:28 2017
@@ -106,7 +106,7 @@
 		bool readArrows(ScribusDoc* doc, ScXmlStreamAttributes& attrs);
 		bool readBookMark(ScribusDoc::BookMa& bookmark, int& elem, ScXmlStreamAttributes& attrs); 
 		bool readCheckProfile(ScribusDoc* doc, ScXmlStreamAttributes& attrs);
-		bool readColor(ColorList& colors, ScXmlStreamAttributes& attrs);
+		void readColor(ColorList& colors, ScXmlStreamAttributes& attrs);
 		bool readGradient(ScribusDoc *doc, VGradient &gra, ScXmlStreamReader& reader);
 		void readCharacterStyleAttrs(ScribusDoc *doc, ScXmlStreamAttributes& attrs, CharStyle & newStyle);
 		void readNamedCharacterStyleAttrs(ScribusDoc *doc, ScXmlStreamAttributes& attrs, CharStyle & newStyle);




More information about the scribus-commit mailing list