r23733 by jghali - Fix coverity 1350804: Uninitialized scalar field

scribus-commit scribus-commit at lists.scribus.net
Sun May 10 13:41:07 UTC 2020


Author: jghali
Date: Sun May 10 13:41:07 2020
New Revision: 23733

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23733
Log:
Fix coverity 1350804: Uninitialized scalar field

Modified:
    trunk/Scribus/scribus/plugins/import/ai/importai.cpp
    trunk/Scribus/scribus/plugins/import/ai/importai.h

Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23733&path=/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.cpp	Sun May 10 13:41:07 2020
@@ -62,55 +62,10 @@
 	#include <podofo/podofo.h>
 #endif
 
-AIPlug::AIPlug(ScribusDoc* doc, int flags) :
-	progressDialog(nullptr),
-	meshMode(false),
-	meshXSize(0),
-	meshYSize(0),
-	currentMeshXPos(0),
-	currentMeshYPos(0),
-	meshNodeCounter(0),
-	meshColorMode(0),
-	meshNode1PointX(0.0),
-	meshNode1PointY(0.0),
-	meshNode1Control1X(0.0),
-	meshNode1Control1Y(0.0),
-	meshNode1Control2X(0.0),
-	meshNode1Control2Y(0.0),
-	meshNode2PointX(0.0),
-	meshNode2PointY(0.0),
-	meshNode2Control1X(0.0),
-	meshNode2Control1Y(0.0),
-	meshNode2Control2X(0.0),
-	meshNode2Control2Y(0.0),
-	meshNode3PointX(0.0),
-	meshNode3PointY(0.0),
-	meshNode3Control1X(0.0),
-	meshNode3Control1Y(0.0),
-	meshNode3Control2X(0.0),
-	meshNode3Control2Y(0.0),
-	meshNode4PointX(0.0),
-	meshNode4PointY(0.0),
-	meshNode4Control1X(0.0),
-	meshNode4Control1Y(0.0),
-	meshNode4Control2X(0.0),
-	meshNode4Control2Y(0.0),
-	textMode(0),
-	textSize(0.0),
-	maxWidth(0.0),
-	tempW(0.0),
-	maxHeight(0.0),
-	textKern(0.0),
-	textScaleH(0.0),
-	textScaleV(0.0),
-	startCurrentTextRange(0.0),
-	endCurrentTextRange(0.0),
-	symbolMode(false),
-	dataMode(false),
-	fObjectMode(false)
+AIPlug::AIPlug(ScribusDoc* doc, int flags)
 {
-	tmpSel=new Selection(this, false);
-	m_Doc=doc;
+	tmpSel = new Selection(this, false);
+	m_Doc = doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
 }
@@ -1922,7 +1877,7 @@
 				m1.rotate(-currentGradientAngle);
 				ite->GrStartX = currentGradientOrigin.x() - ite->xPos() + m_Doc->currentPage()->xOffset();
 				ite->GrStartY = currentGradientOrigin.y() - ite->yPos() + m_Doc->currentPage()->yOffset();
-				QPointF target = m1.map(QPointF(currentGradientLenght, 0.0));
+				QPointF target = m1.map(QPointF(currentGradientLength, 0.0));
 				ite->GrEndX = target.x();
 				ite->GrEndY = target.y();
 				if (wasBC)
@@ -1933,7 +1888,7 @@
 					QTransform m2;
 					m2.rotate(-currentGradientAngle);
 					m2 *= endMatrix;
-					QPointF target = m2.map(QPointF(currentGradientLenght, 0.0));
+					QPointF target = m2.map(QPointF(currentGradientLength, 0.0));
 					ite->GrEndX = target.x();
 					ite->GrEndY = target.y();
 				}
@@ -1942,7 +1897,7 @@
 			currentGradientMatrix = QTransform();
 			currentGradientOrigin = QPointF(0.0, 0.0);
 			currentGradientAngle = 0.0;
-			currentGradientLenght = 1.0;
+			currentGradientLength = 1.0;
 			itemRendered = false;
 		}
 		else if (command == "Bg")
@@ -1954,7 +1909,7 @@
 			QString tmpS = Cdata.mid(en+1, Cdata.size() - en);
 			ScTextStream gVals(&tmpS, QIODevice::ReadOnly);
 			double xOrig, yOrig, m1, m2, m3, m4, m5, m6;
