Various OSX warnings fixes.
authorCarl Hetherington <cth@carlh.net>
Sun, 26 Jul 2020 19:29:43 +0000 (21:29 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 26 Jul 2020 19:30:59 +0000 (21:30 +0200)
16 files changed:
src/lib/cross.h
src/lib/cross_osx.cc
src/lib/encode_server.cc
src/lib/j2k_encoder.cc
src/lib/json_server.cc
src/lib/render_text.cc
src/lib/util.cc
src/lib/wscript
src/tools/dcpomatic.cc
src/tools/dcpomatic_disk.cc
src/tools/dcpomatic_disk_writer.cc
src/tools/dcpomatic_kdm.cc
src/tools/dcpomatic_player.cc
src/tools/dcpomatic_playlist.cc
src/wx/gl_video_view.cc
wscript

index 4d3d2b2c79f21ca7891d0383a3912a68bea1cc44..64cb2e6b83f5bb8952fb1d2c4c10d629e7515385 100644 (file)
 class Log;
 struct AVIOContext;
 
-void dcpomatic_sleep_seconds (int);
-void dcpomatic_sleep_milliseconds (int);
+extern void dcpomatic_sleep_seconds (int);
+extern void dcpomatic_sleep_milliseconds (int);
 extern std::string cpu_info ();
 extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path);
 extern std::list<std::pair<std::string, std::string> > mount_info ();
 extern boost::filesystem::path openssl_path ();
+extern void make_foreground_application ();
 #ifdef DCPOMATIC_DISK
 extern boost::filesystem::path disk_writer_path ();
 #endif
index 574cc8660887b059185dc5d120fa18fb6d114af7..aa05df01688b4ab9c49314a661d5e26feec8fa2a 100644 (file)
@@ -24,6 +24,7 @@
 #include "dcpomatic_log.h"
 #include "config.h"
 #include "exceptions.h"
+#include "warnings.h"
 #include <dcp/raw_convert.h>
 #include <glib.h>
 extern "C" {
@@ -35,6 +36,7 @@ extern "C" {
 #if BOOST_VERSION >= 106100
 #include <boost/dll/runtime_symbol_info.hpp>
 #endif
+#include <ApplicationServices/ApplicationServices.h>
 #include <sys/sysctl.h>
 #include <mach-o/dyld.h>
 #include <IOKit/pwr_mgt/IOPMLib.h>
@@ -180,10 +182,7 @@ Waker::nudge ()
 Waker::Waker ()
 {
        boost::mutex::scoped_lock lm (_mutex);
-       /* We should use this */
-        // IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
-       /* but it's not available on 10.5, so we use this */
-        IOPMAssertionCreate (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &_assertion_id);
+       IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
 }
 
 Waker::~Waker ()
@@ -566,3 +565,14 @@ disk_write_finished ()
 
 }
 
+
+void
+make_foreground_application ()
+{
+       ProcessSerialNumber serial;
+DCPOMATIC_DISABLE_WARNINGS
+       GetCurrentProcess (&serial);
+DCPOMATIC_ENABLE_WARNINGS
+       TransformProcessType (&serial, kProcessTransformToForegroundApplication);
+}
+
index 61e0b09c58f1a340460791c02c7ead7aef417b8a..c30fc8f30323ae52682682e2332c9fcb0e09300a 100644 (file)
@@ -239,9 +239,11 @@ EncodeServer::run ()
        }
 
        for (int i = 0; i < _num_threads; ++i) {
-               boost::thread* t = _worker_threads.create_thread (bind(&EncodeServer::worker_thread, this));
 #ifdef DCPOMATIC_LINUX
+               boost::thread* t = _worker_threads.create_thread (bind(&EncodeServer::worker_thread, this));
                pthread_setname_np (t->native_handle(), "encode-server-worker");
+#else
+               _worker_threads.create_thread (bind(&EncodeServer::worker_thread, this));
 #endif
        }
 
