[qet] [1545] Removed array intialized with a dynamic length at run-time.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 1545
Author:   xavier
Date:     2012-03-04 18:42:25 +0100 (Sun, 04 Mar 2012)
Log Message:
-----------
Removed array intialized with a dynamic length at run-time.

Modified Paths:
--------------
    branches/0.3/sources/customelement.cpp

Modified: branches/0.3/sources/customelement.cpp
===================================================================
--- branches/0.3/sources/customelement.cpp	2012-03-03 20:35:00 UTC (rev 1544)
+++ branches/0.3/sources/customelement.cpp	2012-03-04 17:42:25 UTC (rev 1545)
@@ -511,17 +511,20 @@
 		else break;
 	}
 	if (i < 3) return(false);
-	QPointF points[i-1];
+	QVector<QPointF> points(i-1);
 	for (int j = 1 ; j < i ; ++ j) {
-		points[j-1] = QPointF(
-			e.attribute(QString("x%1").arg(j)).toDouble(),
-			e.attribute(QString("y%1").arg(j)).toDouble()
+		points.insert(
+			j - 1,
+			QPointF(
+				e.attribute(QString("x%1").arg(j)).toDouble(),
+				e.attribute(QString("y%1").arg(j)).toDouble()
+			)
 		);
 	}
 	qp.save();
 	setPainterStyle(e, qp);
-	if (e.attribute("closed") == "false") qp.drawPolyline(points, i-1);
-	else qp.drawPolygon(points, i-1);
+	if (e.attribute("closed") == "false") qp.drawPolyline(points.data(), i-1);
+	else qp.drawPolygon(points.data(), i-1);
 	qp.restore();
 	return(true);
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/