This commit is contained in:
Josh Coalson
2009-01-03 01:35:56 +00:00
parent e5c6439074
commit 75d35cfe0b
4 changed files with 16 additions and 6 deletions

View File

@@ -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;