From e8a74d2f459b30a290ddde075765ea3322f186ce Mon Sep 17 00:00:00 2001 From: darkeye Date: Fri, 17 Nov 2000 15:50:48 +0000 Subject: [PATCH] added -Wall flag to compiler and eleminated new warnings --- darkice/trunk/src/DarkIce.cpp | 73 ++++++++++++++++-------------- darkice/trunk/src/Makefile.am | 2 +- darkice/trunk/src/OssDspSource.cpp | 20 ++++---- darkice/trunk/src/PipeSink.cpp | 5 +- darkice/trunk/src/PipeSource.cpp | 5 +- darkice/trunk/src/TcpSocket.cpp | 5 +- 6 files changed, 63 insertions(+), 47 deletions(-) diff --git a/darkice/trunk/src/DarkIce.cpp b/darkice/trunk/src/DarkIce.cpp index ac8d346..1744b66 100644 --- a/darkice/trunk/src/DarkIce.cpp +++ b/darkice/trunk/src/DarkIce.cpp @@ -108,7 +108,7 @@ DarkIce :: init ( const Config & config ) throw ( Exception ) unsigned int bitsPerSample; unsigned int channel; const char * device; - int i; + unsigned int u; // the [general] section if ( !(cs = config.get( "general")) ) { @@ -148,9 +148,9 @@ DarkIce :: init ( const Config & config ) throw ( Exception ) char * pipeInExt = ".in"; size_t pipeInExtLen = Util::strLen( pipeInExt); - for ( i = 0; i < maxOutput; ++i ) { + for ( u = 0; u < maxOutput; ++u ) { // ugly hack to change the section name to "lame0", "lame1", etc. - lame[lameLen-1] = '0' + i; + lame[lameLen-1] = '0' + u; if ( !(cs = config.get( lame)) ) { break; @@ -202,22 +202,22 @@ DarkIce :: init ( const Config & config ) throw ( Exception ) // go on and create the things - outputs[i].pid = 0; + outputs[u].pid = 0; // the pipes - outputs[i].encOutPipe = new PipeSource( pipeOutName); - outputs[i].encInPipe = new PipeSink( pipeInName); + outputs[u].encOutPipe = new PipeSource( pipeOutName); + outputs[u].encInPipe = new PipeSink( pipeInName); - if ( !outputs[i].encOutPipe->exists() ) { - if ( !outputs[i].encOutPipe->create() ) { + if ( !outputs[u].encOutPipe->exists() ) { + if ( !outputs[u].encOutPipe->create() ) { throw Exception( __FILE__, __LINE__, "can't create out pipe ", pipeOutName ); } } - if ( !outputs[i].encInPipe->exists() ) { - if ( !outputs[i].encInPipe->create() ) { + if ( !outputs[u].encInPipe->exists() ) { + if ( !outputs[u].encInPipe->create() ) { throw Exception( __FILE__, __LINE__, "can't create in pipe", pipeInName ); @@ -227,16 +227,16 @@ DarkIce :: init ( const Config & config ) throw ( Exception ) // encoder related stuff unsigned int bs = bufferSecs * (bitsPerSample / 8) * channel * sampleRate; - outputs[i].encIn = new BufferedSink( outputs[i].encInPipe.get(), + outputs[u].encIn = new BufferedSink( outputs[u].encInPipe.get(), bs, (bitsPerSample / 8) * channel ); reportEvent( 6, "using buffer size", bs); - encConnector->attach( outputs[i].encIn.get()); - outputs[i].encoder = new LameEncoder( encoder, - outputs[i].encInPipe->getFileName(), + encConnector->attach( outputs[u].encIn.get()); + outputs[u].encoder = new LameEncoder( encoder, + outputs[u].encInPipe->getFileName(), dsp.get(), - outputs[i].encOutPipe->getFileName(), + outputs[u].encOutPipe->getFileName(), bitrate, sampleRate, channel, @@ -245,8 +245,8 @@ DarkIce :: init ( const Config & config ) throw ( Exception ) // streaming related stuff - outputs[i].socket = new TcpSocket( server, port); - outputs[i].ice = new IceCast( outputs[i].socket.get(), + outputs[u].socket = new TcpSocket( server, port); + outputs[u].ice = new IceCast( outputs[u].socket.get(), password, mountPoint, remoteDumpFile, @@ -256,11 +256,11 @@ DarkIce :: init ( const Config & config ) throw ( Exception ) genre, bitrate, isPublic ); - outputs[i].shoutConnector = new Connector( outputs[i].encOutPipe.get(), - outputs[i].ice.get()); + outputs[u].shoutConnector = new Connector( outputs[u].encOutPipe.get(), + outputs[u].ice.get()); } - noOutputs = i; + noOutputs = u; } @@ -271,11 +271,11 @@ bool DarkIce :: encode ( void ) throw ( Exception ) { unsigned int len; - int i; + unsigned int u; unsigned long bytes; - for ( i = 0; i < noOutputs; ++i ) { - outputs[i].encoder->start(); + for ( u = 0; u < noOutputs; ++u ) { + outputs[u].encoder->start(); } sleep( 1 ); @@ -298,8 +298,8 @@ DarkIce :: encode ( void ) throw ( Exception ) encConnector->close(); - for ( i = 0; i < noOutputs; ++i ) { - outputs[i].encoder->stop(); + for ( u = 0; u < noOutputs; ++u ) { + outputs[u].encoder->stop(); } return true; @@ -340,22 +340,22 @@ DarkIce :: shout ( unsigned int ix ) throw ( Exception ) int DarkIce :: run ( void ) throw ( Exception ) { - int i; + unsigned int u; - for ( i = 0; i < noOutputs; ++i ) { - outputs[i].pid = fork(); + for ( u = 0; u < noOutputs; ++u ) { + outputs[u].pid = fork(); - if ( outputs[i].pid == -1 ) { + if ( outputs[u].pid == -1 ) { throw Exception( __FILE__, __LINE__, "fork error", errno); - } else if ( outputs[i].pid == 0 ) { + } else if ( outputs[u].pid == 0 ) { // this is the child sleep ( 1 ); - cout << "shouting " << i << endl << flush; - shout( i); - cout << "shouting ends " << i << endl << flush; + cout << "shouting " << u << endl << flush; + shout( u); + cout << "shouting ends " << u << endl << flush; exit(0); } @@ -367,10 +367,10 @@ DarkIce :: run ( void ) throw ( Exception ) encode(); cout << "encoding ends" << endl << flush; - for ( i = 0; i < noOutputs; ++i ) { + for ( u = 0; u < noOutputs; ++u ) { int status; - waitpid( outputs[i].pid, &status, 0); + waitpid( outputs[u].pid, &status, 0); if ( !WIFEXITED(status) ) { throw Exception( __FILE__, __LINE__, @@ -387,6 +387,9 @@ DarkIce :: run ( void ) throw ( Exception ) $Source$ $Log$ + Revision 1.10 2000/11/17 15:50:48 darkeye + added -Wall flag to compiler and eleminated new warnings + Revision 1.9 2000/11/15 18:37:37 darkeye changed the transferable number of bytes to unsigned long diff --git a/darkice/trunk/src/Makefile.am b/darkice/trunk/src/Makefile.am index 4da0f45..252f7a6 100644 --- a/darkice/trunk/src/Makefile.am +++ b/darkice/trunk/src/Makefile.am @@ -1,6 +1,6 @@ bin_PROGRAMS = darkice INCLUDES = -I../stl -CXXFLAGS = -g +CXXFLAGS = -g -Wall darkice_SOURCES = AudioEncoder.h\ AudioSource.h\ diff --git a/darkice/trunk/src/OssDspSource.cpp b/darkice/trunk/src/OssDspSource.cpp index ae86e5e..59c02d9 100644 --- a/darkice/trunk/src/OssDspSource.cpp +++ b/darkice/trunk/src/OssDspSource.cpp @@ -129,8 +129,9 @@ OssDspSource :: strip ( void ) throw ( Exception ) bool OssDspSource :: open ( void ) throw ( Exception ) { - int format; - int i; + int format; + int i; + unsigned int u; if ( isOpen() ) { return false; @@ -162,17 +163,17 @@ OssDspSource :: open ( void ) throw ( Exception ) throw Exception( __FILE__, __LINE__, "can't set format", i); } - i = getChannel(); - if ( ioctl( fileDescriptor, SNDCTL_DSP_CHANNELS, &i) == -1 || - i != getChannel() ) { + u = getChannel(); + if ( ioctl( fileDescriptor, SNDCTL_DSP_CHANNELS, &u) == -1 || + u != getChannel() ) { close(); throw Exception( __FILE__, __LINE__, "can't set channels", i); } - i = getSampleRate(); - if ( ioctl( fileDescriptor, SNDCTL_DSP_SPEED, &i) == -1 || - i != getSampleRate() ) { + u = getSampleRate(); + if ( ioctl( fileDescriptor, SNDCTL_DSP_SPEED, &u) == -1 || + u != getSampleRate() ) { close(); throw Exception( __FILE__, __LINE__, "can't set speed", i); @@ -264,6 +265,9 @@ OssDspSource :: close ( void ) throw ( Exception ) $Source$ $Log$ + Revision 1.5 2000/11/17 15:50:48 darkeye + added -Wall flag to compiler and eleminated new warnings + Revision 1.4 2000/11/13 20:05:07 darkeye changed to workaround to start recording so that it reads one sample per channel, as opposed to only one sample (which misalignes the channels) diff --git a/darkice/trunk/src/PipeSink.cpp b/darkice/trunk/src/PipeSink.cpp index 766782a..21fe06a 100644 --- a/darkice/trunk/src/PipeSink.cpp +++ b/darkice/trunk/src/PipeSink.cpp @@ -89,7 +89,7 @@ PipeSink :: create ( void ) throw ( Exception ) } if ( mkfifo( getFileName(), S_IRUSR | S_IWUSR) == -1 ) { - if ( errno = EEXIST ) { + if ( errno == EEXIST ) { return true; } throw Exception( __FILE__, __LINE__, "mkfifo error", errno); @@ -124,6 +124,9 @@ PipeSink :: open ( void ) throw ( Exception ) $Source$ $Log$ + Revision 1.5 2000/11/17 15:50:48 darkeye + added -Wall flag to compiler and eleminated new warnings + Revision 1.4 2000/11/11 12:33:13 darkeye added kdoc-style documentation diff --git a/darkice/trunk/src/PipeSource.cpp b/darkice/trunk/src/PipeSource.cpp index c4af20b..3a0b1a9 100644 --- a/darkice/trunk/src/PipeSource.cpp +++ b/darkice/trunk/src/PipeSource.cpp @@ -89,7 +89,7 @@ PipeSource :: create ( void ) throw ( Exception ) } if ( mkfifo( getFileName(), S_IRUSR | S_IWUSR) == -1 ) { - if ( errno = EEXIST ) { + if ( errno == EEXIST ) { return true; } throw Exception( __FILE__, __LINE__, "mkfifo error", errno); @@ -105,6 +105,9 @@ PipeSource :: create ( void ) throw ( Exception ) $Source$ $Log$ + Revision 1.4 2000/11/17 15:50:48 darkeye + added -Wall flag to compiler and eleminated new warnings + Revision 1.3 2000/11/12 13:31:40 darkeye added kdoc-style documentation comments diff --git a/darkice/trunk/src/TcpSocket.cpp b/darkice/trunk/src/TcpSocket.cpp index 44f62b7..8a15295 100644 --- a/darkice/trunk/src/TcpSocket.cpp +++ b/darkice/trunk/src/TcpSocket.cpp @@ -134,7 +134,7 @@ TcpSocket :: strip ( void) throw ( Exception ) * Copy Constructor *----------------------------------------------------------------------------*/ TcpSocket :: TcpSocket ( const TcpSocket & ss ) throw ( Exception ) - : Sink( ss ), Source( ss ) + : Source( ss), Sink( ss ) { int fd; @@ -348,6 +348,9 @@ TcpSocket :: close ( void ) throw ( Exception ) $Source$ $Log$ + Revision 1.4 2000/11/17 15:50:48 darkeye + added -Wall flag to compiler and eleminated new warnings + Revision 1.3 2000/11/12 14:54:50 darkeye added kdoc-style documentation comments