Esound cleanup.



Hi!

I did some cleanup on esd sources, to compile them with -Wall -pedantic.
I don't have a CVS account so I am attaching the patch to this mail.

Regards,
Tomislav
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/esound/ChangeLog,v
retrieving revision 1.142
diff -u -r1.142 ChangeLog
--- ChangeLog	1999/03/09 20:04:26	1.142
+++ ChangeLog	1999/03/16 00:29:07
@@ -1,3 +1,8 @@
+1999-03-16  Tomislav Vujec <tvujec@carnet.hr>
+
+	* clients.c, esddsp.c, audio.c, esd-server.h, mix.c, players.c,
+	  filter.c, esdlib.c, proto.c: -Wall and -pedantic cleanups.
+
 1999-03-09  The Rasterman <raster@rasterman.com>
 	* esdlib.c, esd.c: added SIGPIPE handlers and wrappign in all 
 	  libesd calls so "death" of esd and connection is trapped
Index: audio.c
===================================================================
RCS file: /cvs/gnome/esound/audio.c,v
retrieving revision 1.13
diff -u -r1.13 audio.c
--- audio.c	1998/12/30 05:50:13	1.13
+++ audio.c	1999/03/16 00:29:07
@@ -17,14 +17,13 @@
 /* the audio device, /dev/dsp, file descriptor */
 static int esd_audio_fd = -1;
 
-/* debugging messages for audio devices */
-static int driver_trace = 0;
-
 /*******************************************************************/
 /* returns audio_fd for use by main prog - platform dependent */
 
 /* ALSA before OSS as ALSA is OSS compatible */
 #if defined(DRIVER_ALSA) || defined(DRIVER_NEWALSA) 
+/* debugging messages for audio devices */
+static int driver_trace = 0;
 #  include "audio_alsa.c"
 #elif defined(DRIVER_OSS)
 #  include "audio_oss.c"
Index: clients.c
===================================================================
RCS file: /cvs/gnome/esound/clients.c,v
retrieving revision 1.33
diff -u -r1.33 clients.c
--- clients.c	1999/02/16 06:53:15	1.33
+++ clients.c	1999/03/16 00:29:08
@@ -142,7 +142,6 @@
 #ifdef USE_LIBWRAP
 	    {
 		struct request_info req;
-		struct servent *serv;
 
 		request_init( &req, RQ_DAEMON, "esound", RQ_FILE, fd, NULL );
 		fromhost( &req );
Index: esd-server.h
===================================================================
RCS file: /cvs/gnome/esound/esd-server.h,v
retrieving revision 1.41
diff -u -r1.41 esd-server.h
--- esd-server.h	1999/02/16 07:26:04	1.41
+++ esd-server.h	1999/03/16 00:29:08
@@ -42,10 +42,10 @@
 
 /* mix functions control how the player data is combined */
 typedef int mix_func_t( void *player, int length );
-typedef int translate_func_t( void *dest_buf, int dest_len, 
+typedef int translate_func_t( void *dest_buf, unsigned int dest_len, 
 			      int dest_rate, esd_format_t dest_format, 
-			      void *source_data, int src_len, 
-			      int src_rate, esd_format_t src_format );
+			      void *source_data, unsigned int src_len, 
+			      int src_rate );
 /* NOTE: in heavy flux! */
 
 /* a client is what contacts the server, and makes requests of daemon */
Index: esddsp.c
===================================================================
RCS file: /cvs/gnome/esound/esddsp.c,v
retrieving revision 1.13
diff -u -r1.13 esddsp.c
--- esddsp.c	1999/02/01 10:30:34	1.13
+++ esddsp.c	1999/03/16 00:29:09
@@ -145,7 +145,7 @@
     
   if (*player < 0)
     {
-      if (all_info = esd_get_all_info (*esd))
+      if ((all_info = esd_get_all_info (*esd)))
 	{
 	  for (player_info = all_info->player_list; player_info;
 	       player_info = player_info->next)
@@ -315,7 +315,7 @@
 	  esd_info_t *all_info;
 	  esd_player_info_t *player_info;
 
-	  if (all_info = esd_get_all_info (esd))
+	  if ((all_info = esd_get_all_info (esd)))
 	    {
 	      for (player_info = all_info->player_list; player_info;
 		   player_info = player_info->next)
@@ -381,6 +381,7 @@
     return dspctl (fd, request, argp);
   else if (use_mixer)
     return mixctl (fd, request, argp);
+  return (*func) (fd, request, argp);
 }
 
 int
Index: esdlib.c
===================================================================
RCS file: /cvs/gnome/esound/esdlib.c,v
retrieving revision 1.40
diff -u -r1.40 esdlib.c
--- esdlib.c	1999/03/09 20:04:30	1.40
+++ esdlib.c	1999/03/16 00:29:09
@@ -19,7 +19,6 @@
 /* prototypes */
 int esd_set_socket_buffers( int sock, int src_format, 
 			    int src_rate, int base_rate );
-void dummy_signal(int signum);
 
 /* dummy handler */
 static void dummy_signal(int signum) {
Index: filter.c
===================================================================
RCS file: /cvs/gnome/esound/filter.c,v
retrieving revision 1.8
diff -u -r1.8 filter.c
--- filter.c	1999/02/16 06:53:23	1.8
+++ filter.c	1999/03/16 00:29:09
@@ -23,8 +23,7 @@
 				       filter->format, 
 				       buffer, 
 				       size, 
-				       rate, 
-				       format );
+				       rate );
 
     /* hop through the list of filters */
     while( filter ) {
@@ -68,8 +67,7 @@
 						filter->next->format, 
 						filter->data_buffer, 
 						filter->buffer_length, 
-						filter->rate, 
-						filter->format );
+						filter->rate );
 	} else {
 	    /* translate to audio buffer */
 	    data_size = filter->translate_func( buffer, 
@@ -78,8 +76,7 @@
 						format, 
 						filter->data_buffer, 
 						filter->buffer_length, 
-						filter->rate, 
-						filter->format );
+						filter->rate );
 	}
 	
 	/* next filter... */