index 49805007394467ecee4836aa95c85c39ce92fa13..d8d8209c91145f78f2039f84ec1f9fb009df0a5c 100644 (file)
@@ -389,11 +389,15 @@ J2KEncoder::servers_list_changed ()
 
        if (!Config::instance()->only_servers_encode ()) {
                for (int i = 0; i < Config::instance()->master_encoding_threads (); ++i) {
-                       boost::thread* t = _threads->create_thread(boost::bind(&J2KEncoder::encoder_thread, this, optional<EncodeServerDescription>()));
 #ifdef DCPOMATIC_LINUX
+                       boost::thread* t = _threads->create_thread(boost::bind(&J2KEncoder::encoder_thread, this, optional<EncodeServerDescription>()));
                        pthread_setname_np (t->native_handle(), "encode-worker");
 #endif
+#ifdef DCPOMATIC_OSX
+                       _threads->create_thread(boost::bind(&J2KEncoder::encoder_thread, this, optional<EncodeServerDescription>()));
+#endif
 #ifdef DCPOMATIC_WINDOWS
+                       boost::thread* t = _threads->create_thread(boost::bind(&J2KEncoder::encoder_thread, this, optional<EncodeServerDescription>()));
                        if (windows_xp) {
                                SetThreadAffinityMask (t->native_handle(), 1 << i);
                        }
index 3f43a75eb8ee332a53d0a1bac1cb0e2ecc6e1dd0..4cff27b6f60a71e6439432cf8ce1650262d03a6a 100644 (file)
@@ -52,9 +52,11 @@ enum State {
 
 JSONServer::JSONServer (int port)
 {
-       thread* t = new thread (boost::bind (&JSONServer::run, this, port));
 #ifdef DCPOMATIC_LINUX
+       thread* t = new thread (boost::bind (&JSONServer::run, this, port));
        pthread_setname_np (t->native_handle(), "json-server");
+#else
+       new thread (boost::bind (&JSONServer::run, this, port));
 #endif
 }
 
index de33f9380b1b09dfd4a9cde380874aba93e9251f..b0a958c16d194cd15b0a65d5ec72030a29a8f519 100644 (file)
 #include "cross.h"
 #include "font.h"
 #include "dcpomatic_assert.h"
+#include "warnings.h"
 #include <dcp/raw_convert.h>
 #include <fontconfig/fontconfig.h>
 #include <cairomm/cairomm.h>
+DCPOMATIC_DISABLE_WARNINGS
 #include <pangomm.h>
+DCPOMATIC_ENABLE_WARNINGS
 #include <pango/pangocairo.h>
 #ifndef DCPOMATIC_HAVE_SHOW_IN_CAIRO_CONTEXT
 #include <pango/pangocairo.h>
index 91a8ecb6e6e5c5e17f0647ea181e574bb97c26b6..b6ca34d22d2a136f74a83385d7c608ad1b164ffb 100644 (file)
@@ -66,7 +66,9 @@ extern "C" {
 #include <boost/range/algorithm/replace_if.hpp>
 #include <boost/thread.hpp>
 #include <boost/filesystem.hpp>
+DCPOMATIC_DISABLE_WARNINGS
 #include <boost/locale.hpp>
+DCPOMATIC_ENABLE_WARNINGS
 #ifdef DCPOMATIC_WINDOWS
 #include <boost/locale.hpp>
 #include <dbghelp.h>
index c2dfb55d87d32880dabaf5f1a8e36b66e923d88a..0c9cddfa44456db8f352f5d24e208a49059f075e 100644 (file)
@@ -206,7 +206,7 @@ def build(bld):
                  """
 
     if bld.env.TARGET_OSX:
-        obj.framework = ['IOKit', 'Foundation', 'DiskArbitration']
+        obj.framework = ['IOKit', 'Foundation', 'DiskArbitration', 'ApplicationServices']
 
     obj.source = sources + ' version.cc'
 
index 9cd99a265f553b9e51f39a600e20dbe340a0a9a7..75b4025aa554ef2d7956e77fd51fb612c66c3bfc 100644 (file)
@@ -98,9 +98,6 @@
 #ifdef __WXMSW__
 #include <shellapi.h>
 #endif
-#ifdef __WXOSX__
-#include <ApplicationServices/ApplicationServices.h>
-#endif
 #include <boost/filesystem.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/foreach.hpp>
@@ -1548,10 +1545,9 @@ private:
                        unsetenv ("UBUNTU_MENUPROXY");
 #endif
 
-#ifdef __WXOSX__
-                       ProcessSerialNumber serial;
-                       GetCurrentProcess (&serial);
-                       TransformProcessType (&serial, kProcessTransformToForegroundApplication);
+#ifdef DCPOMATIC_OSX
+                       dcpomatic_sleep_seconds (1);
+                       make_foreground_application ();
 #endif
 
                        dcpomatic_setup_path_encoding ();
index 6d87273031fb8590721e082fada9ce71b3735bca..55f2bd4401a0461aa4ba874efc3ee7ecd2784ad3 100644 (file)
@@ -41,7 +41,6 @@
 #include <boost/process/windows.hpp>
 #endif
 #ifdef DCPOMATIC_OSX
-#include <ApplicationServices/ApplicationServices.h>
 #include <notify.h>
 #endif
 
@@ -317,10 +316,8 @@ public:
                        unsetenv ("UBUNTU_MENUPROXY");
 #endif
 
-#ifdef __WXOSX__
-                       ProcessSerialNumber serial;
-                       GetCurrentProcess (&serial);
-                       TransformProcessType (&serial, kProcessTransformToForegroundApplication);
+#ifdef DCPOMATIC_OSX
+                       make_foreground_application ();
 #endif
 
                        dcpomatic_setup_path_encoding ();
index 66d38ec19b77ff8a32f35b53b9c3a3f36d4ab0be..1e6d10fbf24af275eb5d2db0269ef9f5d93f8ae7 100644 (file)
@@ -27,6 +27,7 @@
 #include "lib/file_log.h"
 #include "lib/dcpomatic_log.h"
 #include "lib/nanomsg.h"
+#include "lib/warnings.h"
 extern "C" {
 #include <lwext4/ext4_mbr.h>
 #include <lwext4/ext4_fs.h>
@@ -66,7 +67,10 @@ extern "C" {
 }
 #endif
 
+DCPOMATIC_DISABLE_WARNINGS
 #include <glibmm.h>
+DCPOMATIC_ENABLE_WARNINGS
+
 #include <unistd.h>
 #include <sys/types.h>
 #include <boost/filesystem.hpp>
index 117e756c72e93df587b325817fd181e9ec03f2f7..84573797e996b1b043a8569a389edee626962707 100644 (file)
@@ -718,10 +718,8 @@ private:
                        unsetenv ("UBUNTU_MENUPROXY");
 #endif
 
-#ifdef __WXOSX__
-                       ProcessSerialNumber serial;
-                       GetCurrentProcess (&serial);
-                       TransformProcessType (&serial, kProcessTransformToForegroundApplication);
+#ifdef DCPOMATIC_OSX
+                       make_foreground_application ();
 #endif
 
                        dcpomatic_setup_path_encoding ();
index 67a06aec4f452b1dabde3f2166c73a3d54ba7a46..17f6526257c2a01e6e4d03b5c824d969e2ddb367 100644 (file)
@@ -73,9 +73,6 @@
 #ifdef __WXGTK__
 #include <X11/Xlib.h>
 #endif
-#ifdef __WXOSX__
-#include <ApplicationServices/ApplicationServices.h>
-#endif
 #include <boost/bind.hpp>
 #include <boost/algorithm/string.hpp>
 #include <iostream>
@@ -1156,10 +1153,8 @@ private:
                        unsetenv ("UBUNTU_MENUPROXY");
 #endif
 
-#ifdef __WXOSX__
-                       ProcessSerialNumber serial;
-                       GetCurrentProcess (&serial);
-                       TransformProcessType (&serial, kProcessTransformToForegroundApplication);
+#ifdef DCPOMATIC_OSX
+                       make_foreground_application ();
 #endif
 
                        dcpomatic_setup_path_encoding ();
index 04950028af6dcfaec08a5ed663ebe4fb4f1391eb..b2b5c458a915b96dd263bf0882658009757f1ff1 100644 (file)
@@ -36,9 +36,6 @@
 #include <wx/imaglist.h>
 #include <wx/spinctrl.h>
 #include <wx/preferences.h>
-#ifdef __WXOSX__
-#include <ApplicationServices/ApplicationServices.h>
-#endif
 #include <boost/foreach.hpp>
 
 using std::exception;
@@ -585,10 +582,8 @@ private:
                unsetenv ("UBUNTU_MENUPROXY");
 #endif
 
-#ifdef __WXOSX__
-               ProcessSerialNumber serial;
-               GetCurrentProcess (&serial);
-               TransformProcessType (&serial, kProcessTransformToForegroundApplication);
+#ifdef DCPOMATIC_OSX
+               make_foreground_application ();
 #endif
 
                dcpomatic_setup_path_encoding ();
index 786cee84a3a1afd9a8c19fc19640c7fc5ca433c6..a87249fafdd73d637bfc4649e36ea8137e32a0c3 100644 (file)
@@ -180,7 +180,9 @@ GLVideoView::draw (Position<int> inter_position, dcp::Size inter_size)
        glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();
 
+DCPOMATIC_DISABLE_WARNINGS
        gluOrtho2D (0, canvas_size.GetWidth(), canvas_size.GetHeight(), 0);
+DCPOMATIC_ENABLE_WARNINGS
        check_gl_error ("gluOrtho2d");
        glMatrixMode (GL_MODELVIEW);
        glLoadIdentity ();
diff --git a/wscript b/wscript
index b0faa848393571959fbde0eff1c65d8168107765..b1e2096d4989df154f10164339cf51e55fe1f008 100644 (file)
--- a/wscript
+++ b/wscript
@@ -322,7 +322,7 @@ def configure(conf):
         if conf.options.workaround_gssapi:
             conf.env.LIB_SSH = ['gssapi_krb5']
     else:
-        conf.check_cc(fragment="""
+        conf.check_cxx(fragment="""
                                #include <libssh/libssh.h>\n
                                int main () {\n
                                ssh_new ();\n
@@ -501,7 +501,7 @@ def configure(conf):
 
         conf.check_cxx(fragment="""
                            #include <boost/thread.hpp>\n
-                           int main() { boost::thread t (); }\n
+                           int main() { boost::thread t; }\n
                            """,
                        msg='Checking for boost threading library',
                        libpath='/usr/local/lib',