r21717 by jghali - fix coverity issues 1350049/50/65, 1374348/49/50: unchecked return value

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 8 17:10:56 UTC 2017


Author: jghali
Date: Sun Jan  8 17:10:56 2017
New Revision: 21717

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21717
Log:
fix coverity issues 1350049/50/65, 1374348/49/50: unchecked return value

Modified:
    trunk/Scribus/scribus/ui/resourcemanager.cpp

Modified: trunk/Scribus/scribus/ui/resourcemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21717&path=/trunk/Scribus/scribus/ui/resourcemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/resourcemanager.cpp	(original)
+++ trunk/Scribus/scribus/ui/resourcemanager.cpp	Sun Jan  8 17:10:56 2017
@@ -111,7 +111,8 @@
 	QFile dataFile(ScPaths::downloadDir() + dataFiles[RM_FONTS]);
 	if (!dataFile.exists())
 		return;
-	dataFile.open(QIODevice::ReadOnly);
+	if (!dataFile.open(QIODevice::ReadOnly))
+		return;
 	QTextStream ts(&dataFile);
 	ts.setCodec(QTextCodec::codecForName("UTF-8"));
 	QString errorMsg;
@@ -170,7 +171,8 @@
 	QFile dataFile(ScPaths::downloadDir() + dataFiles[RM_HELP]);
 	if (!dataFile.exists())
 		return;
-	dataFile.open(QIODevice::ReadOnly);
+	if (!dataFile.open(QIODevice::ReadOnly))
+		return;
 	QTextStream ts(&dataFile);
 	ts.setCodec(QTextCodec::codecForName("UTF-8"));
 	QString errorMsg;
@@ -228,7 +230,8 @@
 	QFile dataFile(ScPaths::downloadDir() + dataFiles[RM_PALETTES]);
 	if (!dataFile.exists())
 		return;
-	dataFile.open(QIODevice::ReadOnly);
+	if (!dataFile.open(QIODevice::ReadOnly))
+		return;
 	QTextStream ts(&dataFile);
 	ts.setCodec(QTextCodec::codecForName("UTF-8"));
 	QString errorMsg;
@@ -544,7 +547,8 @@
 	QFile dataFile(ScPaths::downloadDir() + dataFiles[RM_HYPH]);
 	if (!dataFile.exists())
 		return;
-	dataFile.open(QIODevice::ReadOnly);
+	if (!dataFile.open(QIODevice::ReadOnly))
+		return;
 	QTextStream ts(&dataFile);
 	ts.setCodec(QTextCodec::codecForName("UTF-8"));
 	QString errorMsg;
@@ -644,7 +648,8 @@
 	QFile dataFile(ScPaths::downloadDir() + dataFiles[RM_SPELL]);
 	if (!dataFile.exists())
 		return;
-	dataFile.open(QIODevice::ReadOnly);
+	if (!dataFile.open(QIODevice::ReadOnly))
+		return;
 	QTextStream ts(&dataFile);
 	ts.setCodec(QTextCodec::codecForName("UTF-8"));
 	QString errorMsg;
@@ -1143,7 +1148,8 @@
 	QString data;
 	if (dataFile.exists())
 	{
-		dataFile.open(QIODevice::ReadOnly);
+		if (!dataFile.open(QIODevice::ReadOnly))
+			return;
 		data = ts.readAll();
 		dataFile.close();
 	}




More information about the scribus-commit mailing list