Cleanup: minor C++ changes (use nullptr, correct parameter names)

This commit is contained in:
Campbell Barton 2023-07-02 19:37:39 +10:00
parent 69aee8ba6b
commit f7d6b7973a
8 changed files with 32 additions and 21 deletions

@ -928,9 +928,7 @@ BoundBox *BKE_grease_pencil_boundbox_get(Object *ob)
return ob->runtime.bb;
}
void BKE_grease_pencil_data_update(struct Depsgraph * /*depsgraph*/,
struct Scene * /*scene*/,
Object *object)
void BKE_grease_pencil_data_update(Depsgraph * /*depsgraph*/, Scene * /*scene*/, Object *object)
{
/* Free any evaluated data and restore original data. */
BKE_object_free_derived_caches(object);

@ -14,7 +14,7 @@ void ReflectionProbeModule::init()
max_resolution_,
max_probes_,
GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT,
NULL,
nullptr,
max_mipmap_levels);
GPU_texture_mipmap_mode(cubemaps_tx_, true, true);
initialized_ = true;

@ -40,7 +40,7 @@ void RNA_api_meta(StructRNA *srna)
func = RNA_def_function(srna, "transform", "rna_Meta_transform");
RNA_def_function_ui_description(func, "Transform metaball elements by a matrix");
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_function(srna, "update_gpu_tag", "rna_Mball_update_gpu_tag");

@ -7504,11 +7504,11 @@ static void rna_def_space_node(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, nullptr);
prop = RNA_def_property(srna, "geometry_nodes_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "geometry_nodes_type");
RNA_def_property_enum_sdna(prop, nullptr, "geometry_nodes_type");
RNA_def_property_enum_items(prop, geometry_nodes_type_items);
RNA_def_property_ui_text(prop, "Geometry Nodes Type", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, nullptr);
prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);

@ -1147,7 +1147,7 @@ static const EnumPropertyItem *rna_preference_gpu_backend_itemf(bContext * /*C*/
static size_t max_memory_in_megabytes()
{
/* Maximum addressable bytes on this platform. */
const size_t limit_bytes = (((size_t)1) << (sizeof(size_t[8]) - 1));
const size_t limit_bytes = size_t(1) << (sizeof(size_t[8]) - 1);
/* Convert it to megabytes and return. */
return (limit_bytes >> 20);
}
@ -1157,7 +1157,7 @@ static int max_memory_in_megabytes_int()
{
const size_t limit_megabytes = max_memory_in_megabytes();
/* NOTE: The result will fit into integer. */
return (int)min_zz(limit_megabytes, (size_t)INT_MAX);
return int(min_zz(limit_megabytes, size_t(INT_MAX)));
}
static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)

@ -10,10 +10,10 @@
*/
/* Placed up here because of crappy WINSOCK stuff. */
#include <errno.h>
#include <fcntl.h> /* for open flags (O_BINARY, O_RDONLY). */
#include <stddef.h>
#include <string.h>
#include <cerrno>
#include <cstddef>
#include <cstring>
#include <fcntl.h> /* For open flags (#O_BINARY, #O_RDONLY). */
#ifdef WIN32
/* Need to include windows.h so _WIN32_IE is defined. */
@ -3780,15 +3780,28 @@ static void wm_block_file_close_save(bContext *C, void *arg_block, void *arg_dat
static void wm_block_file_close_cancel_button(uiBlock *block, wmGenericCallback *post_action)
{
uiBut *but = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, 0, IFACE_("Cancel"), 0, 0, 0, UI_UNIT_Y, 0, 0, 0, 0, 0, "");
block, UI_BTYPE_BUT, 0, 0, IFACE_("Cancel"), 0, 0, 0, UI_UNIT_Y, nullptr, 0, 0, 0, 0, "");
UI_but_func_set(but, wm_block_file_close_cancel, block, post_action);
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
}
static void wm_block_file_close_discard_button(uiBlock *block, wmGenericCallback *post_action)
{
uiBut *but = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, 0, IFACE_("Don't Save"), 0, 0, 0, UI_UNIT_Y, 0, 0, 0, 0, 0, "");
uiBut *but = uiDefIconTextBut(block,
UI_BTYPE_BUT,
0,
0,
IFACE_("Don't Save"),
0,
0,
0,
UI_UNIT_Y,
nullptr,
0,
0,
0,
0,
"");
UI_but_func_set(but, wm_block_file_close_discard, block, post_action);
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
}
@ -3796,7 +3809,7 @@ static void wm_block_file_close_discard_button(uiBlock *block, wmGenericCallback
static void wm_block_file_close_save_button(uiBlock *block, wmGenericCallback *post_action)
{
uiBut *but = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, 0, IFACE_("Save"), 0, 0, 0, UI_UNIT_Y, 0, 0, 0, 0, 0, "");
block, UI_BTYPE_BUT, 0, 0, IFACE_("Save"), 0, 0, 0, UI_UNIT_Y, nullptr, 0, 0, 0, 0, "");
UI_but_func_set(but, wm_block_file_close_save, block, post_action);
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
UI_but_flag_enable(but, UI_BUT_ACTIVE_DEFAULT);

@ -8,9 +8,9 @@
* Manage initializing resources and correctly shutting down.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN

@ -84,7 +84,7 @@ void wm_close_file_dialog(bContext *C, struct wmGenericCallback *post_action);
*/
bool wm_operator_close_file_dialog_if_needed(bContext *C,
wmOperator *op,
wmGenericCallbackFn exec_fn);
wmGenericCallbackFn post_action_fn);
/**
* Check if there is data that would be lost when closing the current file without saving.
*/