[Bf-blender-cvs] [cad2d32be67] master: Clang-Tidy: Enable bugprone-misplaced-widening-cast

Sergey Sharybin noreply at git.blender.org
Fri Jul 3 17:11:35 CEST 2020


Commit: cad2d32be67729f39fc44172668e77ab8faabf98
Author: Sergey Sharybin
Date:   Fri Jul 3 17:09:24 2020 +0200
Branches: master
https://developer.blender.org/rBcad2d32be67729f39fc44172668e77ab8faabf98

Clang-Tidy: Enable bugprone-misplaced-widening-cast

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

M	.clang-tidy
M	source/blender/blenfont/intern/blf_font.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/mesh/editmesh_undo.c

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

diff --git a/.clang-tidy b/.clang-tidy
index e68834d7f1a..733092e5e8e 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -36,7 +36,6 @@ Checks:  >
   -bugprone-integer-division,
   -bugprone-incorrect-roundings,
   -bugprone-suspicious-string-compare,
-  -bugprone-misplaced-widening-cast,
   -bugprone-not-null-terminated-result,
   -bugprone-suspicious-missing-comma,
   -bugprone-parent-virtual-call,
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index da6224cff7f..50a8223a84c 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -297,7 +297,7 @@ void blf_font_size(FontBLF *font, unsigned int size, unsigned int dpi)
     }
   }
 
-  err = FT_Set_Char_Size(font->face, 0, (FT_F26Dot6)(size * 64), dpi, dpi);
+  err = FT_Set_Char_Size(font->face, 0, ((FT_F26Dot6)(size)) * 64, dpi, dpi);
   if (err) {
     /* FIXME: here we can go through the fixed size and choice a close one */
     printf("The current font don't support the size, %u and dpi, %u\n", size, dpi);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 16a5a13885b..31f8c89c2bc 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1515,7 +1515,7 @@ static void ui_text_clip_right_ex(const uiFontStyle *fstyle,
     l_end = BLF_width_to_strlen(fstyle->uifont_id, str, max_len, okwidth - sep_strwidth, &tmp);
     memcpy(str + l_end, sep, sep_len + 1); /* +1 for trailing '\0'. */
     if (r_final_len) {
-      *r_final_len = (size_t)(l_end + sep_len);
+      *r_final_len = (size_t)(l_end) + sep_len;
     }
   }
 }
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c
index e4ecfa9c680..9f625fd0515 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -619,7 +619,7 @@ static void undomesh_to_editmesh(UndoMesh *um, Object *ob, BMEditMesh *em, Key *
       if (kb_act->totelem != um->me.totvert) {
         /* The current mesh has some extra/missing verts compared to the undo, adjust. */
         MEM_SAFE_FREE(kb_act->data);
-        kb_act->data = MEM_mallocN((size_t)(key->elemsize * bm->totvert), __func__);
+        kb_act->data = MEM_mallocN((size_t)(key->elemsize) * bm->totvert, __func__);
         kb_act->totelem = um->me.totvert;
       }



More information about the Bf-blender-cvs mailing list