r16465 by fschmid - Fixed Bug #9855: Crash when importing EPS file.

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 20 18:30:19 CET 2011


Author: fschmid
Date: Sun Mar 20 17:30:19 2011
New Revision: 16465

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16465
Log:
Fixed Bug #9855: Crash when importing EPS file.

Modified:
    branches/Version135/Scribus/scribus/fpointarray.cpp

Modified: branches/Version135/Scribus/scribus/fpointarray.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16465&path=/branches/Version135/Scribus/scribus/fpointarray.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/fpointarray.cpp (original)
+++ branches/Version135/Scribus/scribus/fpointarray.cpp Sun Mar 20 17:30:19 2011
@@ -56,38 +56,18 @@
 	return *this; 
 }
 
-
-/* optimized for speed:
- *   never shrink
- *   when growing, try to double size
- *   if capacity permits, just increase count
- */
 bool FPointArray::resize(uint newCount)
 {
-	if (newCount <= capacity) {
-		count = newCount;
-		return true;
-	}
-	else if (newCount <= 2*capacity) {
-		QVector<FPoint>::resize(2*capacity);
-		if( static_cast<uint>(QVector<FPoint>::size()) == 2*capacity )
-		{
-			capacity *= 2;
-			count = newCount;
-			return true;
-		}
-	}
-	else {
+	if (newCount == 0)
+	{
+		QVector<FPoint>::resize(0);
+		QVector<FPoint>::squeeze();
+	}
+	else
 		QVector<FPoint>::resize(newCount);
-		if( static_cast<uint>(QVector<FPoint>::size()) == newCount )
-		{
-			capacity = newCount;
-			count = newCount;
-			return true;
-		}
-	}
-	sDebug(QString("Failed resize(): count=%1 capacity=%2 newCount=%3").arg(count).arg(capacity).arg(newCount));
-	return false;
+	capacity = newCount;
+	count = newCount;
+	return true;
 }
 
 




More information about the scribus-commit mailing list