From 5d6748f8fee0fe9d7aa0da0d9ff26de1c8044815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 12:41:10 +0200 Subject: [PATCH] fix compile warnings in libtess2 --- src/libtess2/bucketalloc.c | 2 +- src/libtess2/priorityq.c | 8 ++++---- src/libtess2/sweep.c | 3 +++ src/libtess2/tess.c | 14 +++----------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/libtess2/bucketalloc.c b/src/libtess2/bucketalloc.c index ce64e579e..df1a83c76 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 2af5f347b..49e1c012f 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 0204d3e8a..49559fa12 100755 --- a/src/libtess2/sweep.c +++ b/src/libtess2/sweep.c @@ -428,9 +428,12 @@ 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 ) +#pragma GCC diagnostic pop /* * We've computed a new intersection point, now we need a "data" pointer * from the user so that we can refer to this new vertex in the diff --git a/src/libtess2/tess.c b/src/libtess2/tess.c index ad7147837..80c5b70f4 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 = {