[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
This commit is contained in:
Mike Morris
2015-10-13 14:27:09 -04:00
parent 5b9deae957
commit 62595a9b39
12 changed files with 52 additions and 45 deletions

View File

@@ -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);

View File

@@ -127,10 +127,14 @@ 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);

View File

@@ -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);

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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);