History

src/samplerate.c : Fix a valgrind warning which occured when the call back function returns a count of zero without modifying the pointer value.

Erik de Castro Lopo committed 18 years ago

Commit 2fd33ba1 parent 2df44c22 files · +14 −7Browse files

Unified · Split

2 files
  1. ChangeLog +6 −0
  2. src/samplerate.c +8 −7
ChangeLog+6−0
@@ -1,3 +1,9 @@
12008-07-10 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
2
3 * src/samplerate.c
4 Fix a valgrind warning which occured when the call back function returns
5 a count of zero without modifying the pointer value. Thanks to Paul Kelly.
6
12008-07-09 Erik de Castro Lopo <erikd AT mega-nerd DOT com>72008-07-09 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
2 8
3 * src/src_sinc.c9 * src/src_sinc.c
src/samplerate.c+8−7
@@ -132,16 +132,13 @@ src_process (SRC_STATE *state, SRC_DATA *data) · 131 unmodified lines
132 if (data == NULL)132 if (data == NULL)
133 return SRC_ERR_BAD_DATA ;133 return SRC_ERR_BAD_DATA ;
134 134
135 /* Check src_ratio is in range. */
136 if (is_bad_src_ratio (data->src_ratio))
137 return SRC_ERR_BAD_SRC_RATIO ;
138
139 /* And that data_in and data_out are valid. */135 /* And that data_in and data_out are valid. */
140 if (data->data_in == NULL || data->data_out == NULL)136 if (data->data_in == NULL || data->data_out == NULL)
141 return SRC_ERR_BAD_DATA_PTR ;137 return SRC_ERR_BAD_DATA_PTR ;
142 138
143 if (data->data_in == NULL)139 /* Check src_ratio is in range. */
144 data->input_frames = 0 ;140 if (is_bad_src_ratio (data->src_ratio))
141 return SRC_ERR_BAD_SRC_RATIO ;
145 142
146 if (data->input_frames < 0)143 if (data->input_frames < 0)
147 data->input_frames = 0 ;144 data->input_frames = 0 ;
@@ -226,7 +223,11 @@ src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) · 78 unmodified lines
226 while (output_frames_gen < frames)223 while (output_frames_gen < frames)
227 {224 {
228 if (src_data.input_frames == 0)225 if (src_data.input_frames == 0)
229 { float *ptr ;226 { /* Use a dummy array for the case where the callback function
227 ** returns without setting the ptr.
228 */
229 float dummy [1] ;
230 float *ptr = dummy ;
230 231
231 src_data.input_frames = psrc->callback_func (psrc->user_callback_data, &ptr) ;232 src_data.input_frames = psrc->callback_func (psrc->user_callback_data, &ptr) ;
232 src_data.data_in = ptr ;233 src_data.data_in = ptr ;

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