author | erik <erik> | 2007-01-29 21:53:48 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-29 21:53:48 (UTC) |
commit | 02ef45be75a3024df11365956e1cce6392d9103c (patch) (side-by-side diff) | |
tree | 42fd5c909d67a473f57a607e01d32e01b3dd2511 | |
parent | b2c306a99b8dc82c981390f02db859149fac8cf0 (diff) | |
download | opie-02ef45be75a3024df11365956e1cce6392d9103c.zip opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.gz opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.bz2 |
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).
-rw-r--r-- | libopie2/opiecore/device/odevice_htc.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiepim/private/opimeventsortvector.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/confedit/listviewitemconffile.cpp | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CFilter.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CRegExp.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Palm2QImage.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-reader/QTReader.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/plucker_base.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/striphtml.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katehighlight.cpp | 6 | ||||
-rw-r--r-- | noncore/net/ftplib/ftplib.c | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/contrib/dhry.c | 2 |
14 files changed, 33 insertions, 33 deletions
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp index c21e10d..4e5200b 100644 --- a/libopie2/opiecore/device/odevice_htc.cpp +++ b/libopie2/opiecore/device/odevice_htc.cpp @@ -411,34 +411,33 @@ bool HTC::setDisplayStatus( bool on ) char buf[10]; buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; buf[1] = '\0'; res = ( ::write( fd, &buf[0], 2 ) == 0 ); ::close( fd ); } return res; } Transformation HTC::rotation() const { qDebug( "HTC::rotation()" ); - Transformation rot; + Transformation rot = Rot270; switch ( d->m_model ) { case Model_HTC_Universal: { OHingeStatus hs = readHingeSensor(); qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs ); if ( hs == CASE_PORTRAIT ) rot = Rot0; else if ( hs == CASE_UNKNOWN ) rot = Rot270; - else rot = Rot270; } break; } qDebug( "HTC::rotation() - returning '%d'", rot ); return rot; } ODirection HTC::direction() const { ODirection dir; switch ( d->m_model ) { diff --git a/libopie2/opiepim/private/opimeventsortvector.cpp b/libopie2/opiepim/private/opimeventsortvector.cpp index 4220c63..b85f848 100644 --- a/libopie2/opiepim/private/opimeventsortvector.cpp +++ b/libopie2/opiepim/private/opimeventsortvector.cpp @@ -28,61 +28,58 @@ */ #include "opimeventsortvector.h" #include <opie2/ocontactaccess.h> #include <opie2/opimnotifymanager.h> #include <opie2/odatebookaccess.h> #include <qvaluelist.h> namespace Opie { namespace Internal { -namespace{ - -inline int testAlarmNotifiers( const OPimNotifyManager& leftnotifiers, const OPimNotifyManager& rightnotifiers ){ +int testAlarmNotifiers( const OPimNotifyManager& leftnotifiers, const OPimNotifyManager& rightnotifiers ){ OPimNotifyManager::Alarms left_alarms = leftnotifiers.alarms(); OPimNotifyManager::Alarms right_alarms = rightnotifiers.alarms(); // Well.. How could we compare two lists of alarms? I think we should find the most early datetimes // and compare them.. (se) // Find the first alarm of the left list OPimNotifyManager::Alarms::Iterator it; QDateTime left_earliest; // This datetime is initialized as invalid!! for ( it = left_alarms.begin(); it != left_alarms.end(); ++it ){ if ( !left_earliest.isValid() || left_earliest > (*it).dateTime() ){ left_earliest = (*it).dateTime(); } } QDateTime right_earliest; // This datetime is initialized as invalid!! for ( it = right_alarms.begin(); it != right_alarms.end(); ++it ){ if ( !right_earliest.isValid() || right_earliest > (*it).dateTime() ){ right_earliest = (*it).dateTime(); } } - int ret; + int ret = 0; // Now compare this found alarms if ( !left_earliest .isValid() ) ret++; if ( !right_earliest.isValid() ) ret--; if ( left_earliest.isValid() && right_earliest.isValid() ){ - ret += left_earliest < right_earliest ? -1 : 1; + left_earliest < right_earliest ? ret-- : ret++; } return ret; } -} OPimEventSortVector::OPimEventSortVector( uint size, bool asc, int sort ) : OPimSortVector<OPimEvent>( size, asc, sort ) {} int OPimEventSortVector::compareItems( const OPimEvent& left, const OPimEvent& right ) { if ( left.uid() == right.uid() ) return 0; int ret = 0; bool asc = sortAscending(); 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,50 +41,55 @@ void ListViewItemConfFile::displayText() QString ListViewItemConfFile::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; 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("<?xml")) { _valid = false; break; - }else - if ( s[0] == '[' && s[s.length()-1] == ']' ) + } + else if ( s[0] == '[' && s[s.length()-1] == ']' ) { // odebug << "got group"+s << oendl; group = s.mid(1,s.length()-2); - if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") ); + if (!groupItem) + groupItem = new ListViewItemConfigEntry(this, tr("no group") ); + groupItem = new ListViewItemConfigEntry(this, group ); insertItem( groupItem ); - } else - if ( int pos = s.find('=') ) + } + else if ( int pos = s.find('=') ) { // odebug << "got key"+s << oendl; - if (!groupItem) odebug << "PANIK NO GROUP! >" << group.latin1() << "<" << 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; } void ListViewItemConfFile::remove() { 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 @@ -26,24 +26,25 @@ bool IOIrda::open() { m_attach = new Opie::Core::OProcess(); *m_attach << "irattach /dev/ttyS2 -s"; connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( slotExited(Opie::Core::OProcess*) ) ); if ( m_attach->start() ) { ret= IOSerial::open(); } else { // emit error!!! delete m_attach; m_attach = 0l; + ret = false; } return ret; } void IOIrda::reload( const Profile &config ) { m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); } 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 @@ -698,33 +698,29 @@ void MainWindow::slotFullscreen() { ( m_curSession->widgetStack() )->show(); ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); } m_isFullscreen = !m_isFullscreen; } 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; } else if(index == sm_right) { loc = 2; } 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 @@ -492,25 +492,25 @@ void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos) { m_current = m_buffed = 0; } } else { if (m_buffer != 0) { ch = m_buffer; m_buffer = 0; return; } - unsigned long lnk, lnkoff; + unsigned long lnk = 0, lnkoff = 0; do { if (nextpart[m_buffed] == 0) break; parent->getch(ch, sty, pos); m_laststyle = sty; if (sty.getLink()) { lnk = sty.getData(); lnkoff = sty.getOffset(); } } while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed); m_current = 0; 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 @@ -100,25 +100,25 @@ void CRegExpFilt::prepreprocessing(const QString& pat, bool insens) { #ifdef _WINDOWS tchar c = escapedchar(pat.at(++p).unicode()); #else tchar c = escapedchar(pat[++p].unicode()); #endif regchar(c, insens); break; } case '[' : { - tchar clast; + tchar clast = 0; bool invert = false; tchar c; #ifdef _WINDOWS if (pat.at(p+1).unicode() == '^') #else if (pat[p+1].unicode() == '^') #endif { p++; invert = true; } #ifdef _WINDOWS @@ -278,25 +278,25 @@ unsigned int CRegExpFilt::preprocessing(const QString& pat, bool insens) CV[lower(c)] |= bit[m]; } else { CV[c] |= bit[m]; } m++; break; } case '[' : { - tchar c, clast; + tchar c, clast = 0; bool invert = false; #ifdef _WINDOWS if (pat.at(p+1).unicode() == '^') #else if (pat[p+1].unicode() == '^') #endif { p++; invert = true; } #ifdef _WINDOWS while ((c = pat.at(++p).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 @@ -116,25 +116,25 @@ static ColorMapEntry Palm2BitColormap[] = { static ColorMapEntry Palm4BitColormap[] = { { 255, 255, 255 }, { 238, 238, 238 }, { 221, 221, 221 }, { 204, 204, 204 }, { 187, 187, 187 }, { 170, 170, 170 }, { 153, 153, 153 }, { 136, 136, 136 }, { 119, 119, 119 }, { 102, 102, 102 }, { 85, 85, 85 }, { 68, 68, 68 }, { 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }}; QImage* Palm2QImage (unsigned char *image_bytes_in, int byte_count_in) { 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; palmimage = image_bytes_in; width = READ_BIGENDIAN_SHORT(palmimage + 0); height = READ_BIGENDIAN_SHORT(palmimage + 2); bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4); flags = READ_BIGENDIAN_SHORT(palmimage + 6); bits_per_pixel = palmimage[8]; version = palmimage[9]; next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10); transparent_index = palmimage[12]; @@ -204,25 +204,25 @@ QImage* Palm2QImage } #ifndef USEQPE QImage* qimage = new QImage(width, height, 32); #else QImage* qimage = new QImage(width, height, 16); #endif /* row by row, uncompress the Palm image and copy it to the JPEG buffer */ 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 */ if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { for (j = 0; j < bytes_per_row; ) { incount = *palm_ptr++; inval = *palm_ptr++; memset(rowbuf + j, inval, incount); j += incount; } } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { for (j = 0; j < bytes_per_row; j += 8) { 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 @@ -535,25 +535,25 @@ void QTReader::setTwoTouch(bool _b) { setBackgroundColor( m_bg ); m_twotouch = m_touchone = _b; } void QTReader::setContinuous(bool _b) { buffdoc.setContinuous(m_continuousDocument = _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) { if (m_touchone) { m_touchone = false; m_startpos = startpos; m_startoffset = startoffset; setBackgroundColor( lightGray ); } else 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 @@ -696,25 +696,25 @@ void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsig { unsigned long t = *it; // qDebug("[%u]", t); memcpy(newdata, &t, sizeof(t)); newdata += sizeof(t); } m_nav.setSaveData(data, len, pdata, newlen); delete [] pdata; } 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)); src += sizeof(sz); srclen -= sizeof(sz); } for (int i = 0; i < sz; i++) { unsigned long t; if (srclen >= sizeof(t)) { memcpy(&t, src, sizeof(t)); 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 @@ -464,25 +464,25 @@ linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& } QString href = *hrefit; #if defined(USEQPE) || defined(_WINDOWS) QMap<QString, unsigned long>::Iterator fpit = href2filepos->find(href); #else QMap<QString, unsigned long>::iterator fpit = href2filepos->find(href); #endif if (fpit == href2filepos->end()) { 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()) { if ((ret & eFile) != 0) { locate(m.posn()); return eLink; } } return eNone; } 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 @@ -1307,62 +1307,64 @@ int HlManager::wildcardFind(const QString &fileName) { QRegExp regExp(w.mid(p1,p2 - p1),true,true); if (regExp.match(fileName) == 0) return hlList.at(); } p1 = p2 + 1; } } return -1; } int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { ItemStyleList defaultStyleList; - ItemStyle *defaultStyle; + ItemStyle *defaultStyle = 0; ItemDataList itemDataList; ItemData *itemData; int nAttribs, z; odebug << "HlManager::makeAttribs" << oendl; defaultStyleList.setAutoDelete(true); getDefaults(defaultStyleList); // itemDataList.setAutoDelete(true); 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 defaultStyle = defaultStyleList.at(itemData->defStyleNum); a[z].col = defaultStyle->col; a[z].selCol = defaultStyle->selCol; a[z].bold = defaultStyle->bold; a[z].italic = defaultStyle->italic; } else { // custom style a[z].col = itemData->col; a[z].selCol = itemData->selCol; a[z].bold = itemData->bold; a[z].italic = itemData->italic; } } for (; z < maxAttribs; z++) { a[z].col = black; a[z].selCol = black; + if (defaultStyle) { a[z].bold = defaultStyle->bold; a[z].italic = defaultStyle->italic; } + } return nAttribs; } int HlManager::defaultStyles() { return 10; } QString HlManager::defaultStyleName(int n) { static QStringList names; if (names.isEmpty()) 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 @@ -772,25 +772,25 @@ static int FtpOpenPort(netbuf *nControl, netbuf **nData, int mode, int dir) * FtpAcceptConnection - accept connection from server * * return 1 if successful, 0 otherwise */ static int FtpAcceptConnection(netbuf *nData, netbuf *nControl) { int sData; struct sockaddr addr; unsigned int l; int i; struct timeval tv; fd_set mask; - int rv; + int rv = 1; FD_ZERO(&mask); FD_SET(nControl->handle, &mask); FD_SET(nData->handle, &mask); tv.tv_usec = 0; tv.tv_sec = ACCEPT_TIMEOUT; printf("<<<<<<<<<<<<<<<<%d\n",ACCEPT_TIMEOUT); i = nControl->handle; if (i < nData->handle) i = nData->handle; i = select(i+1, &mask, NULL, NULL, &tv); if (i == -1) 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 @@ -563,25 +563,25 @@ REG Rec_Pointer Ptr_Val_Par; structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp); } /* Proc_1 */ Proc_2 (Int_Par_Ref) /******************/ /* executed once */ /* *Int_Par_Ref == 1, becomes 4 */ 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 */ if (Ch_1_Glob == 'A') /* then, executed */ { Int_Loc -= 1; *Int_Par_Ref = Int_Loc - Int_Glob; Enum_Loc = Ident_1; } /* if */ while (Enum_Loc != Ident_1); /* true */ } /* Proc_2 */ |