From eb49a76dcaa18ef6bf2667b3671913ca9ccf31e7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Oct 2015 16:06:45 +1100 Subject: Cleanup: warnings - remove NULL checks for args already set as ATTR_NONNULL. - double promotion. --- source/blender/blenfont/intern/blf.c | 16 ++-------------- source/blender/blenlib/intern/path_util.c | 17 +++++++---------- source/blender/editors/interface/interface.c | 2 +- source/blender/editors/mesh/editmesh_knife.c | 2 +- source/blender/editors/space_view3d/view3d_edit.c | 2 +- 5 files changed, 12 insertions(+), 27 deletions(-) diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 61b847fd3a3..b7d72bb28bb 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 f5b3f217dee..c94ce842b8c 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 ff92ddb69f2..1fccf0fb2d0 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 cdbb62e8526..621155bc696 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 2a9904c6737..cee0af933d0 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); -- cgit v1.2.3