summaryrefslogtreecommitdiff
path: root/noncore
authorerik <erik>2007-01-22 22:56:12 (UTC)
committer erik <erik>2007-01-22 22:56:12 (UTC)
commit9b4871054d01a47b4c546952a0948553413840d6 (patch) (side-by-side diff)
tree4e0248489c2790cf4225a116cfb903b637d4cdf0 /noncore
parentf60301bab1f8aa3693089036a3791a01ae6f9db8 (diff)
downloadopie-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.
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/filereceive.cpp4
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp4
-rw-r--r--noncore/apps/opie-console/logger.cpp4
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp3
-rw-r--r--noncore/apps/opie-console/script.cpp6
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp6
-rw-r--r--noncore/apps/opie-gutenbrowser/helpwindow.cpp34
-rw-r--r--noncore/graphics/opie-eye/slave/bmp_slave.cpp4
-rw-r--r--noncore/net/ftplib/ftplib.c8
-rw-r--r--noncore/todayplugins/stockticker/stockticker/helpwindow.cpp12
-rw-r--r--noncore/todayplugins/weather/weatherpluginwidget.cpp3
-rw-r--r--noncore/tools/opie-sh/inputdialog.cpp8
12 files changed, 54 insertions, 42 deletions
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
@@ -1,11 +1,12 @@
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
+#include <opie2/odebug.h>
#include <qsocketnotifier.h>
#include "io_layer.h"
#include "procctl.h"
#include "filereceive.h"
@@ -145,13 +146,14 @@ void FileReceive::slotRead() {
}
ar.resize( len );
QString str( ar );
}
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;
delete m_not;
m_not = m_proc = 0l;
close( m_term[0] );
close( m_term[1] );
close( m_comm[0] );
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
@@ -1,12 +1,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
+#include <opie2/odebug.h>
#include <qsocketnotifier.h>
#include "procctl.h"
#include "filetransfer.h"
@@ -231,13 +232,14 @@ void FileTransfer::slotProgress( const QStringList& list ) {
void FileTransfer::cancel() {
if(m_pid > 0) ::kill(m_pid,9 );
}
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;
delete m_not;
m_proc = m_not = 0l;
close( m_term[0] );
close( m_term[1] );
close( m_comm[0] );
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
@@ -1,17 +1,19 @@
#include <qfile.h>
#include <qtextstream.h>
+#include <opie2/odebug.h>
#include "logger.h"
Logger::Logger() {}
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;
}
Logger::~Logger() {
m_file.close();
}
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
@@ -821,13 +821,14 @@ void MainWindow::slotSaveHistory() {
nf.setType("text/plain");
nf.setFile(filename);
nf.setName(info.fileName());
QFile file(filename);
- file.open(IO_WriteOnly );
+ if ( !file.open(IO_WriteOnly ) ) return;
+
QTextStream str(&file );
if ( currentSession() )
currentSession()->emulationHandler()->emulation()->streamHistory(&str);
file.close();
nf.writeLink();
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
@@ -3,19 +3,21 @@
Script::Script() {
}
Script::Script(const QString fileName) {
QFile file(fileName);
- file.open(IO_ReadOnly );
+ if ( !file.open(IO_ReadOnly ) )
+ return;
m_script = file.readAll();
}
void Script::saveTo(const QString fileName) const {
QFile file(fileName);
- file.open(IO_WriteOnly);
+ if ( !file.open(IO_WriteOnly) )
+ return;
file.writeBlock(m_script);
file.close();
}
void Script::append(const QByteArray &data) {
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
@@ -842,28 +842,22 @@ bool Gutenbrowser::load( const char *fileName) {
// QCopEnvelope("QPE/System", "notBusy()" );
return true;
} // end load
void Gutenbrowser::Search() {
-
- // if( searchDlg->isHidden())
- {
odebug << "Starting search dialog" << oendl;
searchDlg = new SearchDialog( this, "Etext Search", true);
searchDlg->setCaption( tr( "Etext Search" ));
- // searchDlg->setLabel( "- searches etext");
connect( searchDlg,SIGNAL( search_signal()),this,SLOT( search_slot()));
connect( searchDlg,SIGNAL( search_done_signal()),this,SLOT( searchdone_slot()));
QString resultString;
QString string = searchDlg->searchString;
Lview->deselect();
searchDlg->show();
- searchDlg->result();
- }
}
void Gutenbrowser::search_slot( ) {
int line, col;
if (!searchDlg /*&& !loadCheck */)
return;
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
@@ -193,39 +193,32 @@ HelpWindow::~HelpWindow()
history.clear();
QMap<int, QString>::Iterator it = mHistory.begin();
for ( ; it != mHistory.end(); ++it )
history.append( *it );
QFile f( QDir::currentDirPath() + "/.history" );
- f.open( IO_WriteOnly );
+ if ( f.open( IO_WriteOnly ) ) {
QDataStream s( &f );
s << history;
f.close();
+ }
bookmarks.clear();
QMap<int, QString>::Iterator it2 = mBookmarks.begin();
for ( ; it2 != mBookmarks.end(); ++it2 )
bookmarks.append( *it2 );
QFile f2( QDir::currentDirPath() + "/.bookmarks" );
- f2.open( IO_WriteOnly );
+ if ( !f2.open( IO_WriteOnly ) )
+ return;
+
QDataStream s2( &f2 );
s2 << bookmarks;
f2.close();
}
-// void HelpWindow::about()
-// {
-// QMessageBox::about( this, "Gutenbrowser", "<p>Thanks to Trolltech for this</p>" );
-// }
-
-// void HelpWindow::aboutQt()
-// {
-// QMessageBox::aboutQt( this, "QBrowser" );
-// }
-
void HelpWindow::openFile()
{
#ifndef QT_NO_FILEDIALOG
QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, this );
if ( !fn.isEmpty() )
browser->setSource( fn );
@@ -289,33 +282,38 @@ void HelpWindow::pathSelected( const QString &_path )
if ( !exists )
mHistory[ hist->insertItem( _path ) ] = _path;
}
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 );
s >> history;
f.close();
while ( history.count() > 20 )
history.remove( history.begin() );
}
-}
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 );
s >> bookmarks;
f.close();
}
-}
void HelpWindow::histChosen( int i )
{
if ( mHistory.contains( i ) )
browser->setSource( mHistory[ i ] );
}
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
@@ -79,16 +79,14 @@ namespace {
{
read_data();
}
void BmpHeader::read_data() {
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);
s.setByteOrder( QDataStream::LittleEndian );
s.readRawBytes(m_Header.type,2);
if (!isBmp()) {
_inputfile.close();
return;
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
@@ -955,13 +955,14 @@ GLOBALDEF int FtpWrite(void *buf, int len, netbuf *nData)
if (nData->dir != FTPLIB_WRITE)
return 0;
if (nData->buf)
i = writeline(buf, len, nData);
else
{
- 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);
}
if (i == -1)
return 0;
nData->xfered += i;
if (nData->idlecb && nData->cbbytes)
@@ -1336,11 +1337,14 @@ GLOBALDEF int FtpDelete(const char *fnm, netbuf *nControl)
* return 1 if successful, 0 otherwise
*/
GLOBALDEF void FtpQuit(netbuf *nControl)
{
if (nControl->dir != FTPLIB_CONTROL)
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);
free(nControl->buf);
free(nControl);
}
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
@@ -179,24 +179,26 @@ HelpWindow::~HelpWindow()
history.clear();
QMap<int, QString>::Iterator it = mHistory.begin();
for ( ; it != mHistory.end(); ++it )
history.append( *it );
QFile f( QDir::currentDirPath() + "/.history" );
- f.open( IO_WriteOnly );
+ if ( f.open( IO_WriteOnly ) ) {
QDataStream s( &f );
s << history;
f.close();
+ }
bookmarks.clear();
QMap<int, QString>::Iterator it2 = mBookmarks.begin();
for ( ; it2 != mBookmarks.end(); ++it2 )
bookmarks.append( *it2 );
QFile f2( QDir::currentDirPath() + "/.bookmarks" );
- f2.open( IO_WriteOnly );
+ if ( !f2.open( IO_WriteOnly ) )
+ return;
QDataStream s2( &f2 );
s2 << bookmarks;
f2.close();
}
void HelpWindow::openFile()
@@ -229,26 +231,28 @@ void HelpWindow::pathSelected( const QString &_path )
}
void HelpWindow::readHistory()
{
if ( QFile::exists( QDir::currentDirPath() + "/.history" ) ) {
QFile f( QDir::currentDirPath() + "/.history" );
- f.open( IO_ReadOnly );
+ if ( !f.open( IO_ReadOnly ) )
+ return;
QDataStream s( &f );
s >> history;
f.close();
while ( history.count() > 20 )
history.remove( history.begin() );
}
}
void HelpWindow::readBookmarks()
{
if ( QFile::exists( QDir::currentDirPath() + "/.bookmarks" ) ) {
QFile f( QDir::currentDirPath() + "/.bookmarks" );
- f.open( IO_ReadOnly );
+ if ( !f.open( IO_ReadOnly ) )
+ return;
QDataStream s( &f );
s >> bookmarks;
f.close();
}
}
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
@@ -101,13 +101,14 @@ void WeatherPluginWidget::retreiveData()
}
OProcess *proc = new OProcess;
*proc << "wget" << "-q" << remoteFile << "-O" << localFile;
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." ) );
}
void WeatherPluginWidget::displayWeather()
{
weatherData = QString::null;
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
@@ -37,18 +37,20 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString
case 1:
comboBox = new QComboBox(edit, this, "combo box");
layout->addWidget(comboBox);
if(!filename.isNull())
{
QFile file(filename);
- file.open(IO_ReadOnly);
+ if (file.open(IO_ReadOnly))
+ {
QTextStream stream(&file);
QString string = stream.read();
comboBox->insertStringList(QStringList::split('\n', string));
}
+ }
else
{
QFile file;
file.open(IO_ReadOnly, 0);
QTextStream stream(&file);
QString string = stream.read();
@@ -60,18 +62,20 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString
listBox = new QListBox(this, "list box");
listBox->setSelectionMode(QListBox::Multi);
layout->addWidget(listBox);
if(!filename.isNull())
{
QFile file(filename);
- file.open(IO_ReadOnly);
+ if (file.open(IO_ReadOnly))
+ {
QTextStream stream(&file);
QString string = stream.read();
listBox->insertStringList(QStringList::split('\n', string));
}
+ }
else
{
QFile file;
file.open(IO_ReadOnly, 0);
QTextStream stream(&file);
QString string = stream.read();