r21995 by craig - Coverity 1350094: Remove unused found bool as when found, we're returning early

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 23 11:15:52 UTC 2017


Author: craig
Date: Sun Apr 23 11:15:52 2017
New Revision: 21995

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21995
Log:
Coverity 1350094: Remove unused found bool as when found, we're returning early

Modified:
    trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp

Modified: trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21995&path=/trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp	(original)
+++ trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp	Sun Apr 23 11:15:52 2017
@@ -724,8 +724,7 @@
 
 	QString SlaDocumentRtfOutput::getFontName(QString name)
 	{
-		QString fontName = name;
-		bool found = false;
+		QString fontName(name);
 		SCFontsIterator it(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts);
 		for ( ; it.hasNext(); it.next())
 		{
@@ -751,24 +750,17 @@
 				}
 			}
 		}
-		if (found)
-			return fontName;
-		else
-		{
-			if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(fontName))
-			{
-				qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
-				MissingFont *dia = new MissingFont(0, fontName, m_Doc);
-				dia->exec();
-				QString fontNameR = dia->getReplacementFont();
-				delete dia;
-				qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
-				PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName] = fontNameR;
-				fontName = fontNameR;
-			}
-			else
-				fontName = PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName];
-		}
+		if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(fontName))
+		{
+			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+			MissingFont dia(0, fontName, m_Doc);
+			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];
 		return fontName;
 	}
 




More information about the scribus-commit mailing list