summaryrefslogtreecommitdiff
path: root/noncore/multimedia
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 /noncore/multimedia
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 (limited to 'noncore/multimedia') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp17
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.cpp11
3 files changed, 16 insertions, 16 deletions
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
@@ -56,62 +56,64 @@ typedef void (*dest_size_cb) (void*, int, int, double, int*, int*, double*);
extern "C" {
xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void *, vo_scale_cb, dest_size_cb );
int null_is_showing_video( const xine_vo_driver_t* self );
void null_set_show_video( const xine_vo_driver_t* self, int show );
void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
}
using namespace XINE;
Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
{
m_initialized = false;
m_duringInitialization = false;
m_video = false;
m_wid = widget;
printf("Lib");
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);
+ 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;
}
else
start();
}
void Lib::run()
{
odebug << "Lib::run() started" << oendl;
initialize();
m_initialized = true;
odebug << "Lib::run() finished" << oendl;
}
void Lib::initialize()
{
m_duringInitialization = true;
m_xine = xine_new( );
QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
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
@@ -17,131 +17,124 @@
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "om3u.h"
/* OPIE */
#include <opie2/odebug.h>
using namespace Opie::Core;
//extern PlayListWidget *playList;
Om3u::Om3u( const QString &filePath, int mode)
- : QStringList (){
+ : QStringList ()
+{
odebug << "<<<<<<<new m3u "+filePath << oendl;
f.setName(filePath);
- f.open(mode);
+ if (!f.open(mode)) {
+ owarn << "Unable to open file " << f.name() << oendl;
+ }
}
Om3u::~Om3u(){}
void Om3u::readM3u() {
// odebug << "<<<<<<reading m3u "+f.name() << oendl;
QTextStream t(&f);
t.setEncoding(QTextStream::UnicodeUTF8);
QString s;
while ( !t.atEnd() ) {
s=t.readLine();
// 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);
}
}
}
}
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
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";
}
}
-// 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";
}
f.writeBlock( list, list.length() );
}
}
void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file
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
@@ -212,54 +212,59 @@ void Thread::terminate()
pthread_cancel( d->self );
}
bool Thread::wait()
{
AutoLock lock( d->guard );
if ( !d->isRunning )
return true;
return d->finishCondition.wait( d->guard );
}
bool Thread::isRunning() const
{
AutoLock lock( d->guard );
return d->isRunning;
}
void Thread::exit()
{
pthread_exit( 0 );
}
-OnewayNotifier::OnewayNotifier()
+OnewayNotifier::OnewayNotifier() :
+ m_readFd(-1),
+ m_writeFd(-1)
{
- int fds[ 2 ];
- pipe( fds );
+ 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() ) );
}
OnewayNotifier::~OnewayNotifier()
{
delete m_notifier;
::close( m_readFd );
::close( m_writeFd );
}
void OnewayNotifier::notify()
{
const char c = 42;
::write( m_writeFd, &c, 1 );
}
void OnewayNotifier::wakeUp()
{
char c = 0;