summaryrefslogtreecommitdiff
path: root/noncore/apps
authorerik <erik>2007-01-19 01:18:01 (UTC)
committer erik <erik>2007-01-19 01:18:01 (UTC)
commit32343107b30904806d02672955c57ed53d39fe79 (patch) (side-by-side diff)
tree9114a0ea170e3adc807a2445b49360f1bfde9626 /noncore/apps
parentac0ce844e90a64247c0adb210e0a23021b011d57 (diff)
downloadopie-32343107b30904806d02672955c57ed53d39fe79.zip
opie-32343107b30904806d02672955c57ed53d39fe79.tar.gz
opie-32343107b30904806d02672955c57ed53d39fe79.tar.bz2
Every file in this commit has a change to check the return value of a call.
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/output.cpp5
-rw-r--r--noncore/apps/tinykate/libkate/document/katebuffer.cpp5
2 files changed, 7 insertions, 3 deletions
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 8c585f4..8f654d5 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -183,26 +183,27 @@ void Output::saveOutput() {
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = QPEApplication::documentDir();
if(filename.right(1).find('/') == -1)
filename+="/";
QString name = fileDlg->LineEdit1->text();
filename+="text/plain/"+name;
odebug << filename << oendl;
QFile f(filename);
- f.open( IO_WriteOnly);
- if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
+ if ( !f.open( IO_WriteOnly ) )
+ owarn << "Could no open file" << oendl;
+ else if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
DocLnk lnk;
lnk.setName(name); //sets file name
lnk.setFile(filename); //sets File property
lnk.setType("text/plain");
if(!lnk.writeLink()) {
odebug << "Writing doclink did not work" << oendl;
}
} else
owarn << "Could not write file" << oendl;
f.close();
}
}
diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.cpp b/noncore/apps/tinykate/libkate/document/katebuffer.cpp
index 4c15fd0..d89edbd 100644
--- a/noncore/apps/tinykate/libkate/document/katebuffer.cpp
+++ b/noncore/apps/tinykate/libkate/document/katebuffer.cpp
@@ -63,25 +63,28 @@ KWBuffer::clear()
/**
* Insert a file at line @p line in the buffer.
*/
void
KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec)
{
if (line) {
odebug << "insert File only supports insertion at line 0 == file opening" << oendl;
return;
}
clear();
QFile iofile(file);
- iofile.open(IO_ReadOnly);
+ if (!iofile.open(IO_ReadOnly)) {
+ owarn << "failed to open file " << iofile.name() << oendl;
+ return;
+ }
QTextStream stream(&iofile);
stream.setCodec(codec);
QString qsl;
int count=0;
for (count=0;((qsl=stream.readLine())!=QString::null); count++)
{
if (count==0)
{
(*m_stringListIt)->append(qsl.unicode(),qsl.length());
}
else
{