shithub: opus

Download patch

ref: f7bf43b3e9c8586d86fbaa1c16498e6401fdc815
parent: bd628ab6336db02c0b9d34b52a8ca5a741e461ce
author: Gregory Maxwell <[email protected]>
date: Mon Sep 19 11:49:43 EDT 2011

Some fixes for C89 builds.

--- a/Makefile.draft
+++ b/Makefile.draft
@@ -12,8 +12,10 @@
 
 # These options affect performance
 # HAVE_LRINTF: Use C99 intrinsics to speed up float-to-int conversion
-# restrict: Don't use the 'restrict' optimization (for pre-C99 compilers)
+#      inline: Don't use the 'inline' keyword (for ANSI C compilers)
+#    restrict: Don't use the 'restrict' keyword (for pre-C99 compilers)
 #CFLAGS += -DHAVE_LRINTF
+#CFLAGS += -Dinline=
 CFLAGS += -Drestrict=
 
 ###################### END OF OPTIONS ######################
--- a/celt/float_cast.h
+++ b/celt/float_cast.h
@@ -115,10 +115,11 @@
 
 #else
 
-#ifdef __GNUC__ /* supported by gcc, but not by all other compilers*/
+#if (defined(__GNUC__) && defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L)
+        /* supported by gcc in C99 mode, but not by all other compilers */
 	#warning "Don't have the functions lrint() and lrintf ()."
 	#warning "Replacing these functions with a standard C cast."
-#endif /* __GNUC__ */
+#endif /* __STDC_VERSION__ >= 199901L */
 	#include	<math.h>
 	#define	float2int(flt)		((int)(floor(.5+flt)))
 #endif
--- a/src/test_opus.c
+++ b/src/test_opus.c
@@ -65,6 +65,7 @@
 #ifdef _WIN32
 #   define STR_CASEINSENSITIVE_COMPARE(x, y) _stricmp(x, y)
 #else
+#   include <strings.h>
 #   define STR_CASEINSENSITIVE_COMPARE(x, y) strcasecmp(x, y)
 #endif