HAVE_FLEXIBLE_ARRAY hacks.

This commit is contained in:
Erik de Castro Lopo 2004-04-30 14:40:08 +00:00
parent 04f2fd12df
commit e11b49fc0a
6 changed files with 39 additions and 15 deletions

View File

@ -1,9 +1,19 @@
2004-05-01 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* configure.ac
Set HAVE_FLEXIBLE_ARRAY in src/config.h depending on whether the compiler
accepts the flexible array struct member as per 1999 ISO C standard.
* src/common.h src/ima_adpcm.c src/paf.c src/ms_adpcm.c
Added ugly #if HAVE_FLEXIBLE_ARRAY and provided a non-standards compliant
hack for non 1999 ISO C compliant compilers.
2004-04-26 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/strings.c
If adding an SF_STR_SOFTWARE string, only append libsndfile-X.Y.Z if the
string does not already have libsndfile in the string. Thanks to Conrad
Parker.
Parker.
* tests/string_test.c
Add test to verify the above.
@ -16,7 +26,7 @@
* doc/command.html
Fix minor error. Thanks to Simon Burton.
* doc/win32.html
* doc/win32.html
Started adding instructions for compiling libsndfile under MinGW.
* configure.ac
@ -25,7 +35,7 @@
* doc/libsndfile.css.in
This is now a template file for configure which sets the foreground and
background colours.
2004-04-20 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* configure.ac

View File

@ -3,7 +3,7 @@
dnl Require autoconf version
AC_PREREQ(2.53)
AC_INIT(libsndfile,1.0.10pre4,erikd@mega-nerd.com)
AC_INIT(libsndfile,1.0.10pre5,erikd@mega-nerd.com)
AC_CONFIG_SRCDIR([src/sndfile.c])
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION)
@ -50,14 +50,12 @@ AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],${HAVE_DECL_S_IRGRP},
AC_C99_FLEXIBLE_ARRAY
if test x$ac_cv_c99_flexible_array = xno ; then
AC_MSG_ERROR([[
**********************************************************************
*** This compiler does not support the 1999 ISO C Standard feature ***
*** feature known as struct flexible array (or the "struct hack"). ***
*** Try GNU GCC-3.1 or later as they are known to work. ***
**********************************************************************
]])
if test x$ac_cv_c99_flexible_array = xyes ; then
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],1, [Set to 1 if the compile supports the struct hack.])
else
AC_MSG_WARN([[*** This compiler does not support the 1999 ISO C Standard feature ***]])
AC_MSG_WARN([[*** feature known as struct flexible array (or the "struct hack"). ***]])
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],0)
fi
#====================================================================================

View File

@ -117,7 +117,11 @@ typedef struct
typedef struct
{ unsigned int version ; /* version of the PEAK chunk */
unsigned int timestamp ; /* secs since 1/1/1970 */
#if HAVE_FLEIBLE_ARRAY
PEAK_POS peaks [] ; /* the per channel peak info */
#else
PEAK_POS peaks [1] ; /* the per channel peak info */
#endif
} PEAK_CHUNK ;
typedef struct

View File

@ -36,7 +36,11 @@ typedef struct IMA_ADPCM_PRIVATE_tag
int stepindx [2] ;
unsigned char *block ;
short *samples ;
unsigned short data [] ; /* ISO C99 struct hack */
#if HAVE_FLEIBLE_ARRAY
unsigned short data [] ; /* ISO C99 struct flexible array. */
#else
unsigned short data [1] ; /* This is a hack and might not work. */
#endif
} IMA_ADPCM_PRIVATE ;
/*============================================================================================

View File

@ -43,7 +43,11 @@ typedef struct
sf_count_t samplecount ;
short *samples ;
unsigned char *block ;
unsigned short dummydata [] ; /* ISO C99 struct hack */
#if HAVE_FLEIBLE_ARRAY
unsigned short dummydata [] ; /* ISO C99 struct flexible array. */
#else
unsigned short dummydata [1] ; /* This is a hack an might not work. */
#endif
} MSADPCM_PRIVATE ;
/*============================================================================================

View File

@ -64,7 +64,11 @@ typedef struct
sf_count_t sample_count ;
int *samples ;
unsigned char *block ;
int data [] ; /* ISO C99 struct hack */
#if HAVE_FLEIBLE_ARRAY
int data [] ; /* ISO C99 struct flexible array. */
#else
int data [1] ; /* This is a hack and may not work. */
#endif
} PAF24_PRIVATE ;
/*------------------------------------------------------------------------------