r19056 by craig - Fix some minor issues found with clang's analyser

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 20 15:00:27 UTC 2014


Author: craig
Date: Sun Apr 20 15:00:26 2014
New Revision: 19056

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19056
Log:
Fix some minor issues found with clang's analyser

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/scimgdataloader_pict.cpp
    trunk/Scribus/scribus/scimgdataloader_pict.h
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19056&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Sun Apr 20 15:00:26 2014
@@ -6058,7 +6058,7 @@
 	ScItemState<QPair<QColor,QColor> > *is = dynamic_cast<ScItemState<QPair<QColor,QColor> > *>(ss);
 	int x = is->getInt("X");
 	int y = is->getInt("Y");
-	meshPoint *mp;
+	meshPoint *mp=NULL;
 	if(is->getBool("PATCH"))
 	{
 		meshGradientPatch *patch = &meshGradientPatches[x];

Modified: trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19056&path=/trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp Sun Apr 20 15:00:26 2014
@@ -63,15 +63,15 @@
 {
 	QFileInfo fi = QFileInfo(fName);
 	baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
-	double b, h, x, y;
-	parseHeader(fName, x, y, b, h);
+	double w=0.0, h=0.0, x=0.0, y=0.0;
+	parseHeader(fName, x, y, w, h);
 	docX = x;
 	docY = y;
-	if (b == 0.0)
-		b = PrefsManager::instance()->appPrefs.docSetupPrefs.pageWidth;
+	if (w == 0.0)
+		w = PrefsManager::instance()->appPrefs.docSetupPrefs.pageWidth;
 	if (h == 0.0)
 		h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
-	docWidth = b - x;
+	docWidth = w - x;
 	docHeight = h - y;
 	progressDialog = NULL;
 	m_Doc = new ScribusDoc();

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19056&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Sun Apr 20 15:00:26 2014
@@ -5006,11 +5006,7 @@
 
 void PSLib::SetColor(const ScColor& farb, double shade, int *h, int *s, int *v, int *k, bool gcr)
 {
-	int h1, s1, v1, k1;
-	h1 = *h;
-	s1 = *s;
-	v1 = *v;
-	k1 = *k;
+	int h1 = *h, s1 = *s, v1 = *v, k1 = *k;
 	ScColor tmp(farb);
 	if (farb.getColorModel() == colorModelRGB)
 		tmp = ScColorEngine::convertToModel(farb, m_Doc, colorModelCMYK);
@@ -5538,7 +5534,7 @@
 	}
 	else
 	{
-		int c, m, y, k;
+		int c=0, m=0, y=0, k=0;
 		SetColor(color, shade, &c, &m, &y, &k, gcr);
 		if (!DoSep || (Plate == 0 || Plate == 1 || Plate == 2 || Plate == 3))
 			PutStream(ToStr(c / 255.0) + " " + ToStr(m / 255.0) + " " + ToStr(y / 255.0) + " " + ToStr(k / 255.0) + " cmyk\n");

Modified: trunk/Scribus/scribus/scimgdataloader_pict.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19056&path=/trunk/Scribus/scribus/scimgdataloader_pict.cpp
==============================================================================
--- trunk/Scribus/scribus/scimgdataloader_pict.cpp (original)
+++ trunk/Scribus/scribus/scimgdataloader_pict.cpp Sun Apr 20 15:00:26 2014
@@ -69,7 +69,7 @@
 	m_profileComponents = 0;
 }
 
-void ScImgDataLoader_PICT::parseHeader(QString fName, double &x, double &y, double &b, double &h)
+void ScImgDataLoader_PICT::parseHeader(QString fName, double &x, double &y, double &w, double &h)
 {
 	QFile f(fName);
 	if (f.open(QIODevice::ReadOnly))
@@ -85,7 +85,7 @@
 		{
 			pctVersion = 1;
 			h = pgW - pgX;
-			b = pgH - pgY;
+			w = pgH - pgY;
 			x = pgY;
 			y = pgX;
 			resX = 72.0;
@@ -112,7 +112,7 @@
 					resX = 72.0;
 					resY = 72.0;
 					h = pgW - pgX;
-					b = pgH - pgY;
+					w = pgH - pgY;
 					x = pgY;
 					y = pgX;
 				}
@@ -124,7 +124,7 @@
 					ts >> pgX >> pgY >> pgW >> pgH;
 					ts >> dummy;
 					h = pgW - pgX;
-					b = pgH - pgY;
+					w = pgH - pgY;
 					x = pgY;
 					y = pgX;
 					resX = xres;
@@ -141,7 +141,7 @@
 	if (!QFile::exists(fn))
 		return false;
 	initialize();
-	double x, y, w, h;
+	double x=0.0, y=0.0, w=0.0, h=0.0;
 	parseHeader(fn, x, y, w, h);
 	docWidth = w;
 	docHeight = h;

Modified: trunk/Scribus/scribus/scimgdataloader_pict.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19056&path=/trunk/Scribus/scribus/scimgdataloader_pict.h
==============================================================================
--- trunk/Scribus/scribus/scimgdataloader_pict.h (original)
+++ trunk/Scribus/scribus/scimgdataloader_pict.h Sun Apr 20 15:00:26 2014
@@ -32,7 +32,7 @@
 	virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail);
 
 private:
-	void parseHeader(QString fName, double &x, double &y, double &b, double &h);
+	void parseHeader(QString fName, double &x, double &y, double &w, double &h);
 	void parsePict(QDataStream &ts);
 	void alignStreamToWord(QDataStream &ts, uint len);
 	void handleColor(QDataStream &ts, bool back);

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19056&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Apr 20 15:00:26 2014
@@ -13270,7 +13270,6 @@
 		}
 	}
 	endAlign();
-	usingDistance=false;
 }
 
 

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19056&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sun Apr 20 15:00:26 2014
@@ -3105,7 +3105,7 @@
 			}
 //			newGroupedItems.clear();
 			FPointArray pts;
-			double x, y, wide;
+			double x=0.0, y=0.0, wide=0.0;
 			QString chstr, ccounter;
 			QChar chstrex;
 			PageItem* bb;




More information about the scribus-commit mailing list