diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-26 03:56:05 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-26 04:33:22 +0300 |
commit | 3961d3493be9c666850e71abe6102f72d3db9332 (patch) | |
tree | 83b903f8040f6384cbd4f702546db52a02bcd3dc /source/blender/makesrna | |
parent | 3a7dc572dc9bbad35bdff3a3aeca8eab0ccb3fb7 (diff) |
Cleanup: use 'u' prefixed integer types for brevity in C code
This also simplifies using function style casts when moving to C++.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 16 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 16 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_test.c | 2 |
5 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index d31a312816a..c91e0e1805e 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -1140,7 +1140,7 @@ static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum e BKE_previewimg_clear_single(prv_img, size); if (values[0] && values[1]) { - prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect"); + prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(uint), "prv_rect"); prv_img->w[size] = values[0]; prv_img->h[size] = values[1]; @@ -1178,7 +1178,7 @@ static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIcon BKE_previewimg_ensure(prv_img, size); - memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int)); + memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(uint)); } static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum eIconSizes size) @@ -1190,7 +1190,7 @@ static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); } - memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int)); + memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(uint)); prv_img->flag[size] |= PRV_USER_EDITED; } @@ -1201,7 +1201,7 @@ static int rna_ImagePreview_pixels_float_get_length(const PointerRNA *ptr, ID *id = ptr->owner_id; PreviewImage *prv_img = (PreviewImage *)ptr->data; - BLI_assert(sizeof(unsigned int) == 4); + BLI_assert(sizeof(uint) == 4); if (id != NULL) { BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); @@ -1219,11 +1219,11 @@ static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, en ID *id = ptr->owner_id; PreviewImage *prv_img = (PreviewImage *)ptr->data; - unsigned char *data = (unsigned char *)prv_img->rect[size]; + uchar *data = (uchar *)prv_img->rect[size]; const size_t len = prv_img->w[size] * prv_img->h[size] * 4; size_t i; - BLI_assert(sizeof(unsigned int) == 4); + BLI_assert(sizeof(uint) == 4); if (id != NULL) { BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); @@ -1243,11 +1243,11 @@ static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr, ID *id = ptr->owner_id; PreviewImage *prv_img = (PreviewImage *)ptr->data; - unsigned char *data = (unsigned char *)prv_img->rect[size]; + uchar *data = (uchar *)prv_img->rect[size]; const size_t len = prv_img->w[size] * prv_img->h[size] * 4; size_t i; - BLI_assert(sizeof(unsigned int) == 4); + BLI_assert(sizeof(uint) == 4); if (id != NULL) { BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index b7ab7689dd7..4e7c06bd37c 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -177,7 +177,7 @@ void rna_Image_generated_color_set(PointerRNA *ptr, const float values[4]) { Image *ima = (Image *)(ptr->data); ImageTile *base_tile = BKE_image_get_tile(ima, 0); - for (unsigned int i = 0; i < 4; i++) { + for (uint i = 0; i < 4; i++) { base_tile->gen_color[i] = CLAMPIS(values[i], 0.0f, FLT_MAX); } } @@ -625,7 +625,7 @@ static void rna_Image_pixels_get(PointerRNA *ptr, float *values) } else { for (i = 0; i < size; i++) { - values[i] = ((unsigned char *)ibuf->rect)[i] * (1.0f / 255.0f); + values[i] = ((uchar *)ibuf->rect)[i] * (1.0f / 255.0f); } } } @@ -650,7 +650,7 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values) } else { for (i = 0; i < size; i++) { - ((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]); + ((uchar *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]); } } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index cc0a396932f..9c6702142f7 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -708,9 +708,9 @@ static void rna_MeshLoopTriangle_normal_get(PointerRNA *ptr, float *values) MLoopTri *lt = (MLoopTri *)ptr->data; const MVert *verts = BKE_mesh_verts(me); const MLoop *loops = BKE_mesh_loops(me); - unsigned int v1 = loops[lt->tri[0]].v; - unsigned int v2 = loops[lt->tri[1]].v; - unsigned int v3 = loops[lt->tri[2]].v; + uint v1 = loops[lt->tri[0]].v; + uint v2 = loops[lt->tri[1]].v; + uint v3 = loops[lt->tri[2]].v; normal_tri_v3(values, verts[v1].co, verts[v2].co, verts[v3].co); } @@ -739,9 +739,9 @@ static float rna_MeshLoopTriangle_area_get(PointerRNA *ptr) MLoopTri *lt = (MLoopTri *)ptr->data; const MVert *verts = BKE_mesh_verts(me); const MLoop *loops = BKE_mesh_loops(me); - unsigned int v1 = loops[lt->tri[0]].v; - unsigned int v2 = loops[lt->tri[1]].v; - unsigned int v3 = loops[lt->tri[2]].v; + uint v1 = loops[lt->tri[0]].v; + uint v2 = loops[lt->tri[1]].v; + uint v3 = loops[lt->tri[2]].v; return area_tri_v3(verts[v1].co, verts[v2].co, verts[v3].co); } @@ -1377,7 +1377,7 @@ static void rna_MeshPoly_vertices_get(PointerRNA *ptr, int *values) MPoly *mp = (MPoly *)ptr->data; const MLoop *loops = BKE_mesh_loops(me); const MLoop *ml = &loops[mp->loopstart]; - unsigned int i; + uint i; for (i = mp->totloop; i > 0; i--, values++, ml++) { *values = ml->v; } @@ -1390,7 +1390,7 @@ static void rna_MeshPoly_vertices_set(PointerRNA *ptr, const int *values) MLoop *loops = BKE_mesh_loops_for_write(me); MLoop *ml = &loops[mp->loopstart]; - unsigned int i; + uint i; for (i = mp->totloop; i > 0; i--, values++, ml++) { ml->v = *values; } diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 8d5e82cbfa8..54ccba24247 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -465,7 +465,7 @@ static void rna_Struct_property_tags_begin(CollectionPropertyIterator *iter, Poi /* here ptr->data should always be the same as iter->parent.type */ StructRNA *srna = (StructRNA *)ptr->data; const EnumPropertyItem *tag_defines = RNA_struct_property_tag_defines(srna); - unsigned int tag_count = tag_defines ? RNA_enum_items_count(tag_defines) : 0; + uint tag_count = tag_defines ? RNA_enum_items_count(tag_defines) : 0; rna_iterator_array_begin( iter, (void *)tag_defines, sizeof(EnumPropertyItem), tag_count, 0, NULL); diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c index ed3be815235..96b732c3aba 100644 --- a/source/blender/makesrna/intern/rna_test.c +++ b/source/blender/makesrna/intern/rna_test.c @@ -103,7 +103,7 @@ void RNA_def_test(BlenderRNA *brna) # ifdef UNIT_TEST StructRNA *srna; PropertyRNA *prop; - unsigned short dimsize[] = {MARRAY_DIMSIZE}; + ushort dimsize[] = {MARRAY_DIMSIZE}; srna = RNA_def_struct(brna, "Test", NULL); RNA_def_struct_sdna(srna, "Test"); |