diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/map/map.hpp | 7 | ||||
-rw-r--r-- | include/mbgl/platform/event.hpp | 6 | ||||
-rw-r--r-- | include/mbgl/platform/log.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/text/collision.hpp | 1 | ||||
-rw-r--r-- | include/mbgl/util/uv-worker.h | 3 | ||||
-rw-r--r-- | include/mbgl/util/uv_detail.hpp | 25 |
6 files changed, 35 insertions, 9 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 7e4687ea6f..ab9775a8c9 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -146,10 +146,15 @@ public: private: // uv async callbacks +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 static void render(uv_async_t *async, int status); static void terminate(uv_async_t *async, int status); static void cleanup(uv_async_t *async, int status); - static void delete_async(uv_handle_t *handle, int status); +#else + static void render(uv_async_t *async); + static void terminate(uv_async_t *async); + static void cleanup(uv_async_t *async); +#endif // Setup void setup(); diff --git a/include/mbgl/platform/event.hpp b/include/mbgl/platform/event.hpp index d2a06618a3..0405cddfad 100644 --- a/include/mbgl/platform/event.hpp +++ b/include/mbgl/platform/event.hpp @@ -57,11 +57,13 @@ struct EventPermutation { } }; -constexpr EventSeverity disabledEventSeverities[] = { #if !DEBUG +constexpr EventSeverity disabledEventSeverities[] = { EventSeverity::Debug, -#endif }; +#else +constexpr EventSeverity *disabledEventSeverities = nullptr; +#endif constexpr Event disabledEvents[] = { diff --git a/include/mbgl/platform/log.hpp b/include/mbgl/platform/log.hpp index dc000b4d52..bcb6d79224 100644 --- a/include/mbgl/platform/log.hpp +++ b/include/mbgl/platform/log.hpp @@ -21,7 +21,7 @@ class Log { private: template <typename T> constexpr static bool includes(const T e, T const *l, const size_t i = 0) { - return i >= sizeof l ? false : *(l + i) == e ? true : includes(e, l, i + 1); + return l == nullptr ? false : i >= sizeof l ? false : *(l + i) == e ? true : includes(e, l, i + 1); } public: diff --git a/include/mbgl/text/collision.hpp b/include/mbgl/text/collision.hpp index 8eec30f216..b7ee6b4520 100644 --- a/include/mbgl/text/collision.hpp +++ b/include/mbgl/text/collision.hpp @@ -5,6 +5,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wunused-variable" #ifdef __clang__ #pragma GCC diagnostic ignored "-Wdeprecated-register" #else diff --git a/include/mbgl/util/uv-worker.h b/include/mbgl/util/uv-worker.h index 451b6fb04d..cb2075d1c3 100644 --- a/include/mbgl/util/uv-worker.h +++ b/include/mbgl/util/uv-worker.h @@ -5,8 +5,7 @@ extern "C" { #endif -typedef struct uv_messenger_s uv_messenger_t; - +#include <mbgl/util/uv-messenger.h> #include <mbgl/util/uv-channel.h> #include <stdlib.h> diff --git a/include/mbgl/util/uv_detail.hpp b/include/mbgl/util/uv_detail.hpp index a80423f822..f80ca1bff5 100644 --- a/include/mbgl/util/uv_detail.hpp +++ b/include/mbgl/util/uv_detail.hpp @@ -23,13 +23,32 @@ private: class loop { public: - inline loop() : l(uv_loop_new()) {} - inline ~loop() { uv_loop_delete(l); } + inline loop() { +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + l = uv_loop_new(); + if (l == nullptr) { +#else + l = new uv_loop_t; + if (uv_loop_init(&l) != 0) { +#endif + throw std::runtime_error("failed to initialize loop"); + } + } + + inline ~loop() { +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + uv_loop_delete(l); +#else + uv_loop_close(l); + delete l; +#endif + + } inline uv_loop_t *operator*() { return l; } private: - uv_loop_t *l; + uv_loop_t *l = nullptr; }; class mutex { |