diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-21 06:30:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-21 06:30:40 +0400 |
commit | 38cee985bb6d6a45fe59cc539dfa9cd6412b6f36 (patch) | |
tree | 59497913e5644e045b21ecb7ba7ad0ee3a5a8ac8 | |
parent | add25e43adae7204d27685eafefde343096d5698 (diff) |
code cleanup: style & warnings.
-rw-r--r-- | source/blender/blenfont/BLF_translation.h | 2 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_lang.c | 61 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_array.h | 4 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_log.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 42 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 14 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_translations.c | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 4 | ||||
-rw-r--r-- | source/blender/render/intern/source/rendercore.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 10 |
13 files changed, 82 insertions, 78 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index 59f66cae727..7194c6c23c1 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -200,4 +200,4 @@ typedef struct //#undef _BLF_I18NCONTEXTS_ITEM -#endif /* __BLF_TRANSLATION_H__ */
\ No newline at end of file +#endif /* __BLF_TRANSLATION_H__ */ diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index ab29fae1a58..84e2ca8edcd 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -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 */ diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index f72bcded9ad..483dd2570e2 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -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; diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index a73227490c6..0ba0f138c28 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -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) && \ diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index fa5bfe34a11..68f8f38fb26 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -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); diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 121f1f2fd67..19518eac5c9 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -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 VMesh* new_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 NewVert* mesh_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 VMesh* quadratic_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 VMesh* interp_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 */ diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 9fc453aec7b..00c45e41587 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -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; } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 03fcba488a8..c27b61d41e2 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -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; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 48184355382..7fa9f40a4ee 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -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); diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index b501ed2a226..6e9f12ec529 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -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; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 611095bfe20..85a6db00703 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -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)) { diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 77445986355..3b71a4565bb 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -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]; diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index a1c7404a031..794bfdde114 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -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. */ |