code cleanup: style & warnings.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 21 Jan 2013 02:30:40 +0000 (02:30 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 21 Jan 2013 02:30:40 +0000 (02:30 +0000)
13 files changed:
source/blender/blenfont/BLF_translation.h
source/blender/blenfont/intern/blf_lang.c
source/blender/blenkernel/intern/pbvh.c
source/blender/blenlib/BLI_array.h
source/blender/bmesh/intern/bmesh_log.c
source/blender/bmesh/tools/bmesh_bevel.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/transform/transform.c
source/blender/python/intern/bpy_app_translations.c
source/blender/python/intern/bpy_rna.c
source/blender/render/intern/source/rendercore.c
source/blender/windowmanager/intern/wm_cursors.c

index 59f66cae7277b3824ecf30ce1c81bb05dd2b4625..7194c6c23c110d7fc285782e631f16cab7e4b5a5 100644 (file)
@@ -200,4 +200,4 @@ typedef struct
 
 //#undef _BLF_I18NCONTEXTS_ITEM
 
-#endif /* __BLF_TRANSLATION_H__ */
\ No newline at end of file
+#endif /* __BLF_TRANSLATION_H__ */
index ab29fae1a589946a3ebbc7b65f78e580dd1fa82f..84e2ca8edcd94d97b1e0b8cc4ae04cde97b449af 100644 (file)
@@ -248,36 +248,6 @@ const char *BLF_lang_get(void)
 #undef LOCALE
 #undef ULANGUAGE
 
-#else /* ! WITH_INTERNATIONAL */
-
-EnumPropertyItem *BLF_RNA_lang_enum_properties(void)
-{
-       return NULL;
-}
-
-void BLF_lang_init(void)
-{
-       return;
-}
-
-void BLF_lang_free(void)
-{
-       return;
-}
-
-void BLF_lang_set(const char *UNUSED(str))
-{
-       return;
-}
-
-const char *BLF_lang_get(void)
-{
-       return "";
-}
-
-#endif /* WITH_INTERNATIONAL */
-
-
 /* Get locale's elements (if relevant pointer is not NULL and element actually exists, e.g. if there is no variant,
  * *variant and *language_variant will always be NULL).
  * Non-null elements are always MEM_mallocN'ed, it's the caller's responsibility to free them.
@@ -328,4 +298,33 @@ void BLF_locale_explode(const char *locale, char **language, char **country, cha
        if (_t && !language) {
                MEM_freeN(_t);
        }
-}
\ No newline at end of file
+}
+
+#else /* ! WITH_INTERNATIONAL */
+
+struct EnumPropertyItem *BLF_RNA_lang_enum_properties(void)
+{
+       return NULL;
+}
+
+void BLF_lang_init(void)
+{
+       return;
+}
+
+void BLF_lang_free(void)
+{
+       return;
+}
+
+void BLF_lang_set(const char *UNUSED(str))
+{
+       return;
+}
+
+const char *BLF_lang_get(void)
+{
+       return "";
+}
+
+#endif /* WITH_INTERNATIONAL */
index f72bcded9ad3d1df2fea98647f1127a810950a4a..483dd2570e2e118c00a7251954c69009136f6156 100644 (file)
@@ -1399,10 +1399,10 @@ void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
 }
 
 int ray_face_intersection(const float ray_start[3],
-                                                 const float ray_normal[3],
-                                                 const float *t0, const float *t1,
-                                                 const float *t2, const float *t3,
-                                                 float *fdist)
+                          const float ray_normal[3],
+                          const float *t0, const float *t1,
+                          const float *t2, const float *t3,
+                          float *fdist)
 {
        float dist;
 
index a73227490c6ad6cfef7972703d0282d6343ca00d..0ba0f138c2809eae74f335604c82f8a8b56382c9 100644 (file)
@@ -79,12 +79,10 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static,
 /* this returns the logical size of the array, not including buffering. */
 #define BLI_array_count(arr) _##arr##_count
 
-/* Grow the array by a fixed number of items. zeroes the new elements.
+/* Grow the array by a fixed number of items.
  *
  * Allow for a large 'num' value when the new size is more then double
  * to allocate the exact sized array. */
-
-/* grow an array by a specified number of items */
 #define BLI_array_grow_items(arr, num)  ((                                    \
        (((void *)(arr) == NULL) &&                                               \
         ((void *)(_##arr##_static) != NULL) &&                                   \
index fa5bfe34a119d9d8607725ae5aa852e4ea921a14..68f8f38fb26d909288f641680e87c868964bfed7 100644 (file)
@@ -277,8 +277,8 @@ static void bm_log_faces_restore(BMesh *bm, BMLog *log, GHash *faces)
                void *key = BLI_ghashIterator_getKey(&gh_iter);
                BMLogFace *lf = BLI_ghashIterator_getValue(&gh_iter);
                BMVert *v[3] = {bm_log_vert_from_id(log, lf->v_ids[0]),
-                                               bm_log_vert_from_id(log, lf->v_ids[1]),
-                                               bm_log_vert_from_id(log, lf->v_ids[2])};
+                               bm_log_vert_from_id(log, lf->v_ids[1]),
+                               bm_log_vert_from_id(log, lf->v_ids[2])};
                BMFace *f;
 
                f = BM_face_create_quad_tri_v(bm, v, 3, NULL, false);
index 121f1f2fd67e51f14a20a9257887172dbd9651cc..19518eac5c9b080d89210b92091eea431021db7a 100644 (file)
@@ -41,7 +41,8 @@
 
 
 
-#define BEVEL_EPSILON  1e-6
+#define BEVEL_EPSILON_D  1e-6
+#define BEVEL_EPSILON    1e-6f
 
 /* for testing */
 // #pragma GCC diagnostic error "-Wpadded"
@@ -320,7 +321,7 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f,
        sub_v3_v3v3(dir1, v->co, BM_edge_other_vert(e1->e, v)->co);
        sub_v3_v3v3(dir2, BM_edge_other_vert(e2->e, v)->co, v->co);
 
-       if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON) {
+       if (angle_v3v3(dir1, dir2) < 100.0f * BEVEL_EPSILON) {
                /* special case: e1 and e2 are parallel; put offset point perp to both, from v.
                 * need to find a suitable plane.
                 * if offsets are different, we're out of luck: just use e1->offset */
@@ -406,7 +407,7 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
        madd_v3_v3fl(off2a, norm_perp2, e2->offset);
        add_v3_v3v3(off2b, off2a, dir2);
 
-       if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON) {
+       if (angle_v3v3(dir1, dir2) < 100.0f * BEVEL_EPSILON) {
                /* lines are parallel; off1a is a good meet point */
                copy_v3_v3(meetco, off1a);
        }
@@ -418,7 +419,7 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
                }
                else if (iret == 2) {
                        /* lines are not coplanar; meetco and isect2 are nearest to first and second lines */
-                       if (len_v3v3(meetco, isect2) > 100.0f * (float)BEVEL_EPSILON) {
+                       if (len_v3v3(meetco, isect2) > 100.0f * BEVEL_EPSILON) {
                                /* offset lines don't meet: project average onto emid; this is not ideal (see TODO above) */
                                mid_v3_v3v3(co, meetco, isect2);
                                closest_to_line_v3(meetco, co, v->co, BM_edge_other_vert(emid->e, v)->co);
@@ -467,7 +468,7 @@ static void slide_dist(EdgeHalf *e, BMVert *v, float d, float slideco[3])
        sub_v3_v3v3(dir, v->co, BM_edge_other_vert(e->e, v)->co);
        len = normalize_v3(dir);
        if (d > len)
-               d = len - (float)(50.0 * BEVEL_EPSILON);
+               d = len - (float)(50.0 * BEVEL_EPSILON_D);
        copy_v3_v3(slideco, v->co);
        madd_v3_v3fl(slideco, dir, -d);
 }
@@ -525,7 +526,7 @@ static int make_unit_square_map(const float va[3], const float vmid[3], const fl
 
        sub_v3_v3v3(va_vmid, vmid, va);
        sub_v3_v3v3(vb_vmid, vmid, vb);
-       if (fabsf(angle_v3v3(va_vmid, vb_vmid) - (float)M_PI) > 100.f *(float)BEVEL_EPSILON) {
+       if (fabsf(angle_v3v3(va_vmid, vb_vmid) - (float)M_PI) > 100.0f * BEVEL_EPSILON) {
                sub_v3_v3v3(vo, va, vb_vmid);
                cross_v3_v3v3(vddir, vb_vmid, va_vmid);
                normalize_v3(vddir);
@@ -787,7 +788,7 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv)
                                                        float dir1[3], dir2[3];
                                                        sub_v3_v3v3(dir1, bv->v->co, BM_edge_other_vert(e1->e, bv->v)->co);
                                                        sub_v3_v3v3(dir2, BM_edge_other_vert(e2->e, bv->v)->co, bv->v->co);
-                                                       if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON) {
+                                                       if (angle_v3v3(dir1, dir2) < 100.0f * BEVEL_EPSILON) {
                                                                epipe = e1;
                                                                break;
                                                        }
@@ -1092,14 +1093,14 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv)
        }
 }
 
-static VMeshnew_adj_subdiv_vmesh(MemArena *mem_arena, int count, int seg)
+static VMesh *new_adj_subdiv_vmesh(MemArena *mem_arena, int count, int seg)
 {
        VMesh *vm;
 
        vm = (VMesh *)BLI_memarena_alloc(mem_arena, sizeof(VMesh));
        vm->count = count;
        vm->seg = seg;
-       vm->mesh = (NewVert *)BLI_memarena_alloc(mem_arena, count * (1 + seg/2) * (1 + seg) * sizeof(NewVert));
+       vm->mesh = (NewVert *)BLI_memarena_alloc(mem_arena, count * (1 + seg / 2) * (1 + seg) * sizeof(NewVert));
        vm->mesh_kind = M_ADJ_SUBDIV;
        return vm;
 }
@@ -1111,7 +1112,7 @@ static VMesh* new_adj_subdiv_vmesh(MemArena *mem_arena, int count, int seg)
  *    0 <= j < ns2, 0 <= k <= ns2  (for even ns2)
  *        also (j=ns2, k=ns2) at i=0 (for even ns2)
  * This function returns the canonical one for any i, j, k in [0,n],[0,ns],[0,ns] */
-static NewVertmesh_vert_canon(VMesh *vm, int i, int j, int k)
+static NewVert *mesh_vert_canon(VMesh *vm, int i, int j, int k)
 {
        int n, ns, ns2, odd;
        NewVert *ans;
@@ -1187,9 +1188,10 @@ static void vmesh_center(VMesh *vm, float r_cent[3])
 /* Do one step of quadratic subdivision (Doo-Sabin), with special rules at boundaries.
  * For now, this is written assuming vm0->nseg is odd.
  * See Hwang-Chuang 2003 paper: "N-sided hole filling and vertex blending using subdivision surfaces"  */
-static VMeshquadratic_subdiv(MemArena *mem_arena, VMesh *vm0)
+static VMesh *quadratic_subdiv(MemArena *mem_arena, VMesh *vm0)
 {
-       int n, ns0, ns20, ns1, ns21, i, j, k, j1, k1;
+       int n, ns0, ns20, ns1 /*, ns21 */;
+       int i, j, k, j1, k1;
        VMesh *vm1;
        float co[3], co1[3], co2[3], co3[3], co4[3];
        float co11[3], co21[3], co31[3], co41[3];
@@ -1204,7 +1206,7 @@ static VMesh* quadratic_subdiv(MemArena *mem_arena, VMesh *vm0)
        BLI_assert(ns0 % 2 == 1);
 
        ns1 = 2 * ns0 - 1;
-       ns21 = ns1 / 2;
+       // ns21 = ns1 / 2;  /* UNUSED */
        vm1 = new_adj_subdiv_vmesh(mem_arena, n, ns1);
 
        for (i = 0; i < n; i ++) {
@@ -1320,7 +1322,7 @@ static int interp_range(const float *frac, int n, const float f, float *r_rest)
 }
 
 /* Interpolate given vmesh to make one with target nseg and evenly spaced border vertices */
-static VMeshinterp_vmesh(MemArena *mem_arena, VMesh *vm0, int nseg)
+static VMesh *interp_vmesh(MemArena *mem_arena, VMesh *vm0, int nseg)
 {
        int n, ns0, nseg2, odd, i, j, k, j0, k0;
        float *prev_frac, *frac, f, restj, restk;
@@ -1405,8 +1407,8 @@ static void bevel_build_rings_subdiv(BevelParams *bp, BMesh *bm, BevVert *bv)
                copy_v3_v3(cob, mesh_vert(bv->vmesh, (i + 1) % n, 0, 0)->co);
                copy_v3_v3(coc, mesh_vert(bv->vmesh, (i + n -1) % n, 0, 0)->co);
                copy_v3_v3(mesh_vert(vm0, i, 0, 0)->co, coa);
-               interp_v3_v3v3(mesh_vert(vm0, i, 0, 1)->co, coa, cob, 1.0f/3.0f);
-               interp_v3_v3v3(mesh_vert(vm0, i, 1, 0)->co, coa, coc, 1.0f/3.0f);
+               interp_v3_v3v3(mesh_vert(vm0, i, 0, 1)->co, coa, cob, 1.0f / 3.0f);
+               interp_v3_v3v3(mesh_vert(vm0, i, 1, 0)->co, coa, coc, 1.0f / 3.0f);
                interp_v3_v3v3(mesh_vert(vm0, i, 1, 1)->co, coa, bv->v->co, fullness);
        }
        vmesh_copy_equiv_verts(vm0);
@@ -1442,16 +1444,16 @@ static void bevel_build_rings_subdiv(BevelParams *bp, BMesh *bm, BevVert *bv)
                 *    j in [0, ns2-1], k in [0, ns2].  And then the center ngon.
                 * For even ns,
                 *    j in [0, ns2-1], k in [0, ns2-1] */
-                for (j = 0; j < ns2; j++) {
-                       for (k = 0; k < ns2 + odd; k++) {
+               for (j = 0; j < ns2; j++) {
+                       for (k = 0; k < ns2 + odd; k++) {
                                bmv1 = mesh_vert(vm, i, j, k)->v;
                                bmv2 = mesh_vert(vm, i, j, k + 1)->v;
                                bmv3 = mesh_vert(vm, i, j + 1, k + 1)->v;
                                bmv4 = mesh_vert(vm, i, j + 1, k)->v;
                                BLI_assert(bmv1 && bmv2 && bmv3 && bmv4);
                                bev_create_quad_tri(bm, bmv1, bmv2, bmv3, bmv4, f);
-                       }
-                }
+                       }
+               }
        } while ((v = v->next) != vm->boundstart);
 
        /* center ngon */
index 9fc453aec7bac76f468149f78e64d61be7267ee0..00c45e4158782678821282462da30b9fad71c32b 100644 (file)
@@ -1154,8 +1154,9 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
                        if (block->rect.xmin <= mx && block->rect.xmin + PNL_HEADER >= mx)
                                inside_header = 1;
                }
-               else if (block->rect.xmin > mx || block->rect.xmax < mx);
+               else if (block->rect.xmin > mx || block->rect.xmax < mx) {
                        /* outside left/right side */
+               }
                else if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my)) {
                        inside_header = 1;
                }
index 03fcba488a84e2997a711259ae8006f96d316744..c27b61d41e273f3267759af23b59049352960b18 100644 (file)
@@ -1567,8 +1567,9 @@ static ProjPixel *project_paint_uvpixel_init(
        }
        
        /* screenspace unclamped, we could keep its z and w values but don't need them at the moment */
-       if(ps->brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D)
+       if (ps->brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) {
                copy_v3_v3(projPixel->worldCoSS, world_spaceCo);
+       }
 
        copy_v2_v2(projPixel->projCoSS, pixelScreenCo);
        
@@ -2520,16 +2521,15 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
                                                if ((ps->do_occlude == FALSE) ||
                                                    !project_bucket_point_occluded(ps, bucketFaceNodes, face_index, pixelScreenCo))
                                                {
-                                                       
                                                        mask = project_paint_uvpixel_mask(ps, face_index, side, w);
-                                                       
+
                                                        if (mask > 0.0f) {
                                                                BLI_linklist_prepend_arena(
                                                                        bucketPixelNodes,
                                                                        project_paint_uvpixel_init(ps, arena, ibuf, x, y, mask, face_index,
-                                                                                               image_index, pixelScreenCo, wco, side, w),
-                                                                                               arena
-                                                                                               );
+                                                                                                  image_index, pixelScreenCo, wco, side, w),
+                                                                       arena
+                                                                       );
                                                        }
                                                }
                                                
