diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-07-26 21:29:43 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-07-26 21:30:59 +0200 |
| commit | 6eba051dcbb8c56e3e2efea946ce0380d17a7b33 (patch) | |
| tree | 3749c9cb5cbd8be4b14936978e13b889ffcc73a3 | |
| parent | 2e0cf721530a17b0190c938b04176e0315950053 (diff) | |
Various OSX warnings fixes.
| -rw-r--r-- | src/lib/cross.h | 5 | ||||
| -rw-r--r-- | src/lib/cross_osx.cc | 18 | ||||
| -rw-r--r-- | src/lib/encode_server.cc | 4 | ||||
| -rw-r--r-- | src/lib/j2k_encoder.cc | 6 | ||||
| -rw-r--r-- | src/lib/json_server.cc | 4 | ||||
| -rw-r--r-- | src/lib/render_text.cc | 3 | ||||
| -rw-r--r-- | src/lib/util.cc | 2 | ||||
| -rw-r--r-- | src/lib/wscript | 2 | ||||
| -rw-r--r-- | src/tools/dcpomatic.cc | 10 | ||||
| -rw-r--r-- | src/tools/dcpomatic_disk.cc | 7 | ||||
| -rw-r--r-- | src/tools/dcpomatic_disk_writer.cc | 4 | ||||
| -rw-r--r-- | src/tools/dcpomatic_kdm.cc | 6 | ||||
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 9 | ||||
| -rw-r--r-- | src/tools/dcpomatic_playlist.cc | 9 | ||||
| -rw-r--r-- | src/wx/gl_video_view.cc | 2 | ||||
| -rw-r--r-- | wscript | 4 |
16 files changed, 53 insertions, 42 deletions
diff --git a/src/lib/cross.h b/src/lib/cross.h index 4d3d2b2c7..64cb2e6b8 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -40,12 +40,13 @@ 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 diff --git a/src/lib/cross_osx.cc b/src/lib/cross_osx.cc index 574cc8660..aa05df016 100644 --- a/src/lib/cross_osx.cc +++ b/src/lib/cross_osx.cc @@ -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); +} + diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc index 61e0b09c5..c30fc8f30 100644 --- a/src/lib/encode_server.cc +++ b/src/lib/encode_server.cc @@ -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 } diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index 498050073..d8d8209c9 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -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); } diff --git a/src/lib/json_server.cc b/src/lib/json_server.cc index 3f43a75eb..4cff27b6f 100644 --- a/src/lib/json_server.cc +++ b/src/lib/json_server.cc @@ -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 } diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc index de33f9380..b0a958c16 100644 --- a/src/lib/render_text.cc +++ b/src/lib/render_text.cc @@ -24,10 +24,13 @@ #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> diff --git a/src/lib/util.cc b/src/lib/util.cc index 91a8ecb6e..b6ca34d22 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -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> diff --git a/src/lib/wscript b/src/lib/wscript index c2dfb55d8..0c9cddfa4 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -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' diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 9cd99a265..75b4025aa 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -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 (); diff --git a/src/tools/dcpomatic_disk.cc b/src/tools/dcpomatic_disk.cc index 6d8727303..55f2bd440 100644 --- a/src/tools/dcpomatic_disk.cc +++ b/src/tools/dcpomatic_disk.cc @@ -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 (); diff --git a/src/tools/dcpomatic_disk_writer.cc b/src/tools/dcpomatic_disk_writer.cc index 66d38ec19..1e6d10fbf 100644 --- a/src/tools/dcpomatic_disk_writer.cc +++ b/src/tools/dcpomatic_disk_writer.cc @@ -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> diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 117e756c7..84573797e 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -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 (); diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 67a06aec4..17f652625 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -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 (); diff --git a/src/tools/dcpomatic_playlist.cc b/src/tools/dcpomatic_playlist.cc index 04950028a..b2b5c458a 100644 --- a/src/tools/dcpomatic_playlist.cc +++ b/src/tools/dcpomatic_playlist.cc @@ -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 (); diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index 786cee84a..a87249faf 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -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 (); @@ -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', |
