Commit 75d35cfe authored by Josh Coalson's avatar Josh Coalson
Browse files

proper handling of variable length arrays (SF#2002481...

proper handling of variable length arrays (SF#2002481 https://sourceforge.net/tracker2/?func=detail&aid=2002481&group_id=13478&atid=113478)
parent e5c64390
......@@ -48,9 +48,9 @@ all default: $(DEFAULT_BUILD)
VERSION=\"1.2.1\"
ifeq ($(OS),Darwin)
CONFIG_CFLAGS=-DHAVE_STDINT_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFLAC__SYS_DARWIN -DWORDS_BIGENDIAN
CONFIG_CFLAGS=-DHAVE_STDINT_H -DHAVE_ICONV -DHAVE_CXX_VARARRAYS -DHAVE_LANGINFO_CODESET -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFLAC__SYS_DARWIN -DWORDS_BIGENDIAN
else
CONFIG_CFLAGS=-DHAVE_STDINT_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DHAVE_SOCKLEN_T -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CONFIG_CFLAGS=-DHAVE_STDINT_H -DHAVE_ICONV -DHAVE_CXX_VARARRAYS -DHAVE_LANGINFO_CODESET -DHAVE_SOCKLEN_T -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
endif
OGG_INCLUDE_DIR=$(HOME)/local/include
......
......@@ -46,6 +46,16 @@ AC_CHECK_SIZEOF(void*,0)
#@@@ new name is AC_CONFIG_HEADERS
AM_CONFIG_HEADER(config.h)
AC_LANG_PUSH(C++)
# c++ flavor first
AC_C_VARARRAYS
if test $ac_cv_c_vararrays = yes; then
AC_DEFINE([HAVE_CXX_VARARRAYS], 1, [Define to 1 if C++ supports variable-length arrays.])
fi
AC_LANG_POP(C++)
# c flavor
AC_C_VARARRAYS
AC_C_BIGENDIAN
AC_CHECK_TYPES(socklen_t, [], [])
......
......@@ -103,7 +103,7 @@
<li>
build system:
<ul>
<li>Fix #includes for gcc 4.3 (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1834168&group_id=13478&atid=113478">SF #1834168</a>).</li>
<li>Fixes for gcc 4.3 (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1834168&group_id=13478&atid=113478">SF #1834168</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=2002481&group_id=13478&atid=113478">SF #2002481</a>).</li>
<li>Fixes for windows builds (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1676822&group_id=13478&atid=113478">SF #1676822</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=1809863&group_id=13478&atid=113478">SF #1809863</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=1756624&group_id=13478&atid=363478">SF #1756624</a>).</li>
</ul>
</li>
......
......@@ -193,8 +193,8 @@ namespace FLAC {
bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
{
FLAC__ASSERT(is_valid());
#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __SUNPRO_CC)
// MSVC++ can't handle:
#ifndef HAVE_CXX_VARARRAYS
// some compilers (MSVC++, Borland C, SunPro, some GCCs w/ -pedantic) can't handle:
// ::FLAC__StreamMetadata *m[num_blocks];
// so we do this ugly workaround
::FLAC__StreamMetadata **m = new ::FLAC__StreamMetadata*[num_blocks];
......@@ -205,7 +205,7 @@ namespace FLAC {
// we can get away with the const_cast since we know the encoder will only correct the is_last flags
m[i] = const_cast< ::FLAC__StreamMetadata*>((const ::FLAC__StreamMetadata*)metadata[i]);
}
#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __SUNPRO_CC)
#ifndef HAVE_CXX_VARARRAYS
// complete the hack
const bool ok = (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks);
delete [] m;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment