Fix Linux build

This commit is contained in:
Leith Bade
2014-12-02 20:04:12 +11:00
parent 2b86522412
commit cfb6e2752c
3 changed files with 13 additions and 10 deletions

View File

@@ -3,7 +3,6 @@
#include <mbgl/storage/asset_request.hpp>
#include <mbgl/storage/response.hpp>
#include <limits>
#include <boost/make_unique.hpp>
#include <zip.h>

View File

@@ -1,11 +1,7 @@
#include <mbgl/android/jni.hpp>
#include <mbgl/storage/asset_request_baton.hpp>
#include <mbgl/storage/asset_request.hpp>
#include <mbgl/storage/response.hpp>
#include <limits>
#include <boost/make_unique.hpp>
namespace mbgl {
void AssetRequestBaton::run(uv_async_t *async) {

View File

@@ -1,11 +1,7 @@
#include <mbgl/android/jni.hpp>
#include <mbgl/storage/asset_request_baton.hpp>
#include <mbgl/storage/asset_request.hpp>
#include <mbgl/storage/response.hpp>
#include <limits>
#include <boost/make_unique.hpp>
namespace mbgl {
AssetRequestBaton::AssetRequestBaton(AssetRequest *request_, const std::string &path_, uv_loop_t *loop)
@@ -14,9 +10,21 @@ AssetRequestBaton::AssetRequestBaton(AssetRequest *request_, const std::string &
async_run(new uv_async_t()),
path(path_) {
uv_async_init(loop, async_run.get(), run);
// Iron out the differences between libuv 0.10 and 0.11
#ifdef UV_ASYNC_CALLBACK
#error Cannot overwrite UV_ASYNC_CALLBACK
#endif
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
#define UV_ASYNC_CALLBACK(name) [](uv_async_t *a, int) { return AssetRequestBaton::name(a); }
#else
#define UV_ASYNC_CALLBACK(name) name
#endif
uv_async_init(loop, async_run.get(), UV_ASYNC_CALLBACK(run));
async_run->data = this;
#undef UV_ASYNC_CALLBACK
uv_async_send(async_run.get());
}