code cleanup: quiet some -Wshadow warnings, mix of obvious mistakes and harmless...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 15 Mar 2013 22:55:10 +0000 (22:55 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 15 Mar 2013 22:55:10 +0000 (22:55 +0000)
build_files/cmake/macros.cmake
source/blender/blenlib/intern/noise.c
source/blender/bmesh/operators/bmo_extrude.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/render/render_preview.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/windowmanager/intern/wm_subwindow.c

index 0b95237271970ab1de2017c2ab84a957faa8ee1b..9fe76df20b9422b810984757a0feeea3bcbb0432 100644 (file)
@@ -492,6 +492,7 @@ macro(remove_strict_flags)
                remove_cc_flag("-Wredundant-decls")
                remove_cc_flag("-Wundef")
                remove_cc_flag("-Wshadow")
+               remove_cc_flag("-Wold-style-definition")
                remove_cc_flag("-Werror=[^ ]+")
                remove_cc_flag("-Werror")
 
index c159f707b98983ae3c9527ce51b2b1485ef12932..6e52145c65391dcb1f915785189c0f508bfd2f73 100644 (file)
@@ -281,9 +281,9 @@ static float npfade(float t)
        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. */
              v = h < 4 ? y : h == 12 || h == 14 ? x : z;
        return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
index 4fde6150f053dcf02e657105828ec871cb6c3174..992123a86d5408a1b6f6fe6b3cf491375d30e466 100644 (file)
@@ -271,7 +271,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
        BMOIter siter;
        BMIter iter, fiter, viter;
        BMEdge *e, *e_new;
-       BMVert *v, *v2;
+       BMVert *v;
        BMFace *f;
        bool found, fwd, delorig = false;
        BMOpSlot *slot_facemap_out;
@@ -441,7 +441,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
 
        /* link isolated vert */
        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);
        }
 
index 9a9e31a32cca23da47e5654a9f44c52181bd8453..3ca400e1759bc30d661c8edced3c3777169e7cc1 100644 (file)
@@ -235,14 +235,13 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
        BLI_assert(*type == MOUSEPAN);
 
        /* sign differs, reset */
-       if ((dy > 0 && lastdy < 0) || (dy < 0 && lastdy > 0))
+       if ((dy > 0 && lastdy < 0) || (dy < 0 && lastdy > 0)) {
                lastdy = dy;
+       }
        else {
                lastdy += dy;
                
                if (ABS(lastdy) > (int)UI_UNIT_Y) {
-                       int dy = event->prevy - event->y;
-                       
                        if (U.uiflag2 & USER_TRACKPAD_NATURAL)
                                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.
         */
        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 */
                uiBut *but = ui_but_find_mouse_over(ar, xy_input[0], xy_input[1]);
                if (but) {
index 03c127f33c819be948950d4d9e7e2c314dce4275..febd1820e5c18f678938c3c45d464d470e35503a 100644 (file)
@@ -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 */
        /* here we try to figure out the right location */
        if (butregion) {
-               float ofsx = rect_fl.xmin, ofsy = rect_fl.ymax;
-               ui_block_to_window_fl(butregion, but->block, &ofsx, &ofsy);
-               BLI_rctf_translate(&rect_fl, 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_fl, &ofsy_fl);
+               BLI_rctf_translate(&rect_fl, ofsx_fl - rect_fl.xmin, ofsy_fl - rect_fl.ymax);
        }
        BLI_rcti_rctf_copy(&rect_i, &rect_fl);
 
index 5caa8744be7b505c7d784eea3a2a6150f9d0ea20..7802e5460ffb6b585a7c8124e02f7a4ae392c8b4 100644 (file)
@@ -188,8 +188,8 @@ typedef struct IconPreview {
 
 /* *************************** Preview for buttons *********************** */
 
-static Main *pr_main = NULL;
-static Main *pr_main_cycles = NULL;
+static Main *G_pr_main = NULL;
+static Main *G_pr_main_cycles = NULL;
 
 #ifndef WITH_HEADLESS
 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)
 {
 #ifndef WITH_HEADLESS
-       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 = load_main_from_memory(datatoc_preview_blend, datatoc_preview_blend_size);
+       G_pr_main_cycles = load_main_from_memory(datatoc_preview_cycles_blend, datatoc_preview_cycles_blend_size);
 #endif
 }
 
 void ED_preview_free_dbase(void)
 {
-       if (pr_main)
-               free_main(pr_main);
+       if (G_pr_main)
+               free_main(G_pr_main);
 
-       if (pr_main_cycles)
-               free_main(pr_main_cycles);
+       if (G_pr_main_cycles)
+               free_main(G_pr_main_cycles);
 }
 
 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_rect = cur_size->rect;
                sp->id = ip->id;
-               sp->pr_main = pr_main;
+               sp->pr_main = G_pr_main;
 
                common_preview_startjob(sp, stop, do_update, progress);
                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
         * once with custom preview .blend path for external engines */
        if (BKE_scene_use_new_shading_nodes(scene))
-               sp->pr_main = pr_main_cycles;
+               sp->pr_main = G_pr_main_cycles;
        else
-               sp->pr_main = pr_main;
+               sp->pr_main = G_pr_main;
 
        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;
index fbabaaee32ab1c5b1c4e1e1ce22c88d96fc49481..70001b5952876883d2e05892f7f2272f9870d8d9 100644 (file)
@@ -548,7 +548,6 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
        RNAUpdateCb *cb;
        Image *ima;
        ImageUser *iuser;
-       ImBuf *ibuf;
        Scene *scene = CTX_data_scene(C);
        uiLayout *row, *split, *col;
        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);
 
                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);
                        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) {
                                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);
                                        BKE_image_release_ibuf(ima, ibuf, lock);
                                        uiItemL(layout, str, ICON_NONE);
index 2eba28858bc6f436c836b540ac7a8bbaaa69206a..d332fb9f8b3cc599f8c9a30d2f01212b913eb368 100644 (file)
@@ -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;
 
index 20406ac463d5ad2d59b00396b48da6930ef805d6..01bebe8a1b8d9da129b3ede934bd3ab2cd42bb25 100644 (file)
@@ -257,9 +257,9 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
        glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
        
        if (srct) {
-               int width  = BLI_rcti_size_x(srct) + 1; /* only here */
-               int height = BLI_rcti_size_y(srct) + 1;
-               glScissor(srct->xmin, srct->ymin, width, height);
+               int scissor_width  = BLI_rcti_size_x(srct) + 1; /* only here */
+               int scissor_height = BLI_rcti_size_y(srct) + 1;
+               glScissor(srct->xmin, srct->ymin, scissor_width, scissor_height);
        }
        else
                glScissor(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);