[Bf-blender-cvs] [eb49a76] master: Cleanup: warnings

Campbell Barton noreply at git.blender.org
Sat Oct 17 08:12:14 CEST 2015


Commit: eb49a76dcaa18ef6bf2667b3671913ca9ccf31e7
Author: Campbell Barton
Date:   Sat Oct 17 16:06:45 2015 +1100
Branches: master
https://developer.blender.org/rBeb49a76dcaa18ef6bf2667b3671913ca9ccf31e7

Cleanup: warnings

- remove NULL checks for args already set as ATTR_NONNULL.
- double promotion.

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

M	source/blender/blenfont/intern/blf.c
M	source/blender/blenlib/intern/path_util.c
M	source/blender/editors/interface/interface.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/space_view3d/view3d_edit.c

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

diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 61b847f..b7d72bb 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -176,9 +176,6 @@ int BLF_load(const char *name)
 	char *filename;
 	int i;
 
-	if (!name)
-		return -1;
-
 	/* check if we already load this font. */
 	i = blf_search(name);
 	if (i >= 0) {
@@ -216,9 +213,6 @@ int BLF_load_unique(const char *name)
 	char *filename;
 	int i;
 
-	if (!name)
-		return -1;
-
 	/* Don't search in the cache!! make a new
 	 * object font, this is for keep fonts threads safe.
 	 */
@@ -260,9 +254,6 @@ int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size)
 	FontBLF *font;
 	int i;
 
-	if (!name)
-		return -1;
-
 	i = blf_search(name);
 	if (i >= 0) {
 		/*font = global_font[i];*/ /*UNUSED*/
@@ -275,7 +266,7 @@ int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size)
 		return -1;
 	}
 
-	if (!mem || !mem_size) {
+	if (!mem_size) {
 		printf("Can't load font: %s from memory!!\n", name);
 		return -1;
 	}
@@ -295,9 +286,6 @@ int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size
 	FontBLF *font;
 	int i;
 
-	if (!name)
-		return -1;
-
 	/*
 	 * Don't search in the cache, make a new object font!
 	 * this is to keep the font thread safe.
@@ -308,7 +296,7 @@ int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size
 		return -1;
 	}
 
-	if (!mem || !mem_size) {
+	if (!mem_size) {
 		printf("Can't load font: %s from memory!!\n", name);
 		return -1;
 	}
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index f5b3f21..c94ce84 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -960,7 +960,7 @@ bool BLI_path_frame_range(char *path, int sta, int end, int digits)
  */
 bool BLI_path_frame_get(char *path, int *r_frame, int *r_numdigits)
 {
-	if (path && *path) {
+	if (*path) {
 		char *file = (char *)BLI_last_slash(path);
 		char *c;
 		int len, numdigits;
@@ -1009,9 +1009,9 @@ bool BLI_path_frame_get(char *path, int *r_frame, int *r_numdigits)
 	return false;
 }
 
-void BLI_path_frame_strip(char *path, bool setsharp, char *ext)
+void BLI_path_frame_strip(char *path, bool set_frame_char, char *ext)
 {
-	if (path && *path) {
+	if (*path) {
 		char *file = (char *)BLI_last_slash(path);
 		char *c, *suffix;
 		int len;
@@ -1046,15 +1046,12 @@ void BLI_path_frame_strip(char *path, bool setsharp, char *ext)
 		if (numdigits) {
 			/* replace the number with the suffix and terminate the string */
 			while (numdigits--) {
-				if (ext) *ext++ = *suffix;
-
-				if (setsharp) *c++ = '#';
-				else *c++ = *suffix;
-
+				*ext++ = *suffix;
+				*c++ = set_frame_char ? '#' : *suffix;
 				suffix++;
 			}
-			*c = 0;
-			if (ext) *ext = 0;
+			*c = '\0';
+			*ext = '\0';
 		}
 	}
 }
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index ff92ddb..1fccf0f 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2093,7 +2093,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
 
 		BLI_assert(step > 0.0);
 
-		step_final = (step / scale_unit) / UI_PRECISION_FLOAT_SCALE;
+		step_final = (step / scale_unit) / (double)UI_PRECISION_FLOAT_SCALE;
 
 		if (step == step_unit) {
 			/* Logic here is to scale by the original 'step_orig'
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index cdbb62e..621155b 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -2116,7 +2116,7 @@ static float snap_v2_angle(float r[2], const float v[2], const float v_ref[2], f
 
 	normalize_v2_v2(v_unit, v);
 	angle = angle_signed_v2v2(v_unit, v_ref);
-	angle_delta = (round(angle / angle_snap) * angle_snap) - angle;
+	angle_delta = (roundf(angle / angle_snap) * angle_snap) - angle;
 	rotate_m2(m2, angle_delta);
 
 	mul_v2_m2v2(r, m2, v);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 2a9904c..cee0af9 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1035,7 +1035,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
 
 		sub_v3_v3v3(dvec, newvec, vod->trackvec);
 
-		angle = (len_v3(dvec) / (2.0f * TRACKBALLSIZE)) * M_PI;
+		angle = (len_v3(dvec) / (2.0f * TRACKBALLSIZE)) * (float)M_PI;
 
 		/* Allow for rotation beyond the interval [-pi, pi] */
 		angle = angle_wrap_rad(angle);




More information about the Bf-blender-cvs mailing list