Cleanup: use C++ conventions (function style cast, nullptr)

This commit is contained in:
Campbell Barton
2023-06-14 12:20:07 +10:00
parent d4b23cae8f
commit 47b52b39ac
4 changed files with 9 additions and 9 deletions

View File

@@ -1378,7 +1378,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 278, 4)) {
const float sqrt_3 = (float)M_SQRT3;
const float sqrt_3 = float(M_SQRT3);
LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
br->fill_threshold /= sqrt_3;
}

View File

@@ -615,7 +615,7 @@ int BM_uv_element_get_unique_index(UvElementMap *element_map, UvElement *child)
return unique_index[index];
}
#define INVALID_ISLAND ((uint)-1)
#define INVALID_ISLAND (uint(-1))
static void bm_uv_assign_island(UvElementMap *element_map,
UvElement *element,

View File

@@ -218,7 +218,7 @@ void RNA_api_mesh(StructRNA *srna)
RNA_def_function_ui_description(func,
"Transform mesh vertices by a matrix "
"(Warning: inverts normals if matrix is negative)");
parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
parm = RNA_def_float_matrix(func, "matrix", 4, 4, nullptr, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
@@ -249,7 +249,7 @@ void RNA_api_mesh(StructRNA *srna)
"(split normals are also computed if not yet present)");
parm = RNA_def_string(func,
"uvmap",
NULL,
nullptr,
MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX,
"",
"Name of the UV map to use for tangent space computation");
@@ -266,7 +266,7 @@ void RNA_api_mesh(StructRNA *srna)
RNA_def_boolean(
func, "use_bitflags", false, "", "Produce bitflags groups instead of simple numeric values");
/* return values */
parm = RNA_def_int_array(func, "poly_groups", 1, NULL, 0, 0, "", "Smooth Groups", 0, 0);
parm = RNA_def_int_array(func, "poly_groups", 1, nullptr, 0, 0, "", "Smooth Groups", 0, 0);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);
parm = RNA_def_int(
func, "groups", 0, 0, INT_MAX, "groups", "Total number of groups", 0, INT_MAX);
@@ -278,7 +278,7 @@ void RNA_api_mesh(StructRNA *srna)
"(use zero-vectors to keep auto ones)");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* TODO: see how array size of 0 works, this shouldn't be used. */
parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
parm = RNA_def_float_array(func, "normals", 1, nullptr, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
RNA_def_property_multi_array(parm, 2, normals_array_dim);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
@@ -291,7 +291,7 @@ void RNA_api_mesh(StructRNA *srna)
"(use zero-vectors to keep auto ones)");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* TODO: see how array size of 0 works, this shouldn't be used. */
parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
parm = RNA_def_float_array(func, "normals", 1, nullptr, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
RNA_def_property_multi_array(parm, 2, normals_array_dim);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
@@ -350,7 +350,7 @@ void RNA_api_mesh(StructRNA *srna)
func = RNA_def_function(srna, "count_selected_items", "rna_Mesh_count_selected_items ");
RNA_def_function_ui_description(func, "Return the number of selected items (vert, edge, face)");
parm = RNA_def_int_vector(func, "result", 3, NULL, 0, INT_MAX, "Result", NULL, 0, INT_MAX);
parm = RNA_def_int_vector(func, "result", 3, nullptr, 0, INT_MAX, "Result", nullptr, 0, INT_MAX);
RNA_def_function_output(func, parm);
}

View File

@@ -440,7 +440,7 @@ GPUTexture *RE_pass_ensure_gpu_texture_cache(Render *re, RenderPass *rpass)
1,
format,
GPU_TEXTURE_USAGE_GENERAL,
NULL);
nullptr);
if (rpass->buffer.gpu_texture) {
GPU_texture_update(rpass->buffer.gpu_texture, GPU_DATA_FLOAT, rpass->buffer.data);