shithub: libsamplerate

Download patch

ref: 6bda4b061da31dce799b4b56a39b20f8942026e5
parent: 5babc698c94c2f8207288a51d5286427b4b98307
author: Erik de Castro Lopo <erikd@mingus>
date: Mon Jun 5 18:48:55 EDT 2006

Fix MSVC compiler warnings.

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-06  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * src/samplerate.c src/src_linear.c src/src_sinc.c
+    Fix MSVC compiler warnings.
+
 2006-05-26  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * tests/calc_snr.c
--- a/src/samplerate.c
+++ b/src/samplerate.c
@@ -449,7 +449,7 @@
 {
 	while (len)
 	{	len -- ;
-		out [len] = in [len] / (1.0 * 0x8000) ;
+		out [len] = (float) (in [len] / (1.0 * 0x8000)) ;
 		} ;
 
 	return ;
@@ -457,7 +457,7 @@
 
 void
 src_float_to_short_array (const float *in, short *out, int len)
-{	float scaled_value ;
+{	double scaled_value ;
 
 	while (len)
 	{	len -- ;
@@ -472,7 +472,7 @@
 			continue ;
 			} ;
 
-		out [len] = (lrintf (scaled_value) >> 16) ;
+		out [len] = (short) (lrint (scaled_value) >> 16) ;
 		} ;
 
 } /* src_float_to_short_array */
@@ -482,7 +482,7 @@
 {
 	while (len)
 	{	len -- ;
-		out [len] = in [len] / (8.0 * 0x10000000) ;
+		out [len] = (float) (in [len] / (8.0 * 0x10000000)) ;
 		} ;
 
 	return ;
@@ -490,7 +490,7 @@
 
 void
 src_float_to_int_array (const float *in, int *out, int len)
-{	float scaled_value ;
+{	double scaled_value ;
 
 	while (len)
 	{	len -- ;
@@ -505,7 +505,7 @@
 			continue ;
 			} ;
 
-		out [len] = lrintf (scaled_value) ;
+		out [len] = lrint (scaled_value) ;
 		} ;
 
 } /* src_float_to_int_array */
--- a/src/src_linear.c
+++ b/src/src_linear.c
@@ -87,8 +87,8 @@
 			src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / (linear->out_count - 1) ;
 
 		for (ch = 0 ; ch < linear->channels ; ch++)
-		{	data->data_out [linear->out_gen] = linear->last_value [ch] + input_index *
-										(data->data_in [ch] - linear->last_value [ch]) ;
+		{	data->data_out [linear->out_gen] = (float) (linear->last_value [ch] + input_index *
+										(data->data_in [ch] - linear->last_value [ch])) ;
 			linear->out_gen ++ ;
 			} ;
 
@@ -112,8 +112,8 @@
 			} ;
 
 		for (ch = 0 ; ch < linear->channels ; ch++)
-		{	data->data_out [linear->out_gen] = data->data_in [linear->in_used - linear->channels + ch] + input_index *
-						(data->data_in [linear->in_used + ch] - data->data_in [linear->in_used - linear->channels + ch]) ;
+		{	data->data_out [linear->out_gen] = (float) (data->data_in [linear->in_used - linear->channels + ch] + input_index *
+						(data->data_in [linear->in_used + ch] - data->data_in [linear->in_used - linear->channels + ch])) ;
 			linear->out_gen ++ ;
 			} ;
 
--- a/src/src_sinc.c
+++ b/src/src_sinc.c
@@ -319,8 +319,8 @@
 		start_filter_index = DOUBLE_TO_FP (input_index * float_increment) ;
 
 		for (ch = 0 ; ch < filter->channels ; ch++)
-		{	data->data_out [filter->out_gen] = (float_increment / filter->index_inc) *
-											calc_output (filter, increment, start_filter_index, ch) ;
+		{	data->data_out [filter->out_gen] = (float) ((float_increment / filter->index_inc) *
+											calc_output (filter, increment, start_filter_index, ch)) ;
 			filter->out_gen ++ ;
 			} ;