diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-12-28 01:15:24 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-12-28 01:15:24 +0000 |
| commit | ea81a192a65a03b664dac61de21e06cea7aa97a2 (patch) | |
| tree | f21447aeb9f24320ea6c1c4cb7a05539646bb85a /src | |
| parent | 75788462338b1b4f464d075465da3cb372c40004 (diff) | |
Purge assert() from src/, at least (not asdcplib).
Diffstat (limited to 'src')
| -rw-r--r-- | src/asset.cc | 7 | ||||
| -rw-r--r-- | src/certificates.cc | 25 | ||||
| -rw-r--r-- | src/cpl.cc | 3 | ||||
| -rw-r--r-- | src/dcp.cc | 14 | ||||
| -rw-r--r-- | src/dcp_assert.h | 22 | ||||
| -rw-r--r-- | src/decrypted_kdm.cc | 3 | ||||
| -rw-r--r-- | src/exceptions.cc | 7 | ||||
| -rw-r--r-- | src/exceptions.h | 6 | ||||
| -rw-r--r-- | src/file.cc | 3 | ||||
| -rw-r--r-- | src/mono_picture_mxf.cc | 3 | ||||
| -rw-r--r-- | src/mono_picture_mxf_writer.cc | 7 | ||||
| -rw-r--r-- | src/mxf.cc | 7 | ||||
| -rw-r--r-- | src/mxf_writer.cc | 3 | ||||
| -rw-r--r-- | src/reel_mxf_asset.cc | 3 | ||||
| -rw-r--r-- | src/reel_picture_asset.cc | 3 | ||||
| -rw-r--r-- | src/rgb_xyz.cc | 11 | ||||
| -rw-r--r-- | src/sound_mxf_writer.cc | 5 | ||||
| -rw-r--r-- | src/stereo_picture_mxf.cc | 3 | ||||
| -rw-r--r-- | src/stereo_picture_mxf_writer.cc | 7 | ||||
| -rw-r--r-- | src/subtitle_content.cc | 5 | ||||
| -rw-r--r-- | src/util.cc | 5 | ||||
| -rw-r--r-- | src/xyz_frame.cc | 6 |
22 files changed, 105 insertions, 53 deletions
diff --git a/src/asset.cc b/src/asset.cc index 2ca58a62..e2dcc0f6 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -25,6 +25,7 @@ #include "asset.h" #include "util.h" #include "exceptions.h" +#include "dcp_assert.h" #include "compose.hpp" #include <libxml++/libxml++.h> @@ -51,7 +52,7 @@ Asset::Asset (boost::filesystem::path file) void Asset::write_to_pkl (xmlpp::Node* node, Standard standard) const { - assert (!_file.empty ()); + DCP_ASSERT (!_file.empty ()); xmlpp::Node* asset = node->add_child ("Asset"); asset->add_child("Id")->add_child_text ("urn:uuid:" + _id); @@ -64,7 +65,7 @@ Asset::write_to_pkl (xmlpp::Node* node, Standard standard) const void Asset::write_to_assetmap (xmlpp::Node* node, boost::filesystem::path root) const { - assert (!_file.empty ()); + DCP_ASSERT (!_file.empty ()); xmlpp::Node* asset = node->add_child ("Asset"); asset->add_child("Id")->add_child_text ("urn:uuid:" + _id); @@ -83,7 +84,7 @@ Asset::write_to_assetmap (xmlpp::Node* node, boost::filesystem::path root) const string Asset::hash (function<void (float)> progress) const { - assert (!_file.empty ()); + DCP_ASSERT (!_file.empty ()); if (_hash.empty ()) { _hash = make_digest (_file, progress); diff --git a/src/certificates.cc b/src/certificates.cc index 601662ea..da8f39c7 100644 --- a/src/certificates.cc +++ b/src/certificates.cc @@ -26,6 +26,7 @@ #include "compose.hpp" #include "exceptions.h" #include "util.h" +#include "dcp_assert.h" #include <libxml++/nodes/element.h> #include <openssl/x509.h> #include <openssl/ssl.h> @@ -122,7 +123,7 @@ Certificate::operator= (Certificate const & other) string Certificate::certificate (bool with_begin_end) const { - assert (_certificate); + DCP_ASSERT (_certificate); BIO* bio = BIO_new (BIO_s_mem ()); if (!bio) { @@ -155,7 +156,7 @@ Certificate::certificate (bool with_begin_end) const string Certificate::issuer () const { - assert (_certificate); + DCP_ASSERT (_certificate); return name_for_xml (X509_get_issuer_name (_certificate)); } @@ -174,7 +175,7 @@ Certificate::get_name_part (X509_NAME* n, int nid) { int p = -1; p = X509_NAME_get_index_by_NID (n, nid, p); - assert (p != -1); + DCP_ASSERT (p != -1); return asn_to_utf8 (X509_NAME_ENTRY_get_data (X509_NAME_get_entry (n, p))); } @@ -182,7 +183,7 @@ Certificate::get_name_part (X509_NAME* n, int nid) string Certificate::name_for_xml (X509_NAME * n) { - assert (n); + DCP_ASSERT (n); string s = String::compose ( "dnQualifier=%1,CN=%2,OU=%3,O=%4", @@ -199,7 +200,7 @@ Certificate::name_for_xml (X509_NAME * n) string Certificate::subject () const { - assert (_certificate); + DCP_ASSERT (_certificate); return name_for_xml (X509_get_subject_name (_certificate)); } @@ -207,7 +208,7 @@ Certificate::subject () const string Certificate::common_name () const { - assert (_certificate); + DCP_ASSERT (_certificate); return get_name_part (X509_get_subject_name (_certificate), NID_commonName); } @@ -215,10 +216,10 @@ Certificate::common_name () const string Certificate::serial () const { - assert (_certificate); + DCP_ASSERT (_certificate); ASN1_INTEGER* s = X509_get_serialNumber (_certificate); - assert (s); + DCP_ASSERT (s); BIGNUM* b = ASN1_INTEGER_to_BN (s, 0); char* c = BN_bn2dec (b); @@ -233,7 +234,7 @@ Certificate::serial () const string Certificate::thumbprint () const { - assert (_certificate); + DCP_ASSERT (_certificate); uint8_t buffer[8192]; uint8_t* p = buffer; @@ -257,7 +258,7 @@ Certificate::thumbprint () const RSA * Certificate::public_key () const { - assert (_certificate); + DCP_ASSERT (_certificate); if (_public_key) { return _public_key; @@ -299,7 +300,7 @@ dcp::operator<< (ostream& s, Certificate const & c) Certificate CertificateChain::root () const { - assert (!_certificates.empty()); + DCP_ASSERT (!_certificates.empty()); return _certificates.front (); } @@ -307,7 +308,7 @@ CertificateChain::root () const Certificate CertificateChain::leaf () const { - assert (_certificates.size() >= 2); + DCP_ASSERT (_certificates.size() >= 2); return _certificates.back (); } @@ -27,6 +27,7 @@ #include "reel_sound_asset.h" #include "reel_subtitle_asset.h" #include "local_time.h" +#include "dcp_assert.h" #include "compose.hpp" #include <libxml/parser.h> @@ -250,7 +251,7 @@ CPL::pkl_type (Standard standard) const case SMPTE: return "text/xml"; default: - assert (false); + DCP_ASSERT (false); } } @@ -38,12 +38,12 @@ #include "AS_DCP.h" #include "decrypted_kdm.h" #include "decrypted_kdm_key.h" +#include "dcp_assert.h" #include <xmlsec/xmldsig.h> #include <xmlsec/app.h> #include <libxml++/libxml++.h> #include <boost/filesystem.hpp> #include <boost/algorithm/string.hpp> -#include <cassert> #include <iostream> using std::string; @@ -251,7 +251,7 @@ DCP::write_pkl (Standard standard, string pkl_uuid, XMLMetadata metadata, shared pkl->add_child("Id")->add_child_text ("urn:uuid:" + pkl_uuid); /* XXX: this is a bit of a hack */ - assert (cpls().size() > 0); + DCP_ASSERT (cpls().size() > 0); pkl->add_child("AnnotationText")->add_child_text (cpls().front()->annotation_text ()); pkl->add_child("IssueDate")->add_child_text (metadata.issue_date); @@ -286,7 +286,7 @@ DCP::write_volindex (Standard standard) const p /= "VOLINDEX.xml"; break; default: - assert (false); + DCP_ASSERT (false); } xmlpp::Document doc; @@ -300,7 +300,7 @@ DCP::write_volindex (Standard standard) const root = doc.create_root_node ("VolumeIndex", "http://www.smpte-ra.org/schemas/429-9/2007/AM"); break; default: - assert (false); + DCP_ASSERT (false); } root->add_child("Index")->add_child_text ("1"); @@ -320,7 +320,7 @@ DCP::write_assetmap (Standard standard, string pkl_uuid, int pkl_length, XMLMeta p /= "ASSETMAP.xml"; break; default: - assert (false); + DCP_ASSERT (false); } xmlpp::Document doc; @@ -334,7 +334,7 @@ DCP::write_assetmap (Standard standard, string pkl_uuid, int pkl_length, XMLMeta root = doc.create_root_node ("AssetMap", "http://www.smpte-ra.org/schemas/429-9/2007/AM"); break; default: - assert (false); + DCP_ASSERT (false); } root->add_child("Id")->add_child_text ("urn:uuid:" + make_uuid()); @@ -354,7 +354,7 @@ DCP::write_assetmap (Standard standard, string pkl_uuid, int pkl_length, XMLMeta root->add_child("Issuer")->add_child_text (metadata.issuer); break; default: - assert (false); + DCP_ASSERT (false); } xmlpp::Node* asset_list = root->add_child ("AssetList"); diff --git a/src/dcp_assert.h b/src/dcp_assert.h new file mode 100644 index 00000000..fa1ab8ea --- /dev/null +++ b/src/dcp_assert.h @@ -0,0 +1,22 @@ +/* + Copyright (C) 2014 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "exceptions.h" + +#define DCP_ASSERT(x) if (!(x)) throw ProgrammingError (__FILE__, __LINE__); diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc index 02515fe8..5f374dc7 100644 --- a/src/decrypted_kdm.cc +++ b/src/decrypted_kdm.cc @@ -26,6 +26,7 @@ #include "cpl.h" #include "mxf.h" #include "signer.h" +#include "dcp_assert.h" #include "AS_DCP.h" #include "KM_util.h" #include "compose.hpp" @@ -173,7 +174,7 @@ DecryptedKDM::DecryptedKDM (EncryptedKDM const & kdm, string private_key) break; } default: - assert (false); + DCP_ASSERT (false); } delete[] decrypted; diff --git a/src/exceptions.cc b/src/exceptions.cc index b31974d4..4045021c 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -74,3 +74,10 @@ NotEncryptedError::NotEncryptedError (string const & what) { } + + +ProgrammingError::ProgrammingError (string file, int line) + : StringError (String::compose ("Programming error at %1:%2", file, line)) +{ + +} diff --git a/src/exceptions.h b/src/exceptions.h index fd7c7618..9b2617ee 100644 --- a/src/exceptions.h +++ b/src/exceptions.h @@ -166,6 +166,12 @@ public: ~NotEncryptedError () throw () {} }; +class ProgrammingError : public StringError +{ +public: + ProgrammingError (std::string file, int line); +}; + } #endif diff --git a/src/file.cc b/src/file.cc index f4a91add..f2915947 100644 --- a/src/file.cc +++ b/src/file.cc @@ -23,6 +23,7 @@ #include "file.h" #include "util.h" +#include "dcp_assert.h" #include <stdio.h> using namespace dcp; @@ -35,7 +36,7 @@ File::File (boost::filesystem::path file) _size = boost::filesystem::file_size (file); _data = new uint8_t[_size]; FILE* f = dcp::fopen_boost (file, "r"); - assert (f); + DCP_ASSERT (f); fread (_data, 1, _size, f); fclose (f); } diff --git a/src/mono_picture_mxf.cc b/src/mono_picture_mxf.cc index 66cfa12c..57a0d0a9 100644 --- a/src/mono_picture_mxf.cc +++ b/src/mono_picture_mxf.cc @@ -22,6 +22,7 @@ #include "AS_DCP.h" #include "KM_fileio.h" #include "exceptions.h" +#include "dcp_assert.h" #include "mono_picture_frame.h" #include "compose.hpp" @@ -105,7 +106,7 @@ MonoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, boos } shared_ptr<const MonoPictureMXF> other_picture = dynamic_pointer_cast<const MonoPictureMXF> (other); - assert (other_picture); + DCP_ASSERT (other_picture); for (int i = 0; i < _intrinsic_duration; ++i) { if (i >= other_picture->intrinsic_duration()) { diff --git a/src/mono_picture_mxf_writer.cc b/src/mono_picture_mxf_writer.cc index 5cc424e1..01292876 100644 --- a/src/mono_picture_mxf_writer.cc +++ b/src/mono_picture_mxf_writer.cc @@ -26,6 +26,7 @@ #include "mono_picture_mxf_writer.h" #include "exceptions.h" #include "picture_mxf.h" +#include "dcp_assert.h" #include "picture_mxf_writer_common.cc" @@ -60,7 +61,7 @@ MonoPictureMXFWriter::start (uint8_t* data, int size) FrameInfo MonoPictureMXFWriter::write (uint8_t* data, int size) { - assert (!_finalized); + DCP_ASSERT (!_finalized); if (!_started) { start (data, size); @@ -85,8 +86,8 @@ MonoPictureMXFWriter::write (uint8_t* data, int size) void MonoPictureMXFWriter::fake_write (int size) { - assert (_started); - assert (!_finalized); + DCP_ASSERT (_started); + DCP_ASSERT (!_finalized); Kumu::Result_t r = _state->mxf_writer.FakeWriteFrame (size); if (ASDCP_FAILURE (r)) { @@ -29,6 +29,7 @@ #include "util.h" #include "metadata.h" #include "exceptions.h" +#include "dcp_assert.h" #include "compose.hpp" #include <libxml++/nodes/element.h> #include <boost/filesystem.hpp> @@ -79,7 +80,7 @@ MXF::fill_writer_info (ASDCP::WriterInfo* writer_info, Standard standard) } unsigned int c; Kumu::hex2bin (_id.c_str(), writer_info->AssetUUID, Kumu::UUID_Length, &c); - assert (c == Kumu::UUID_Length); + DCP_ASSERT (c == Kumu::UUID_Length); if (_key) { Kumu::GenRandomUUID (writer_info->ContextID); @@ -87,7 +88,7 @@ MXF::fill_writer_info (ASDCP::WriterInfo* writer_info, Standard standard) unsigned int c; Kumu::hex2bin (_key_id.c_str(), writer_info->CryptographicKeyID, Kumu::UUID_Length, &c); - assert (c == Kumu::UUID_Length); + DCP_ASSERT (c == Kumu::UUID_Length); } } @@ -175,6 +176,6 @@ MXF::pkl_type (Standard standard) const case SMPTE: return "application/mxf"; default: - assert (false); + DCP_ASSERT (false); } } diff --git a/src/mxf_writer.cc b/src/mxf_writer.cc index 21720772..93f3ab07 100644 --- a/src/mxf_writer.cc +++ b/src/mxf_writer.cc @@ -23,6 +23,7 @@ #include "mxf_writer.h" #include "mxf.h" +#include "dcp_assert.h" using namespace dcp; @@ -47,7 +48,7 @@ MXFWriter::~MXFWriter () void MXFWriter::finalize () { - assert (!_finalized); + DCP_ASSERT (!_finalized); _finalized = true; _mxf->_intrinsic_duration = _frames_written; } diff --git a/src/reel_mxf_asset.cc b/src/reel_mxf_asset.cc index 8395376e..9d7c1fad 100644 --- a/src/reel_mxf_asset.cc +++ b/src/reel_mxf_asset.cc @@ -19,6 +19,7 @@ #include "reel_mxf_asset.h" #include "mxf.h" +#include "dcp_assert.h" #include <libcxml/cxml.h> using boost::shared_ptr; @@ -57,7 +58,7 @@ ReelMXFAsset::write_to_cpl (xmlpp::Node* node, Standard s) const ++i; } - assert (i != c.end ()); + DCP_ASSERT (i != c.end ()); if (!_key_id.empty ()) { (*i)->add_child("KeyId")->add_child_text ("urn:uuid:" + _key_id); diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc index 1fbd635b..5cf2b858 100644 --- a/src/reel_picture_asset.cc +++ b/src/reel_picture_asset.cc @@ -24,6 +24,7 @@ #include "content.h" #include "reel_picture_asset.h" #include "picture_mxf.h" +#include "dcp_assert.h" #include "compose.hpp" #include <libcxml/cxml.h> #include <iomanip> @@ -78,7 +79,7 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const ++i; } - assert (i != c.end ()); + DCP_ASSERT (i != c.end ()); (*i)->add_child ("FrameRate")->add_child_text (String::compose ("%1 %2", _frame_rate.numerator, _frame_rate.denominator)); if (standard == INTEROP) { diff --git a/src/rgb_xyz.cc b/src/rgb_xyz.cc index de8d484a..35332fc2 100644 --- a/src/rgb_xyz.cc +++ b/src/rgb_xyz.cc @@ -24,6 +24,7 @@ #include "colour_matrix.h" #include "colour_conversion.h" #include "transfer_function.h" +#include "dcp_assert.h" #include <cmath> using std::min; @@ -68,7 +69,7 @@ dcp::xyz_to_rgba ( uint8_t* argb_line = argb; for (int x = 0; x < xyz_frame->size().width; ++x) { - assert (*xyz_x >= 0 && *xyz_y >= 0 && *xyz_z >= 0 && *xyz_x < 4096 && *xyz_y < 4096 && *xyz_z < 4096); + DCP_ASSERT (*xyz_x >= 0 && *xyz_y >= 0 && *xyz_z >= 0 && *xyz_x < 4096 && *xyz_y < 4096 && *xyz_z < 4096); /* In gamma LUT */ s.x = lut_in[*xyz_x++]; @@ -144,7 +145,7 @@ dcp::xyz_to_rgb ( uint8_t* buffer_line = buffer; for (int x = 0; x < xyz_frame->size().width; ++x) { - assert (*xyz_x >= 0 && *xyz_y >= 0 && *xyz_z >= 0 && *xyz_x < 4096 && *xyz_y < 4096 && *xyz_z < 4096); + DCP_ASSERT (*xyz_x >= 0 && *xyz_y >= 0 && *xyz_z >= 0 && *xyz_x < 4096 && *xyz_y < 4096 && *xyz_z < 4096); /* In gamma LUT */ s.x = lut_in[*xyz_x++]; @@ -223,9 +224,9 @@ dcp::rgb_to_xyz ( d.y = d.y * DCI_COEFFICIENT * 65535; d.z = d.z * DCI_COEFFICIENT * 65535; - assert (d.x >= 0 && d.x < 65536); - assert (d.y >= 0 && d.y < 65536); - assert (d.z >= 0 && d.z < 65536); + DCP_ASSERT (d.x >= 0 && d.x < 65536); + DCP_ASSERT (d.y >= 0 && d.y < 65536); + DCP_ASSERT (d.z >= 0 && d.z < 65536); /* Out gamma LUT */ xyz->data(0)[jn] = lut_out[(int) d.x] * 4096; diff --git a/src/sound_mxf_writer.cc b/src/sound_mxf_writer.cc index 51ba7e40..52547b16 100644 --- a/src/sound_mxf_writer.cc +++ b/src/sound_mxf_writer.cc @@ -20,6 +20,7 @@ #include "sound_mxf_writer.h" #include "sound_mxf.h" #include "exceptions.h" +#include "dcp_assert.h" #include "compose.hpp" #include "AS_DCP.h" @@ -68,7 +69,7 @@ SoundMXFWriter::SoundMXFWriter (SoundMXF* m, boost::filesystem::path file, Stand void SoundMXFWriter::write (float const * const * data, int frames) { - assert (!_finalized); + DCP_ASSERT (!_finalized); for (int i = 0; i < frames; ++i) { @@ -83,7 +84,7 @@ SoundMXFWriter::write (float const * const * data, int frames) } _frame_buffer_offset += 3 * _sound_mxf->channels(); - assert (_frame_buffer_offset <= int (_state->frame_buffer.Capacity())); + DCP_ASSERT (_frame_buffer_offset <= int (_state->frame_buffer.Capacity())); /* Finish the MXF frame if required */ if (_frame_buffer_offset == int (_state->frame_buffer.Capacity())) { diff --git a/src/stereo_picture_mxf.cc b/src/stereo_picture_mxf.cc index 726b0fee..1c8fa618 100644 --- a/src/stereo_picture_mxf.cc +++ b/src/stereo_picture_mxf.cc @@ -22,6 +22,7 @@ #include "stereo_picture_frame.h" #include "exceptions.h" #include "stereo_picture_mxf_writer.h" +#include "dcp_assert.h" using std::string; using std::pair; @@ -106,7 +107,7 @@ StereoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, bo } shared_ptr<const StereoPictureMXF> other_picture = dynamic_pointer_cast<const StereoPictureMXF> (other); - assert (other_picture); + DCP_ASSERT (other_picture); for (int i = 0; i < _intrinsic_duration; ++i) { shared_ptr<const StereoPictureFrame> frame_A = get_frame (i); diff --git a/src/stereo_picture_mxf_writer.cc b/src/stereo_picture_mxf_writer.cc index 4f98c60e..2c0468f6 100644 --- a/src/stereo_picture_mxf_writer.cc +++ b/src/stereo_picture_mxf_writer.cc @@ -19,6 +19,7 @@ #include "stereo_picture_mxf_writer.h" #include "exceptions.h" +#include "dcp_assert.h" #include "picture_mxf.h" #include "AS_DCP.h" #include "KM_fileio.h" @@ -58,7 +59,7 @@ StereoPictureMXFWriter::start (uint8_t* data, int size) FrameInfo StereoPictureMXFWriter::write (uint8_t* data, int size) { - assert (!_finalized); + DCP_ASSERT (!_finalized); if (!_started) { start (data, size); @@ -95,8 +96,8 @@ StereoPictureMXFWriter::write (uint8_t* data, int size) void StereoPictureMXFWriter::fake_write (int size) { - assert (_started); - assert (!_finalized); + DCP_ASSERT (_started); + DCP_ASSERT (!_finalized); Kumu::Result_t r = _state->mxf_writer.FakeWriteFrame (size, _next_eye == EYE_LEFT ? ASDCP::JP2K::SP_LEFT : ASDCP::JP2K::SP_RIGHT); if (ASDCP_FAILURE (r)) { diff --git a/src/subtitle_content.cc b/src/subtitle_content.cc index 1b5e6a1b..5e7c5b25 100644 --- a/src/subtitle_content.cc +++ b/src/subtitle_content.cc @@ -24,6 +24,7 @@ #include "font.h" #include "text.h" #include "subtitle_string.h" +#include "dcp_assert.h" #include "AS_DCP.h" #include "KM_util.h" #include <libxml++/nodes/element.h> @@ -121,8 +122,8 @@ SubtitleContent::maybe_add_subtitle (string text, ParseState const & parse_state return; } - assert (!parse_state.text_nodes.empty ()); - assert (!parse_state.subtitle_nodes.empty ()); + DCP_ASSERT (!parse_state.text_nodes.empty ()); + DCP_ASSERT (!parse_state.subtitle_nodes.empty ()); dcp::Font effective_font (parse_state.font_nodes); dcp::Text effective_text (*parse_state.text_nodes.back ()); diff --git a/src/util.cc b/src/util.cc index 58eacbfb..ac067a76 100644 --- a/src/util.cc +++ b/src/util.cc @@ -27,6 +27,7 @@ #include "argb_frame.h" #include "certificates.h" #include "xyz_frame.h" +#include "dcp_assert.h" #include "compose.hpp" #include "KM_util.h" #include "KM_fileio.h" @@ -154,7 +155,7 @@ dcp::content_kind_to_string (ContentKind kind) return "advertisement"; } - assert (false); + DCP_ASSERT (false); } /** Convert a string from a <ContentKind> node to a libdcp ContentKind. @@ -189,7 +190,7 @@ dcp::content_kind_from_string (string kind) return ADVERTISEMENT; } - assert (false); + DCP_ASSERT (false); } /** Decompress a JPEG2000 image to a bitmap. diff --git a/src/xyz_frame.cc b/src/xyz_frame.cc index cba90883..48098361 100644 --- a/src/xyz_frame.cc +++ b/src/xyz_frame.cc @@ -22,7 +22,7 @@ */ #include "xyz_frame.h" -#include <cassert> +#include "dcp_assert.h" #include <stdexcept> using namespace dcp; @@ -31,7 +31,7 @@ using namespace dcp; XYZFrame::XYZFrame (opj_image_t* image) : _opj_image (image) { - assert (_opj_image->numcomps == 3); + DCP_ASSERT (_opj_image->numcomps == 3); } /** Construct a new XYZFrame with undefined contents. @@ -77,7 +77,7 @@ XYZFrame::~XYZFrame () int * XYZFrame::data (int c) const { - assert (c >= 0 && c < 3); + DCP_ASSERT (c >= 0 && c < 3); return _opj_image->comps[c].data; } |
