summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-10-22 15:13:35 +0200
committerKonstantin Käfer <mail@kkaefer.com>2014-10-22 15:13:35 +0200
commit253bbd1c5b5c5ae4a7bdbf731f58efa08d8cf855 (patch)
tree24b9c20ad564f3dd991fbcd5570aa6c4f2d81f6a /src
parentd54809b04adf0b64e13b97852cfed860f92682a9 (diff)
parent251fafe2bf6dff34868a4e32953adcb73cb20db6 (diff)
downloadqtlocation-mapboxgl-253bbd1c5b5c5ae4a7bdbf731f58efa08d8cf855.tar.gz
New mason-based build system
Diffstat (limited to 'src')
-rwxr-xr-xsrc/libtess2/bucketalloc.c2
-rwxr-xr-xsrc/libtess2/priorityq.c8
-rwxr-xr-xsrc/libtess2/sweep.c3
-rwxr-xr-xsrc/libtess2/tess.c14
-rw-r--r--src/map/map.cpp16
-rw-r--r--src/storage/file_request_baton.cpp26
-rw-r--r--src/storage/http_request.cpp9
-rw-r--r--src/style/function_properties.cpp4
-rw-r--r--src/util/compression.cpp4
-rw-r--r--src/util/parsedate.c2
-rw-r--r--src/util/uv-messenger.c8
-rw-r--r--src/util/uv.cpp6
12 files changed, 72 insertions, 30 deletions
diff --git a/src/libtess2/bucketalloc.c b/src/libtess2/bucketalloc.c
index ce64e579e7..df1a83c76c 100755
--- a/src/libtess2/bucketalloc.c
+++ b/src/libtess2/bucketalloc.c
@@ -59,7 +59,7 @@ struct BucketAlloc
static int CreateBucket( struct BucketAlloc* ba )
{
- size_t size;
+ unsigned int size;
Bucket* bucket;
void* freelist;
unsigned char* head;
diff --git a/src/libtess2/priorityq.c b/src/libtess2/priorityq.c
index 2af5f347b9..49e1c012f5 100755
--- a/src/libtess2/priorityq.c
+++ b/src/libtess2/priorityq.c
@@ -209,13 +209,13 @@ PQhandle pqHeapInsert( TESSalloc* alloc, PriorityQHeap *pq, PQkey keyNew )
// If the heap overflows, double its size.
pq->max <<= 1;
pq->nodes = (PQnode *)alloc->memrealloc( alloc->userData, pq->nodes,
- (size_t)((pq->max + 1) * sizeof( pq->nodes[0] )));
+ (unsigned int)((pq->max + 1) * sizeof( pq->nodes[0] )));
if (pq->nodes == NULL) {
pq->nodes = saveNodes; // restore ptr to free upon return
return INV_HANDLE;
}
pq->handles = (PQhandleElem *)alloc->memrealloc( alloc->userData, pq->handles,
- (size_t) ((pq->max + 1) * sizeof( pq->handles[0] )));
+ (unsigned int) ((pq->max + 1) * sizeof( pq->handles[0] )));
if (pq->handles == NULL) {
pq->handles = saveHandles; // restore ptr to free upon return
return INV_HANDLE;
@@ -351,7 +351,7 @@ int pqInit( TESSalloc* alloc, PriorityQ *pq )
(pq->size * sizeof(pq->order[0])) );
*/
pq->order = (PQkey **)alloc->memalloc( alloc->userData,
- (size_t)((pq->size+1) * sizeof(pq->order[0])) );
+ (unsigned int)((pq->size+1) * sizeof(pq->order[0])) );
/* the previous line is a patch to compensate for the fact that IBM */
/* machines return a null on a malloc of zero bytes (unlike SGI), */
/* so we have to put in this defense to guard against a memory */
@@ -438,7 +438,7 @@ PQhandle pqInsert( TESSalloc* alloc, PriorityQ *pq, PQkey keyNew )
// If the heap overflows, double its size.
pq->max <<= 1;
pq->keys = (PQkey *)alloc->memrealloc( alloc->userData, pq->keys,
- (size_t)(pq->max * sizeof( pq->keys[0] )));
+ (unsigned int)(pq->max * sizeof( pq->keys[0] )));
if (pq->keys == NULL) {
pq->keys = saveKey; // restore ptr to free upon return
return INV_HANDLE;
diff --git a/src/libtess2/sweep.c b/src/libtess2/sweep.c
index 0204d3e8a3..be3ee561ce 100755
--- a/src/libtess2/sweep.c
+++ b/src/libtess2/sweep.c
@@ -428,6 +428,8 @@ static void VertexWeights( TESSvertex *isect, TESSvertex *org, TESSvertex *dst,
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
static void GetIntersectData( TESStesselator *tess, TESSvertex *isect,
TESSvertex *orgUp, TESSvertex *dstUp,
TESSvertex *orgLo, TESSvertex *dstLo )
@@ -444,6 +446,7 @@ static void GetIntersectData( TESStesselator *tess, TESSvertex *isect,
VertexWeights( isect, orgUp, dstUp, &weights[0] );
VertexWeights( isect, orgLo, dstLo, &weights[2] );
}
+#pragma GCC diagnostic pop
static int CheckForRightSplice( TESStesselator *tess, ActiveRegion *regUp )
/*
diff --git a/src/libtess2/tess.c b/src/libtess2/tess.c
index ad71478375..80c5b70f41 100755
--- a/src/libtess2/tess.c
+++ b/src/libtess2/tess.c
@@ -46,17 +46,6 @@
#define Dot(u,v) (u[0]*v[0] + u[1]*v[1] + u[2]*v[2])
-static void Normalize( TESSreal v[3] )
-{
- TESSreal len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
-
- assert( len > 0 );
- len = sqrtf( len );
- v[0] /= len;
- v[1] /= len;
- v[2] /= len;
-}
-
#define ABS(x) ((x) < 0 ? -(x) : (x))
static int LongAxis( TESSreal v[3] )
@@ -436,6 +425,8 @@ int tessMeshSetWindingNumber( TESSmesh *mesh, int value,
return 1;
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
void* heapAlloc( void* userData, unsigned int size )
{
return malloc( size );
@@ -450,6 +441,7 @@ void heapFree( void* userData, void* ptr )
{
free( ptr );
}
+#pragma GCC diagnostic pop
static TESSalloc defaulAlloc =
{
diff --git a/src/map/map.cpp b/src/map/map.cpp
index a1543dbdae..f255c3ff65 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -145,10 +145,6 @@ void Map::stop(stop_callback cb, void *data) {
async = false;
}
-void Map::delete_async(uv_handle_t *handle) {
- delete (uv_async_t *)handle;
-}
-
void Map::run() {
#ifndef NDEBUG
if (!async) {
@@ -203,7 +199,11 @@ void Map::cleanup() {
}
}
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+void Map::cleanup(uv_async_t *async, int) {
+#else
void Map::cleanup(uv_async_t *async) {
+#endif
Map *map = static_cast<Map *>(async->data);
map->view.make_active();
@@ -221,7 +221,11 @@ void Map::setReachability(bool reachable) {
}
}
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+void Map::render(uv_async_t *async, int) {
+#else
void Map::render(uv_async_t *async) {
+#endif
Map *map = static_cast<Map *>(async->data);
assert(uv_thread_self() == map->map_thread);
@@ -241,7 +245,11 @@ void Map::render(uv_async_t *async) {
}
}
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+void Map::terminate(uv_async_t *async, int) {
+#else
void Map::terminate(uv_async_t *async) {
+#endif
// Closes all open handles on the loop. This means that the loop will automatically terminate.
Map *map = static_cast<Map *>(async->data);
assert(uv_thread_self() == map->map_thread);
diff --git a/src/storage/file_request_baton.cpp b/src/storage/file_request_baton.cpp
index 127c78f3e5..64c6c13b12 100644
--- a/src/storage/file_request_baton.cpp
+++ b/src/storage/file_request_baton.cpp
@@ -29,7 +29,11 @@ void FileRequestBaton::notify_error(uv_fs_t *req) {
if (ptr->request && req->result < 0 && !ptr->canceled && req->result != UV_ECANCELED) {
ptr->request->response = std::unique_ptr<Response>(new Response);
ptr->request->response->code = req->result == UV_ENOENT ? 404 : 500;
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+ ptr->request->response->message = uv_strerror(uv_last_error(req->loop));
+#else
ptr->request->response->message = uv_strerror(int(req->result));
+#endif
ptr->request->notify();
}
}
@@ -63,7 +67,7 @@ void FileRequestBaton::file_stated(uv_fs_t *req) {
FileRequestBaton *ptr = (FileRequestBaton *)req->data;
assert(ptr->thread_id == uv_thread_self());
- if (req->result < 0 || ptr->canceled || !ptr->request) {
+ if (req->result != 0 || ptr->canceled || !ptr->request) {
// Stating failed or was canceled. We already have an open file handle
// though, which we'll have to close.
notify_error(req);
@@ -71,13 +75,22 @@ void FileRequestBaton::file_stated(uv_fs_t *req) {
uv_fs_req_cleanup(req);
uv_fs_close(req->loop, req, ptr->fd, file_closed);
} else {
- if (static_cast<const uv_stat_t *>(req->ptr)->st_size > std::numeric_limits<int>::max()) {
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+ const uv_statbuf_t *stat = static_cast<const uv_statbuf_t *>(req->ptr);
+#else
+ const uv_stat_t *stat = static_cast<const uv_stat_t *>(req->ptr);
+#endif
+ if (stat->st_size > std::numeric_limits<int>::max()) {
// File is too large for us to open this way because uv_buf's only support unsigned
// ints as maximum size.
if (ptr->request) {
ptr->request->response = std::unique_ptr<Response>(new Response);
ptr->request->response->code = UV_EFBIG;
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+ ptr->request->response->message = uv_strerror(uv_err_t {UV_EFBIG, 0});
+#else
ptr->request->response->message = uv_strerror(UV_EFBIG);
+#endif
ptr->request->notify();
}
@@ -85,11 +98,15 @@ void FileRequestBaton::file_stated(uv_fs_t *req) {
uv_fs_close(req->loop, req, ptr->fd, file_closed);
} else {
const unsigned int size =
- (unsigned int)(static_cast<const uv_stat_t *>(req->ptr)->st_size);
+ (unsigned int)(stat->st_size);
ptr->body.resize(size);
ptr->buffer = uv_buf_init(const_cast<char *>(ptr->body.data()), size);
uv_fs_req_cleanup(req);
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+ uv_fs_read(req->loop, req, ptr->fd, ptr->buffer.base, ptr->buffer.len, -1, file_read);
+#else
uv_fs_read(req->loop, req, ptr->fd, &ptr->buffer, 1, 0, file_read);
+#endif
}
}
}
@@ -117,8 +134,7 @@ void FileRequestBaton::file_read(uv_fs_t *req) {
}
void FileRequestBaton::file_closed(uv_fs_t *req) {
- FileRequestBaton *ptr = (FileRequestBaton *)req->data;
- assert(ptr->thread_id == uv_thread_self());
+ assert(((FileRequestBaton *)req->data)->thread_id == uv_thread_self());
if (req->result < 0) {
// Closing the file failed. But there isn't anything we can do.
diff --git a/src/storage/http_request.cpp b/src/storage/http_request.cpp
index 1b799d4895..ca1412fd9e 100644
--- a/src/storage/http_request.cpp
+++ b/src/storage/http_request.cpp
@@ -77,7 +77,11 @@ void HTTPRequest::startHTTPRequest(std::unique_ptr<Response> &&res) {
http_baton->response = std::move(res);
http_baton->async->data = new util::ptr<HTTPRequestBaton>(http_baton);
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+ uv_async_init(loop, http_baton->async, [](uv_async_t *async, int) {
+#else
uv_async_init(loop, http_baton->async, [](uv_async_t *async) {
+#endif
util::ptr<HTTPRequestBaton> &http_baton = *(util::ptr<HTTPRequestBaton> *)async->data;
if (http_baton->request) {
@@ -193,7 +197,12 @@ void HTTPRequest::retryHTTPRequest(std::unique_ptr<Response> &&res, uint64_t tim
backoff_timer = new uv_timer_t();
uv_timer_init(loop, backoff_timer);
backoff_timer->data = new RetryBaton(this, std::move(res));
+
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+ uv_timer_start(backoff_timer, [](uv_timer_t *timer, int) {
+#else
uv_timer_start(backoff_timer, [](uv_timer_t *timer) {
+#endif
std::unique_ptr<RetryBaton> pair { static_cast<RetryBaton *>(timer->data) };
pair->first->startHTTPRequest(std::move(pair->second));
pair->first->backoff_timer = nullptr;
diff --git a/src/style/function_properties.cpp b/src/style/function_properties.cpp
index 346efe65b6..69466c1f64 100644
--- a/src/style/function_properties.cpp
+++ b/src/style/function_properties.cpp
@@ -18,10 +18,10 @@ template <typename T>
T StopsFunction<T>::evaluate(float z) const {
bool smaller = false;
float smaller_z = 0.0f;
- T smaller_val {};
+ T smaller_val = T();
bool larger = false;
float larger_z = 0.0f;
- T larger_val {};
+ T larger_val = T();
for (uint32_t i = 0; i < values.size(); i++) {
float stop_z = values[i].first;
diff --git a/src/util/compression.cpp b/src/util/compression.cpp
index de4e09764c..d6d6370546 100644
--- a/src/util/compression.cpp
+++ b/src/util/compression.cpp
@@ -18,7 +18,7 @@ std::string compress(const std::string &raw) {
}
deflate_stream.next_in = (Bytef *)raw.data();
- deflate_stream.avail_in = raw.size();
+ deflate_stream.avail_in = uInt(raw.size());
std::string result;
char out[16384];
@@ -53,7 +53,7 @@ std::string decompress(const std::string &raw) {
}
inflate_stream.next_in = (Bytef *)raw.data();
- inflate_stream.avail_in = raw.size();
+ inflate_stream.avail_in = uInt(raw.size());
std::string result;
char out[15384];
diff --git a/src/util/parsedate.c b/src/util/parsedate.c
index 123c5c4e5f..f888def853 100644
--- a/src/util/parsedate.c
+++ b/src/util/parsedate.c
@@ -208,7 +208,7 @@ int raw_equal(const char *first, const char *second)
int clamp_to_int(long slnum)
{
- return slnum > INT_MAX ? INT_MAX : slnum < INT_MIN ? INT_MIN : slnum;
+ return slnum > INT_MAX ? INT_MAX : slnum < INT_MIN ? INT_MIN : (int)slnum;
}
diff --git a/src/util/uv-messenger.c b/src/util/uv-messenger.c
index a25c84dc59..82df1cae75 100644
--- a/src/util/uv-messenger.c
+++ b/src/util/uv-messenger.c
@@ -8,7 +8,15 @@ typedef struct {
void *queue[2];
} uv__messenger_item_t;
+
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
+void uv__messenger_callback(uv_async_t *async, int status) {
+#pragma clang diagnostic pop
+#else
void uv__messenger_callback(uv_async_t *async) {
+#endif
uv_messenger_t *msgr = (uv_messenger_t *)async->data;
uv__messenger_item_t *item;
diff --git a/src/util/uv.cpp b/src/util/uv.cpp
index b97074f054..03a885d308 100644
--- a/src/util/uv.cpp
+++ b/src/util/uv.cpp
@@ -5,6 +5,11 @@
namespace uv {
std::string cwd() {
+#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
+ char dir[512];
+ uv_cwd(dir, 512);
+ return dir;
+#else
size_t max = 0;
std::string dir;
do {
@@ -14,6 +19,7 @@ std::string cwd() {
} while (max == dir.size());
dir.resize(max - 1);
return dir;
+#endif
}
void deleter::operator()(uv_async_t *async) {