diff options
author | GZharun <grygoriiz@wavesglobal.com> | 2014-12-25 09:57:46 +0200 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-29 14:18:11 -0400 |
commit | f837b66c2026bba2a1815aa1a87c78aa9f751d79 (patch) | |
tree | 96522031de7148012c9b6e3f05107ebc0614377c /libs/ardour/ardour/export_format_specification.h | |
parent | 5877f255f0061494271ec4e331c339fbbe34d6f3 (diff) |
[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.
Diffstat (limited to 'libs/ardour/ardour/export_format_specification.h')
-rw-r--r-- | libs/ardour/ardour/export_format_specification.h | 46 |
1 files changed, 41 insertions, 5 deletions
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; } |