diff options
-rw-r--r-- | source/blender/blenlib/BLI_lasso.h | 6 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_strict_flags.h | 3 | ||||
-rw-r--r-- | source/blender/blenlib/intern/boxpack2d.c | 14 | ||||
-rw-r--r-- | source/blender/blenlib/intern/gsqueue.c | 17 | ||||
-rw-r--r-- | source/blender/blenlib/intern/lasso.c | 15 | ||||
-rw-r--r-- | source/blender/blenlib/intern/quadric.c | 2 |
6 files changed, 32 insertions, 25 deletions
diff --git a/source/blender/blenlib/BLI_lasso.h b/source/blender/blenlib/BLI_lasso.h index 0addd463a70..28f21e5bd85 100644 --- a/source/blender/blenlib/BLI_lasso.h +++ b/source/blender/blenlib/BLI_lasso.h @@ -34,8 +34,8 @@ struct rcti; -void BLI_lasso_boundbox(struct rcti *rect, const int mcords[][2], const short moves); -bool BLI_lasso_is_point_inside(const int mcords[][2], const short moves, const int sx, const int sy, const int error_value); -bool BLI_lasso_is_edge_inside(const int mcords[][2], const short moves, int x0, int y0, int x1, int y1, const int error_value); +void BLI_lasso_boundbox(struct rcti *rect, const int mcords[][2], const unsigned int moves); +bool BLI_lasso_is_point_inside(const int mcords[][2], const unsigned int moves, const int sx, const int sy, const int error_value); +bool BLI_lasso_is_edge_inside(const int mcords[][2], const unsigned int moves, int x0, int y0, int x1, int y1, const int error_value); #endif diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h index 0f41c95a035..5c5a6f45f0c 100644 --- a/source/blender/blenlib/BLI_strict_flags.h +++ b/source/blender/blenlib/BLI_strict_flags.h @@ -33,6 +33,9 @@ # pragma GCC diagnostic error "-Wsign-compare" # pragma GCC diagnostic error "-Wconversion" # endif +# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 /* gcc4.8+ only (behavior changed to ignore globals)*/ +# pragma GCC diagnostic error "-Wshadow" +# endif #endif #endif /* __BLI_STRICT_FLAGS_H__ */ diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index 8a97fdcab67..1087b02b3bb 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -27,7 +27,9 @@ #include <stdlib.h> /* for qsort */ #include "MEM_guardedalloc.h" -#include "BLI_boxpack2d.h" +#include "BLI_strict_flags.h" + +#include "BLI_boxpack2d.h" /* own include */ /* BoxPacker for backing 2D rectangles into a square * @@ -169,11 +171,11 @@ void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float * } /* Sort boxes, biggest first */ - qsort(boxarray, len, sizeof(BoxPack), box_areasort); + qsort(boxarray, (size_t)len, sizeof(BoxPack), box_areasort); /* add verts to the boxes, these are only used internally */ - vert = vertarray = MEM_mallocN(len * 4 * sizeof(BoxVert), "BoxPack Verts"); - vertex_pack_indices = MEM_mallocN(len * 3 * sizeof(int), "BoxPack Indices"); + vert = vertarray = MEM_mallocN((size_t)len * 4 * sizeof(BoxVert), "BoxPack Verts"); + vertex_pack_indices = MEM_mallocN((size_t)len * 3 * sizeof(int), "BoxPack Indices"); for (box = boxarray, box_index = 0, i = 0; box_index < len; box_index++, box++) { @@ -241,7 +243,7 @@ void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float * box_width = box->w; box_height = box->h; - qsort(vertex_pack_indices, verts_pack_len, sizeof(int), vertex_sort); + qsort(vertex_pack_indices, (size_t)verts_pack_len, sizeof(int), vertex_sort); /* Pack the box in with the others */ /* sort the verts */ @@ -318,7 +320,7 @@ void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float * (*tot_height) = max_ff(BOXTOP(box), (*tot_height)); /* Place the box */ - vert->free &= ~quad_flags[j]; + vert->free &= (short)~quad_flags[j]; switch (j) { case TR: diff --git a/source/blender/blenlib/intern/gsqueue.c b/source/blender/blenlib/intern/gsqueue.c index 7f158bc3efb..6967742f89b 100644 --- a/source/blender/blenlib/intern/gsqueue.c +++ b/source/blender/blenlib/intern/gsqueue.c @@ -35,6 +35,7 @@ #include "BLI_utildefines.h" #include "BLI_gsqueue.h" +#include "BLI_strict_flags.h" typedef struct _GSQueueElem GSQueueElem; struct _GSQueueElem { @@ -93,7 +94,7 @@ int BLI_gsqueue_size(GSQueue *gq) */ void BLI_gsqueue_peek(GSQueue *gq, void *item_r) { - memcpy(item_r, &gq->head[1], gq->elem_size); + memcpy(item_r, &gq->head[1], (size_t)gq->elem_size); } /** @@ -114,7 +115,7 @@ void BLI_gsqueue_pop(GSQueue *gq, void *item_r) gq->head = gq->head->next; } - if (item_r) memcpy(item_r, &elem[1], gq->elem_size); + if (item_r) memcpy(item_r, &elem[1], (size_t)gq->elem_size); MEM_freeN(elem); } @@ -130,11 +131,11 @@ void BLI_gsqueue_push(GSQueue *gq, void *item) /* compare: prevent events added double in row */ if (!BLI_gsqueue_is_empty(gq)) { - if (0 == memcmp(item, &gq->head[1], gq->elem_size)) + if (0 == memcmp(item, &gq->head[1], (size_t)gq->elem_size)) return; } - elem = MEM_mallocN(sizeof(*elem) + gq->elem_size, "gqueue_push"); - memcpy(&elem[1], item, gq->elem_size); + elem = MEM_mallocN(sizeof(*elem) + (size_t)gq->elem_size, "gqueue_push"); + memcpy(&elem[1], item, (size_t)gq->elem_size); elem->next = NULL; if (BLI_gsqueue_is_empty(gq)) { @@ -154,8 +155,8 @@ void BLI_gsqueue_push(GSQueue *gq, void *item) */ void BLI_gsqueue_pushback(GSQueue *gq, void *item) { - GSQueueElem *elem = MEM_mallocN(sizeof(*elem) + gq->elem_size, "gqueue_push"); - memcpy(&elem[1], item, gq->elem_size); + GSQueueElem *elem = MEM_mallocN(sizeof(*elem) + (size_t)gq->elem_size, "gqueue_push"); + memcpy(&elem[1], item, (size_t)gq->elem_size); elem->next = gq->head; if (BLI_gsqueue_is_empty(gq)) { @@ -176,5 +177,3 @@ void BLI_gsqueue_free(GSQueue *gq) } MEM_freeN(gq); } - - diff --git a/source/blender/blenlib/intern/lasso.c b/source/blender/blenlib/intern/lasso.c index aa08a780394..8e22d6f1182 100644 --- a/source/blender/blenlib/intern/lasso.c +++ b/source/blender/blenlib/intern/lasso.c @@ -34,12 +34,13 @@ #include "BLI_math.h" #include "BLI_rect.h" +#include "BLI_strict_flags.h" #include "BLI_lasso.h" /* own include */ -void BLI_lasso_boundbox(rcti *rect, const int mcords[][2], const short moves) +void BLI_lasso_boundbox(rcti *rect, const int mcords[][2], const unsigned int moves) { - short a; + unsigned int a; rect->xmin = rect->xmax = mcords[0][0]; rect->ymin = rect->ymax = mcords[0][1]; @@ -53,11 +54,11 @@ void BLI_lasso_boundbox(rcti *rect, const int mcords[][2], const short moves) } -bool BLI_lasso_is_point_inside(const int mcords[][2], const short moves, +bool BLI_lasso_is_point_inside(const int mcords[][2], const unsigned int moves, const int sx, const int sy, const int error_value) { - if (sx == error_value) { + if (sx == error_value || moves == 0) { return false; } else { @@ -67,14 +68,14 @@ bool BLI_lasso_is_point_inside(const int mcords[][2], const short moves, } /* edge version for lasso select. we assume boundbox check was done */ -bool BLI_lasso_is_edge_inside(const int mcords[][2], const short moves, +bool BLI_lasso_is_edge_inside(const int mcords[][2], const unsigned int moves, int x0, int y0, int x1, int y1, const int error_value) { int v1[2], v2[2]; - int a; + unsigned int a; - if (x0 == error_value || x1 == error_value) { + if (x0 == error_value || x1 == error_value || moves == 0) { return false; } diff --git a/source/blender/blenlib/intern/quadric.c b/source/blender/blenlib/intern/quadric.c index b06534d282a..8c831bdada0 100644 --- a/source/blender/blenlib/intern/quadric.c +++ b/source/blender/blenlib/intern/quadric.c @@ -35,6 +35,8 @@ //#include <string.h> #include "BLI_math.h" +#include "BLI_strict_flags.h" + #include "BLI_quadric.h" /* own include */ |