shithub: libsamplerate

Download patch

ref: c28af3dece9b149341ec8020259fc46b9a314740
parent: 5f60997fe351d62b1eab9face1fbd9d51655aff3
author: evpobr <evpobr@gmail.com>
date: Fri Nov 6 09:22:35 EST 2020

Fix some C++ incompatibilities

--- a/src/samplerate.c
+++ b/src/samplerate.c
@@ -267,7 +267,7 @@
 	state->saved_frames = src_data.input_frames ;
 
 	if (error != 0)
-	{	state->error = error ;
+	{	state->error = (SRC_ERROR) error ;
 		return 0 ;
 		} ;
 
--- a/src/src_linear.c
+++ b/src/src_linear.c
@@ -173,7 +173,7 @@
 		priv = (LINEAR_DATA *) calloc (1, sizeof (LINEAR_DATA)) ;
 		if (priv)
 		{
-			priv->last_value = calloc (state->channels, sizeof (float)) ;
+			priv->last_value = (float *) calloc (state->channels, sizeof (float)) ;
 			if (!priv->last_value)
 			{
 				free (priv) ;
@@ -229,7 +229,7 @@
 		return SRC_ERR_MALLOC_FAILED ;
 
 	memcpy (to_priv, from_priv, sizeof (LINEAR_DATA)) ;
-	to_priv->last_value = malloc (sizeof (float) * from->channels) ;
+	to_priv->last_value = (float *) malloc (sizeof (float) * from->channels) ;
 	if (!to_priv->last_value)
 	{
 		free (to_priv) ;
--- a/src/src_sinc.c
+++ b/src/src_sinc.c
@@ -223,7 +223,7 @@
 		return SRC_ERR_MALLOC_FAILED ;
 
 	*filter = temp_filter ;
-	filter->buffer = calloc (temp_filter.b_len + state->channels, sizeof (float)) ;
+	filter->buffer = (float *) calloc (temp_filter.b_len + state->channels, sizeof (float)) ;
 	if (!filter->buffer)
 	{	free (filter) ;
 		return SRC_ERR_MALLOC_FAILED ;
@@ -276,7 +276,7 @@
 	if ((to_filter = (SINC_FILTER *) calloc (1, sizeof (SINC_FILTER))) == NULL)
 		return SRC_ERR_MALLOC_FAILED ;
 	memcpy (to_filter, from_filter, sizeof (SINC_FILTER)) ;
-	to_filter->buffer = malloc (sizeof (float) * (from_filter->b_len + from->channels)) ;
+	to_filter->buffer = (float *) malloc (sizeof (float) * (from_filter->b_len + from->channels)) ;
 	if (!to_filter->buffer)
 	{
 		free (to_filter) ;
--- a/src/src_zoh.c
+++ b/src/src_zoh.c
@@ -164,7 +164,7 @@
 		priv = (ZOH_DATA *) calloc (1, sizeof (ZOH_DATA)) ;
 		if (priv)
 		{
-			priv->last_value = calloc (state->channels, sizeof (float)) ;
+			priv->last_value = (float *) calloc (state->channels, sizeof (float)) ;
 			if (!priv->last_value)
 			{
 				free (priv) ;
@@ -221,7 +221,7 @@
 		return SRC_ERR_MALLOC_FAILED ;
 
 	memcpy (to_priv, from_priv, sizeof (ZOH_DATA)) ;
-	to_priv->last_value = malloc (sizeof (float) * from->channels) ;
+	to_priv->last_value = (float *) malloc (sizeof (float) * from->channels) ;
 	if (!to_priv->last_value)
 	{	free (to_priv) ;
 		return SRC_ERR_MALLOC_FAILED ;