[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53938] trunk/blender/source/blender: code cleanup: style & warnings.

Campbell Barton ideasman42 at gmail.com
Mon Jan 21 03:30:45 CET 2013


Revision: 53938
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53938
Author:   campbellbarton
Date:     2013-01-21 02:30:40 +0000 (Mon, 21 Jan 2013)
Log Message:
-----------
code cleanup: style & warnings.

Modified Paths:
--------------
    trunk/blender/source/blender/blenfont/BLF_translation.h
    trunk/blender/source/blender/blenfont/intern/blf_lang.c
    trunk/blender/source/blender/blenkernel/intern/pbvh.c
    trunk/blender/source/blender/blenlib/BLI_array.h
    trunk/blender/source/blender/bmesh/intern/bmesh_log.c
    trunk/blender/source/blender/bmesh/tools/bmesh_bevel.c
    trunk/blender/source/blender/editors/interface/interface_panel.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/transform/transform.c
    trunk/blender/source/blender/python/intern/bpy_app_translations.c
    trunk/blender/source/blender/python/intern/bpy_rna.c
    trunk/blender/source/blender/render/intern/source/rendercore.c
    trunk/blender/source/blender/windowmanager/intern/wm_cursors.c

Modified: trunk/blender/source/blender/blenfont/BLF_translation.h
===================================================================
--- trunk/blender/source/blender/blenfont/BLF_translation.h	2013-01-21 01:52:23 UTC (rev 53937)
+++ trunk/blender/source/blender/blenfont/BLF_translation.h	2013-01-21 02:30:40 UTC (rev 53938)
@@ -200,4 +200,4 @@
 
 //#undef _BLF_I18NCONTEXTS_ITEM
 
-#endif /* __BLF_TRANSLATION_H__ */
\ No newline at end of file
+#endif /* __BLF_TRANSLATION_H__ */

Modified: trunk/blender/source/blender/blenfont/intern/blf_lang.c
===================================================================
--- trunk/blender/source/blender/blenfont/intern/blf_lang.c	2013-01-21 01:52:23 UTC (rev 53937)
+++ trunk/blender/source/blender/blenfont/intern/blf_lang.c	2013-01-21 02:30:40 UTC (rev 53938)
@@ -248,36 +248,6 @@
 #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 @@
 	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 */

Modified: trunk/blender/source/blender/blenkernel/intern/pbvh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/pbvh.c	2013-01-21 01:52:23 UTC (rev 53937)
+++ trunk/blender/source/blender/blenkernel/intern/pbvh.c	2013-01-21 02:30:40 UTC (rev 53938)
@@ -1399,10 +1399,10 @@
 }
 
 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;
 

Modified: trunk/blender/source/blender/blenlib/BLI_array.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_array.h	2013-01-21 01:52:23 UTC (rev 53937)
+++ trunk/blender/source/blender/blenlib/BLI_array.h	2013-01-21 02:30:40 UTC (rev 53938)
@@ -79,12 +79,10 @@
 /* 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) &&                                   \

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_log.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_log.c	2013-01-21 01:52:23 UTC (rev 53937)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_log.c	2013-01-21 02:30:40 UTC (rev 53938)
@@ -277,8 +277,8 @@
 		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);

Modified: trunk/blender/source/blender/bmesh/tools/bmesh_bevel.c
===================================================================
--- trunk/blender/source/blender/bmesh/tools/bmesh_bevel.c	2013-01-21 01:52:23 UTC (rev 53937)
+++ trunk/blender/source/blender/bmesh/tools/bmesh_bevel.c	2013-01-21 02:30:40 UTC (rev 53938)
@@ -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 @@
 	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 @@
 	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 @@
 		}
 		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 @@
 	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 @@
 
 	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 @@
 							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 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 @@
  *    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 @@
 /* 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 @@
 	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 @@
 }
 
 /* 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 @@
 		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 @@
 		 *    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;

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list