r20787 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 30 16:25:11 UTC 2016


Author: jghali
Date: Sat Jan 30 16:25:11 2016
New Revision: 20787

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

Modified:
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20787&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp	Sat Jan 30 16:25:11 2016
@@ -28,6 +28,11 @@
 	m_iText=iText;
 	m_returnToDefaultLang=false;
 	m_primaryLangIndex=0;
+
+	m_dictionaryMap = 0;
+	m_hspellerMap = 0;
+	m_wfList = 0;
+	m_wfListIndex = 0;
 }
 
 void HunspellDialog::set(QMap<QString, QString>* dictionaryMap, QMap<QString, HunspellDict*> *hspellerMap, QList<WordsFound> *wfList)
@@ -50,7 +55,7 @@
 	languagesComboBox->setCurrentIndex(0);
 	m_primaryLangIndex=0;
 	languagesComboBox->blockSignals(b);
-	wfListIndex=0;
+	m_wfListIndex=0;
 	goToNextWord(0);
 }
 
@@ -70,15 +75,15 @@
 		languagesComboBox->blockSignals(b);
 	}
 	if (i>=0)
-		wfListIndex=i;
+		m_wfListIndex=i;
 	else
 	{
 		do {
-			++wfListIndex;
-		} while (wfListIndex<m_wfList->count() && (m_wfList->at(wfListIndex).changed || m_wfList->at(wfListIndex).ignore));
-		//qDebug()<<"selected word index"<<wfListIndex;
+			++m_wfListIndex;
+		} while (m_wfListIndex<m_wfList->count() && (m_wfList->at(m_wfListIndex).changed || m_wfList->at(m_wfListIndex).ignore));
+		//qDebug()<<"selected word index"<<m_wfListIndex;
 	}
-	if (wfListIndex>=m_wfList->count())
+	if (m_wfListIndex>=m_wfList->count())
 	{
 		statusLabel->setText(tr("Spelling check complete"));
 		suggestionsListWidget->clear();
@@ -91,7 +96,7 @@
 	}
 	else
 		statusLabel->setText("");
-	currWF=m_wfList->at(wfListIndex);
+	currWF=m_wfList->at(m_wfListIndex);
 	setLanguageCombo(currWF.lang);
 	updateSuggestions(currWF.replacements);
 
@@ -104,9 +109,9 @@
 
 void HunspellDialog::ignoreAllWords()
 {
-	if (wfListIndex < 0 || wfListIndex >= m_wfList->count())
+	if (m_wfListIndex < 0 || m_wfListIndex >= m_wfList->count())
 		return;
-	QString wordToIgnore = m_wfList->at(wfListIndex).w;
+	QString wordToIgnore = m_wfList->at(m_wfListIndex).w;
 	//Do we start from 0 or from the instance of the word where we are... 0 for now
 	for(int i = 0; i < m_wfList->count(); ++i)
 		if (m_wfList->at(i).w == wordToIgnore)
@@ -117,17 +122,17 @@
 void HunspellDialog::changeWord()
 {
 	//If we have ignored a word or its already changed, skip to the next.
-	if(m_wfList->at(wfListIndex).ignore || m_wfList->at(wfListIndex).changed)
+	if(m_wfList->at(m_wfListIndex).ignore || m_wfList->at(m_wfListIndex).changed)
 		goToNextWord();
-	replaceWord(wfListIndex);
+	replaceWord(m_wfListIndex);
 	goToNextWord();
 }
 
 void HunspellDialog::changeAllWords()
 {
-	if(m_wfList->at(wfListIndex).ignore && !m_wfList->at(wfListIndex).changed)
+	if(m_wfList->at(m_wfListIndex).ignore && !m_wfList->at(m_wfListIndex).changed)
 		return;
-	QString wordToChange=m_wfList->at(wfListIndex).w;
+	QString wordToChange=m_wfList->at(m_wfListIndex).w;
 	//Do we start from 0 or from the instance of the word where we are... 0 for now
 	for(int i=0;i<m_wfList->count();++i)
 		if(m_wfList->at(i).w==wordToChange)
@@ -161,9 +166,9 @@
 	//qDebug()<<wordLang<<newLanguage;
 	if (m_wfList->count()==0)
 		return;
-	if (wfListIndex>=m_wfList->count())
-		wfListIndex=0;
-	QString word=m_wfList->at(wfListIndex).w;
+	if (m_wfListIndex>=m_wfList->count())
+		m_wfListIndex=0;
+	QString word=m_wfList->at(m_wfListIndex).w;
 	if ((*m_hspellerMap)[wordLang]->spell(word)==0)
 	{
 		QStringList replacements = (*m_hspellerMap)[wordLang]->suggest(word);
@@ -171,7 +176,7 @@
 	}
 	else
 	{
-		(*m_wfList)[wfListIndex].changed=true;
+		(*m_wfList)[m_wfListIndex].changed=true;
 		m_docChanged=true;
 		goToNextWord();
 	}

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20787&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h	Sat Jan 30 16:25:11 2016
@@ -41,7 +41,7 @@
 		QMap<QString, HunspellDict*> *m_hspellerMap;
 		QList<WordsFound>* m_wfList;
 		WordsFound currWF;
-		int wfListIndex;
+		int  m_wfListIndex;
 		bool m_docChanged;
 		bool m_returnToDefaultLang;
 		int m_primaryLangIndex;




More information about the scribus-commit mailing list