r17526 by jghali - #10725: misc patches for plugins

scribus-commit scribus-commit at lists.scribus.net
Wed May 30 19:15:34 UTC 2012


Author: jghali
Date: Wed May 30 19:15:34 2012
New Revision: 17526

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17526
Log:
#10725: misc patches for plugins

Modified:
    trunk/Scribus/scribus/plugins/import/ai/importai.cpp
    trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
    trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
    trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
    trunk/Scribus/scribus/plugins/scripter/pythonize.cpp

Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17526&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 Wed May 30 19:15:34 2012
@@ -679,22 +679,37 @@
 bool AIPlug::decompressAIData(QString &fName)
 {
 	QString f2 = fName+"_decom.ai";
-	FILE *source = fopen(fName.toLocal8Bit().constData(), "rb");
-	fseek(source, 20, SEEK_SET);
-	FILE *dest = fopen(f2.toLocal8Bit().constData(), "wb");
+	FILE *source, *dest;
 	int ret;
 	unsigned have;
 	z_stream strm;
 	char in[4096];
 	char out[4096];
+
+	source = fopen(fName.toLocal8Bit().constData(), "rb");
+	if (!source)
+		return false;
+	fseek(source, 20, SEEK_SET);
+	dest = fopen(f2.toLocal8Bit().constData(), "wb");
+	if (!dest)
+	{
+		fclose(source);
+		return false;
+	}
+
 	strm.zalloc = Z_NULL;
 	strm.zfree = Z_NULL;
 	strm.opaque = Z_NULL;
 	strm.avail_in = 0;
 	strm.next_in = Z_NULL;
 	ret = inflateInit(&strm);
+
 	if (ret != Z_OK)
+	{
+		fclose(source);
+		fclose(dest);
 		return false;
+	}
 	do
 	{
 		strm.avail_in = fread(in, 1, 4096, source);

Modified: trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17526&path=/trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/shape/importshape.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/shape/importshape.cpp Wed May 30 19:15:34 2012
@@ -536,18 +536,16 @@
 			FirstM = true;
 			for( QStringList::Iterator it = pointList.begin(); it != pointList.end(); it++ )
 			{
+				x = ScCLocale::toDoubleC(*(it++));
+				y = ScCLocale::toDoubleC(*it);
 				if( bFirst )
 				{
-					x = ScCLocale::toDoubleC(*(it++));
-					y = ScCLocale::toDoubleC(*it);
 					svgMoveTo(x * Conversion, y * Conversion);
 					bFirst = false;
 					WasM = true;
 				}
 				else
 				{
-					x = ScCLocale::toDoubleC(*(it++));
-					y = ScCLocale::toDoubleC(*it);
 					svgLineTo(&PoLine, x * Conversion, y * Conversion);
 				}
 			}
@@ -716,18 +714,16 @@
 			FirstM = true;
 			for( QStringList::Iterator it1 = pointList.begin(); it1 != pointList.end(); it1++ )
 			{
+				x = ScCLocale::toDoubleC(*(it1++));
+				y = ScCLocale::toDoubleC(*it1);
 				if( bFirst )
 				{
-					x = ScCLocale::toDoubleC(*(it1++));
-					y = ScCLocale::toDoubleC(*it1);
 					svgMoveTo(x * Conversion, y * Conversion);
 					bFirst = false;
 					WasM = true;
 				}
 				else
 				{
-					x = ScCLocale::toDoubleC(*(it1++));
-					y = ScCLocale::toDoubleC(*it1);
 					svgLineTo(&PoLine, x * Conversion, y * Conversion);
 				}
 			}

Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17526&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Wed May 30 19:15:34 2012
@@ -1640,17 +1640,15 @@
 		double y = 0.0;
 		for( QStringList::Iterator it = pointList.begin(); it != pointList.end(); it++ )
 		{
+			x = ScCLocale::toDoubleC(*(it++));
+			y = ScCLocale::toDoubleC(*it);
 			if( bFirst )
 			{
-				x = ScCLocale::toDoubleC(*(it++));
-				y = ScCLocale::toDoubleC(*it);
 				ite->PoLine.svgMoveTo(x, y);
 				bFirst = false;
 			}
 			else
 			{
-				x = ScCLocale::toDoubleC(*(it++));
-				y = ScCLocale::toDoubleC(*it);
 				ite->PoLine.svgLineTo(x, y);
 			}
 		}

Modified: trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17526&path=/trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp Wed May 30 19:15:34 2012
@@ -279,17 +279,15 @@
 	for( uint i = 0; i < points.size(); ++i )
 	{
 		FPoint point = points.point(i);
+		x = point.x();
+		y = point.y();
 		if( bFirst )
 		{
-			x = point.x();
-			y = point.y();
 			polyline.svgMoveTo(x, y);
 			bFirst = false;
 		}
 		else
 		{
-			x = point.x();
-			y = point.y();
 			polyline.svgLineTo(x, y);
 		}
 	}

Modified: trunk/Scribus/scribus/plugins/scripter/pythonize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17526&path=/trunk/Scribus/scribus/plugins/scripter/pythonize.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/pythonize.cpp (original)
+++ trunk/Scribus/scribus/plugins/scripter/pythonize.cpp Wed May 30 19:15:34 2012
@@ -122,7 +122,7 @@
 
     int res = PyRun_SimpleString (line);
 
-    delete line;
+    delete[] line;
     return res == 0;
 }
 




More information about the scribus-commit mailing list