shithub: libsamplerate

Download patch

ref: beed7b1e3fe8db029f4c5c5d3549504b5c2530c5
parent: d5b699e15f5e81bfef1081ac7fb8896b18b6bd2d
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Fri Dec 12 10:14:42 EST 2008

Fix a couple of very minor warnings uncovered by Erik Hovland using a static analysis tool.

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-12  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    *  src/samplerate.c examples/audio_out.c tests/*.c
+    Fix a couple of very minor warnings uncovered by Erik Hovland using a
+    static analysis tool.
+
 2008-12-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * reconfigure.mk autogen.sh
--- a/examples/audio_out.c
+++ b/examples/audio_out.c
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <errno.h>
 
 #include <config.h>
 
@@ -793,7 +792,8 @@
 AUDIO_OUT *
 audio_open (int channels, int samplerate)
 {
-	channels = samplerate ;
+	(void) channels ;
+	(void) samplerate ;
 
 	return NULL ;
 } /* audio_open */
@@ -801,9 +801,9 @@
 void
 audio_play (get_audio_callback_t callback, AUDIO_OUT *audio_out, void *callback_data)
 {
-	callback = NULL ;
-	audio_out = NULL ;
-	callback_data = NULL ;
+	(void) callback ;
+	(void) audio_out ;
+	(void) callback_data ;
 
 	return ;
 } /* audio_play */
--- a/src/samplerate.c
+++ b/src/samplerate.c
@@ -87,7 +87,8 @@
 	if (error != NULL)
 		*error = 0 ;
 
-	src_state = src_new (converter_type, channels, error) ;
+	if ((src_state = src_new (converter_type, channels, error)) == NULL)
+		return NULL ;
 
 	src_reset (src_state) ;
 
--- a/tests/callback_hang_test.c
+++ b/tests/callback_hang_test.c
@@ -107,7 +107,7 @@
 static void
 alarm_handler (int number)
 {
-	number = 0 ;
+	(void) number ;
 	printf ("\n\n    Error : Hang inside src_callback_read() detected. Exiting!\n\n") ;
 	exit (1) ;
 } /* alarm_handler */
@@ -117,7 +117,7 @@
 {
 	static float buffer [20] ;
 
-	cb_data = NULL ;
+	(void) cb_data ;
 	*data = buffer ;
 
 	return ARRAY_LEN (buffer) ;
--- a/tests/downsample_test.c
+++ b/tests/downsample_test.c
@@ -17,6 +17,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <samplerate.h>
 
 #include "util.h"
@@ -35,7 +36,10 @@
 	data.data_in = in ;
 	data.data_out = out ;
 
-	src_simple (&data, converter, 1) ;
+	if (src_simple (&data, converter, 1))
+	{	puts ("src_simple failed.") ;
+		exit (1) ;
+		} ;
 
 	puts ("ok") ;
 } /* downsample_test */
--- a/tests/float_short_test.c
+++ b/tests/float_short_test.c
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <math.h>
 
 #include <samplerate.h>
 
--- a/tests/reset_test.c
+++ b/tests/reset_test.c
@@ -18,7 +18,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <math.h>
 
 #include <samplerate.h>