Try to fix compile warning on OS X.
[libdcp.git] / src / util.cc
index 0c3cea08251e09030b40ffef1ce0910c8a3cf2f3..ac2246c30f851c0abb99146180e43eb6f9eb6a77 100644 (file)
@@ -42,6 +42,7 @@
 #include "openjpeg_image.h"
 #include "dcp_assert.h"
 #include "compose.hpp"
+#include <openjpeg.h>
 #include <asdcp/KM_util.h>
 #include <asdcp/KM_fileio.h>
 #include <asdcp/AS_DCP.h>
@@ -243,22 +244,8 @@ dcp::init ()
        if (xmlSecCryptoInit() < 0) {
                throw MiscError ("could not initialise xmlsec-crypto");
        }
-}
 
-bool dcp::operator== (dcp::Size const & a, dcp::Size const & b)
-{
-       return (a.width == b.width && a.height == b.height);
-}
-
-bool dcp::operator!= (dcp::Size const & a, dcp::Size const & b)
-{
-       return !(a == b);
-}
-
-ostream& dcp::operator<< (ostream& s, dcp::Size const & a)
-{
-       s << a.width << "x" << a.height;
-       return s;
+       OpenSSL_add_all_algorithms();
 }
 
 /** Decode a base64 string.  The base64 decode routine in KM_util.cpp
@@ -353,7 +340,7 @@ dcp::file_to_string (boost::filesystem::path p, uintmax_t max_length)
 {
        uintmax_t len = boost::filesystem::file_size (p);
        if (len > max_length) {
-               throw MiscError ("Unexpectedly long file");
+               throw MiscError (String::compose ("Unexpectedly long file (%1)", p.string()));
        }
 
        FILE* f = fopen_boost (p, "r");
@@ -413,3 +400,9 @@ dcp::remove_urn_uuid (string raw)
        DCP_ASSERT (raw.substr(0, 9) == "urn:uuid:");
        return raw.substr (9);
 }
+
+string
+dcp::openjpeg_version ()
+{
+       return opj_version ();
+}