From 40ac8250b246743f73010152671b9e60c83c8883 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 6 Mar 2020 15:56:09 +0100 Subject: Fix narrowing from int to short when removing material slot --- source/blender/blenkernel/intern/material.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index f8e1e9aeef2..219d4eaa407 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -594,8 +594,7 @@ void BKE_object_material_resize(Main *bmain, Object *ob, const short totcol, boo char *newmatbits; if (do_id_user && totcol < ob->totcol) { - short i; - for (i = totcol; i < ob->totcol; i++) { + for (int i = totcol; i < ob->totcol; i++) { id_us_min((ID *)ob->mat[i]); } } @@ -965,7 +964,6 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) { Material *mao, ***matarar; short *totcolp; - short a, actcol; if (ob == NULL || ob->totcol == 0) { return false; @@ -1002,7 +1000,7 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) id_us_min(&mao->id); } - for (a = ob->actcol; a < ob->totcol; a++) { + for (int a = ob->actcol; a < ob->totcol; a++) { (*matarar)[a - 1] = (*matarar)[a]; } (*totcolp)--; @@ -1012,7 +1010,7 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) *matarar = NULL; } - actcol = ob->actcol; + const int actcol = ob->actcol; for (Object *obt = bmain->objects.first; obt; obt = obt->id.next) { if (obt->data == ob->data) { @@ -1026,7 +1024,7 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) id_us_min(&mao->id); } - for (a = actcol; a < obt->totcol; a++) { + for (int a = actcol; a < obt->totcol; a++) { obt->mat[a - 1] = obt->mat[a]; obt->matbits[a - 1] = obt->matbits[a]; } -- cgit v1.2.3