mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
proper handling of variable length arrays (SF#2002481 https://sourceforge.net/tracker2/?func=detail&aid=2002481&group_id=13478&atid=113478)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user