Work around symbol clash with ERROR on Win32/mingw.
authorCarl Hetherington <cth@carlh.net>
Fri, 13 Jun 2014 11:51:48 +0000 (12:51 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 13 Jun 2014 11:51:48 +0000 (12:51 +0100)
12 files changed:
src/asset.cc
src/content.cc
src/cpl.cc
src/dcp.cc
src/mono_picture_mxf.cc
src/mxf.cc
src/picture_mxf.cc
src/reel.cc
src/sound_mxf.cc
src/subtitle_content.h
src/types.h
tools/dcpdiff.cc

index 6bf8fec5dcc1fc70dc65596d8df381e9b5d859b3..80b010825b57eb95f72acf39d801bc2a9185fef2 100644 (file)
@@ -106,7 +106,7 @@ bool
 Asset::equals (boost::shared_ptr<const Asset> other, EqualityOptions, function<void (NoteType, string)> note) const
 {
        if (_hash != other->_hash) {
-               note (ERROR, "Asset hashes differ");
+               note (DCP_ERROR, "Asset hashes differ");
                return false;
        }
 
index 50db005aaa3a55a8b0e1da5ed76769a33f75ea45..007d5cbcad3f5f6ff0fa3621973eea47b0bab011 100644 (file)
@@ -27,9 +27,6 @@
 #include <boost/function.hpp>
 #include <iostream>
 
-/* We need this here for the #undef ERROR for Windows */
-#include "types.h"
-
 using namespace std;
 using namespace boost;
 using namespace dcp;
@@ -57,12 +54,12 @@ Content::equals (shared_ptr<const Content> other, EqualityOptions opt, boost::fu
        }
        
        if (_edit_rate != other->_edit_rate) {
-               note (ERROR, "content edit rates differ");
+               note (DCP_ERROR, "content edit rates differ");
                return false;
        }
        
        if (_intrinsic_duration != other->_intrinsic_duration) {
-               note (ERROR, "asset intrinsic durations differ");
+               note (DCP_ERROR, "asset intrinsic durations differ");
                return false;
        }
 
index fcfa9efac37e5006b799ca6672d672d228df2197..535fd77f65d7ba2611d8a0915b5ec6631d94cde7 100644 (file)
@@ -179,17 +179,17 @@ CPL::equals (CPL const & other, EqualityOptions opt, boost::function<void (NoteT
        if (_annotation_text != other._annotation_text && !opt.cpl_annotation_texts_can_differ) {
                stringstream s;
                s << "annotation texts differ: " << _annotation_text << " vs " << other._annotation_text << "\n";
-               note (ERROR, s.str ());
+               note (DCP_ERROR, s.str ());
                return false;
        }
 
        if (_content_kind != other._content_kind) {
-               note (ERROR, "content kinds differ");
+               note (DCP_ERROR, "content kinds differ");
                return false;
        }
 
        if (_reels.size() != other._reels.size()) {
-               note (ERROR, String::compose ("reel counts differ (%1 vs %2)", _reels.size(), other._reels.size()));
+               note (DCP_ERROR, String::compose ("reel counts differ (%1 vs %2)", _reels.size(), other._reels.size()));
                return false;
        }
        
index a7c6869d55eb183f31f2ca13293dd139dc5d09f0..96798751ab3641da6511ab1015494797d126e40c 100644 (file)
@@ -172,7 +172,7 @@ bool
 DCP::equals (DCP const & other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
 {
        if (_assets.size() != other._assets.size()) {
-               note (ERROR, String::compose ("Asset counts differ: %1 vs %2", _assets.size(), other._assets.size()));
+               note (DCP_ERROR, String::compose ("Asset counts differ: %1 vs %2", _assets.size(), other._assets.size()));
                return false;
        }
 
index 4af24008eb7d751e18bc91aad6a776776b9ee8c2..815d88207c34022fa1f25460aef1cf23049e8963 100644 (file)
@@ -107,7 +107,7 @@ MonoPictureMXF::equals (shared_ptr<const Content> other, EqualityOptions opt, bo
                        return false;
                }
                
-               note (PROGRESS, String::compose ("Comparing video frame %1 of %2", i, _intrinsic_duration));
+               note (DCP_PROGRESS, String::compose ("Comparing video frame %1 of %2", i, _intrinsic_duration));
                shared_ptr<const MonoPictureFrame> frame_A = get_frame (i);
                shared_ptr<const MonoPictureFrame> frame_B = other_picture->get_frame (i);
                
index dd4d2efcbb1b87c57636674c186650a82bd38f12..def53c15b9c21512965b5fcbf00ffec97b7813d8 100644 (file)
@@ -98,12 +98,12 @@ MXF::equals (shared_ptr<const Content> other, EqualityOptions opt, boost::functi
        
        shared_ptr<const MXF> other_mxf = dynamic_pointer_cast<const MXF> (other);
        if (!other_mxf) {
-               note (ERROR, "comparing an MXF asset with a non-MXF asset");
+               note (DCP_ERROR, "comparing an MXF asset with a non-MXF asset");
                return false;
        }
        
        if (_file != other_mxf->file ()) {
-               note (ERROR, "MXF names differ");
+               note (DCP_ERROR, "MXF names differ");
                if (!opt.mxf_names_can_differ) {
                        return false;
                }
index 4a8e477b33e1e59234adb2e4ea083e78ae7e4709..e3a43e378171f461815d269d7d16947eb60b5f9d 100644 (file)
@@ -94,12 +94,12 @@ PictureMXF::descriptor_equals (
 //             a.QuantizationDefault != b.QuantizationDefault
                ) {
                
-               note (ERROR, "video MXF picture descriptors differ");
+               note (DCP_ERROR, "video MXF picture descriptors differ");
                return false;
        }
 
        if (a.ContainerDuration != b.ContainerDuration) {
-               note (ERROR, "video container durations differ");
+               note (DCP_ERROR, "video container durations differ");
        }
        
 //             for (unsigned int j = 0; j < ASDCP::JP2K::MaxComponents; ++j) {
@@ -118,7 +118,7 @@ PictureMXF::frame_buffer_equals (
        ) const
 {
        if (size_A == size_B && memcmp (data_A, data_B, size_A) == 0) {
-               note (NOTE, "J2K identical");
+               note (DCP_NOTE, "J2K identical");
                /* Easy result; the J2K data is identical */
                return true;
        }
@@ -136,7 +136,7 @@ PictureMXF::frame_buffer_equals (
        for (int c = 0; c < 3; ++c) {
                
                if (image_A->size() != image_B->size()) {
-                       note (ERROR, String::compose ("image sizes for frame %1 differ", frame));
+                       note (DCP_ERROR, String::compose ("image sizes for frame %1 differ", frame));
                        return false;
                }
                
@@ -162,11 +162,11 @@ PictureMXF::frame_buffer_equals (
        
        double const std_dev = sqrt (double (total_squared_deviation) / abs_diffs.size());
        
-       note (NOTE, String::compose ("mean difference %1, deviation %2", mean, std_dev));
+       note (DCP_NOTE, String::compose ("mean difference %1, deviation %2", mean, std_dev));
        
        if (mean > opt.max_mean_pixel_error) {
                note (
-                       ERROR,
+                       DCP_ERROR,
                        String::compose ("mean %1 out of range %2 in frame %3", mean, opt.max_mean_pixel_error, frame)
                        );
                
@@ -175,7 +175,7 @@ PictureMXF::frame_buffer_equals (
 
        if (std_dev > opt.max_std_dev_pixel_error) {
                note (
-                       ERROR,
+                       DCP_ERROR,
                        String::compose ("standard deviation %1 out of range %2 in frame %3", std_dev, opt.max_std_dev_pixel_error, frame)
                        );
                
index 34b520b49365b08db4047ff46dc686f167f5545f..08a0c93626a23c91a4d712b40d4effebc72949c8 100644 (file)
@@ -98,7 +98,7 @@ bool
 Reel::equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
 {
        if ((_main_picture && !other->_main_picture) || (!_main_picture && other->_main_picture)) {
-               note (ERROR, "reel has different assets");
+               note (DCP_ERROR, "reel has different assets");
                return false;
        }
        
@@ -107,7 +107,7 @@ Reel::equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, boost::f
        }
 
        if ((_main_sound && !other->_main_sound) || (!_main_sound && other->_main_sound)) {
-               note (ERROR, "reel has different assets");
+               note (DCP_ERROR, "reel has different assets");
                return false;
        }
        
@@ -116,7 +116,7 @@ Reel::equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, boost::f
        }
 
        if ((_main_subtitle && !other->_main_subtitle) || (!_main_subtitle && other->_main_subtitle)) {
-               note (ERROR, "reel has different assets");
+               note (DCP_ERROR, "reel has different assets");
                return false;
        }
        
index fa48a6c1ad79fd64a652eae525f87efe4cdfb638..ff2167d9f54b4d2b3cd50ff9568276de10ac9694 100644 (file)
@@ -122,7 +122,7 @@ SoundMXF::equals (shared_ptr<const Content> other, EqualityOptions opt, boost::f
 //             desc_A.ChannelFormat != desc_B.ChannelFormat ||
                ) {
                
-               note (ERROR, "audio MXF picture descriptors differ");
+               note (DCP_ERROR, "audio MXF picture descriptors differ");
                return false;
        }
        
@@ -139,7 +139,7 @@ SoundMXF::equals (shared_ptr<const Content> other, EqualityOptions opt, boost::f
                }
                
                if (buffer_A.Size() != buffer_B.Size()) {
-                       note (ERROR, String::compose ("sizes of audio data for frame %1 differ", i));
+                       note (DCP_ERROR, String::compose ("sizes of audio data for frame %1 differ", i));
                        return false;
                }
                
@@ -147,7 +147,7 @@ SoundMXF::equals (shared_ptr<const Content> other, EqualityOptions opt, boost::f
                        for (uint32_t i = 0; i < buffer_A.Size(); ++i) {
                                int const d = abs (buffer_A.RoData()[i] - buffer_B.RoData()[i]);
                                if (d > opt.max_audio_sample_error) {
-                                       note (ERROR, String::compose ("PCM data difference of %1", d));
+                                       note (DCP_ERROR, String::compose ("PCM data difference of %1", d));
                                        return false;
                                }
                        }
index 2c606921b33b676b579089498bb36cc1d12cc378..1ddb9122427f78654ce084fd47e23f4a4d4b0bcc 100644 (file)
@@ -55,7 +55,7 @@ public:
                boost::function<void (NoteType, std::string)> note
                ) const {
                /* XXX */
-               note (ERROR, "subtitle content not compared yet");
+               note (DCP_ERROR, "subtitle content not compared yet");
                return true;
        }
 
index ece7d44c284bb547ee18764103947b887c7d8aa0..5ef04bd39caabd45bec65bd1267454b5906e51fc 100644 (file)
@@ -137,13 +137,13 @@ struct EqualityOptions
        bool mxf_names_can_differ;
 };
 
-/* Win32 defines this */       
-#undef ERROR
-
+/* I've been unable to make mingw happy with ERROR as a symbol, so
+   I'm using a DCP_ prefix here.
+*/
 enum NoteType {
-       PROGRESS,
-       ERROR,
-       NOTE
+       DCP_PROGRESS,
+       DCP_ERROR,
+       DCP_NOTE
 };
 
 enum Standard {
index e7b4f59f67b584868fb9919138761a0cf607d1ea..3f19ee24061e9e9f5e40f9d4278fc0b8003e61a6 100644 (file)
@@ -53,7 +53,7 @@ help (string n)
 void
 note (NoteType t, string n)
 {
-       if (t == ERROR || verbose) {
+       if (t == DCP_ERROR || verbose) {
                cout << " " << n << "\n";
        }
 }