code cleanup: quiet some -Wshadow warnings, mix of obvious mistakes and harmless global/local naming conflict.
This commit is contained in:
@@ -492,6 +492,7 @@ macro(remove_strict_flags)
|
|||||||
remove_cc_flag("-Wredundant-decls")
|
remove_cc_flag("-Wredundant-decls")
|
||||||
remove_cc_flag("-Wundef")
|
remove_cc_flag("-Wundef")
|
||||||
remove_cc_flag("-Wshadow")
|
remove_cc_flag("-Wshadow")
|
||||||
|
remove_cc_flag("-Wold-style-definition")
|
||||||
remove_cc_flag("-Werror=[^ ]+")
|
remove_cc_flag("-Werror=[^ ]+")
|
||||||
remove_cc_flag("-Werror")
|
remove_cc_flag("-Werror")
|
||||||
|
|
||||||
|
@@ -281,9 +281,9 @@ static float npfade(float t)
|
|||||||
return (t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f));
|
return (t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
static float grad(int hash, float x, float y, float z)
|
static float grad(int hash_val, float x, float y, float z)
|
||||||
{
|
{
|
||||||
int h = hash & 15; /* CONVERT LO 4 BITS OF HASH CODE */
|
int h = hash_val & 15; /* CONVERT LO 4 BITS OF HASH CODE */
|
||||||
float u = h < 8 ? x : y, /* INTO 12 GRADIENT DIRECTIONS. */
|
float u = h < 8 ? x : y, /* INTO 12 GRADIENT DIRECTIONS. */
|
||||||
v = h < 4 ? y : h == 12 || h == 14 ? x : z;
|
v = h < 4 ? y : h == 12 || h == 14 ? x : z;
|
||||||
return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
|
return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
|
||||||
|
@@ -271,7 +271,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
|
|||||||
BMOIter siter;
|
BMOIter siter;
|
||||||
BMIter iter, fiter, viter;
|
BMIter iter, fiter, viter;
|
||||||
BMEdge *e, *e_new;
|
BMEdge *e, *e_new;
|
||||||
BMVert *v, *v2;
|
BMVert *v;
|
||||||
BMFace *f;
|
BMFace *f;
|
||||||
bool found, fwd, delorig = false;
|
bool found, fwd, delorig = false;
|
||||||
BMOpSlot *slot_facemap_out;
|
BMOpSlot *slot_facemap_out;
|
||||||
@@ -441,7 +441,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
|
|||||||
|
|
||||||
/* link isolated vert */
|
/* link isolated vert */
|
||||||
for (v = BMO_iter_new(&siter, dupeop.slots_out, "isovert_map.out", 0); v; v = BMO_iter_step(&siter)) {
|
for (v = BMO_iter_new(&siter, dupeop.slots_out, "isovert_map.out", 0); v; v = BMO_iter_step(&siter)) {
|
||||||
v2 = *((void **)BMO_iter_map_value(&siter));
|
BMVert *v2 = *((void **)BMO_iter_map_value(&siter));
|
||||||
BM_edge_create(bm, v, v2, v->e, BM_CREATE_NO_DOUBLE);
|
BM_edge_create(bm, v, v2, v->e, BM_CREATE_NO_DOUBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -235,14 +235,13 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
|
|||||||
BLI_assert(*type == MOUSEPAN);
|
BLI_assert(*type == MOUSEPAN);
|
||||||
|
|
||||||
/* sign differs, reset */
|
/* sign differs, reset */
|
||||||
if ((dy > 0 && lastdy < 0) || (dy < 0 && lastdy > 0))
|
if ((dy > 0 && lastdy < 0) || (dy < 0 && lastdy > 0)) {
|
||||||
lastdy = dy;
|
lastdy = dy;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
lastdy += dy;
|
lastdy += dy;
|
||||||
|
|
||||||
if (ABS(lastdy) > (int)UI_UNIT_Y) {
|
if (ABS(lastdy) > (int)UI_UNIT_Y) {
|
||||||
int dy = event->prevy - event->y;
|
|
||||||
|
|
||||||
if (U.uiflag2 & USER_TRACKPAD_NATURAL)
|
if (U.uiflag2 & USER_TRACKPAD_NATURAL)
|
||||||
dy = -dy;
|
dy = -dy;
|
||||||
|
|
||||||
@@ -804,8 +803,6 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
|
|||||||
* button we mouse over is X or Y aligned, then lock the mouse to that axis after.
|
* button we mouse over is X or Y aligned, then lock the mouse to that axis after.
|
||||||
*/
|
*/
|
||||||
if (drag_info->xy_lock[0] == false && drag_info->xy_lock[1] == false) {
|
if (drag_info->xy_lock[0] == false && drag_info->xy_lock[1] == false) {
|
||||||
ARegion *ar = CTX_wm_region(C);
|
|
||||||
|
|
||||||
/* first store the buttons original coords */
|
/* first store the buttons original coords */
|
||||||
uiBut *but = ui_but_find_mouse_over(ar, xy_input[0], xy_input[1]);
|
uiBut *but = ui_but_find_mouse_over(ar, xy_input[0], xy_input[1]);
|
||||||
if (but) {
|
if (but) {
|
||||||
|
@@ -663,9 +663,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
|
|||||||
/* since the text has beens caled already, the size of tooltips is defined now */
|
/* since the text has beens caled already, the size of tooltips is defined now */
|
||||||
/* here we try to figure out the right location */
|
/* here we try to figure out the right location */
|
||||||
if (butregion) {
|
if (butregion) {
|
||||||
float ofsx = rect_fl.xmin, ofsy = rect_fl.ymax;
|
float ofsx_fl = rect_fl.xmin, ofsy_fl = rect_fl.ymax;
|
||||||
ui_block_to_window_fl(butregion, but->block, &ofsx, &ofsy);
|
ui_block_to_window_fl(butregion, but->block, &ofsx_fl, &ofsy_fl);
|
||||||
BLI_rctf_translate(&rect_fl, ofsx - rect_fl.xmin, ofsy - rect_fl.ymax);
|
BLI_rctf_translate(&rect_fl, ofsx_fl - rect_fl.xmin, ofsy_fl - rect_fl.ymax);
|
||||||
}
|
}
|
||||||
BLI_rcti_rctf_copy(&rect_i, &rect_fl);
|
BLI_rcti_rctf_copy(&rect_i, &rect_fl);
|
||||||
|
|
||||||
|
@@ -188,8 +188,8 @@ typedef struct IconPreview {
|
|||||||
|
|
||||||
/* *************************** Preview for buttons *********************** */
|
/* *************************** Preview for buttons *********************** */
|
||||||
|
|
||||||
static Main *pr_main = NULL;
|
static Main *G_pr_main = NULL;
|
||||||
static Main *pr_main_cycles = NULL;
|
static Main *G_pr_main_cycles = NULL;
|
||||||
|
|
||||||
#ifndef WITH_HEADLESS
|
#ifndef WITH_HEADLESS
|
||||||
static Main *load_main_from_memory(char *blend, int blend_size)
|
static Main *load_main_from_memory(char *blend, int blend_size)
|
||||||
@@ -214,18 +214,18 @@ static Main *load_main_from_memory(char *blend, int blend_size)
|
|||||||
void ED_preview_init_dbase(void)
|
void ED_preview_init_dbase(void)
|
||||||
{
|
{
|
||||||
#ifndef WITH_HEADLESS
|
#ifndef WITH_HEADLESS
|
||||||
pr_main = load_main_from_memory(datatoc_preview_blend, datatoc_preview_blend_size);
|
G_pr_main = load_main_from_memory(datatoc_preview_blend, datatoc_preview_blend_size);
|
||||||
pr_main_cycles = load_main_from_memory(datatoc_preview_cycles_blend, datatoc_preview_cycles_blend_size);
|
G_pr_main_cycles = load_main_from_memory(datatoc_preview_cycles_blend, datatoc_preview_cycles_blend_size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ED_preview_free_dbase(void)
|
void ED_preview_free_dbase(void)
|
||||||
{
|
{
|
||||||
if (pr_main)
|
if (G_pr_main)
|
||||||
free_main(pr_main);
|
free_main(G_pr_main);
|
||||||
|
|
||||||
if (pr_main_cycles)
|
if (G_pr_main_cycles)
|
||||||
free_main(pr_main_cycles);
|
free_main(G_pr_main_cycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
|
static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
|
||||||
@@ -1028,7 +1028,7 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short
|
|||||||
sp->pr_method = PR_ICON_RENDER;
|
sp->pr_method = PR_ICON_RENDER;
|
||||||
sp->pr_rect = cur_size->rect;
|
sp->pr_rect = cur_size->rect;
|
||||||
sp->id = ip->id;
|
sp->id = ip->id;
|
||||||
sp->pr_main = pr_main;
|
sp->pr_main = G_pr_main;
|
||||||
|
|
||||||
common_preview_startjob(sp, stop, do_update, progress);
|
common_preview_startjob(sp, stop, do_update, progress);
|
||||||
shader_preview_free(sp);
|
shader_preview_free(sp);
|
||||||
@@ -1131,9 +1131,9 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
|
|||||||
/* hardcoded preview .blend for cycles/internal, this should be solved
|
/* hardcoded preview .blend for cycles/internal, this should be solved
|
||||||
* once with custom preview .blend path for external engines */
|
* once with custom preview .blend path for external engines */
|
||||||
if (BKE_scene_use_new_shading_nodes(scene))
|
if (BKE_scene_use_new_shading_nodes(scene))
|
||||||
sp->pr_main = pr_main_cycles;
|
sp->pr_main = G_pr_main_cycles;
|
||||||
else
|
else
|
||||||
sp->pr_main = pr_main;
|
sp->pr_main = G_pr_main;
|
||||||
|
|
||||||
if (ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
|
if (ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
|
||||||
else sp->col[0] = sp->col[1] = sp->col[2] = sp->col[3] = 1.0f;
|
else sp->col[0] = sp->col[1] = sp->col[2] = sp->col[3] = 1.0f;
|
||||||
|
@@ -548,7 +548,6 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
|
|||||||
RNAUpdateCb *cb;
|
RNAUpdateCb *cb;
|
||||||
Image *ima;
|
Image *ima;
|
||||||
ImageUser *iuser;
|
ImageUser *iuser;
|
||||||
ImBuf *ibuf;
|
|
||||||
Scene *scene = CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
uiLayout *row, *split, *col;
|
uiLayout *row, *split, *col;
|
||||||
uiBlock *block;
|
uiBlock *block;
|
||||||
@@ -595,7 +594,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
|
|||||||
uiBlockSetNFunc(block, rna_update_cb, MEM_dupallocN(cb), NULL);
|
uiBlockSetNFunc(block, rna_update_cb, MEM_dupallocN(cb), NULL);
|
||||||
|
|
||||||
if (ima->source == IMA_SRC_VIEWER) {
|
if (ima->source == IMA_SRC_VIEWER) {
|
||||||
ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
|
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
|
||||||
image_info(scene, iuser, ima, ibuf, str, MAX_INFO_LEN);
|
image_info(scene, iuser, ima, ibuf, str, MAX_INFO_LEN);
|
||||||
BKE_image_release_ibuf(ima, ibuf, lock);
|
BKE_image_release_ibuf(ima, ibuf, lock);
|
||||||
|
|
||||||
@@ -665,7 +664,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
|
|||||||
}
|
}
|
||||||
else if (ima->source != IMA_SRC_GENERATED) {
|
else if (ima->source != IMA_SRC_GENERATED) {
|
||||||
if (compact == 0) {
|
if (compact == 0) {
|
||||||
ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
|
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
|
||||||
image_info(scene, iuser, ima, ibuf, str, MAX_INFO_LEN);
|
image_info(scene, iuser, ima, ibuf, str, MAX_INFO_LEN);
|
||||||
BKE_image_release_ibuf(ima, ibuf, lock);
|
BKE_image_release_ibuf(ima, ibuf, lock);
|
||||||
uiItemL(layout, str, ICON_NONE);
|
uiItemL(layout, str, ICON_NONE);
|
||||||
|
@@ -471,7 +471,7 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void view3d_main_area_exit(wmWindowManager *wm, ARegion *ar)
|
static void view3d_main_area_exit(wmWindowManager *UNUSED(wm), ARegion *ar)
|
||||||
{
|
{
|
||||||
RegionView3D *rv3d = ar->regiondata;
|
RegionView3D *rv3d = ar->regiondata;
|
||||||
|
|
||||||
|
@@ -257,9 +257,9 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
|
|||||||
glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
|
glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
|
||||||
|
|
||||||
if (srct) {
|
if (srct) {
|
||||||
int width = BLI_rcti_size_x(srct) + 1; /* only here */
|
int scissor_width = BLI_rcti_size_x(srct) + 1; /* only here */
|
||||||
int height = BLI_rcti_size_y(srct) + 1;
|
int scissor_height = BLI_rcti_size_y(srct) + 1;
|
||||||
glScissor(srct->xmin, srct->ymin, width, height);
|
glScissor(srct->xmin, srct->ymin, scissor_width, scissor_height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
glScissor(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
|
glScissor(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
|
||||||
|
Reference in New Issue
Block a user