Index: mix.c
===================================================================
RCS file: /cvs/gnome/esound/mix.c,v
retrieving revision 1.20
diff -u -r1.20 mix.c
--- mix.c	1999/01/25 05:55:32	1.20
+++ mix.c	1999/03/16 00:29:10
@@ -6,7 +6,7 @@
 /* ESD_BUF_SIZE is the maximum possible number of samples */
 signed int mixed_buffer[ ESD_BUF_SIZE ];
 
-/* prototype for compiler */;
+/* prototype for compiler */
 int mix_and_copy( void *dest_buf, int dest_len, 
 		  int dest_rate, esd_format_t dest_format, 
 		  void *source_data, int src_len, 
@@ -14,26 +14,26 @@
 
 int mix_from_stereo_16s( void *dest_buf, unsigned int dest_len, 
 			 int dest_rate, esd_format_t dest_format, 
-			 signed short *source_data_ss, int src_len, int src_rate );
+			 void *source_data, unsigned int src_len, int src_rate );
 int mix_from_stereo_8u( void *dest_buf, unsigned int dest_len, 
 			int dest_rate, esd_format_t dest_format, 
-			unsigned char *source_data_uc, int src_len, int src_rate );
+			void *source_data, unsigned int src_len, int src_rate );
 int mix_from_mono_16s( void *dest_buf, unsigned int dest_len, 
 		       int dest_rate, esd_format_t dest_format, 
-		       signed short *source_data_ss, int src_len, int src_rate );
+		       void *source_data, unsigned int src_len, int src_rate );
 int mix_from_mono_8u( void *dest_buf, unsigned int dest_len, 
 		      int dest_rate, esd_format_t dest_format, 
-		      unsigned char *source_data_uc, int src_len, int src_rate );
+		      void *source_data, unsigned int src_len, int src_rate );
 
-int mix_mono_8u_to_stereo_32s_sv( esd_player_t *player, int length );
-int mix_stereo_8u_to_stereo_32s_sv( esd_player_t *player, int length );
-int mix_mono_16s_to_stereo_32s_sv( esd_player_t *player, int length );
-int mix_stereo_16s_to_stereo_32s_sv( esd_player_t *player, int length );
-
-int mix_mono_8u_to_stereo_32s( esd_player_t *player, int length );
-int mix_stereo_8u_to_stereo_32s( esd_player_t *player, int length );
-int mix_mono_16s_to_stereo_32s( esd_player_t *player, int length );
-int mix_stereo_16s_to_stereo_32s( esd_player_t *player, int length );
+int mix_mono_8u_to_stereo_32s_sv( void *player_v, int length );
+int mix_stereo_8u_to_stereo_32s_sv( void *player_v, int length );
+int mix_mono_16s_to_stereo_32s_sv( void *player_v, int length );
+int mix_stereo_16s_to_stereo_32s_sv( void *player_v, int length );
+
+int mix_mono_8u_to_stereo_32s( void *player, int length );
+int mix_stereo_8u_to_stereo_32s( void *player_v, int length );
+int mix_mono_16s_to_stereo_32s( void *player_v, int length );
+int mix_stereo_16s_to_stereo_32s( void *player_v, int length );
 
 void clip_mix_to_output_16s( signed short *output, int length );
 void clip_mix_to_output_8u( signed char *output, int length );
