From 02ef45be75a3024df11365956e1cce6392d9103c Mon Sep 17 00:00:00 2001 From: erik Date: Mon, 29 Jan 2007 21:53:48 +0000 Subject: Each file in this commit has an issue where the initial value of a variable is assumed to be something but no initial value is given. This commit changes that by either assigning an initial value or removing the assumption on an initial value (usually the former). --- (limited to 'noncore') diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp index 2958cf5..a7d6b00 100644 --- a/noncore/apps/confedit/listviewitemconffile.cpp +++ b/noncore/apps/confedit/listviewitemconffile.cpp @@ -41,48 +41,53 @@ void ListViewItemConfFile::displayText() QString ListViewItemConfFile::fileName() { - return confFileInfo->fileName(); + return confFileInfo->fileName(); } void ListViewItemConfFile::parseFile() { - //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl; - QFile confFile(confFileInfo->absFilePath()); - if(! confFile.open(IO_ReadOnly)) - QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); - QTextStream t( &confFile ); - QString s; + //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl; + QFile confFile(confFileInfo->absFilePath()); + if(! confFile.open(IO_ReadOnly)) + QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); + + QTextStream t( &confFile ); + QString s; QString group; - ListViewItemConfigEntry *groupItem; + ListViewItemConfigEntry *groupItem = 0; ListViewItemConfigEntry *item; while ( !t.atEnd() ) { - s = t.readLine().stripWhiteSpace(); - //odebug << "line: >" << s.latin1() << "<\n" << oendl; - if (s.contains("" << s.latin1() << "<\n" << oendl; + if (s.contains("" << group.latin1() << "<" << oendl; - item = new ListViewItemConfigEntry(this, group, s ); + //odebug << "got key"+s << oendl; + if (!groupItem) + odebug << "PANIC! no group >" << group.latin1() << "<" << oendl; + + item = new ListViewItemConfigEntry(this, group, s ); groupItem->insertItem( item ); } } - confFile.close(); - setExpandable( _valid ); -// odebug << "ListViewItemConfFile::parseFile END" << oendl; + confFile.close(); + setExpandable( _valid ); + //odebug << "ListViewItemConfFile::parseFile END" << oendl; } diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp index 9d27c85..a0f72ae 100644 --- a/noncore/apps/opie-console/io_irda.cpp +++ b/noncore/apps/opie-console/io_irda.cpp @@ -35,6 +35,7 @@ bool IOIrda::open() { // emit error!!! delete m_attach; m_attach = 0l; + ret = false; } return ret; } diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index aba7244..a884179 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -707,15 +707,11 @@ void MainWindow::slotFullscreen() { void MainWindow::slotScrollbarSelected(int index) { - int loc; + int loc = 0; Config cfg( "Konsole" ); cfg.setGroup("ScrollBar"); - if(index == sm_none) - { - loc = 0; - } - else if(index == sm_left) + if(index == sm_left) { loc = 1; } @@ -724,7 +720,7 @@ void MainWindow::slotScrollbarSelected(int index) loc = 2; } - cfg.writeEntry("Position", loc); + cfg.writeEntry("Position", loc); if (currentSession()) { currentSession()->emulationHandler()->setScrollbarLocation(loc); diff --git a/noncore/apps/opie-reader/CFilter.cpp b/noncore/apps/opie-reader/CFilter.cpp index 25cdfae..a4ea60a 100644 --- a/noncore/apps/opie-reader/CFilter.cpp +++ b/noncore/apps/opie-reader/CFilter.cpp @@ -501,7 +501,7 @@ void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos) m_buffer = 0; return; } - unsigned long lnk, lnkoff; + unsigned long lnk = 0, lnkoff = 0; do { if (nextpart[m_buffed] == 0) break; diff --git a/noncore/apps/opie-reader/CRegExp.cpp b/noncore/apps/opie-reader/CRegExp.cpp index 6318d28..e3194df 100644 --- a/noncore/apps/opie-reader/CRegExp.cpp +++ b/noncore/apps/opie-reader/CRegExp.cpp @@ -109,7 +109,7 @@ void CRegExpFilt::prepreprocessing(const QString& pat, bool insens) case '[' : { - tchar clast; + tchar clast = 0; bool invert = false; tchar c; #ifdef _WINDOWS @@ -287,7 +287,7 @@ unsigned int CRegExpFilt::preprocessing(const QString& pat, bool insens) case '[' : { - tchar c, clast; + tchar c, clast = 0; bool invert = false; #ifdef _WINDOWS if (pat.at(p+1).unicode() == '^') diff --git a/noncore/apps/opie-reader/Palm2QImage.cpp b/noncore/apps/opie-reader/Palm2QImage.cpp index 361755f..09cad1c 100644 --- a/noncore/apps/opie-reader/Palm2QImage.cpp +++ b/noncore/apps/opie-reader/Palm2QImage.cpp @@ -125,7 +125,7 @@ QImage* Palm2QImage unsigned int width, height, bytes_per_row, flags, next_depth_offset; unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount; unsigned int palm_red_bits, palm_green_bits, palm_blue_bits; - unsigned char *palm_ptr, *x_ptr, *imagedata, *inbyte, *rowbuf, *lastrow, + unsigned char *palm_ptr, *x_ptr, *inbyte, *rowbuf, *lastrow, *imagedatastart, *palmimage; ColorMapEntry *colormap; @@ -213,7 +213,7 @@ QImage* Palm2QImage rowbuf = new unsigned char[bytes_per_row * width]; lastrow = new unsigned char[bytes_per_row * width]; - for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { + for (i=0, palm_ptr = imagedatastart , x_ptr = 0; i < height; ++i) { // qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); /* first, uncompress the Palm image */ diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp index 0c56dd4..75da8ac 100644 --- a/noncore/apps/opie-reader/QTReader.cpp +++ b/noncore/apps/opie-reader/QTReader.cpp @@ -544,7 +544,7 @@ void QTReader::setContinuous(bool _b) void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno) { - unsigned long wrdstart, wrdend; + unsigned long wrdstart = 0, wrdend = 0; QString wrd; int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin; if (m_twotouch) diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp index 849edfc..302ac73 100644 --- a/noncore/apps/opie-reader/plucker_base.cpp +++ b/noncore/apps/opie-reader/plucker_base.cpp @@ -705,7 +705,7 @@ void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsig void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) { - unsigned short sz; + unsigned short sz = 0; if (srclen >= sizeof(sz)) { memcpy(&sz, src, sizeof(sz)); diff --git a/noncore/apps/opie-reader/striphtml.cpp b/noncore/apps/opie-reader/striphtml.cpp index c434dbb..a2ad56b 100644 --- a/noncore/apps/opie-reader/striphtml.cpp +++ b/noncore/apps/opie-reader/striphtml.cpp @@ -473,7 +473,7 @@ linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& if (href == "history.back()") { QString fc = currentfile; - unsigned long loc; + unsigned long loc = 0; htmlmark m(fc, loc); linkType ret = (m_nav.back(m)) ? eFile : eNone; if (fc == m.filename()) diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 89024f7..ee6030f 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp @@ -1316,7 +1316,7 @@ int HlManager::wildcardFind(const QString &fileName) { int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { ItemStyleList defaultStyleList; - ItemStyle *defaultStyle; + ItemStyle *defaultStyle = 0; ItemDataList itemDataList; ItemData *itemData; int nAttribs, z; @@ -1330,7 +1330,7 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { highlight->getItemDataList(itemDataList); nAttribs = itemDataList.count(); for (z = 0; z < nAttribs; z++) { - odebug << "HlManager::makeAttribs: createing one attribute definition" << oendl; + odebug << "HlManager::makeAttribs: creating an attribute definition" << oendl; itemData = itemDataList.at(z); if (itemData->defStyle) { // default style @@ -1351,8 +1351,10 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { for (; z < maxAttribs; z++) { a[z].col = black; a[z].selCol = black; - a[z].bold = defaultStyle->bold; - a[z].italic = defaultStyle->italic; + if (defaultStyle) { + a[z].bold = defaultStyle->bold; + a[z].italic = defaultStyle->italic; + } } return nAttribs; } diff --git a/noncore/net/ftplib/ftplib.c b/noncore/net/ftplib/ftplib.c index addf9d2..ce4c05f 100644 --- a/noncore/net/ftplib/ftplib.c +++ b/noncore/net/ftplib/ftplib.c @@ -781,7 +781,7 @@ static int FtpAcceptConnection(netbuf *nData, netbuf *nControl) int i; struct timeval tv; fd_set mask; - int rv; + int rv = 1; FD_ZERO(&mask); FD_SET(nControl->handle, &mask); diff --git a/noncore/settings/sysinfo/contrib/dhry.c b/noncore/settings/sysinfo/contrib/dhry.c index 07fd1c0..5426157 100644 --- a/noncore/settings/sysinfo/contrib/dhry.c +++ b/noncore/settings/sysinfo/contrib/dhry.c @@ -572,7 +572,7 @@ Proc_2 (Int_Par_Ref) One_Fifty *Int_Par_Ref; { One_Fifty Int_Loc; - Enumeration Enum_Loc; + Enumeration Enum_Loc = Ident_2; Int_Loc = *Int_Par_Ref + 10; do /* executed once */ -- cgit v0.9.0.2