Purge assert() from src/, at least (not asdcplib).
authorCarl Hetherington <cth@carlh.net>
Sun, 28 Dec 2014 01:15:24 +0000 (01:15 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 28 Dec 2014 01:15:24 +0000 (01:15 +0000)
22 files changed:
src/asset.cc
src/certificates.cc
src/cpl.cc
src/dcp.cc
src/dcp_assert.h [new file with mode: 0644]
src/decrypted_kdm.cc
src/exceptions.cc
src/exceptions.h
src/file.cc
src/mono_picture_mxf.cc
src/mono_picture_mxf_writer.cc
src/mxf.cc
src/mxf_writer.cc
src/reel_mxf_asset.cc
src/reel_picture_asset.cc
src/rgb_xyz.cc
src/sound_mxf_writer.cc
src/stereo_picture_mxf.cc
src/stereo_picture_mxf_writer.cc
src/subtitle_content.cc
src/util.cc
src/xyz_frame.cc

index 2ca58a62178bf6e33f5cb2981f358c81070a16a1..e2dcc0f60eea51259a17fdc61970d8350ddca3db 100644 (file)
@@ -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);
index 601662ea1c0009ac8aa7192d04b5cfc15a92d112..da8f39c739caf6f1cb8e20e5773184d372cfd064 100644 (file)
@@ -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 ();
 }
 
index d7f3a79a80cb8c5e44fc17c9b9d93bcb07f58ed7..b5b4d7152601de2ed84591507abfdc81e4323903 100644 (file)
@@ -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);
        }
 }
        
index b1443e1ada0cc03c5c5b5f5326d20e8b44e99cfe..ea55454a3ac282ac7160bff4cb3683190485a42f 100644 (file)
 #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 (file)
index 0000000..fa1ab8e
--- /dev/null
@@ -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__);
index 02515fe879a3079488e91c8096e79dc7d86f8f2a..5f374dc7d8083863c7c4fe80bec7215c3679f196 100644 (file)
@@ -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;
index b31974d47c3cddb4023684ceb3bb3c72290e33b6..4045021c953680b1f896e6814432be1c449a83fa 100644 (file)
@@ -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))
+{
+
+}
index fd7c7618b3fa2c65a905ceecf9cf9502820052b9..9b2617eee3d7c85d1b39595ffbc1d09dad177233 100644 (file)
@@ -166,6 +166,12 @@ public:
        ~NotEncryptedError () throw () {}
 };
        
+class ProgrammingError : public StringError
+{
+public:
+       ProgrammingError (std::string file, int line);
+};
+
 }
 
 #endif
index f4a91add29be8441c5f3e9ab2fc11ac916b9aa2c..f2915947812ec0f5368cb967c0e7d5c96eb9ab98 100644 (file)
@@ -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);
 }
index 66cfa12cba3a402b30fde50f800f393873bddc97..57a0d0a93cf2210b88cf1f3a91b8bde249f149b2 100644 (file)
@@ -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()) {
index 5cc424e1572e28907c4ba2bfb959a9f8a50b05b1..01292876a0ef0438469b8719134cb7c9d4341e5d 100644 (file)
@@ -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)) {
index 2de3fb4a0e640f28751e3ef4d8c0b8d81404162a..6707b63843f68695883ae04d47069bbc1681a4d3 100644 (file)
@@ -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);
        }
 }
index 2172077228c1823262be7d3bfb2aa4398e718f3a..93f3ab071af9889be729accec70b9edb7c79478f 100644 (file)
@@ -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;
 }
index 8395376e1598eeabefba0df58898b576b410bc32..9d7c1fada363d66737cbf9fe1de6677d96d057c1 100644 (file)
@@ -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);
index 1fbd635b78e825b096f03ff9388d460c4f7c5f1d..5cf2b858716a928129a248d2833899bb05235966 100644 (file)
@@ -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) {
index de8d484abdaa5576d41f8ffa8710d0d3f672b8fa..35332fc2baa969d6b728a975ac7ddeeda4103ae8 100644 (file)
@@ -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;
index 51ba7e404a918b6f1dc4ac2d968d457b82ed87db..52547b16b973f589424cea6d54bbda0b88ec9fb1 100644 (file)
@@ -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())) {
index 726b0feeea052365b33426ae2e40de5f43a5d328..1c8fa6180949696e0553bf827511879d10a84fd4 100644 (file)
@@ -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);
index 4f98c60e3d70ef95e0b1c53dc1223758141bd065..2c0468f6956d5e341465dfaa5a7c87c0df6694e2 100644 (file)
@@ -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)) {
index 1b5e6a1b2e32447c0295a788682846d6fdb7852b..5e7c5b257001b666e5c415596df9f32a744a66bd 100644 (file)
@@ -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 ());
index 58eacbfbca1cc0b7847db8d85a601652a8dd9131..ac067a7670233f32581c178d6cf896b553a58dc7 100644 (file)
@@ -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 &lt;ContentKind&gt; 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.
index cba908836ad0b5126d884756cf370a9b84285cf4..480983618f6781f6cd75b596a52dda075ae700ba 100644 (file)
@@ -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;
 }