author | erik <erik> | 2007-01-22 22:56:12 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-22 22:56:12 (UTC) |
commit | 9b4871054d01a47b4c546952a0948553413840d6 (patch) (side-by-side diff) | |
tree | 4e0248489c2790cf4225a116cfb903b637d4cdf0 | |
parent | f60301bab1f8aa3693089036a3791a01ae6f9db8 (diff) | |
download | opie-9b4871054d01a47b4c546952a0948553413840d6.zip opie-9b4871054d01a47b4c546952a0948553413840d6.tar.gz opie-9b4871054d01a47b4c546952a0948553413840d6.tar.bz2 |
Every file in this commit makes a call to a function which returns a value.
Each file also didn't check the return value.
This commit changes it so that every single non-checked call in these files
is checked.
-rw-r--r-- | core/multimedia/opieplayer/om3u.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiemm/opieexif.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/filereceive.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/filetransfer.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/logger.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/script.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/helpwindow.cpp | 34 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/slave/bmp_slave.cpp | 4 | ||||
-rw-r--r-- | noncore/net/ftplib/ftplib.c | 8 | ||||
-rw-r--r-- | noncore/todayplugins/stockticker/stockticker/helpwindow.cpp | 12 | ||||
-rw-r--r-- | noncore/todayplugins/weather/weatherpluginwidget.cpp | 3 | ||||
-rw-r--r-- | noncore/tools/opie-sh/inputdialog.cpp | 8 |
14 files changed, 62 insertions, 45 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp index 48aa47e..68ea015 100644 --- a/core/multimedia/opieplayer/om3u.cpp +++ b/core/multimedia/opieplayer/om3u.cpp @@ -49,3 +49,4 @@ Om3u::Om3u( const QString &filePath, int mode) f.setName(filePath); - f.open(mode); + if ( !f.open(mode) ) + owarn << "Failed to open file " << f.name() << oendl; } diff --git a/libopie2/opiemm/opieexif.cpp b/libopie2/opiemm/opieexif.cpp index de49937..653216c 100644 --- a/libopie2/opiemm/opieexif.cpp +++ b/libopie2/opiemm/opieexif.cpp @@ -207,3 +207,3 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode) - size = QMAX( 0ul, infile.size()-infile.at() ); + size = infile.size()-infile.at(); Data = (uchar *)malloc(size); @@ -811,3 +811,7 @@ bool ExifData::scan(const QString & path) QFile f(path); - f.open(IO_ReadOnly); + if ( !f.open(IO_ReadOnly) ) { + owarn << "Unable to open file " << f.name() << " readonly" << oendl; + DiscardData(); + return false; + } diff --git a/noncore/apps/opie-console/filereceive.cpp b/noncore/apps/opie-console/filereceive.cpp index 452be60..41e6888 100644 --- a/noncore/apps/opie-console/filereceive.cpp +++ b/noncore/apps/opie-console/filereceive.cpp @@ -5,2 +5,3 @@ +#include <opie2/odebug.h> #include <qsocketnotifier.h> @@ -150,3 +151,4 @@ void FileReceive::slotExec() { char buf[2]; - ::read(m_term[0], buf, 1 ); + if (::read(m_term[0], buf, 1 ) == -1) + owarn << "read of m_term[0] failed" << oendl; delete m_proc; diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp index 7eebc65..6e2d2d5 100644 --- a/noncore/apps/opie-console/filetransfer.cpp +++ b/noncore/apps/opie-console/filetransfer.cpp @@ -6,2 +6,3 @@ +#include <opie2/odebug.h> #include <qsocketnotifier.h> @@ -236,3 +237,4 @@ void FileTransfer::slotExec() { char buf[2]; - ::read(m_term[0], buf, 1 ); + if (::read(m_term[0], buf, 1 ) == -1) + owarn << "read of m_term[0] failed" << oendl; delete m_proc; diff --git a/noncore/apps/opie-console/logger.cpp b/noncore/apps/opie-console/logger.cpp index 6620faf..0fdeca0 100644 --- a/noncore/apps/opie-console/logger.cpp +++ b/noncore/apps/opie-console/logger.cpp @@ -2,2 +2,3 @@ #include <qtextstream.h> +#include <opie2/odebug.h> @@ -10,3 +11,4 @@ Logger::Logger(const QString fileName) { m_file.setName(fileName); - m_file.open(IO_ReadWrite); + if ( !m_file.open(IO_ReadWrite) ) + owarn << "failed to open " << m_file.name() << oendl; } diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 18c0434..aba7244 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -826,3 +826,4 @@ void MainWindow::slotSaveHistory() { QFile file(filename); - file.open(IO_WriteOnly ); + if ( !file.open(IO_WriteOnly ) ) return; + QTextStream str(&file ); diff --git a/noncore/apps/opie-console/script.cpp b/noncore/apps/opie-console/script.cpp index faea412..8d35776 100644 --- a/noncore/apps/opie-console/script.cpp +++ b/noncore/apps/opie-console/script.cpp @@ -8,3 +8,4 @@ Script::Script(const QString fileName) { QFile file(fileName); - file.open(IO_ReadOnly ); + if ( !file.open(IO_ReadOnly ) ) + return; m_script = file.readAll(); @@ -14,3 +15,4 @@ void Script::saveTo(const QString fileName) const { QFile file(fileName); - file.open(IO_WriteOnly); + if ( !file.open(IO_WriteOnly) ) + return; file.writeBlock(m_script); diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index 733db17..8b02f9f 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp @@ -847,5 +847,2 @@ bool Gutenbrowser::load( const char *fileName) { void Gutenbrowser::Search() { - - // if( searchDlg->isHidden()) - { odebug << "Starting search dialog" << oendl; @@ -853,3 +850,2 @@ void Gutenbrowser::Search() { searchDlg->setCaption( tr( "Etext Search" )); - // searchDlg->setLabel( "- searches etext"); connect( searchDlg,SIGNAL( search_signal()),this,SLOT( search_slot())); @@ -861,4 +857,2 @@ void Gutenbrowser::Search() { searchDlg->show(); - searchDlg->result(); - } } diff --git a/noncore/apps/opie-gutenbrowser/helpwindow.cpp b/noncore/apps/opie-gutenbrowser/helpwindow.cpp index 4bdac02..f444a2e 100644 --- a/noncore/apps/opie-gutenbrowser/helpwindow.cpp +++ b/noncore/apps/opie-gutenbrowser/helpwindow.cpp @@ -198,3 +198,3 @@ HelpWindow::~HelpWindow() QFile f( QDir::currentDirPath() + "/.history" ); - f.open( IO_WriteOnly ); + if ( f.open( IO_WriteOnly ) ) { QDataStream s( &f ); @@ -202,2 +202,3 @@ HelpWindow::~HelpWindow() f.close(); + } @@ -209,3 +210,5 @@ HelpWindow::~HelpWindow() QFile f2( QDir::currentDirPath() + "/.bookmarks" ); - f2.open( IO_WriteOnly ); + if ( !f2.open( IO_WriteOnly ) ) + return; + QDataStream s2( &f2 ); @@ -215,12 +218,2 @@ HelpWindow::~HelpWindow() -// void HelpWindow::about() -// { -// QMessageBox::about( this, "Gutenbrowser", "<p>Thanks to Trolltech for this</p>" ); -// } - -// void HelpWindow::aboutQt() -// { -// QMessageBox::aboutQt( this, "QBrowser" ); -// } - void HelpWindow::openFile() @@ -294,5 +287,9 @@ void HelpWindow::readHistory() { - if ( QFile::exists( QDir::currentDirPath() + "/.history" ) ) { + if ( !QFile::exists( QDir::currentDirPath() + "/.history" ) ) + return; + QFile f( QDir::currentDirPath() + "/.history" ); - f.open( IO_ReadOnly ); + if ( !f.open( IO_ReadOnly ) ) + return; + QDataStream s( &f ); @@ -303,3 +300,2 @@ void HelpWindow::readHistory() } -} @@ -307,5 +303,8 @@ void HelpWindow::readBookmarks() { - if ( QFile::exists( QDir::currentDirPath() + "/.bookmarks" ) ) { + if ( !QFile::exists( QDir::currentDirPath() + "/.bookmarks" ) ) + return; + QFile f( QDir::currentDirPath() + "/.bookmarks" ); - f.open( IO_ReadOnly ); + if ( !f.open( IO_ReadOnly ) ) + return; QDataStream s( &f ); @@ -314,3 +313,2 @@ void HelpWindow::readBookmarks() } -} diff --git a/noncore/graphics/opie-eye/slave/bmp_slave.cpp b/noncore/graphics/opie-eye/slave/bmp_slave.cpp index 2fa825f..0efadac 100644 --- a/noncore/graphics/opie-eye/slave/bmp_slave.cpp +++ b/noncore/graphics/opie-eye/slave/bmp_slave.cpp @@ -84,6 +84,4 @@ namespace { memset(&m_Header,0,sizeof(pBmpHeader)); - _inputfile.open(IO_Raw|IO_ReadOnly); - if (!_inputfile.isOpen()) { + if (!_inputfile.open(IO_Raw|IO_ReadOnly)) return; - } QDataStream s(&_inputfile); diff --git a/noncore/net/ftplib/ftplib.c b/noncore/net/ftplib/ftplib.c index 421f855..efcd6f0 100644 --- a/noncore/net/ftplib/ftplib.c +++ b/noncore/net/ftplib/ftplib.c @@ -960,3 +960,4 @@ GLOBALDEF int FtpWrite(void *buf, int len, netbuf *nData) { - socket_wait(nData); + if (socket_wait(nData) < 0) + fprintf(stderr, "FtpWrite: socket_wait failed with %s\n", nData->ctrl->response); i = net_write(nData->handle, buf, len); @@ -1341,3 +1342,6 @@ GLOBALDEF void FtpQuit(netbuf *nControl) return; - FtpSendCmd("QUIT",'2',nControl); + if (FtpSendCmd("QUIT",'2',nControl) == 1) { + if (ftplib_debug > 2) + fprintf(stderr, "FtpQuit: FtpSendCmd(QUIT) failed\n"); + } net_close(nControl->handle); diff --git a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp index 410d642..2498bf9 100644 --- a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp +++ b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp @@ -184,3 +184,3 @@ HelpWindow::~HelpWindow() QFile f( QDir::currentDirPath() + "/.history" ); - f.open( IO_WriteOnly ); + if ( f.open( IO_WriteOnly ) ) { QDataStream s( &f ); @@ -188,2 +188,3 @@ HelpWindow::~HelpWindow() f.close(); + } @@ -195,3 +196,4 @@ HelpWindow::~HelpWindow() QFile f2( QDir::currentDirPath() + "/.bookmarks" ); - f2.open( IO_WriteOnly ); + if ( !f2.open( IO_WriteOnly ) ) + return; QDataStream s2( &f2 ); @@ -234,3 +236,4 @@ void HelpWindow::readHistory() QFile f( QDir::currentDirPath() + "/.history" ); - f.open( IO_ReadOnly ); + if ( !f.open( IO_ReadOnly ) ) + return; QDataStream s( &f ); @@ -247,3 +250,4 @@ void HelpWindow::readBookmarks() QFile f( QDir::currentDirPath() + "/.bookmarks" ); - f.open( IO_ReadOnly ); + if ( !f.open( IO_ReadOnly ) ) + return; QDataStream s( &f ); diff --git a/noncore/todayplugins/weather/weatherpluginwidget.cpp b/noncore/todayplugins/weather/weatherpluginwidget.cpp index fe54051..27624c5 100644 --- a/noncore/todayplugins/weather/weatherpluginwidget.cpp +++ b/noncore/todayplugins/weather/weatherpluginwidget.cpp @@ -106,3 +106,4 @@ void WeatherPluginWidget::retreiveData() connect( proc, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( dataRetrieved(Opie::Core::OProcess*) ) ); - proc->start(); + if ( !proc->start() ) + weatherLabel->setText( tr( "Could not start wget process." ) ); } diff --git a/noncore/tools/opie-sh/inputdialog.cpp b/noncore/tools/opie-sh/inputdialog.cpp index 8046795..1dd8bf7 100644 --- a/noncore/tools/opie-sh/inputdialog.cpp +++ b/noncore/tools/opie-sh/inputdialog.cpp @@ -42,3 +42,4 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString QFile file(filename); - file.open(IO_ReadOnly); + if (file.open(IO_ReadOnly)) + { QTextStream stream(&file); @@ -48,2 +49,3 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString } + } else @@ -65,3 +67,4 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString QFile file(filename); - file.open(IO_ReadOnly); + if (file.open(IO_ReadOnly)) + { QTextStream stream(&file); @@ -71,2 +74,3 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString } + } else |