@@ -137,13 +137,14 @@
 /* takes the 16 bit signed source waveform, and mixes to player */
 int mix_from_stereo_16s( void *dest_buf, unsigned int dest_len, 
 			 int dest_rate, esd_format_t dest_format, 
-			 signed short *source_data_ss, int src_len, int src_rate )
+			 void *source_data, unsigned int src_len, int src_rate )
 {
     int rd_dat = 0, bytes_written = 0;
     unsigned int wr_dat = 0;
     register unsigned char *target_data_uc = NULL;
     register signed short *target_data_ss = NULL;
-    signed short lsample, rsample;
+    signed short lsample, rsample,
+	*source_data_ss = (signed short *) source_data;
 
     ESDBG_MIXER( printf( "mixing from stereo 16s\n" ); );
 
@@ -254,13 +255,14 @@
 /* takes the 8 bit unsigned source waveform, and mixes to player */
 int mix_from_stereo_8u( void *dest_buf, unsigned int dest_len, 
 			int dest_rate, esd_format_t dest_format, 
-			unsigned char *source_data_uc, int src_len, int src_rate )
+			void *source_data, unsigned int src_len, int src_rate )
 {
     int rd_dat = 0, bytes_written = 0;
     unsigned int wr_dat = 0;
     register unsigned char *target_data_uc = NULL;
     register signed short *target_data_ss = NULL;
     signed short lsample, rsample;
+    unsigned char *source_data_uc = (unsigned char *) source_data;
 
     ESDBG_MIXER( printf( "mixing from stereo 8u\n" ); );
 
@@ -364,13 +366,13 @@
 /* takes the 16 bit mono signed source waveform, and mixes to player */
 int mix_from_mono_16s( void *dest_buf, unsigned int dest_len, 
 		       int dest_rate, esd_format_t dest_format, 
-		       signed short *source_data_ss, int src_len, int src_rate )
+		       void *source_data, unsigned int src_len, int src_rate )
 {
     int rd_dat = 0, bytes_written = 0;
     unsigned int wr_dat = 0;
     register unsigned char *target_data_uc = NULL;
     register signed short *target_data_ss = NULL;
-    signed short lsample;
+    signed short lsample, *source_data_ss = (signed short *) source_data;
 
     ESDBG_MIXER( printf( "mixing from mono 16s\n" ); );
 
@@ -472,13 +474,14 @@
 /* takes the 8 bit mono unsigned source waveform, and mixes to player */
 int mix_from_mono_8u( void *dest_buf, unsigned int dest_len, 
 		      int dest_rate, esd_format_t dest_format, 
-		      unsigned char *source_data_uc, int src_len, int src_rate )
+		      void *source_data, unsigned int src_len, int src_rate )
 {
     int rd_dat = 0, bytes_written = 0;
     unsigned int wr_dat = 0;
     register unsigned char *target_data_uc = NULL;
     register signed short *target_data_ss = NULL;
     signed short lsample;
+    unsigned char *source_data_uc = (unsigned char *) source_data;
 
     ESDBG_MIXER( printf( "mixing from mono 8u\n" ); );
 
@@ -578,11 +581,12 @@
 /*******************************************************************/
 /* takes the input player, and mixes to 16 bit signed waveform */
 
-int mix_mono_8u_to_stereo_32s_sv( esd_player_t *player, int length )
+int mix_mono_8u_to_stereo_32s_sv( void *player_v, int length )
 {
     int rd_dat = 0;
     unsigned int wr_dat=0;
     signed short sample;
+    esd_player_t *player = (esd_player_t *) player_v;
     register unsigned char *source_data_uc 
 	= (unsigned char *) player->data_buffer;
 
@@ -603,11 +607,12 @@
     return wr_dat * sizeof(signed short);
 }
 
-int mix_stereo_8u_to_stereo_32s_sv( esd_player_t *player, int length )
+int mix_stereo_8u_to_stereo_32s_sv( void *player_v, int length )
 {
     int rd_dat = 0;
     unsigned int wr_dat=0;
     signed short sample;
+    esd_player_t *player = (esd_player_t *) player_v;
     register unsigned char *source_data_uc 
 	= (unsigned char *) player->data_buffer;
 
@@ -635,11 +640,12 @@
     return wr_dat * sizeof(signed short);
 }    
 
-int mix_mono_16s_to_stereo_32s_sv( esd_player_t *player, int length )
+int mix_mono_16s_to_stereo_32s_sv( void *player_v, int length )
 {
     int rd_dat = 0;
     unsigned int wr_dat=0;
     signed short sample;
+    esd_player_t *player = (esd_player_t *) player_v;
     register signed short *source_data_ss
 	= (signed short *) player->data_buffer;
 
@@ -659,11 +665,12 @@
     return wr_dat * sizeof(signed short);
 }	
 
-int mix_stereo_16s_to_stereo_32s_sv( esd_player_t *player, int length )
+int mix_stereo_16s_to_stereo_32s_sv( void *player_v, int length )
 {
     int rd_dat = 0;
     unsigned int wr_dat=0;
     signed short sample;
+    esd_player_t *player = (esd_player_t *) player_v;
     register signed short *source_data_ss
 	= (signed short *) player->data_buffer;
 
@@ -692,11 +699,12 @@
 /*******************************************************************/
 /* take input player, mix to 16 bit signed waveform, volume control */
 
-int mix_mono_8u_to_stereo_32s( esd_player_t *player, int length )
+int mix_mono_8u_to_stereo_32s( void *player_v, int length )
 {
     int rd_dat = 0;
     unsigned int wr_dat=0;
     signed short sample;
+    esd_player_t *player = (esd_player_t *) player_v;
     register unsigned char *source_data_uc 
 	= (unsigned char *) player->data_buffer;
 
@@ -720,11 +728,12 @@
     return wr_dat * sizeof(signed short);
 }
 
-int mix_stereo_8u_to_stereo_32s( esd_player_t *player, int length )
+int mix_stereo_8u_to_stereo_32s( void *player_v, int length )
 {
     int rd_dat = 0;
     unsigned int wr_dat=0;
     signed short sample;
+    esd_player_t *player = (esd_player_t *) player_v;
     register unsigned char *source_data_uc 
 	= (unsigned char *) player->data_buffer;
 
@@ -762,11 +771,12 @@
     return wr_dat * sizeof(signed short);
 }    
 
-int mix_mono_16s_to_stereo_32s( esd_player_t *player, int length )
+int mix_mono_16s_to_stereo_32s( void *player_v, int length )
 {
     int rd_dat = 0;
     unsigned int wr_dat=0;
     signed short sample;
+    esd_player_t *player = (esd_player_t *) player_v;
     register signed short *source_data_ss
 	= (signed short *) player->data_buffer;
 
@@ -788,11 +798,12 @@
     return wr_dat * sizeof(signed short);
 }	
 
-int mix_stereo_16s_to_stereo_32s( esd_player_t *player, int length )
+int mix_stereo_16s_to_stereo_32s( void *player_v, int length )
 {
     int rd_dat = 0;
     unsigned int wr_dat=0;
     signed short sample;
+    esd_player_t *player = (esd_player_t *) player_v;
     register signed short *source_data_ss
 	= (signed short *) player->data_buffer;
 
@@ -865,7 +876,7 @@
 	if (*mixed < SHRT_MIN) {
 	    *output++ = 0; mixed++;
 	} else if (*mixed > SHRT_MAX) {
-	    *output++ = 255; mixed++;
+	    *output++ = (signed char) 255; mixed++;
 	} else {
 	    *output++ = (*mixed++) / 256 + 128;
 	}
Index: players.c
===================================================================
RCS file: /cvs/gnome/esound/players.c,v
retrieving revision 1.35
diff -u -r1.35 players.c
--- players.c	1999/02/16 06:53:24	1.35
+++ players.c	1999/03/16 00:29:11
@@ -181,8 +181,7 @@
 					 player->format, 
 					 src_buffer, 
 					 src_length, 
-					 src_rate, 
-					 src_format );
+					 src_rate );
 
 	/* endian swap multi-byte data if we need to */
 	client = (esd_client_t *) (player->parent);
@@ -385,8 +384,7 @@
 					  monitor->format, 
 					  output_buffer, 
 					  length, 
-					  esd_audio_rate,
-					  esd_audio_format );
+					  esd_audio_rate );
 
 	/* write the data buffer to the socket */
 	ESD_WRITE_BIN( monitor->source_id, monitor->data_buffer, 
Index: proto.c
===================================================================
RCS file: /cvs/gnome/esound/proto.c,v
retrieving revision 1.36
diff -u -r1.36 proto.c
--- proto.c	1999/03/09 20:04:32	1.36
+++ proto.c	1999/03/16 00:29:11
@@ -172,7 +172,7 @@
 
     if ( esd_validate_source( client, client->proto_data, 0 ) )
     {
-	ok = esd_check_endian( client, (int*)(client->proto_data + ESD_KEY_LEN) );
+	ok = esd_check_endian( client, (unsigned int *)(client->proto_data + ESD_KEY_LEN) );
     } else {
 	ok = 0;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]