From f837b66c2026bba2a1815aa1a87c78aa9f751d79 Mon Sep 17 00:00:00 2001 From: GZharun Date: Thu, 25 Dec 2014 09:57:46 +0200 Subject: [Summary] Fixed issue with export built on Mavericks. There was not check on empty sets in ExportFormatSpecification class. C standard, section 6.5.6.8 says: "...if the result points one past the last element of the array object, it shall not be used as the operand of a unary * operator that is evaluated..." So GCC compiler and CLANG compiler (Mavericks) process this operation different way. GCC returns 0 on an attempt to dereference end iterator when CLANG returns a non 0 value. --- libs/ardour/ardour/export_format_specification.h | 46 +++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'libs/ardour/ardour/export_format_specification.h') diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h index ed6e259644..dfc846f16a 100644 --- a/libs/ardour/ardour/export_format_specification.h +++ b/libs/ardour/ardour/export_format_specification.h @@ -114,11 +114,47 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase { std::string format_name () const { return _format_name; } Type type () const { return _type; } - FormatId format_id () const { return *format_ids.begin(); } - Endianness endianness () const { return *endiannesses.begin(); } - SampleFormat sample_format () const { return *sample_formats.begin(); } - SampleRate sample_rate () const { return *sample_rates.begin(); } - Quality quality () const { return *qualities.begin(); } + + FormatId format_id () const + { + if (!format_ids.empty() ) + return *format_ids.begin(); + else + return FormatId(0); + } + + Endianness endianness () const + { + if (!endiannesses.empty() ) + return *endiannesses.begin(); + else + return Endianness(0); + } + + SampleFormat sample_format () const + { + if (!sample_formats.empty() ) + return *sample_formats.begin(); + else + return SampleFormat(0); + } + + SampleRate sample_rate () const + { + if (!sample_rates.empty() ) + return *sample_rates.begin(); + else + return SampleRate(0); + + } + + Quality quality () const + { + if (!qualities.empty() ) + return *qualities.begin(); + else + return Quality(0); + } DitherType dither_type () const { return _dither_type; } SRCQuality src_quality () const { return _src_quality; } -- cgit v1.2.3