History

Merge from --mdev.

Erik de Castro Lopo committed 17 years ago

Commit c6bc4682 parents cd83675 94966fc10 files · +30 −26Browse files

Unified · Split

10 files
  1. ChangeLog +10 −0
  2. examples/audio_out.c +5 −5
  3. src/samplerate.c +2 −1
  4. src/src_linear.c +2 −5
  5. src/src_sinc.c +2 −5
  6. src/src_zoh.c +2 −5
  7. tests/callback_hang_test.c +2 −2
  8. tests/downsample_test.c +5 −1
  9. tests/float_short_test.c +0 −1
  10. tests/reset_test.c +0 −1
ChangeLog+10−0
@@ -1,3 +1,13 @@
1+2008-12-12 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
2+
3+ * src/samplerate.c examples/audio_out.c tests/*.c
4+ Fix a couple of very minor warnings uncovered by Erik Hovland using a
5+ static analysis tool.
6+
7+ * src/src_*.c
8+ Fix a potential memory leak. Thanks to Peter G. Vavaroutsos for point this
9+ out.
10+
111 2008-12-11 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
212
313 * reconfigure.mk autogen.sh
examples/audio_out.c+5−5
@@ -20,7 +20,6 @@ · 19 unmodified lines
2020 #include <stdlib.h>
2121 #include <string.h>
2222 #include <unistd.h>
23−#include <errno.h>
2423
2524 #include <config.h>
2625
@@ -793,7 +792,8 @@ audio_close (AUDIO_OUT *audio_out) · 766 unmodified lines
793792 AUDIO_OUT *
794793 audio_open (int channels, int samplerate)
795794 {
796− channels = samplerate ;
795+ (void) channels ;
796+ (void) samplerate ;
797797
798798 return NULL ;
799799 } /* audio_open */
@@ -801,9 +801,9 @@ audio_open (int channels, int samplerate) · 1 unmodified line
801801 void
802802 audio_play (get_audio_callback_t callback, AUDIO_OUT *audio_out, void *callback_data)
803803 {
804− callback = NULL ;
805− audio_out = NULL ;
806− callback_data = NULL ;
804+ (void) callback ;
805+ (void) audio_out ;
806+ (void) callback_data ;
807807
808808 return ;
809809 } /* audio_play */
src/samplerate.c+2−1
@@ -87,7 +87,8 @@ src_callback_new (src_callback_t func, int converter_type, int channels, int *er · 86 unmodified lines
8787 if (error != NULL)
8888 *error = 0 ;
8989
90− src_state = src_new (converter_type, channels, error) ;
90+ if ((src_state = src_new (converter_type, channels, error)) == NULL)
91+ return NULL ;
9192
9293 src_reset (src_state) ;
9394
src/src_linear.c+2−5
@@ -174,11 +174,8 @@ linear_set_converter (SRC_PRIVATE *psrc, int src_enum) · 173 unmodified lines
174174 return SRC_ERR_BAD_CONVERTER ;
175175
176176 if (psrc->private_data != NULL)
177− { priv = (LINEAR_DATA*) psrc->private_data ;
178− if (priv->linear_magic_marker != LINEAR_MAGIC_MARKER)
179− { free (psrc->private_data) ;
180− psrc->private_data = NULL ;
181− } ;
177+ { free (psrc->private_data) ;
178+ psrc->private_data = NULL ;
182179 } ;
183180
184181 if (psrc->private_data == NULL)
src/src_sinc.c+2−5
@@ -154,11 +154,8 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) · 153 unmodified lines
154154 return SRC_ERR_SHIFT_BITS ;
155155
156156 if (psrc->private_data != NULL)
157− { filter = (SINC_FILTER*) psrc->private_data ;
158− if (filter->sinc_magic_marker != SINC_MAGIC_MARKER)
159− { free (psrc->private_data) ;
160− psrc->private_data = NULL ;
161− } ;
157+ { free (psrc->private_data) ;
158+ psrc->private_data = NULL ;
162159 } ;
163160
164161 memset (&temp_filter, 0, sizeof (temp_filter)) ;
src/src_zoh.c+2−5
@@ -165,11 +165,8 @@ zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) · 164 unmodified lines
165165 return SRC_ERR_BAD_CONVERTER ;
166166
167167 if (psrc->private_data != NULL)
168− { priv = (ZOH_DATA*) psrc->private_data ;
169− if (priv->zoh_magic_marker != ZOH_MAGIC_MARKER)
170− { free (psrc->private_data) ;
171− psrc->private_data = NULL ;
172− } ;
168+ { free (psrc->private_data) ;
169+ psrc->private_data = NULL ;
173170 } ;
174171
175172 if (psrc->private_data == NULL)
tests/callback_hang_test.c+2−2
@@ -107,7 +107,7 @@ callback_hang_test (int converter) · 106 unmodified lines
107107 static void
108108 alarm_handler (int number)
109109 {
110− number = 0 ;
110+ (void) number ;
111111 printf ("\n\n Error : Hang inside src_callback_read() detected. Exiting!\n\n") ;
112112 exit (1) ;
113113 } /* alarm_handler */
@@ -117,7 +117,7 @@ input_callback (void *cb_data, float **data) · 3 unmodified lines
117117 {
118118 static float buffer [20] ;
119119
120− cb_data = NULL ;
120+ (void) cb_data ;
121121 *data = buffer ;
122122
123123 return ARRAY_LEN (buffer) ;
tests/downsample_test.c+5−1
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 */
1818
1919 #include <stdio.h>
20+#include <stdlib.h>
2021 #include <samplerate.h>
2122
2223 #include "util.h"
@@ -35,7 +36,10 @@ downsample_test (int converter) · 12 unmodified lines
3536 data.data_in = in ;
3637 data.data_out = out ;
3738
38− src_simple (&data, converter, 1) ;
39+ if (src_simple (&data, converter, 1))
40+ { puts ("src_simple failed.") ;
41+ exit (1) ;
42+ } ;
3943
4044 puts ("ok") ;
4145 } /* downsample_test */
tests/float_short_test.c+0−1
@@ -19,7 +19,6 @@ · 18 unmodified lines
1919 #include <stdio.h>
2020 #include <stdlib.h>
2121 #include <string.h>
22−#include <math.h>
2322
2423 #include <samplerate.h>
2524
tests/reset_test.c+0−1
@@ -18,7 +18,6 @@ · 17 unmodified lines
1818
1919 #include <stdio.h>
2020 #include <stdlib.h>
21−#include <math.h>
2221
2322 #include <samplerate.h>
2423

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t