@@ -5021,7 +5021,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
 
        /* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */
        ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW ||
-                                               brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true;
+                         brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true;
        ps->is_texbrush = (brush->mtex.tex) ? 1 : 0;
 
 
index 481843553827abe0548ac6cf44b0e9f72e1a1688..7fa9f40a4ee391e0b97c8541cc84429e25379687 100644 (file)
@@ -908,7 +908,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                                                initVertSlide(t);
                                                        }
                                                        /* vert slide can fail on unconnected vertices (rare but possible) */
-                                                       if(t->state == TRANS_CANCEL) {
+                                                       if (t->state == TRANS_CANCEL) {
                                                                t->state = TRANS_STARTING;
                                                                resetTransRestrictions(t);
                                                                restoreTransObjects(t);
index b501ed2a22605036f09630060114897aa99196d0..6e9f12ec5292d1585ea26c259fb9999aba9bb8a4 100644 (file)
@@ -147,7 +147,7 @@ static void _build_translations_cache(PyObject *py_messages, const char *locale)
        _translations_cache = BLI_ghash_new(_ghashutil_keyhash, _ghashutil_keycmp, __func__);
 
        /* Iterate over all py dicts. */
-       while(PyDict_Next(py_messages, &pos, NULL, &uuid_dict)) {
+       while (PyDict_Next(py_messages, &pos, NULL, &uuid_dict)) {
                PyObject *lang_dict;
 
 #if 0
@@ -172,7 +172,7 @@ static void _build_translations_cache(PyObject *py_messages, const char *locale)
                        Py_ssize_t ppos = 0;
 
                        /* Iterate over all translations of the found language dict, and populate our ghash cache. */
-                       while(PyDict_Next(lang_dict, &ppos, &pykey, &trans)) {
+                       while (PyDict_Next(lang_dict, &ppos, &pykey, &trans)) {
                                GHashKey *key;
                                PyObject *tmp;
                                const char *msgctxt = NULL, *msgid = NULL;
index 611095bfe20afcfd5f1b7c8b4def501670f2a450..85a6db0070342ce32da9a7f139a58b6c70f02197 100644 (file)
@@ -1626,8 +1626,6 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                        /* Unicode String */
 #ifdef WITH_INTERNATIONAL
                                        bool do_translate = RNA_property_flag(prop) & PROP_STRING_PY_TRANSLATE;
-#else
-                                       bool do_translate = false;
 #endif  /* WITH_INTERNATIONAL */
 
 #ifdef USE_STRING_COERCE
@@ -1644,9 +1642,11 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
 #endif  /* USE_STRING_COERCE */
 
                                        /* Any half-brained compiler should be able to optimize this out when WITH_INTERNATIONAL is off */
+#ifdef WITH_INTERNATIONAL
                                        if (do_translate) {
                                                param = IFACE_(param);
                                        }
+#endif
 
                                        if (param == NULL) {
                                                if (PyUnicode_Check(value)) {
index 77445986355492f6dd4dc4c343e57f575ebe0e0e..3b71a4565bb8165cd2a2511259c77cab44fccdd0 100644 (file)
@@ -1139,7 +1139,7 @@ static void addAlphaOverFloatMask(float *dest, float *source, unsigned short dma
                dest[3]+= source[3];
                
                return;
-        }
+       }
 
        dest[0]= (mul*dest[0]) + source[0];
        dest[1]= (mul*dest[1]) + source[1];
index a1c7404a0314c250d025a60e5c94cc1b4d080a85..794bfdde1141fbc5ff12485f4fc49b51bac04568 100644 (file)
@@ -198,10 +198,14 @@ void WM_cursor_grab_enable(wmWindow *win, int wrap, int hide, int bounds[4])
                bounds[3] /= fac;
        }
        
-       if (hide) mode = GHOST_kGrabHide;
-       else if (wrap) mode = GHOST_kGrabWrap;
+       if (hide) {
+               mode = GHOST_kGrabHide;
+       }
+       else if (wrap) {
+               mode = GHOST_kGrabWrap;
+       }
        if ((G.debug & G_DEBUG) == 0) {
-               if (win && win->ghostwin) {
+               if (win->ghostwin) {
                        const GHOST_TabletData *tabletdata = GHOST_GetTabletData(win->ghostwin);
                        
                        /* Note: There is no tabletdata on Windows if no tablet device is connected. */