summaryrefslogtreecommitdiff
authorerik <erik>2007-01-31 22:06:07 (UTC)
committer erik <erik>2007-01-31 22:06:07 (UTC)
commit9395cf2a65184e493714c699bb23b02ea31feef5 (patch) (side-by-side diff)
treeea07c026298820559c13ad32e612d51048cee0a9
parent958e042c5a4d4e38fd1baae50b78a2febfd306ab (diff)
downloadopie-9395cf2a65184e493714c699bb23b02ea31feef5.zip
opie-9395cf2a65184e493714c699bb23b02ea31feef5.tar.gz
opie-9395cf2a65184e493714c699bb23b02ea31feef5.tar.bz2
I expanded my audit to include any app I could get to compile in i386.
In that expansion a whole new crop of unchecked returns has sprung up. This commit fixes those weeds or should I say potential bugs.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp88
-rw-r--r--noncore/apps/opie-gutenbrowser/openetext.cpp174
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp30
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp141
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.cpp17
-rw-r--r--noncore/net/opiestumbler/opiestumbler.cpp3
-rw-r--r--noncore/settings/networksettings/mainwindow/mainwindowimp.cpp11
-rw-r--r--noncore/settings/networksettings/ppp/modem.cpp6
8 files changed, 235 insertions, 235 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 6c246e97..7f21ab3 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -17,13 +17,13 @@
#include "output.h"
/* OPIE */
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
-//#include <opie2///odebug.h>
+#include <opie2/odebug.h>
/* QT */
#include <qpushbutton.h>
#include <qmultilineedit.h>
//#include <qlayout.h>
@@ -455,61 +455,64 @@ bool LibraryDialog::download_newEtext()
return true;
}
bool LibraryDialog::getEtext(const QStringList &networkList)
{
- NetworkDialog *NetworkDlg;
- NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", true, 0, networkList);
+ NetworkDialog *NetworkDlg;
+ NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", true, 0, networkList);
-// use new, improved, *INSTANT* network-dialog-file-getterer
- if( NetworkDlg->exec() != 0 ) {
- File_Name = NetworkDlg->localFileName;
+ // use new, improved, *INSTANT* network-dialog-file-getterer
+ if( NetworkDlg->exec() != 0 ) {
+ File_Name = NetworkDlg->localFileName;
- qDebug("Just downloaded " + NetworkDlg->localFileName);
+ qDebug("Just downloaded " + NetworkDlg->localFileName);
- if(NetworkDlg->successDownload) {
- //odebug << "Filename is "+File_Name << oendl;
- if(File_Name.right(4) == ".txt") {
- QString s_fileName = File_Name;
- s_fileName.replace( s_fileName.length() - 3, 3, "gtn");
- // s_fileName.replace( s_fileName.length()-3,3,"etx");
- rename( File_Name.latin1(), s_fileName.latin1());
- File_Name = s_fileName;
+ if(NetworkDlg->successDownload) {
+ //odebug << "Filename is "+File_Name << oendl;
+ if(File_Name.right(4) == ".txt") {
+ QString s_fileName = File_Name;
+ s_fileName.replace( s_fileName.length() - 3, 3, "gtn");
+ if (rename( File_Name.latin1(), s_fileName.latin1()) == 1) {
+ owarn << "Failed to rename " << File_Name.latin1() << " to "
+ << s_fileName.latin1() << oendl;
+ return false;
+ }
- //odebug << "Filename is now "+File_Name << oendl;
+ File_Name = s_fileName;
- }
- if(File_Name.length() > 5 ) {
- setTitle();
- QFileInfo fi(File_Name);
- QString name_file = fi.fileName();
- name_file = name_file.left( name_file.length() - 4);
-
- //odebug << "Setting doclink" << oendl;
- DocLnk lnk;
- //odebug << "name is "+name_file << oendl;
- lnk.setName(name_file); //sets file name
- //odebug << "Title is "+DlglistItemTitle << oendl;
- lnk.setComment(DlglistItemTitle);
+ //odebug << "Filename is now "+File_Name << oendl;
- //odebug << "Filename is "+File_Name << oendl;
- lnk.setFile(File_Name); //sets File property
- lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
- lnk.setExec(File_Name);
- lnk.setIcon("gutenbrowser/Gutenbrowser");
- if(!lnk.writeLink()) {
- //odebug << "Writing doclink did not work" << oendl;
- } else {
}
- } else
- QMessageBox::message("Note","<p>There was an error with the file</p>");
- }
- }
+ if(File_Name.length() > 5 ) {
+ setTitle();
+ QFileInfo fi(File_Name);
+ QString name_file = fi.fileName();
+ name_file = name_file.left( name_file.length() - 4);
+
+ //odebug << "Setting doclink" << oendl;
+ DocLnk lnk;
+ //odebug << "name is "+name_file << oendl;
+ lnk.setName(name_file); //sets file name
+ //odebug << "Title is "+DlglistItemTitle << oendl;
+ lnk.setComment(DlglistItemTitle);
+
+ //odebug << "Filename is "+File_Name << oendl;
+ lnk.setFile(File_Name); //sets File property
+ lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
+ lnk.setExec(File_Name);
+ lnk.setIcon("gutenbrowser/Gutenbrowser");
+ if(!lnk.writeLink()) {
+ //odebug << "Writing doclink did not work" << oendl;
+ }
+ } else
+ QMessageBox::message("Note","<p>There was an error with the file</p>");
+ }
+ }
- return true;
+ return true;
}
bool LibraryDialog::download_Etext()
{ // ftp method
// might have to use old gpl'd ftp for embedded!!
@@ -698,13 +701,12 @@ void LibraryDialog::onButtonSearch()
QString resultString;
int i_berger = 0;
if( searchDlg->exec() != 0 ) {
QString searcherStr = searchDlg->get_text();
- int fluff = 0;
bool cS;
if( searchDlg->caseSensitiveCheckBox->isChecked())
cS = true; //case sensitive
else
cS = false;
diff --git a/noncore/apps/opie-gutenbrowser/openetext.cpp b/noncore/apps/opie-gutenbrowser/openetext.cpp
index 0267416..a5d855d 100644
--- a/noncore/apps/opie-gutenbrowser/openetext.cpp
+++ b/noncore/apps/opie-gutenbrowser/openetext.cpp
@@ -54,24 +54,28 @@ OpenEtext::~OpenEtext()
void OpenEtext::getTitles()
{
QListBox_1->clear();
Config config("Gutenbrowser");
config.setGroup( "Files" );
s_numofFiles = config.readEntry("NumberOfFiles", "0");
- QLabel_1->setText( tr(
- s_numofFiles+" etexts in your library."));
+ QLabel_1->setText( tr( s_numofFiles+" etexts in your library." ) );
int i_numofFiles = s_numofFiles.toInt();
for (int i = 1; i <= i_numofFiles+1; i++) {
QString temp;
temp.setNum(i);
config.setGroup( "Files" );
QString ramble = config.readEntry(temp, "" );
config.setGroup( "Titles" );
title = config.readEntry(ramble, "");
if( !title.isEmpty()) {
- QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), title, -1);
+ QListBox_1->insertItem ( QPixmap(
+ QPEApplication::qpeDir() +
+ "pics/gutenbrowser/gutenbrowser_sm.png"
+ ),
+ title,
+ -1);
}
}
}
/*
opens selected title */
@@ -97,33 +101,26 @@ void OpenEtext::select_title(int index )
Config config("Gutenbrowser");
config.setGroup( "Files" );
file = config.readEntry(temp, "");
OpenEtext::accept();
}
-/*
- This function imports already existing etexts into the local library list*/
+/*!
+ * This function imports already existing etexts into the local library list
+ */
void OpenEtext::open()
{
OpenFileButton->setDown(TRUE);
title = "";
QString currDir="";
QString filer;
QString name_file;
QString local ;
local = (QDir::homeDirPath () +"Applications/gutenbrowser");
QDir library( local);
-// fileBrowser *browseForFiles;
-// browseForFiles=new fileBrowser(this,"Browse for File", TRUE, 0, "guten/plain;text/plain");
-// // browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*");
-// browseForFiles->setFileView( 0);
-// browseForFiles->showMaximized();
-// browseForFiles->exec();
-// QString selFile= browseForFiles->selectedFileName;
-// fileList=browseForFiles->fileList;
Config cfg("Gutenbrowser");
cfg. setGroup ( "View" );
QString dir = cfg.readEntry("LastOpenDirectory", QPEApplication::documentDir());
QMap<QString, QStringList> map;
map.insert(tr("All"), QStringList() );
QStringList text;
@@ -131,61 +128,49 @@ OpenFileButton->setDown(TRUE);
map.insert(tr("Text"), text );
text << "*";
map.insert(tr("All"), text );
QString str = OFileDialog::getOpenFileName( 2, dir , QString::null, map);
- if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) {
- filer = str;
-
- odebug << "Open file: "+str << oendl;
-
- // QStringList::ConstIterator f;
-// QString fileTemp;
-// for ( f = fileList.begin(); f != fileList.end(); f++ ) {
-// fileTemp = *f;
-// fileTemp.right( fileTemp.length()-5);
-// fileName = fileTemp;
-// if( !fileName.isEmpty() ){
-// filer = fileName;
-// } else { //filename is empty
-// // QString sMsg;
-// // sMsg = "Error opening library filelist "+fileName;
-// }
-
- if( filer.right(4) == ".txt"
- || filer.right(4) == ".TXT"
- || filer.right(4) == ".etx"
- || filer.right(4) == ".ETX"
- || filer.right(4) == ".etx"
- || filer.right(4) == ".ETX"
- || filer.right(4) == ".zip"
- || filer.right(4) == ".ZIP" ) {
+ if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) {
+ filer = str;
+
+ odebug << "Open file: "+str << oendl;
+
+ if( filer.right(4) == ".txt" ||
+ filer.right(4) == ".TXT" ||
+ filer.right(4) == ".etx" ||
+ filer.right(4) == ".ETX" ||
+ filer.right(4) == ".etx" ||
+ filer.right(4) == ".ETX" ||
+ filer.right(4) == ".zip" ||
+ filer.right(4) == ".ZIP" )
+ {
QFileInfo zipFile( filer);
QString s_fileName = zipFile.fileName();
QString cmd;
- if( s_fileName.right(4) == ".zip") { // unzip that sucker....
+ if( s_fileName.right(4) == ".zip") { // unzip the file
s_fileName = s_fileName.left( s_fileName.length() - 4);
if( chdir((const char*)local_library.latin1())!=0)
- odebug << "chdir failed." << oendl; // QString cmd = "gunzip -d " + filer + " -d " + local_library;
+ odebug << "chdir failed." << oendl;
cmd = "gunzip -S .zip " + filer;
fileName = local_library + s_fileName + ".txt";
system( cmd);
- }
-// this renames the .txt to .etx!!
- else /*if( s_fileName.right(4) == ".txt" || if( s_fileName.right(4) == ".TXT"))*/ {
-// odebug << "Filename is "+fileName << oendl;
+ } else { // else rename .txt to .etx
+ // odebug << "Filename is "+fileName << oendl;
s_fileName = fileName;
- s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx");
- rename(fileName.latin1(),s_fileName.latin1());
+ s_fileName.replace( s_fileName.length()-3,3,"gtn");
+ if (rename(fileName.latin1(),s_fileName.latin1()) == -1)
+ owarn << "Rename of " << fileName.latin1() << " to "
+ << s_fileName.latin1() << " failed" << oendl;
fileName = s_fileName;
-// odebug << "Filename is now "+fileName << oendl;
+ // odebug << "Filename is now "+fileName << oendl;
}
} else
- fileName = str;
+ fileName = str;
FindTitle(fileName);
QFileInfo fi( fileName);
name_file = fi.fileName();
name_file = name_file.left(name_file.length() - 4);
@@ -198,20 +183,23 @@ OpenFileButton->setDown(TRUE);
lnk.setComment(title);
QListBox_1->clear();
getTitles();
odebug << "Filename is "+fileName << oendl;
lnk.setFile(fileName); //sets File property
- lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
+ // @bug This is probably not a registered MIME type. Perhaps we should
+ // set a valid MIME type here instead. Or maybe register .etx as a
+ // Gutenberge etext?
+ lnk.setType("guten/plain");
lnk.setExec(fileName);
lnk.setIcon("gutenbrowser/Gutenbrowser");
if(!lnk.writeLink())
odebug << "Writing doclink did not work" << oendl;
} // end of for each file name....
- OpenFileButton->setDown(FALSE);
+ OpenFileButton->setDown(FALSE);
}
/*
find the title in the config file */
bool OpenEtext::FindTitle( QString filename)
{
@@ -221,40 +209,39 @@ bool OpenEtext::FindTitle( QString filename)
int i_numofFiles = s_numofFiles.toInt();
QFileInfo fi(filename);
name = fi.fileName();
odebug << "filename to open is " + name << oendl;
QFile indexLib( filename);
- bool findCheck = FALSE;
- // int Titlenumber=0;
+ bool findCheck = FALSE;
if ( indexLib.open( IO_ReadOnly) ) {
- odebug << "file opened successfully" << oendl;
+ odebug << "file opened successfully" << oendl;
QTextStream indexStream( &indexLib );
QString target = "Project Gutenberg Etext of";
QString target2 = "Project Gutenberg Etext";
QString target3 = "Project Gutenberg's Etext of";
QString target4 = "Project Gutenberg's Etext";
QString indexLine;
while ( !indexStream.eof() ) {
- // until end of file..
+ // until end of file..
indexLine = indexStream.readLine();
if( indexLine.find(target, 0, TRUE) > -1 && !findCheck) {findCheck = TRUE;
title = indexLine.mid( indexLine.find(target, 0, TRUE) + (target.length()) , indexLine.find("\r", 0, TRUE));
title = title.left( title.find( "*",0, TRUE));
title = title.stripWhiteSpace ();
// odebug << "Found the title 1 and it is " << title << "" << oendl;
-// QListBox_1->insertItem ( title);
+// QListBox_1->insertItem ( title);
}
if( indexLine.find( target2, 0, TRUE) > -1 && !findCheck) {
findCheck = TRUE;
title = indexLine.mid( indexLine.find( target2, 0, TRUE ) + ( target2.length()) , indexLine.find("\r", 0, TRUE) );
title = title.left( title.find( "*",0, TRUE));
title = title.stripWhiteSpace ();
-// odebug << "Found the title 2 and it is " << title << "" << oendl;
-// QListBox_1->insertItem ( title);
+// odebug << "Found the title 2 and it is " << title << "" << oendl;
+// QListBox_1->insertItem ( title);
}
if( indexLine.find( target3, 0, TRUE) > -1 && !findCheck) {
findCheck = TRUE;
title = indexLine.mid( indexLine.find( target3, 0, TRUE) + ( target3.length()) , indexLine.find("\r", 0, TRUE));
title = title.left( title.find( "*",0, TRUE));
title = title.stripWhiteSpace ();
@@ -274,13 +261,12 @@ bool OpenEtext::FindTitle( QString filename)
odebug << "Trying hard to find title from GUTINDEX.ALL" << oendl;
title = titleFromLibrary( filename);
findCheck = TRUE;
}
if ( checkConf() == false && findCheck == TRUE) {
-
config.setGroup( "Files");
config.writeEntry("NumberOfFiles",i_numofFiles + 1 );
QString interger;
interger.setNum( i_numofFiles +1);
config.writeEntry(interger, filename);
config.setGroup( "Titles" );
@@ -312,16 +298,16 @@ bool OpenEtext::FindTitle( QString filename)
QString OpenEtext::titleFromLibrary( QString fileName)
{
QFile indexLib( local_index);
QString target;
int find1 = fileName.findRev("/",-1,TRUE) + 1;
int find2 = fileName.findRev(".gtn",-1,TRUE) - find1;
- if(find2==-1-find1)
- int find2 = fileName.findRev(".etx",-1,TRUE) - find1;
- else if(find2==-1-find1)
- int find2 = fileName.findRev(".txt",-1,TRUE) - find1;
+ if(find2== (-1-find1))
+ find2 = fileName.findRev(".etx",-1,TRUE) - find1;
+ else if(find2==(-1-find1))
+ find2 = fileName.findRev(".txt",-1,TRUE) - find1;
target = fileName.mid( find1, find2 );
QString checker = target.right(1);
bool ok;
checker.toInt( &ok,10);
if( ok) {
@@ -331,31 +317,30 @@ QString OpenEtext::titleFromLibrary( QString fileName)
checker.toInt( &ok,10);
if( ok) {
target = target.left( target.length()-1);
}
}
if ( indexLib.open( IO_ReadOnly) ) {
- // file opened successfully
+ // file opened successfully
QTextStream indexStream( &indexLib );
QString indexLine;
bool findCheck = FALSE;
- while ( !indexStream.atEnd() ) { // until end of file..
+ while ( !indexStream.atEnd() ) { // until end of file..
indexLine = indexStream.readLine();
if( indexLine.find( target,0,FALSE) > 0 ) {
findCheck = TRUE;
title = indexLine.mid( 9, 50);
-// title = indexLine.mid( 26, indexLine.length() );
title = title.stripWhiteSpace ();
// odebug << "Finally Found the title and it is\n " << title << "" << oendl;
-// QListBox_1->insertItem ( title);
+// QListBox_1->insertItem ( title);
}
} //end while loop
}
else
- odebug << "Error opening library index "+ local_index << oendl;
+ odebug << "Error opening library index "+ local_index << oendl;
return title;
}
bool OpenEtext::checkConf()
{
QString file = fileName;
@@ -378,28 +363,31 @@ bool OpenEtext::checkConf()
}
void OpenEtext::remove()
{
title_text = QListBox_1->text( QListBox_1->currentItem() );
title_text=title_text.stripWhiteSpace();
- QString msg ="<p>Do you really want to REMOVE\n" +title_text +"?\nThis will not delete the file.</P>";
- switch( QMessageBox::information( this, (tr("Remove Etext")),
- (tr(msg)),
- (tr("&Yes")), (tr("&Cancel")), 0 )){
+ QString msg ="<p>Do you really want to REMOVE\n" + title_text +
+ "?\nThis will not delete the file.</P>";
+ switch( QMessageBox::information( this, tr("Remove Etext"),
+ tr(msg),
+ tr("&Yes"), tr("&Cancel"), 0 ) )
+ {
case 0: // Yes clicked,
removeSelection();
QListBox_1->clear();
getTitles();
break;
- case 1: // Cancel
- break;
- };
+ case 1:
+ default:
+ }
}
-/*
- this removes selected title entry*/
+/*!
+ * This removes selected title entry
+ */
void OpenEtext::removeSelection()
{
Config config("Gutenbrowser");
config.setGroup( "Files" );
s_numofFiles = config.readEntry("NumberOfFiles", "0");
int rem=0;
@@ -414,13 +402,13 @@ void OpenEtext::removeSelection()
QString s_filename = config.readEntry(fileNum, "" );
config.setGroup( "Titles" );
QString file_title = config.readEntry( s_filename, "");
if(title_text == file_title) {
rem=i;
-//odebug << "file title to remove is "+file_title << oendl;
+ //odebug << "file title to remove is "+file_title << oendl;
selFile = s_filename;
config.removeEntry( s_filename); //removes file=title
}
}
config.setGroup( "Files" );
@@ -433,17 +421,17 @@ void OpenEtext::removeSelection()
if (!s_filename2.isEmpty()) {
config.writeEntry(fileNum, s_filename2 );
}
}
config.writeEntry("NumberOfFiles", i_numofFiles - 1 );
config.removeEntry(fileNum2);
-// remFile();
}
-/*
- removes file title name from list and config file*/
+/*!
+ * Removes file title name from list and config file
+ */
void OpenEtext::remFile()
{
Config config("Gutenbrowser");
config.setGroup( "Files" );
QString remFile;
s_numofFiles = config.readEntry("NumberOfFiles", "0");
@@ -458,37 +446,37 @@ void OpenEtext::remFile()
for(int fg = i_numofFiles - i; fg < i_numofFiles ; fg++ ) { //this rewrites Files number entry
QString fileNum2;
fileNum2.setNum( fg + 1);
QString s_filename2 = config.readEntry(fileNum2, "" );
- if (!s_filename2.isEmpty()) {
+ if (!s_filename2.isEmpty())
config.writeEntry(fileNum, s_filename2 );
- }
}
}
}
config.writeEntry("NumberOfFiles", i_numofFiles - 1 );
config.removeEntry(s_numofFiles);
QListBox_1->triggerUpdate(true);
}
-/*
-sorts the list*/
+/*!
+ * Sorts the list
+ */
void OpenEtext::scan() {
QListBox_1->sort(TRUE);
QListBox_1->triggerUpdate(true);
}
void OpenEtext::editTitle() {
int currentItem=QListBox_1->currentItem();
QString title_text = QListBox_1->text( currentItem);
-//odebug << "Selected "+title_text << oendl;
+ //odebug << "Selected "+title_text << oendl;
Config config("Gutenbrowser");
config.setGroup( "Files" );
s_numofFiles = config.readEntry("NumberOfFiles", "0");
int i_numofFiles = s_numofFiles.toInt();
QString fileNum;
@@ -496,26 +484,30 @@ void OpenEtext::editTitle() {
fileNum.setNum(i);
config.setGroup( "Files" );
QString s_filename = config.readEntry(fileNum, "" );
config.setGroup( "Titles" );
QString file_title = config.readEntry( s_filename, "");
-//odebug << "file_title is "+file_title << oendl;
+ //odebug << "file_title is "+file_title << oendl;
if(title_text == file_title ) {
selFile = s_filename;
-//odebug << "Edit: "+ file_title << oendl;
+ //odebug << "Edit: "+ file_title << oendl;
i=i_numofFiles+1;
Edit_Title *titleEdit;
titleEdit = new Edit_Title(this,file_title ,TRUE);
if(titleEdit->exec() !=0) {
-//odebug << titleEdit->newTitle << oendl;
+ //odebug << titleEdit->newTitle << oendl;
config.writeEntry( s_filename, titleEdit->newTitle);
QListBox_1->removeItem(currentItem);
- QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), titleEdit->newTitle, currentItem);
+ QListBox_1->insertItem (
+ QPixmap( QPEApplication::qpeDir()+
+ "pics/gutenbrowser/gutenbrowser_sm.png"),
+ titleEdit->newTitle, currentItem
+ );
}
}
}
-// getTitles();
+ //getTitles();
QListBox_1->triggerUpdate(true);
}
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 84d28ce..5f281b7 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -74,26 +74,28 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
// get the configuration
// not really OO, should be an extra class, later
if ( !QFile::exists(configPath) ) {
QFile f(configPath);
- f.open(IO_WriteOnly);
- QTextStream ts( &f );
- ts << "misc.memcpy_method:glibc\n";
- ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n";
- ts << "codec.ffmpeg_pp_quality:3\n";
- ts << "audio.num_buffers:50\n";
- ts << "audio.size_buffers:4096\n";
- ts << "video.num_buffers:20\n";
- ts << "video.size_buffers:4096\n";
- ts << "audio.out_num_audio_buf:16\n";
- ts << "audio.out_size_audio_buf:8096\n";
- ts << "audio.out_size_zero_buf:1024\n";
- ts << "audio.passthrough_offset:0\n";
- f.close();
+ if (f.open(IO_WriteOnly)) {
+ QTextStream ts( &f );
+ ts << "misc.memcpy_method:glibc\n";
+ ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n";
+ ts << "codec.ffmpeg_pp_quality:3\n";
+ ts << "audio.num_buffers:50\n";
+ ts << "audio.size_buffers:4096\n";
+ ts << "video.num_buffers:20\n";
+ ts << "video.size_buffers:4096\n";
+ ts << "audio.out_num_audio_buf:16\n";
+ ts << "audio.out_size_audio_buf:8096\n";
+ ts << "audio.out_size_zero_buf:1024\n";
+ ts << "audio.passthrough_offset:0\n";
+ f.close();
+ } else
+ owarn << "Failed to open " f.name() << oendl;
}
if ( initMode == InitializeImmediately ) {
initialize();
m_initialized = true;
}
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp
index 790fa09..f2a01d3 100644
--- a/noncore/multimedia/opieplayer2/om3u.cpp
+++ b/noncore/multimedia/opieplayer2/om3u.cpp
@@ -35,118 +35,111 @@
#include <opie2/odebug.h>
using namespace Opie::Core;
//extern PlayListWidget *playList;
Om3u::Om3u( const QString &filePath, int mode)
- : QStringList (){
-odebug << "<<<<<<<new m3u "+filePath << oendl;
- f.setName(filePath);
- f.open(mode);
+ : QStringList ()
+{
+ odebug << "<<<<<<<new m3u "+filePath << oendl;
+ f.setName(filePath);
+ if (!f.open(mode)) {
+ owarn << "Unable to open file " << f.name() << oendl;
+ }
}
Om3u::~Om3u(){}
void Om3u::readM3u() {
-// odebug << "<<<<<<reading m3u "+f.name() << oendl;
+// odebug << "<<<<<<reading m3u "+f.name() << oendl;
QTextStream t(&f);
- t.setEncoding(QTextStream::UnicodeUTF8);
- QString s;
+ t.setEncoding(QTextStream::UnicodeUTF8);
+ QString s;
while ( !t.atEnd() ) {
s=t.readLine();
-// odebug << s << oendl;
+ // odebug << s << oendl;
if( s.find( "#", 0, TRUE) == -1 ) {
- if( s.left(2) == "E:" || s.left(2) == "P:" ) {
- s = s.right( s.length() -2 );
- QFileInfo f( s );
- QString name = f.baseName();
- name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
- s=s.replace( QRegExp( "\\" ), "/" );
- append(s);
-// odebug << s << oendl;
- } else { // is url
- QString name;
- name = s;
- append(name);
- }
+ if( s.left(2) == "E:" || s.left(2) == "P:" ) {
+ s = s.right( s.length() -2 );
+ QFileInfo f( s );
+ QString name = f.baseName();
+ name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
+ s=s.replace( QRegExp( "\\" ), "/" );
+ append(s);
+// odebug << s << oendl;
+ } else { // is url
+ QString name;
+ name = s;
+ append(name);
+ }
}
}
}
void Om3u::readPls() { //it's a pls file
- QTextStream t( &f );
- t.setEncoding(QTextStream::UnicodeUTF8);
- QString s;
- while ( !t.atEnd() ) {
- s = t.readLine();
- if( s.left(4) == "File" ) {
- s = s.right( s.length() - s.find("=",0,true)-1 );
- s = s.stripWhiteSpace();
- s.replace( QRegExp( "%20" )," ");
-// odebug << "adding " + s + " to playlist" << oendl;
- // numberofentries=2
- // File1=http
- // Title
- // Length
- // Version
- // File2=http
- s = s.replace( QRegExp( "\\" ), "/" );
- QFileInfo f( s );
- QString name = f.baseName();
- if( name.left( 4 ) == "http" ) {
- name = s.right( s.length() - 7);
- } else {
- name = s;
- }
- name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
- if( s.at( s.length() - 4) == '.') // if this is probably a file
+ QTextStream t( &f );
+ t.setEncoding(QTextStream::UnicodeUTF8);
+ QString s;
+ while ( !t.atEnd() ) {
+ s = t.readLine();
+ if( s.left(4) == "File" ) {
+ s = s.right( s.length() - s.find("=",0,true)-1 );
+ s = s.stripWhiteSpace();
+ s.replace( QRegExp( "%20" )," ");
+ // odebug << "adding " + s + " to playlist" << oendl;
+ s = s.replace( QRegExp( "\\" ), "/" );
+ QFileInfo f( s );
+ QString name = f.baseName();
+ if( name.left( 4 ) == "http" ) {
+ name = s.right( s.length() - 7);
+ } else {
+ name = s;
+ }
+ name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
+ if( s.at( s.length() - 4) == '.') // if this is probably a file
+ append(s);
+ else { //if its a url
append(s);
- else { //if its a url
-// if( name.right( 1 ).find( '/' ) == -1) {
-// s += "/";
-// }
- append(s);
- }
}
}
+ }
}
void Om3u::write() { //writes list to m3u file
- QString list;
- QTextStream t(&f);
- t.setEncoding(QTextStream::UnicodeUTF8);
- if(count()>0) {
- for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
-// odebug << *it << oendl;
- t << *it << "\n";
+ QString list;
+ QTextStream t(&f);
+ t.setEncoding(QTextStream::UnicodeUTF8);
+ if(count()>0) {
+ for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
+ // odebug << *it << oendl;
+ t << *it << "\n";
+ }
}
- }
-// f.close();
}
void Om3u::add(const QString &filePath) { //adds to m3u file
append(filePath);
}
void Om3u::remove(const QString &filePath) { //removes from m3u list
- QString list, currentFile;
- if(count()>0) {
- for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
- currentFile=*it;
- // odebug << *it << oendl;
-
- if( filePath != currentFile)
- list += currentFile+"\n";
+ QString list, currentFile;
+ if(count()>0) {
+ for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
+ currentFile=*it;
+ // odebug << *it << oendl;
+
+ if( filePath != currentFile)
+ list += currentFile+"\n";
+ }
+ f.writeBlock( list, list.length() );
}
- f.writeBlock( list, list.length() );
- }
}
void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file
- f.close();
- f.remove();
+ f.close();
+ f.remove();
}
void Om3u::close() { //closes m3u file
f.close();
}
diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp
index b5cac61..5fc8a0b 100644
--- a/noncore/multimedia/opieplayer2/threadutil.cpp
+++ b/noncore/multimedia/opieplayer2/threadutil.cpp
@@ -230,18 +230,23 @@ bool Thread::isRunning() const
void Thread::exit()
{
pthread_exit( 0 );
}
-OnewayNotifier::OnewayNotifier()
-{
- int fds[ 2 ];
- pipe( fds );
- m_readFd = fds[ 0 ];
- m_writeFd = fds[ 1 ];
+OnewayNotifier::OnewayNotifier() :
+ m_readFd(-1),
+ m_writeFd(-1)
+{
+ int fds[ 2 ] = { -1, -1 };
+ if (pipe( fds ) == 0) {
+ m_readFd = fds[ 0 ];
+ m_writeFd = fds[ 1 ];
+ } else {
+ owarn << "Call to pipe() failed" << oendl;
+ }
m_notifier = new QSocketNotifier( m_readFd, QSocketNotifier::Read );
connect( m_notifier, SIGNAL( activated(int) ),
this, SLOT( wakeUp() ) );
}
diff --git a/noncore/net/opiestumbler/opiestumbler.cpp b/noncore/net/opiestumbler/opiestumbler.cpp
index 9b0d099..ab0b8d8 100644
--- a/noncore/net/opiestumbler/opiestumbler.cpp
+++ b/noncore/net/opiestumbler/opiestumbler.cpp
@@ -339,13 +339,14 @@ void OpieStumbler::slotAssociated()
delete m_proc;
}
m_proc = new Opie::Core::OProcess(this);
*m_proc << "udhcpc" << "-f" << "-n" << "-i" << m_interface;
- m_proc->start(Opie::Core::OProcess::DontCare);
+ if (!m_proc->start(Opie::Core::OProcess::DontCare))
+ owarn << "Execution of udhcpc returned false. Are paths correct?" << oendl;
QTimer::singleShot(5000, this, SLOT(slotCheckDHCP()));
}
void OpieStumbler::slotCheckDHCP()
{
if(!m_proc->isRunning()) {
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
index 650e634..e81f603 100644
--- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
@@ -193,13 +193,14 @@ void MainWindowImp::getAllInterfaces()
if ( !QString( pifr->ifr_name ).startsWith( "wifi" ) ) ifaces += pifr->ifr_name;
else odebug << "ignoring hostap control interface " << pifr->ifr_name << oendl;
}
}
else
{
- procFile.open(IO_ReadOnly);
+ if (!procFile.open(IO_ReadOnly))
+ owarn << "Failed to open proc file " << procFile.name() << oendl;
QString line;
QTextStream procTs(&procFile);
int loc = -1;
procTs.readLine(); // eat a line
procTs.readLine(); // eat a line
@@ -729,13 +730,14 @@ void MainWindowImp::setHostname()
}
OProcess h;
_procTemp="";
h << "hostname" << m_Nameinput->text();
connect(&h,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(slotHostname(Opie::Core::OProcess*,char*,int)));
- h.start(OProcess::Block,OProcess::Stderr);
+ if (!h.start(OProcess::Block,OProcess::Stderr))
+ owarn << "Failed execution of 'hostname'. Are the paths correct?" << oendl;
odebug << "Got " << _procTemp << " - " << h.exitStatus() << oendl;
if (h.exitStatus()!=0) {
QMessageBox::critical(0, tr("Sorry"), QString(tr("Could not set name.\n%1")).arg(_procTemp.stripWhiteSpace()));
return;
}
_procTemp="";
@@ -765,19 +767,20 @@ void MainWindowImp::initHostname()
{
OProcess h;
_procTemp="";
h << "hostname";
connect(&h,SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),this,SLOT(slotHostname(Opie::Core::OProcess*,char*,int)));
- h.start(OProcess::Block,OProcess::AllOutput);
+ if (!h.start(OProcess::Block,OProcess::AllOutput))
+ owarn << "Could not execute 'hostname'. Are the paths correct?" oendl;
odebug << "Got " << _procTemp <<oendl;
m_Nameinput->setText(_procTemp.stripWhiteSpace());
_procTemp="";
}
-void MainWindowImp::slotHostname(Opie::Core::OProcess */*proc*/, char *buffer, int buflen)
+void MainWindowImp::slotHostname(Opie::Core::OProcess * /*proc*/, char *buffer, int buflen)
{
if (buflen < 1 || buffer==0) return;
char*_t = new char[buflen+1];
::memset(_t,0,buflen+1);
::memcpy(_t,buffer,buflen);
_procTemp+=_t;
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp
index 7b2e2a3..17ada9b 100644
--- a/noncore/settings/networksettings/ppp/modem.cpp
+++ b/noncore/settings/networksettings/ppp/modem.cpp
@@ -765,14 +765,16 @@ bool Modem::createAuthFile(Auth method, const char *username, const char *passwo
if(!(oldName = authFile(method, Old)))
return false;
// delete old file if any
unlink(oldName);
- rename(authfile, oldName);
- rename(newName, authfile);
+ if (rename(authfile, oldName) == -1)
+ return false;
+ if (rename(newName, authfile) == -1)
+ return false;
return true;
}
bool Modem::removeAuthFile(Auth method) {