r22309 by craig -

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 30 00:05:29 UTC 2017


Author: craig
Date: Sat Dec 30 00:05:29 2017
New Revision: 22309

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22309
Log:
Fix Coverity issues

Modified:
    trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
    trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
    trunk/Scribus/scribus/ui/cpalette.cpp
    trunk/Scribus/scribus/ui/storyeditor.cpp

Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22309&path=/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp	Sat Dec 30 00:05:29 2017
@@ -1375,8 +1375,8 @@
 		{
 			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 			QScopedPointer<MissingFont> dia(new MissingFont(0, family, m_Doc));
-			dia->exec();
-			fontName = dia->getReplacementFont();
+			if (dia->exec())
+				fontName = dia->getReplacementFont();
 			qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
 			PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[family] = fontName;
 		}

Modified: trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22309&path=/trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp	Sat Dec 30 00:05:29 2017
@@ -404,11 +404,13 @@
 	if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(fontName))
 	{
 		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
-		MissingFont dia(0, fontName, doc);
-		dia.exec();
-		qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
-		PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName] = dia.getReplacementFont();
-		fontName = dia.getReplacementFont();
+		QScopedPointer<MissingFont> dia(new MissingFont(0, fontName, doc));
+		if (dia->exec())
+		{
+			qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
+			PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName] = dia->getReplacementFont();
+			fontName = dia->getReplacementFont();
+		}
 	}
 	else
 		fontName = PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName];
@@ -428,7 +430,7 @@
 void XtgScanner::setColor()
 {
 	flushText();
-	token = getToken();	
+	token = getToken();
 
 	QHash<QString,QString> color;
 	color.insert("cC","Cyan");

Modified: trunk/Scribus/scribus/ui/cpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22309&path=/trunk/Scribus/scribus/ui/cpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cpalette.cpp	(original)
+++ trunk/Scribus/scribus/ui/cpalette.cpp	Sat Dec 30 00:05:29 2017
@@ -1783,26 +1783,26 @@
 	m_Pattern_rotation = dia->spinAngle->value();
 	double skewX = dia->spinXSkew->value();
 	double a;
-	if (skewX == 90)
-		a = 1;
-	else if (skewX == 180)
-		a = 0;
-	else if (skewX == 270)
-		a = -1;
-	else if (skewX == 360)
-		a = 0;
+	if (skewX == 90.0)
+		a = 1.0;
+	else if (skewX == 180.0)
+		a = 0.0;
+	else if (skewX == 270.0)
+		a = -1.0;
+	else if (skewX == 360.0)
+		a = 0.0;
 	else
 		a = tan(M_PI / 180.0 * skewX);
 	m_Pattern_skewX = tan(a);
 	skewX = dia->spinYSkew->value();
-	if (skewX == 90)
-		a = 1;
-	else if (skewX == 180)
-		a = 0;
-	else if (skewX == 270)
-		a = -1;
-	else if (skewX == 360)
-		a = 0;
+	if (skewX == 90.0)
+		a = 1.0;
+	else if (skewX == 180.0)
+		a = 0.0;
+	else if (skewX == 270.0)
+		a = -1.0;
+	else if (skewX == 360.0)
+		a = 0.0;
 	else
 		a = tan(M_PI / 180.0 * skewX);
 	m_Pattern_skewY = tan(a);

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22309&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp	(original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp	Sat Dec 30 00:05:29 2017
@@ -46,6 +46,7 @@
 #include <QRegExp>
 #include <QShowEvent>
 #include <QSignalBlocker>
+#include <QScopedPointer>
 #include <QScrollBar>
 #include <QTextBlock>
 #include <QTextCodec>
@@ -3011,15 +3012,17 @@
 {
 	m_blockUpdate = true;
 	EditorBar->setRepaint(false);
-	SearchReplace dia(this, m_doc, m_item, false);
-	dia.exec();
-	int pos = dia.firstMatchCursorPosition();
-	if (pos >= 0)
-	{
-		QTextCursor tCursor = Editor->textCursor();
-		tCursor.setPosition(pos);
-		Editor->setTextCursor(tCursor);
-		Editor->SelStack.push(qMakePair(pos, -1));
+	QScopedPointer<SearchReplace> dia(new SearchReplace(this, m_doc, m_item, false));
+	if (dia->exec())
+	{
+		int pos = dia->firstMatchCursorPosition();
+		if (pos >= 0)
+		{
+			QTextCursor tCursor = Editor->textCursor();
+			tCursor.setPosition(pos);
+			Editor->setTextCursor(tCursor);
+			Editor->SelStack.push(qMakePair(pos, -1));
+		}
 	}
 	qApp->processEvents();
 	m_blockUpdate = false;




More information about the scribus-commit mailing list