-			gVals >> xOrig >> yOrig >> currentGradientAngle >> currentGradientLenght >> m1 >> m2 >> m3 >> m4 >> m5 >> m6;
+			gVals >> xOrig >> yOrig >> currentGradientAngle >> currentGradientLength >> m1 >> m2 >> m3 >> m4 >> m5 >> m6;
 			currentGradientOrigin = QPointF(xOrig - docX, docHeight - (yOrig - docY));
 			currentGradientMatrix = QTransform(m1, m2, m3, m4, m5, m6);
 		}
@@ -3387,7 +3342,7 @@
 	meshMode = false;
 	dataMode = false;
 	fObjectMode = false;
-	dataString = "";
+	dataString.clear();
 	itemLocked = false;
 	patternX1 = 0.0;
 	patternY1 = 0.0;
@@ -3408,8 +3363,8 @@
 	currentGradientMatrix = QTransform();
 	currentGradientOrigin = QPointF(0.0, 0.0);
 	currentGradientAngle = 0.0;
-	currentGradientLenght = 1.0;
-	currentPatternName = "";
+	currentGradientLength = 1.0;
+	currentPatternName.clear();
 	currentPatternX = 0.0;
 	currentPatternY = 0.0;
 	currentPatternXScale = 1.0;

Modified: trunk/Scribus/scribus/plugins/import/ai/importai.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23733&path=/trunk/Scribus/scribus/plugins/import/ai/importai.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.h	(original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.h	Sun May 10 13:41:07 2020
@@ -95,88 +95,93 @@
 	QStringList importedColors;
 	QStringList importedGradients;
 	QStringList importedPatterns;
-	double baseX, baseY;
-	double docX;
-	double docY;
-	double docWidth;
-	double docHeight;
-
-	double LineW;
-	Qt::PenCapStyle CapStyle;
-	Qt::PenJoinStyle JoinStyle;
-	double DashOffset;
+	double baseX = 0.0;
+	double baseY = 0.0;
+	double docX = 0.0;
+	double docY = 0.0;
+	double docWidth = 0.0;
+	double docHeight = 0.0;
+
+	double LineW = 1.0;
+	Qt::PenCapStyle CapStyle = Qt::FlatCap;
+	Qt::PenJoinStyle JoinStyle = Qt::MiterJoin;
+	double DashOffset = 0.0;
 	QList<double> DashPattern;
-	double Opacity;
-	int blendMode;
+	double Opacity = 1.0;
+	int blendMode = 0;
 	QString CurrColorFill;
 	QString CurrColorStroke;
-	double CurrStrokeShade;
-	double CurrFillShade;
-	bool fillRule;
-	bool itemLocked;
+	double CurrStrokeShade = 100.0;
+	double CurrFillShade = 100.0;
+	bool fillRule = false;
+	bool itemLocked = false;
 
 	FPointArray Coords;
 	FPointArray clipCoords;
 	FPointArray currentSpecialPath;
 	FPoint currentPoint;
-	int currentLayer;
-	bool firstLayer;
-	bool FirstU, WasU, ClosedPath;
+	int currentLayer = 0;
+	bool firstLayer = true;
+	bool FirstU = false;
+	bool WasU = false;
 	bool interactive;
-	MultiProgressDialog * progressDialog;
-	bool cancel;
-	ScribusDoc* m_Doc;
-	Selection* tmpSel;
+	MultiProgressDialog * progressDialog = nullptr;
+	bool cancel = false;
+	ScribusDoc* m_Doc = nullptr;
+	Selection* tmpSel = nullptr;
 	int importerFlags;
 	QStringList commandList;
-	bool convertedPDF;
+	bool convertedPDF = false;
 	QMap<QString, VGradient> m_gradients;
 	VGradient currentGradient;
 	QString currentGradientName;
 	QTransform currentGradientMatrix;
 	QPointF currentGradientOrigin;
-	double currentGradientAngle;
-	double currentGradientLenght;
-	bool gradientMode;
-	bool wasBC;
-	bool itemRendered;
+	double currentGradientAngle = 0.0;
+	double currentGradientLength = 1.0;
+	bool gradientMode = false;
+	bool wasBC = false;
+	bool itemRendered = false;
 	QTransform startMatrix;
 	QTransform endMatrix;
-	bool patternMode;
+	bool patternMode = false;
 	QString currentPatternDefName;
 	QString currentPatternName;
-	double patternX1;
-	double patternY1;
-	double patternX2;
-	double patternY2;
-	double currentPatternX;
-	double currentPatternY;
-	double currentPatternXScale;
-	double currentPatternYScale;
-	double currentPatternRotation;
+	double patternX1 = 0.0;
+	double patternY1 = 0.0;
+	double patternX2 = 0.0;
+	double patternY2 = 0.0;
+	double currentPatternX = 0.0;
+	double currentPatternY = 0.0;
+	double currentPatternXScale = 1.0;
+	double currentPatternYScale = 1.0;
+	double currentPatternRotation = 0.0;
 	QString currentStrokePatternName;
-	double currentStrokePatternX;
-	double currentStrokePatternY;
-	double currentStrokePatternXScale;
-	double currentStrokePatternYScale;
-	double currentStrokePatternRotation;
-	bool meshMode;
-	int meshXSize, meshYSize;
-	int currentMeshXPos, currentMeshYPos;
-	int meshNodeCounter;
-	int meshColorMode;
-	double meshNode1PointX, meshNode1PointY;
-	double meshNode1Control1X, meshNode1Control1Y;
-	double meshNode1Control2X, meshNode1Control2Y;
-	double meshNode2PointX, meshNode2PointY;
-	double meshNode2Control1X, meshNode2Control1Y;
-	double meshNode2Control2X, meshNode2Control2Y;
-	double meshNode3PointX, meshNode3PointY;
-	double meshNode3Control1X, meshNode3Control1Y;
+	double currentStrokePatternX = 0.0;
+	double currentStrokePatternY = 0.0;
+	double currentStrokePatternXScale = 1.0;
+	double currentStrokePatternYScale = 1.0;
+	double currentStrokePatternRotation = 0.0;
+	bool meshMode = false;
+	int meshXSize = 0;
+	int meshYSize = 0;
+	int currentMeshXPos = 0;
+	int currentMeshYPos = 0;
+	int meshNodeCounter = 0;
+	int meshColorMode = 0;
+	double meshNode1PointX = 0.0;
+	double meshNode1PointY = 0.0;
+	double meshNode1Control1X = 0.0, meshNode1Control1Y = 0.0;
+	double meshNode1Control2X = 0.0, meshNode1Control2Y = 0.0;
+	double meshNode2PointX = 0.0, meshNode2PointY = 0.0;
+	double meshNode2Control1X = 0.0, meshNode2Control1Y = 0.0;
+	double meshNode2Control2X = 0.0, meshNode2Control2Y = 0.0;
+	double meshNode3PointX = 0.0, meshNode3PointY = 0.0;
+	double meshNode3Control1X = 0.0, meshNode3Control1Y = 0.0;
 	double meshNode3Control2X, meshNode3Control2Y;
-	double meshNode4PointX, meshNode4PointY;
-	double meshNode4Control1X, meshNode4Control1Y;
-	double meshNode4Control2X, meshNode4Control2Y;
+	double meshNode4PointX = 0.0, meshNode4PointY = 0.0;
+	double meshNode4Control1X = 0.0, meshNode4Control1Y = 0.0;
+	double meshNode4Control2X = 0.0, meshNode4Control2Y = 0.0;
 	QString meshColor1, meshColor2, meshColor3, meshColor4;
 	QList<QList<MeshPoint> > meshGradientArray;
 	QString docCreator;
@@ -184,24 +189,24 @@
 	QString docTime;
 	QString docOrganisation;
 	QString docTitle;
-	int textMode;
+	int textMode = 0;
 	QTransform textMatrix;
 	StoryText textData;
 	QString textFont;
-	double textSize;
-	double maxWidth;
-	double tempW;
-	double maxHeight;
-	double textKern;
-	double textScaleH;
-	double textScaleV;
-	int startCurrentTextRange;
-	int endCurrentTextRange;
+	double textSize = 0.0;
+	double maxWidth = 0.0;
+	double tempW = 0.0;
+	double maxHeight = 0.0;
+	double textKern= 0.0;
+	double textScaleH = 0.0;
+	double textScaleV = 0.0;
+	int startCurrentTextRange = 0;
+	int endCurrentTextRange = 0;
 	QString currentSymbolName;
 	QMap<QString, QPointF> importedSymbols;
-	bool symbolMode;
-	bool dataMode;
-    bool fObjectMode;
+	bool symbolMode = false;
+	bool dataMode = false;
+    bool fObjectMode = false;
 	QString dataString;
 
 public slots:




More information about the scribus-commit mailing list