r20925 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Sun Feb 7 00:18:28 UTC 2016


Author: jghali
Date: Sun Feb  7 00:18:28 2016
New Revision: 20925

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20925
Log:
coverity #1350742: uninitialized pointer field

Modified:
    trunk/Scribus/scribus/upgradechecker.cpp
    trunk/Scribus/scribus/upgradechecker.h

Modified: trunk/Scribus/scribus/upgradechecker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20925&path=/trunk/Scribus/scribus/upgradechecker.cpp
==============================================================================
--- trunk/Scribus/scribus/upgradechecker.cpp	(original)
+++ trunk/Scribus/scribus/upgradechecker.cpp	Sun Feb  7 00:18:28 2016
@@ -31,7 +31,12 @@
 UpgradeChecker::UpgradeChecker() : QObject()
 {
 	init();
-	m_writeToConsole=true;
+
+	m_fin = false;
+	m_file = 0;
+	m_networkManager = 0;
+	m_networkReply = 0;
+	m_writeToConsole = true;
 }
 
 UpgradeChecker::~UpgradeChecker()
@@ -70,13 +75,13 @@
 
 	m_fin=false;
 
-	m_=new QFile(m_tempFile);
+	m_file=new QFile(m_tempFile);
 	m_networkManager=new QNetworkAccessManager(this);
-	if (m_networkManager!=0 && m_!=0)
+	if (m_networkManager!=0 && m_file!=0)
 	{
 		outputText( tr("No data on your computer will be sent to an external location"));
 		qApp->processEvents();
-		if(m_->open(QIODevice::ReadWrite))
+		if(m_file->open(QIODevice::ReadWrite))
 		{
 			QString hostname("services.scribus.net");
 			QString filepath("/"+filename);
@@ -105,12 +110,12 @@
 			{
 					outputText("<b>"+ tr("Timed out when attempting to get update file.")+"</b>");
 			}
-			m_->close();
+			m_file->close();
 		}
-		m_->remove();
-	}
-	delete m_;
-	m_=0;
+		m_file->remove();
+	}
+	delete m_file;
+	m_file=0;
 	outputText( tr("Finished") );
 	m_networkReply->deleteLater();
 	m_networkManager->deleteLater();
@@ -122,7 +127,7 @@
 		outputText(QString("Failed: %1").arg(qPrintable(m_networkReply->errorString())));
 	else
 	{
-		m_->reset();
+		m_file->reset();
 		process();
 		m_fin=true;
 		show(m_networkReply->error()!=QNetworkReply::NoError);
@@ -132,14 +137,14 @@
 
 void UpgradeChecker::downloadReadyRead()
 {
-	m_->write(m_networkReply->readAll());
+	m_file->write(m_networkReply->readAll());
 }
 
 bool UpgradeChecker::process()
 {
-	if (!m_)
+	if (!m_file)
 		return false;
-	QTextStream ts(m_);
+	QTextStream ts(m_file);
 	ts.setCodec(QTextCodec::codecForName("UTF-8"));
 	QString errorMsg;
 	int eline;
@@ -151,7 +156,7 @@
 		if (data.toLower().contains("404 not found"))
 			outputText("<b>"+ tr("File not found on server")+"</b>");
 		else
-			outputText("<b>"+ tr("Could not open version file: %1\nError:%2 at line: %3, row: %4").arg(m_->fileName()).arg(errorMsg).arg(eline).arg(ecol)+"</b>");
+			outputText("<b>"+ tr("Could not open version file: %1\nError:%2 at line: %3, row: %4").arg(m_file->fileName()).arg(errorMsg).arg(eline).arg(ecol)+"</b>");
 		return false;
 	}
 	

Modified: trunk/Scribus/scribus/upgradechecker.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20925&path=/trunk/Scribus/scribus/upgradechecker.h
==============================================================================
--- trunk/Scribus/scribus/upgradechecker.h	(original)
+++ trunk/Scribus/scribus/upgradechecker.h	Sun Feb  7 00:18:28 2016
@@ -51,7 +51,7 @@
 	QNetworkAccessManager* m_networkManager;
 	QNetworkReply *m_networkReply;
 	QString m_message;
-	QFile *m_;
+	QFile *m_file;
 	bool m_errorReported;
 };
 




More information about the scribus-commit mailing list