diff options
author | Mike Morris <michael.patrick.morris@gmail.com> | 2015-10-13 14:27:09 -0400 |
---|---|---|
committer | Mike Morris <michael.patrick.morris@gmail.com> | 2015-10-14 11:36:28 -0400 |
commit | 62595a9b394547bffb8c2965b103bd87dd397e15 (patch) | |
tree | d97215f2b66d01d6dffa4252b1aa26e76b90f08d | |
parent | 5b9deae95709ea557f28e4a5dcbe3ac8fd47023e (diff) | |
download | qtlocation-mapboxgl-62595a9b394547bffb8c2965b103bd87dd397e15.tar.gz |
[core] bump libuv to 1.7.5 across all platforms
UV_ASYNC_PARAMS and UV_TIMER_PARAMS for libuv <= 0.10 compatibility
use st_mtim.tv_sec in libuv > 0.10.x
-rw-r--r-- | bin/render.cpp | 8 | ||||
-rw-r--r-- | platform/default/asset_request_fs.cpp | 4 | ||||
-rw-r--r-- | platform/default/http_request_curl.cpp | 30 | ||||
-rw-r--r-- | platform/node/src/node_map.cpp | 14 | ||||
-rw-r--r-- | platform/node/src/util/async_queue.hpp | 1 | ||||
-rw-r--r-- | scripts/android/configure.sh | 2 | ||||
-rw-r--r-- | scripts/ios/configure.sh | 2 | ||||
-rwxr-xr-x | scripts/ios/package.sh | 2 | ||||
-rw-r--r-- | scripts/linux/configure.sh | 2 | ||||
-rw-r--r-- | scripts/osx/configure.sh | 2 | ||||
-rw-r--r-- | src/mbgl/util/uv_detail.hpp | 22 | ||||
-rw-r--r-- | test/storage/http_error.cpp | 8 |
12 files changed, 52 insertions, 45 deletions
diff --git a/bin/render.cpp b/bin/render.cpp index b89ca256e4..685f3ddac4 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -24,6 +24,12 @@ namespace po = boost::program_options; #include <cstdlib> #include <iostream> +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +#define UV_ASYNC_PARAMS(handle) uv_async_t *handle, int +#else +#define UV_ASYNC_PARAMS(handle) uv_async_t *handle +#endif + int main(int argc, char *argv[]) { std::string style_path; double lat = 0, lon = 0; @@ -98,7 +104,7 @@ int main(int argc, char *argv[]) { } uv_async_t *async = new uv_async_t; - uv_async_init(uv_default_loop(), async, [](uv_async_t *as, int) { + uv_async_init(uv_default_loop(), async, [](UV_ASYNC_PARAMS(as)) { std::unique_ptr<const StillImage> image(reinterpret_cast<const StillImage *>(as->data)); uv_close(reinterpret_cast<uv_handle_t *>(as), [](uv_handle_t *handle) { delete reinterpret_cast<uv_async_t *>(handle); diff --git a/platform/default/asset_request_fs.cpp b/platform/default/asset_request_fs.cpp index 733e240fb9..9fc4e55de4 100644 --- a/platform/default/asset_request_fs.cpp +++ b/platform/default/asset_request_fs.cpp @@ -127,11 +127,15 @@ void AssetRequest::fileStated(uv_fs_t *req) { uv_fs_close(req->loop, req, self->fd, fileClosed); } else { self->response = std::make_unique<Response>(); +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 #ifdef __APPLE__ self->response->modified = stat->st_mtimespec.tv_sec; #else self->response->modified = stat->st_mtime; #endif +#else + self->response->modified = stat->st_mtim.tv_sec; +#endif self->response->etag = util::toString(stat->st_ino); const auto size = (unsigned int)(stat->st_size); self->response->data.resize(size); diff --git a/platform/default/http_request_curl.cpp b/platform/default/http_request_curl.cpp index 7ea9208556..307993876a 100644 --- a/platform/default/http_request_curl.cpp +++ b/platform/default/http_request_curl.cpp @@ -23,6 +23,12 @@ #include <cstring> #include <cstdio> +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +#define UV_TIMER_PARAMS(timer) uv_timer_t *timer, int +#else +#define UV_TIMER_PARAMS(timer) uv_timer_t *timer +#endif + void handleError(CURLMcode code) { if (code != CURLM_OK) { throw std::runtime_error(std::string("CURL multi error: ") + curl_multi_strerror(code)); @@ -54,11 +60,7 @@ public: static int handleSocket(CURL *handle, curl_socket_t s, int action, void *userp, void *socketp); static void perform(uv_poll_t *req, int status, int events); static int startTimeout(CURLM *multi, long timeout_ms, void *userp); -#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 - static void onTimeout(uv_timer_t *req, int status); -#else - static void onTimeout(uv_timer_t *req); -#endif + static void onTimeout(UV_TIMER_PARAMS(req)); CURL *getHandle(); void returnHandle(CURL *handle); @@ -102,11 +104,7 @@ private: static size_t writeCallback(void *const contents, const size_t size, const size_t nmemb, void *userp); void retry(uint64_t timeout) final; -#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 - static void restart(uv_timer_t *timer, int); -#else - static void restart(uv_timer_t *timer); -#endif + static void restart(UV_TIMER_PARAMS(timer)); void finish(ResponseStatus status); void start(); @@ -300,11 +298,7 @@ int HTTPCURLContext::handleSocket(CURL * /* handle */, curl_socket_t s, int acti return 0; } -#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 -void HTTPCURLContext::onTimeout(uv_timer_t *req, int /* status */) { -#else -void HTTPCURLContext::onTimeout(uv_timer_t *req) { -#endif +void HTTPCURLContext::onTimeout(UV_TIMER_PARAMS(req)) { assert(req->data); auto context = reinterpret_cast<HTTPCURLContext *>(req->data); MBGL_VERIFY_THREAD(context->tid); @@ -612,11 +606,7 @@ void HTTPCURLRequest::retry() { } } -#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 -void HTTPCURLRequest::restart(uv_timer_t *timer, int) { -#else -void HTTPCURLRequest::restart(uv_timer_t *timer) { -#endif +void HTTPCURLRequest::restart(UV_TIMER_PARAMS(timer)) { // Restart the request. auto baton = reinterpret_cast<HTTPCURLRequest *>(timer->data); diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index f1abf48066..bbc3e0658d 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -6,6 +6,12 @@ #include <unistd.h> +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +#define UV_ASYNC_PARAMS(handle) uv_async_t *handle, int +#else +#define UV_ASYNC_PARAMS(handle) uv_async_t *handle +#endif + namespace node_mbgl { struct NodeMap::RenderOptions { @@ -335,12 +341,8 @@ NodeMap::NodeMap(v8::Local<v8::Object> options) : async(new uv_async_t) { async->data = this; -#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 - uv_async_init(uv_default_loop(), async, [](uv_async_t *as, int) { -#else - uv_async_init(uv_default_loop(), async, [](uv_async_t *as) { -#endif - reinterpret_cast<NodeMap *>(as->data)->renderFinished(); + uv_async_init(uv_default_loop(), async, [](UV_ASYNC_PARAMS(handle)) { + reinterpret_cast<NodeMap *>(handle->data)->renderFinished(); }); // Make sure the async handle doesn't keep the loop alive. diff --git a/platform/node/src/util/async_queue.hpp b/platform/node/src/util/async_queue.hpp index 81319da8c7..b9081b3aeb 100644 --- a/platform/node/src/util/async_queue.hpp +++ b/platform/node/src/util/async_queue.hpp @@ -8,7 +8,6 @@ #include <queue> #include <string> - #if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 #define UV_ASYNC_PARAMS(handle) uv_async_t *handle, int #else diff --git a/scripts/android/configure.sh b/scripts/android/configure.sh index 1c952abfdb..54eccabd8f 100644 --- a/scripts/android/configure.sh +++ b/scripts/android/configure.sh @@ -6,7 +6,7 @@ OPENSSL_VERSION=1.0.1l LIBPNG_VERSION=1.6.16 JPEG_VERSION=v9a SQLITE_VERSION=3.8.8.1 -LIBUV_VERSION=1.4.0 +LIBUV_VERSION=1.7.5 ZLIB_VERSION=system NUNICODE_VERSION=1.5.1 LIBZIP_VERSION=0.11.2 diff --git a/scripts/ios/configure.sh b/scripts/ios/configure.sh index e86e355d0d..1c2513b7fc 100644 --- a/scripts/ios/configure.sh +++ b/scripts/ios/configure.sh @@ -2,7 +2,7 @@ BOOST_VERSION=1.57.0 SQLITE_VERSION=system -LIBUV_VERSION=0.10.28 +LIBUV_VERSION=1.7.5 ZLIB_VERSION=system VARIANT_VERSION=1.0 RAPIDJSON_VERSION=1.0.2 diff --git a/scripts/ios/package.sh b/scripts/ios/package.sh index 76adcfb814..7352557d12 100755 --- a/scripts/ios/package.sh +++ b/scripts/ios/package.sh @@ -7,7 +7,7 @@ set -u NAME=Mapbox OUTPUT=build/ios/pkg IOS_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version` -LIBUV_VERSION=0.10.28 +LIBUV_VERSION=1.7.5 if [[ ${#} -eq 0 ]]; then # e.g. "make ipackage" BUILD_FOR_DEVICE=true diff --git a/scripts/linux/configure.sh b/scripts/linux/configure.sh index 29854e10ea..7fd1226d40 100644 --- a/scripts/linux/configure.sh +++ b/scripts/linux/configure.sh @@ -7,7 +7,7 @@ GLFW_VERSION=3.1 LIBPNG_VERSION=1.6.16 JPEG_VERSION=v9a SQLITE_VERSION=3.8.8.1 -LIBUV_VERSION=0.10.28 +LIBUV_VERSION=1.7.5 ZLIB_VERSION=system NUNICODE_VERSION=1.5.1 LIBZIP_VERSION=0.11.2 diff --git a/scripts/osx/configure.sh b/scripts/osx/configure.sh index 450f958339..b7536d4699 100644 --- a/scripts/osx/configure.sh +++ b/scripts/osx/configure.sh @@ -7,7 +7,7 @@ GLFW_VERSION=3.1 LIBPNG_VERSION=1.6.16 JPEG_VERSION=v9a SQLITE_VERSION=3.8.8.1 -LIBUV_VERSION=0.10.28 +LIBUV_VERSION=1.7.5 ZLIB_VERSION=system NUNICODE_VERSION=1.5.1 LIBZIP_VERSION=0.11.2 diff --git a/src/mbgl/util/uv_detail.hpp b/src/mbgl/util/uv_detail.hpp index f502ee1066..86a64d33f2 100644 --- a/src/mbgl/util/uv_detail.hpp +++ b/src/mbgl/util/uv_detail.hpp @@ -13,6 +13,14 @@ #undef B0 #endif +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +#define UV_ASYNC_PARAMS(handle) uv_async_t *handle, int +#define UV_TIMER_PARAMS(timer) uv_timer_t *timer, int +#else +#define UV_ASYNC_PARAMS(handle) uv_async_t *handle +#define UV_TIMER_PARAMS(timer) uv_timer_t *timer +#endif + #include <functional> #include <cassert> #include <memory> @@ -119,12 +127,8 @@ public: } private: -#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 - static void async_cb(uv_async_t* a, int) { -#else - static void async_cb(uv_async_t* a) { -#endif - reinterpret_cast<async*>(a->data)->fn(); + static void async_cb(UV_ASYNC_PARAMS(handle)) { + reinterpret_cast<async*>(handle->data)->fn(); } std::function<void ()> fn; @@ -153,11 +157,7 @@ public: } private: -#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 - static void timer_cb(uv_timer_t* t, int) { -#else - static void timer_cb(uv_timer_t* t) { -#endif + static void timer_cb(UV_TIMER_PARAMS(t)) { reinterpret_cast<timer*>(t->data)->fn(); } diff --git a/test/storage/http_error.cpp b/test/storage/http_error.cpp index be2811cd06..7edce61e5c 100644 --- a/test/storage/http_error.cpp +++ b/test/storage/http_error.cpp @@ -7,6 +7,12 @@ #include <cmath> +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +#define UV_TIMER_PARAMS uv_timer_t*, int +#else +#define UV_TIMER_PARAMS uv_timer_t* +#endif + TEST_F(Storage, HTTPError) { SCOPED_TEST(HTTPTemporaryError) SCOPED_TEST(HTTPConnectionError) @@ -15,7 +21,7 @@ TEST_F(Storage, HTTPError) { uv_timer_t statusChange; uv_timer_init(uv_default_loop(), &statusChange); - uv_timer_start(&statusChange, [](uv_timer_t *, int) { + uv_timer_start(&statusChange, [](UV_TIMER_PARAMS) { NetworkStatus::Reachable(); }, 500, 500); uv_unref((uv_handle_t *)&statusChange); |