shithub: libsamplerate

Download patch

ref: 4ff9f4afdaa2587184846087bb61ae6419836d89
parent: ece924526fe18b0e292df06b86ca11d112f54a79
author: evpobr <evpobr@gmail.com>
date: Sun Oct 25 07:44:06 EDT 2020

Make use of C99 bool type

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,6 +92,7 @@
 check_function_exists(alarm HAVE_ALARM)
 check_function_exists(signal HAVE_SIGNAL)
 
+check_include_file(stdbool.h HAVE_STDBOOL_H)
 check_include_file(sys/times.h HAVE_SYS_TIMES_H)
 check_include_file(unistd.h HAVE_UNISTD_H)
 
--- a/config.h.in
+++ b/config.h.in
@@ -48,6 +48,9 @@
 /* Set to 1 if you have libsndfile. */
 #cmakedefine01 HAVE_SNDFILE
 
+/* Define to 1 if you have the <stdbool.h> header file. */
+#cmakedefine HAVE_STDBOOL_H
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #cmakedefine01 HAVE_STDINT_H
 
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,7 @@
 	])
 
 AC_HEADER_STDC
+AC_HEADER_STDBOOL
 
 AC_CHECK_HEADERS([stdint.h sys/times.h])
 
--- a/src/common.h
+++ b/src/common.h
@@ -10,6 +10,9 @@
 #define COMMON_H_INCLUDED
 
 #include <stdint.h>
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
 
 #include <math.h>
 
--- a/src/src_linear.c
+++ b/src/src_linear.c
@@ -55,7 +55,7 @@
 	{	/* If we have just been reset, set the last_value data. */
 		for (ch = 0 ; ch < priv->channels ; ch++)
 			priv->last_value [ch] = data->data_in [ch] ;
-		priv->dirty = 1 ;
+		priv->dirty = true ;
 		} ;
 
 	priv->in_count = data->input_frames * priv->channels ;
@@ -203,7 +203,7 @@
 		return ;
 
 	priv->channels = state->channels ;
-	priv->dirty = 0 ;
+	priv->dirty = false ;
 	memset (priv->last_value, 0, sizeof (priv->last_value [0]) * priv->channels) ;
 
 	return ;
--- a/src/src_zoh.c
+++ b/src/src_zoh.c
@@ -26,7 +26,7 @@
 typedef struct
 {	int		zoh_magic_marker ;
 	int		channels ;
-	int		dirty ;
+	bool	dirty ;
 	long	in_count, in_used ;
 	long	out_count, out_gen ;
 	float	last_value [] ;
@@ -53,7 +53,7 @@
 	{	/* If we have just been reset, set the last_value data. */
 		for (ch = 0 ; ch < priv->channels ; ch++)
 			priv->last_value [ch] = data->data_in [ch] ;
-		priv->dirty = 1 ;
+		priv->dirty = true ;
 		} ;
 
 	priv->in_count = data->input_frames * priv->channels ;
@@ -194,7 +194,7 @@
 		return ;
 
 	priv->channels = state->channels ;
-	priv->dirty = 0 ;
+	priv->dirty = false ;
 	memset (priv->last_value, 0, sizeof (priv->last_value [0]) * priv->channels) ;
 
 	return ;