[Bf-blender-cvs] [af93ebc] master: Code Cleanup: style and redundant casts

Campbell Barton noreply at git.blender.org
Thu Jan 16 09:16:28 CET 2014


Commit: af93ebcb503293e382f74c2d33554504269d4815
Author: Campbell Barton
Date:   Thu Jan 16 19:15:53 2014 +1100
https://developer.blender.org/rBaf93ebcb503293e382f74c2d33554504269d4815

Code Cleanup: style and redundant casts

===================================================================

M	source/blender/blenkernel/intern/suggestions.c
M	source/blender/blenlib/intern/scanfill.c
M	source/blender/blenlib/intern/storage.c
M	source/blender/blenlib/intern/string.c
M	source/blender/blenlib/intern/winstuff_dir.c
M	source/blender/bmesh/operators/bmo_smooth_laplacian.c
M	source/blender/bmesh/tools/bmesh_bevel.c
M	source/blender/compositor/intern/COM_Node.cpp
M	source/blender/editors/animation/keyframes_edit.c
M	source/blender/editors/animation/keyframing.c
M	source/blender/editors/armature/armature_naming.c
M	source/blender/editors/armature/pose_lib.c
M	source/blender/editors/interface/view2d.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/space_file/file_panels.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_outliner/outliner_edit.c
M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_tools.c
M	source/blender/editors/space_sequencer/sequencer_edit.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/editors/transform/transform_constraints.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/uvedit/uvedit_ops.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_sequencer.c
M	source/blender/modifiers/intern/MOD_mask.c
M	source/blender/nodes/composite/node_composite_tree.c
M	source/blender/windowmanager/intern/wm_cursors.c
M	source/blender/windowmanager/intern/wm_dragdrop.c
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c
index 6f9736d..d46fa59 100644
--- a/source/blender/blenkernel/intern/suggestions.c
+++ b/source/blender/blenkernel/intern/suggestions.c
@@ -52,7 +52,7 @@ static int txttl_cmp(const char *first, const char *second, int len)
 {
 	int cmp, i;
 	for (cmp = 0, i = 0; i < len; i++) {
-		if ( (cmp = toupper(first[i]) - toupper(second[i])) ) {
+		if ((cmp = toupper(first[i]) - toupper(second[i]))) {
 			break;
 		}
 	}
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index c4cefad..d1eb725 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -699,7 +699,7 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
 
 						ed3 = sc1->edge_first;
 						while (ed3) {
-							if ( (ed3->v1 == v1 && ed3->v2 == v3) || (ed3->v1 == v3 && ed3->v2 == v1) ) {
+							if ((ed3->v1 == v1 && ed3->v2 == v3) || (ed3->v1 == v3 && ed3->v2 == v1)) {
 								if (twoconnected || ed3->f == SF_EDGE_BOUNDARY) {
 									BLI_remlink((ListBase *)&(sc1->edge_first), ed3);
 									BLI_addtail(&sf_ctx->filledgebase, ed3);
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 6f03529..de40cab 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -486,7 +486,7 @@ int BLI_exists(const char *name)
 	unsigned int old_error_mode;
 
 	len = wcslen(tmp_16);
-	if (len > 3 && (tmp_16[len - 1] == L'\\' || tmp_16[len - 1] == L'/') )
+	if (len > 3 && (tmp_16[len - 1] == L'\\' || tmp_16[len - 1] == L'/'))
 		tmp_16[len - 1] = '\0';
 
 	/* change error mode so user does not get a "no disk in drive" popup
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 0ce40f7..6b738fa 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -513,17 +513,17 @@ int BLI_natstrcmp(const char *s1, const char *s2)
 		c1 = tolower(s1[d1]);
 		c2 = tolower(s2[d2]);
 		
-		if (isdigit(c1) && isdigit(c2) ) {
+		if (isdigit(c1) && isdigit(c2)) {
 			int numcompare = left_number_strcmp(s1 + d1, s2 + d2, &tiebreaker);
 			
 			if (numcompare != 0)
 				return numcompare;
 
 			d1++;
-			while (isdigit(s1[d1]) )
+			while (isdigit(s1[d1]))
 				d1++;
 			d2++;
-			while (isdigit(s2[d2]) )
+			while (isdigit(s2[d2]))
 				d2++;
 			
 			c1 = tolower(s1[d1]);
diff --git a/source/blender/blenlib/intern/winstuff_dir.c b/source/blender/blenlib/intern/winstuff_dir.c
index 4082681..90250de 100644
--- a/source/blender/blenlib/intern/winstuff_dir.c
+++ b/source/blender/blenlib/intern/winstuff_dir.c
@@ -21,12 +21,16 @@
  * Windows-posix compatibility layer for opendir/readdir/closedir
  */
 
-/** \file blender/blenlib/intern/winstuff.c
+/** \file blender/blenlib/intern/winstuff_dir.c
  *  \ingroup bli
+ *
+ * Posix compatibility functions for windows dealing with DIR
+ * (opendir, readdir, closedir)
  */
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 
+/* standalone for inclusion in binaries other then blender */
 #  ifdef USE_STANDALONE
 #    define MEM_mallocN(size, str) ((void)str, malloc(size))
 #    define MEM_callocN(size, str) ((void)str, calloc(size, 1))
diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
index 16e70e8..c36c746 100644
--- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c
+++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
@@ -362,7 +362,7 @@ static void fill_laplacian_matrix(LaplacianSystem *sys)
 		}
 	}
 	BM_ITER_MESH (e, &eiter, sys->bm, BM_EDGES_OF_MESH) {
-		if (!BM_elem_flag_test(e, BM_ELEM_SELECT) && BM_edge_is_boundary(e) ) {
+		if (!BM_elem_flag_test(e, BM_ELEM_SELECT) && BM_edge_is_boundary(e)) {
 			v1 = e->v1->co;
 			v2 =  e->v2->co;
 			idv1 = BM_elem_index_get(e->v1);
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 836588c..d07d833 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -2522,7 +2522,7 @@ static bool tri_corner_test(BevelParams *bp, BevVert *bv)
 		totang += ang;
 	}
 	angdiff = fabsf(totang - 3.0f * (float)M_PI_2);
-	if ((bp->pro_super_r == PRO_SQUARE_R && angdiff > (float)M_PI/16.0f) ||
+	if ((bp->pro_super_r == PRO_SQUARE_R && angdiff > (float)M_PI / 16.0f) ||
 	    (angdiff > (float)M_PI_4))
 	{
 		return false;
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index f59580a..b62e2d0 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -39,7 +39,7 @@
 //#include <stdio.h>
 #include "COM_defines.h"
 
-Node::Node(bNode *editorNode, bool create_sockets): NodeBase()
+Node::Node(bNode *editorNode, bool create_sockets) : NodeBase()
 {
 	setbNode(editorNode);
 	
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 6566906..6010a64 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -121,7 +121,7 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
 				}
 				
 				/* Only operate on this BezTriple if it fullfills the criteria of the validation func */
-				if ( (ok = key_ok(ked, bezt)) ) {
+				if ((ok = key_ok(ked, bezt))) {
 					if (ked) ked->curflags = ok;
 					
 					/* Exit with return-code '1' if function returns positive
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 1b77c15..2fd30ed 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1984,7 +1984,7 @@ static short object_frame_has_keyframe(Object *ob, float frame, short filter)
 	}
 	
 	/* try shapekey keyframes (if available, and allowed by filter) */
-	if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOSKEY) ) {
+	if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOSKEY)) {
 		Key *key = BKE_key_from_object(ob);
 		
 		/* shapekeys can have keyframes ('Relative Shape Keys') 
@@ -2000,7 +2000,7 @@ static short object_frame_has_keyframe(Object *ob, float frame, short filter)
 	}
 
 	/* try materials */
-	if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOMAT) ) {
+	if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOMAT)) {
 		/* if only active, then we can skip a lot of looping */
 		if (filter & ANIMFILTER_KEYS_ACTIVE) {
 			Material *ma = give_current_material(ob, (ob->actcol + 1));
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c
index a4b40f6..c214dc3 100644
--- a/source/blender/editors/armature/armature_naming.c
+++ b/source/blender/editors/armature/armature_naming.c
@@ -113,8 +113,9 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, const char *
 			
 			for (ct = targets.first; ct; ct = ct->next) {
 				if (ct->tar == ob) {
-					if (!strcmp(ct->subtarget, oldname) )
+					if (STREQ(ct->subtarget, oldname)) {
 						BLI_strncpy(ct->subtarget, newname, MAXBONENAME);
+					}
 				}
 			}
 			
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 3a9dd3c..7a825b3 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -920,7 +920,7 @@ static void poselib_keytag_pose(bContext *C, Scene *scene, tPoseLib_PreviewData
 		pchan = BKE_pose_channel_find_name(pose, agrp->name);
 		
 		if (pchan) {
-			if ( (pld->selcount == 0) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) ) {
+			if ((pld->selcount == 0) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))) {
 				if (autokey) {
 					/* add datasource override for the PoseChannel, to be used later */
 					ANIM_relative_keyingset_add_source(&dsources, &pld->ob->id, &RNA_PoseBone, pchan); 
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 06f13c3..544d9a0 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -823,17 +823,17 @@ void UI_view2d_curRect_reset(View2D *v2d)
 	/* handle width - posx and negx flags are mutually exclusive, so watch out */
 	if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
 		/* width is in negative-x half */
-		v2d->cur.xmin = (float)-width;
+		v2d->cur.xmin = -width;
 		v2d->cur.xmax = 0.0f;
 	}
 	else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
 		/* width is in positive-x half */
 		v2d->cur.xmin = 0.0f;
-		v2d->cur.xmax = (float)width;
+		v2d->cur.xmax = width;
 	}
 	else {
 		/* width is centered around (x == 0) */
-		const float dx = (float)width / 2.0f;
+		const float dx = width / 2.0f;
 		
 		v2d->cur.xmin = -dx;
 		v2d->cur.xmax = dx;
@@ -842,17 +842,17 @@ void UI_view2d_curRect_reset(View2D *v2d)
 	/* handle height - posx and negx flags are mutually exclusive, so watch out */
 	if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
 		/* height is in negative-y half */
-		v2d->cur.ymin = (float)-height;
+		v2d->cur.ymin = -height;
 		v2d->cur.ymax = 0.0f;
 	}
 	else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
 		/* height is in positive-y half */
 		v2d->cur.ymin = 0.0f;
-		v2d->cur.ymax = (float)height;
+		v2d->cur.ymax = height;
 	}
 	else {
 		/* height is centered around (y == 0) */
-		const float dy = (float)height / 2.0f;
+		const float dy = height / 2.0f;
 		
 		v2d->cur.ymin = -dy;
 		v2d->cur.ymax = dy;
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index b80d4de..5488545 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -455,7 +455,7 @@ void ED_object_editmode_enter(bContext *C, int flag)
 	ob = base->

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list