From 9395cf2a65184e493714c699bb23b02ea31feef5 Mon Sep 17 00:00:00 2001 From: erik Date: Wed, 31 Jan 2007 22:06:07 +0000 Subject: 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. --- (limited to 'noncore/multimedia') 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 @@ -77,20 +77,22 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) // 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 ) { 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 @@ -38,89 +38,82 @@ using namespace Opie::Core; //extern PlayListWidget *playList; Om3u::Om3u( const QString &filePath, int mode) - : QStringList (){ -odebug << "<<<<<<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 @@ -128,22 +121,22 @@ void Om3u::add(const QString &filePath) { //adds to m3u file } 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(); } 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 @@ -233,12 +233,17 @@ 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) ), -- cgit v0.9.0.2