added -Wall flag to compiler and eleminated new warnings

This commit is contained in:
darkeye 2000-11-17 15:50:48 +00:00
parent 6bb7ca8649
commit e8a74d2f45
6 changed files with 63 additions and 47 deletions

View File

@ -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

View File

@ -1,6 +1,6 @@
bin_PROGRAMS = darkice
INCLUDES = -I../stl
CXXFLAGS = -g
CXXFLAGS = -g -Wall
darkice_SOURCES = AudioEncoder.h\
AudioSource.h\

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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