r21119 by craig -

scribus-commit scribus-commit at lists.scribus.net
Fri Mar 25 21:48:49 UTC 2016


Author: craig
Date: Fri Mar 25 21:48:49 2016
New Revision: 21119

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21119
Log:
Fix 2 coverity issues in boxes code: 1357147-9

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/text/textlayout.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21119&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Fri Mar 25 21:48:49 2016
@@ -456,9 +456,6 @@
 	double   restartX; //starting X position of line if must be restarted
 	double   rowDesc;
 
-	double   ascend;
-	double   descend;
-	double   width;
 	double   xPos;
 	double   yPos;
 	int      breakIndex;
@@ -482,6 +479,29 @@
 		colWidth = colwidth;
 		colGap = colgap;
 		hyphenCount = 0;
+
+		isEmpty = true;
+		colLeft = insets.left() + lineCorr;
+		colRight = colLeft + colWidth;
+		startOfCol = true;
+		afterOverflow = false;
+		addLine = false;
+		recalculateY = false;
+		lastInRowLine = false;
+		addLeftIndent = false;
+		wasFirstInRow = false;
+		leftIndent = 0.0;
+		rightMargin = 0.0;
+		mustLineEnd = false;
+		restartIndex = 0;
+		restartRowIndex = 0;
+		restartX = 0.0;
+		rowDesc = 0.0;
+		xPos = 0.0;
+		yPos = 0.0;
+		breakIndex = -1;
+		breakXPos = 0.0;
+		maxShrink = 0.0;
 	}
 
 	/// move position to next column
@@ -522,7 +542,6 @@
 		breakXPos = 0.0;
 		maxShrink = 0.0;
 		maxStretch = 0.0;
-		width = 0.0;
 		leftIndent = 0.0;
 		rightMargin = 0.0;
 		rowDesc = 0.0;

Modified: trunk/Scribus/scribus/text/textlayout.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21119&path=/trunk/Scribus/scribus/text/textlayout.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textlayout.cpp	(original)
+++ trunk/Scribus/scribus/text/textlayout.cpp	Fri Mar 25 21:48:49 2016
@@ -94,16 +94,19 @@
 
 void TextLayout::appendLine(LineBox* ls)
 {
-	assert( ls->firstChar() >= 0 );
-	assert( ls->firstChar() < story()->length() );
-	assert( ls->lastChar() < story()->length() );
+	assert(ls);
+	assert(ls->firstChar() >= 0);
+	assert(ls->firstChar() < story()->length());
+	assert(ls->lastChar() < story()->length());
+	assert(!m_box->boxes().empty());
+
+	GroupBox* column = dynamic_cast<GroupBox*>(m_box->boxes().last());
+	assert(column);
 
 	// HACK: the ascent set by PageItem_TextFrame::layout()
 	// is useless, we reset it again based on the y position
-	ls->setAscent(ls->y() - m_box->boxes().last()->naturalHeight());
-	GroupBox* gb=dynamic_cast<GroupBox*>(m_box->boxes().last());
-	if (gb)
-		gb->addBox(ls);
+	ls->setAscent(ls->y() - column->naturalHeight());
+	column->addBox(ls);
 }
 
 // Remove the last line from the list. Used when we need to backtrack on the layouting.




More information about the scribus-commit mailing list