Unified · Split
| @@ -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 | + | |
| 1 | 11 | 2008-12-11 Erik de Castro Lopo <erikd AT mega-nerd DOT com> |
| 2 | 12 | |
| 3 | 13 | * reconfigure.mk autogen.sh |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <stdlib.h> |
| 21 | 21 | #include <string.h> |
| 22 | 22 | #include <unistd.h> |
| 23 | −#include <errno.h> | |
| 24 | 23 | |
| 25 | 24 | #include <config.h> |
| 26 | 25 | |
| @@ -793,7 +792,8 @@ audio_close (AUDIO_OUT *audio_out) · 766 unmodified lines | ||
| 793 | 792 | AUDIO_OUT * |
| 794 | 793 | audio_open (int channels, int samplerate) |
| 795 | 794 | { |
| 796 | − channels = samplerate ; | |
| 795 | + (void) channels ; | |
| 796 | + (void) samplerate ; | |
| 797 | 797 | |
| 798 | 798 | return NULL ; |
| 799 | 799 | } /* audio_open */ |
| @@ -801,9 +801,9 @@ audio_open (int channels, int samplerate) · 1 unmodified line | ||
| 801 | 801 | void |
| 802 | 802 | audio_play (get_audio_callback_t callback, AUDIO_OUT *audio_out, void *callback_data) |
| 803 | 803 | { |
| 804 | − callback = NULL ; | |
| 805 | − audio_out = NULL ; | |
| 806 | − callback_data = NULL ; | |
| 804 | + (void) callback ; | |
| 805 | + (void) audio_out ; | |
| 806 | + (void) callback_data ; | |
| 807 | 807 | |
| 808 | 808 | return ; |
| 809 | 809 | } /* audio_play */ |
| @@ -87,7 +87,8 @@ src_callback_new (src_callback_t func, int converter_type, int channels, int *er · 86 unmodified lines | ||
| 87 | 87 | if (error != NULL) |
| 88 | 88 | *error = 0 ; |
| 89 | 89 | |
| 90 | − src_state = src_new (converter_type, channels, error) ; | |
| 90 | + if ((src_state = src_new (converter_type, channels, error)) == NULL) | |
| 91 | + return NULL ; | |
| 91 | 92 | |
| 92 | 93 | src_reset (src_state) ; |
| 93 | 94 | |
| @@ -174,11 +174,8 @@ linear_set_converter (SRC_PRIVATE *psrc, int src_enum) · 173 unmodified lines | ||
| 174 | 174 | return SRC_ERR_BAD_CONVERTER ; |
| 175 | 175 | |
| 176 | 176 | 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 ; | |
| 182 | 179 | } ; |
| 183 | 180 | |
| 184 | 181 | if (psrc->private_data == NULL) |
| @@ -154,11 +154,8 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) · 153 unmodified lines | ||
| 154 | 154 | return SRC_ERR_SHIFT_BITS ; |
| 155 | 155 | |
| 156 | 156 | 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 ; | |
| 162 | 159 | } ; |
| 163 | 160 | |
| 164 | 161 | memset (&temp_filter, 0, sizeof (temp_filter)) ; |
| @@ -165,11 +165,8 @@ zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) · 164 unmodified lines | ||
| 165 | 165 | return SRC_ERR_BAD_CONVERTER ; |
| 166 | 166 | |
| 167 | 167 | 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 ; | |
| 173 | 170 | } ; |
| 174 | 171 | |
| 175 | 172 | if (psrc->private_data == NULL) |
| @@ -107,7 +107,7 @@ callback_hang_test (int converter) · 106 unmodified lines | ||
| 107 | 107 | static void |
| 108 | 108 | alarm_handler (int number) |
| 109 | 109 | { |
| 110 | − number = 0 ; | |
| 110 | + (void) number ; | |
| 111 | 111 | printf ("\n\n Error : Hang inside src_callback_read() detected. Exiting!\n\n") ; |
| 112 | 112 | exit (1) ; |
| 113 | 113 | } /* alarm_handler */ |
| @@ -117,7 +117,7 @@ input_callback (void *cb_data, float **data) · 3 unmodified lines | ||
| 117 | 117 | { |
| 118 | 118 | static float buffer [20] ; |
| 119 | 119 | |
| 120 | − cb_data = NULL ; | |
| 120 | + (void) cb_data ; | |
| 121 | 121 | *data = buffer ; |
| 122 | 122 | |
| 123 | 123 | return ARRAY_LEN (buffer) ; |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | #include <stdio.h> |
| 20 | +#include <stdlib.h> | |
| 20 | 21 | #include <samplerate.h> |
| 21 | 22 | |
| 22 | 23 | #include "util.h" |
| @@ -35,7 +36,10 @@ downsample_test (int converter) · 12 unmodified lines | ||
| 35 | 36 | data.data_in = in ; |
| 36 | 37 | data.data_out = out ; |
| 37 | 38 | |
| 38 | − src_simple (&data, converter, 1) ; | |
| 39 | + if (src_simple (&data, converter, 1)) | |
| 40 | + { puts ("src_simple failed.") ; | |
| 41 | + exit (1) ; | |
| 42 | + } ; | |
| 39 | 43 | |
| 40 | 44 | puts ("ok") ; |
| 41 | 45 | } /* downsample_test */ |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <stdio.h> |
| 20 | 20 | #include <stdlib.h> |
| 21 | 21 | #include <string.h> |
| 22 | −#include <math.h> | |
| 23 | 22 | |
| 24 | 23 | #include <samplerate.h> |
| 25 | 24 | |
| @@ -18,7 +18,6 @@ · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | #include <stdio.h> |
| 20 | 20 | #include <stdlib.h> |
| 21 | −#include <math.h> | |
| 22 | 21 | |
| 23 | 22 | #include <samplerate.h> |
| 24 | 23 | |