diff --git a/source/blender/python/intern/bpy.cc b/source/blender/python/intern/bpy.cc index 664a4683841..f0c58b3ab7c 100644 --- a/source/blender/python/intern/bpy.cc +++ b/source/blender/python/intern/bpy.cc @@ -213,14 +213,14 @@ static PyObject *bpy_flip_name(PyObject * /*self*/, PyObject *args, PyObject *kw // PyDoc_STRVAR(bpy_user_resource_doc[] = /* now in bpy/utils.py */ static PyObject *bpy_user_resource(PyObject * /*self*/, PyObject *args, PyObject *kw) { - const struct PyC_StringEnumItems type_items[] = { + const PyC_StringEnumItems type_items[] = { {BLENDER_USER_DATAFILES, "DATAFILES"}, {BLENDER_USER_CONFIG, "CONFIG"}, {BLENDER_USER_SCRIPTS, "SCRIPTS"}, {BLENDER_USER_AUTOSAVE, "AUTOSAVE"}, {0, nullptr}, }; - struct PyC_StringEnum type = {type_items}; + PyC_StringEnum type = {type_items}; const char *subdir = nullptr; @@ -257,13 +257,13 @@ PyDoc_STRVAR(bpy_system_resource_doc, " :type path: string\n"); static PyObject *bpy_system_resource(PyObject * /*self*/, PyObject *args, PyObject *kw) { - const struct PyC_StringEnumItems type_items[] = { + const PyC_StringEnumItems type_items[] = { {BLENDER_SYSTEM_DATAFILES, "DATAFILES"}, {BLENDER_SYSTEM_SCRIPTS, "SCRIPTS"}, {BLENDER_SYSTEM_PYTHON, "PYTHON"}, {0, nullptr}, }; - struct PyC_StringEnum type = {type_items}; + PyC_StringEnum type = {type_items}; const char *subdir = nullptr; @@ -303,13 +303,13 @@ PyDoc_STRVAR( " :rtype: string\n"); static PyObject *bpy_resource_path(PyObject * /*self*/, PyObject *args, PyObject *kw) { - const struct PyC_StringEnumItems type_items[] = { + const PyC_StringEnumItems type_items[] = { {BLENDER_RESOURCE_PATH_USER, "USER"}, {BLENDER_RESOURCE_PATH_LOCAL, "LOCAL"}, {BLENDER_RESOURCE_PATH_SYSTEM, "SYSTEM"}, {0, nullptr}, }; - struct PyC_StringEnum type = {type_items}; + PyC_StringEnum type = {type_items}; int major = BLENDER_VERSION / 100, minor = BLENDER_VERSION % 100; const char *path; @@ -611,7 +611,7 @@ static PyObject *bpy_import_test(const char *modname) return mod; } -void BPy_init_modules(struct bContext *C) +void BPy_init_modules(bContext *C) { PointerRNA ctx_ptr; PyObject *mod; diff --git a/source/blender/python/intern/bpy_app.cc b/source/blender/python/intern/bpy_app.cc index fffa9e26254..6af33165258 100644 --- a/source/blender/python/intern/bpy_app.cc +++ b/source/blender/python/intern/bpy_app.cc @@ -132,7 +132,7 @@ static PyStructSequence_Desc app_info_desc = { ARRAY_SIZE(app_info_fields) - 1, }; -static PyObject *make_app_info(void) +static PyObject *make_app_info() { PyObject *app_info; int pos = 0; @@ -339,7 +339,7 @@ PyDoc_STRVAR(bpy_app_preview_render_size_doc, static PyObject *bpy_app_preview_render_size_get(PyObject * /*self*/, void *closure) { return PyLong_FromLong( - (long)UI_icon_preview_to_render_size(eIconSizes(POINTER_AS_INT(closure)))); + long(UI_icon_preview_to_render_size(eIconSizes(POINTER_AS_INT(closure))))); } static PyObject *bpy_app_autoexec_fail_message_get(PyObject * /*self*/, void * /*closure*/) @@ -568,7 +568,7 @@ static PyMethodDef bpy_app_methods[] = { {nullptr, nullptr, 0, nullptr}, }; -static void py_struct_seq_getset_init(void) +static void py_struct_seq_getset_init() { /* tricky dynamic members, not to py-spec! */ for (PyGetSetDef *getset = bpy_app_getsets; getset->name; getset++) { @@ -578,7 +578,7 @@ static void py_struct_seq_getset_init(void) } } -static void py_struct_seq_method_init(void) +static void py_struct_seq_method_init() { for (PyMethodDef *method = bpy_app_methods; method->ml_name; method++) { BLI_assert_msg(method->ml_flags & METH_STATIC, "Only static methods make sense for 'bpy.app'"); @@ -590,7 +590,7 @@ static void py_struct_seq_method_init(void) /* end dynamic bpy.app */ -PyObject *BPY_app_struct(void) +PyObject *BPY_app_struct() { PyObject *ret; diff --git a/source/blender/python/intern/bpy_app_alembic.cc b/source/blender/python/intern/bpy_app_alembic.cc index 4dae142901e..ba511a4628e 100644 --- a/source/blender/python/intern/bpy_app_alembic.cc +++ b/source/blender/python/intern/bpy_app_alembic.cc @@ -33,7 +33,7 @@ static PyStructSequence_Desc app_alembic_info_desc = { ARRAY_SIZE(app_alembic_info_fields) - 1, }; -static PyObject *make_alembic_info(void) +static PyObject *make_alembic_info() { PyObject *alembic_info = PyStructSequence_New(&BlenderAppABCType); @@ -75,7 +75,7 @@ static PyObject *make_alembic_info(void) return alembic_info; } -PyObject *BPY_app_alembic_struct(void) +PyObject *BPY_app_alembic_struct() { PyStructSequence_InitType(&BlenderAppABCType, &app_alembic_info_desc); diff --git a/source/blender/python/intern/bpy_app_build_options.cc b/source/blender/python/intern/bpy_app_build_options.cc index 1412b8279f8..21428b99d05 100644 --- a/source/blender/python/intern/bpy_app_build_options.cc +++ b/source/blender/python/intern/bpy_app_build_options.cc @@ -70,7 +70,7 @@ static PyStructSequence_Desc app_builtopts_info_desc = { ARRAY_SIZE(app_builtopts_info_fields) - 1, }; -static PyObject *make_builtopts_info(void) +static PyObject *make_builtopts_info() { PyObject *builtopts_info; int pos = 0; @@ -337,7 +337,7 @@ static PyObject *make_builtopts_info(void) return builtopts_info; } -PyObject *BPY_app_build_options_struct(void) +PyObject *BPY_app_build_options_struct() { PyObject *ret; diff --git a/source/blender/python/intern/bpy_app_ffmpeg.cc b/source/blender/python/intern/bpy_app_ffmpeg.cc index 0929ceac2c9..0621e4ea756 100644 --- a/source/blender/python/intern/bpy_app_ffmpeg.cc +++ b/source/blender/python/intern/bpy_app_ffmpeg.cc @@ -51,7 +51,7 @@ static PyStructSequence_Desc app_ffmpeg_info_desc = { ARRAY_SIZE(app_ffmpeg_info_fields) - 1, }; -static PyObject *make_ffmpeg_info(void) +static PyObject *make_ffmpeg_info() { PyObject *ffmpeg_info; int pos = 0; @@ -118,7 +118,7 @@ static PyObject *make_ffmpeg_info(void) return ffmpeg_info; } -PyObject *BPY_app_ffmpeg_struct(void) +PyObject *BPY_app_ffmpeg_struct() { PyObject *ret; diff --git a/source/blender/python/intern/bpy_app_handlers.cc b/source/blender/python/intern/bpy_app_handlers.cc index da51c54c8f3..721605a3f01 100644 --- a/source/blender/python/intern/bpy_app_handlers.cc +++ b/source/blender/python/intern/bpy_app_handlers.cc @@ -26,7 +26,7 @@ #include "BPY_extern.h" -void bpy_app_generic_callback(struct Main *main, +void bpy_app_generic_callback(Main *main, PointerRNA **pointers, const int pointers_num, void *arg); @@ -213,7 +213,7 @@ static PyTypeObject BPyPersistent_Type = { static PyObject *py_cb_array[BKE_CB_EVT_TOT] = {nullptr}; -static PyObject *make_app_cb_info(void) +static PyObject *make_app_cb_info() { PyObject *app_cb_info; int pos; @@ -239,7 +239,7 @@ static PyObject *make_app_cb_info(void) return app_cb_info; } -PyObject *BPY_app_handlers_struct(void) +PyObject *BPY_app_handlers_struct() { PyObject *ret; @@ -344,7 +344,7 @@ static PyObject *choose_arguments(PyObject *func, PyObject *args_all, PyObject * } /* the actual callback - not necessarily called from py */ -void bpy_app_generic_callback(struct Main * /*main*/, +void bpy_app_generic_callback(Main * /*main*/, PointerRNA **pointers, const int pointers_num, void *arg) diff --git a/source/blender/python/intern/bpy_app_icons.cc b/source/blender/python/intern/bpy_app_icons.cc index 686eb22124a..90b67cac175 100644 --- a/source/blender/python/intern/bpy_app_icons.cc +++ b/source/blender/python/intern/bpy_app_icons.cc @@ -75,7 +75,7 @@ static PyObject *bpy_app_icons_new_triangles(PyObject * /*self*/, PyObject *args memcpy(coords, PyBytes_AS_STRING(py_coords), coords_size); memcpy(colors, PyBytes_AS_STRING(py_colors), colors_size); - struct Icon_Geom *geom = static_cast(MEM_mallocN(sizeof(*geom), __func__)); + Icon_Geom *geom = static_cast(MEM_mallocN(sizeof(*geom), __func__)); geom->coords_len = tris_len; geom->coords_range[0] = coords_range[0]; geom->coords_range[1] = coords_range[1]; @@ -113,7 +113,7 @@ static PyObject *bpy_app_icons_new_triangles_from_file(PyObject * /*self*/, return nullptr; } - struct Icon_Geom *geom = BKE_icon_geom_from_file(filepath); + Icon_Geom *geom = BKE_icon_geom_from_file(filepath); if (geom == nullptr) { PyErr_SetString(PyExc_ValueError, "Unable to load from file"); return nullptr; @@ -175,7 +175,7 @@ static PyModuleDef M_AppIcons_module_def = { /*m_free*/ nullptr, }; -PyObject *BPY_app_icons_module(void) +PyObject *BPY_app_icons_module() { PyObject *sys_modules = PyImport_GetModuleDict(); diff --git a/source/blender/python/intern/bpy_app_ocio.cc b/source/blender/python/intern/bpy_app_ocio.cc index b5a56351a38..201fd90be54 100644 --- a/source/blender/python/intern/bpy_app_ocio.cc +++ b/source/blender/python/intern/bpy_app_ocio.cc @@ -36,7 +36,7 @@ static PyStructSequence_Desc app_ocio_info_desc = { ARRAY_SIZE(app_ocio_info_fields) - 1, }; -static PyObject *make_ocio_info(void) +static PyObject *make_ocio_info() { PyObject *ocio_info; int pos = 0; @@ -80,7 +80,7 @@ static PyObject *make_ocio_info(void) return ocio_info; } -PyObject *BPY_app_ocio_struct(void) +PyObject *BPY_app_ocio_struct() { PyObject *ret; diff --git a/source/blender/python/intern/bpy_app_oiio.cc b/source/blender/python/intern/bpy_app_oiio.cc index 268a219867b..39bd0cb2fc5 100644 --- a/source/blender/python/intern/bpy_app_oiio.cc +++ b/source/blender/python/intern/bpy_app_oiio.cc @@ -31,7 +31,7 @@ static PyStructSequence_Desc app_oiio_info_desc = { ARRAY_SIZE(app_oiio_info_fields) - 1, }; -static PyObject *make_oiio_info(void) +static PyObject *make_oiio_info() { PyObject *oiio_info; int pos = 0; @@ -62,7 +62,7 @@ static PyObject *make_oiio_info(void) return oiio_info; } -PyObject *BPY_app_oiio_struct(void) +PyObject *BPY_app_oiio_struct() { PyObject *ret; diff --git a/source/blender/python/intern/bpy_app_opensubdiv.cc b/source/blender/python/intern/bpy_app_opensubdiv.cc index be92eb76933..e8dbee086c2 100644 --- a/source/blender/python/intern/bpy_app_opensubdiv.cc +++ b/source/blender/python/intern/bpy_app_opensubdiv.cc @@ -33,7 +33,7 @@ static PyStructSequence_Desc app_opensubdiv_info_desc = { ARRAY_SIZE(app_opensubdiv_info_fields) - 1, }; -static PyObject *make_opensubdiv_info(void) +static PyObject *make_opensubdiv_info() { PyObject *opensubdiv_info; int pos = 0; @@ -73,7 +73,7 @@ static PyObject *make_opensubdiv_info(void) return opensubdiv_info; } -PyObject *BPY_app_opensubdiv_struct(void) +PyObject *BPY_app_opensubdiv_struct() { PyObject *ret; diff --git a/source/blender/python/intern/bpy_app_openvdb.cc b/source/blender/python/intern/bpy_app_openvdb.cc index a6eae8d47a8..8f825119f6a 100644 --- a/source/blender/python/intern/bpy_app_openvdb.cc +++ b/source/blender/python/intern/bpy_app_openvdb.cc @@ -33,7 +33,7 @@ static PyStructSequence_Desc app_openvdb_info_desc = { ARRAY_SIZE(app_openvdb_info_fields) - 1, }; -static PyObject *make_openvdb_info(void) +static PyObject *make_openvdb_info() { PyObject *openvdb_info; int pos = 0; @@ -77,7 +77,7 @@ static PyObject *make_openvdb_info(void) return openvdb_info; } -PyObject *BPY_app_openvdb_struct(void) +PyObject *BPY_app_openvdb_struct() { PyObject *ret; diff --git a/source/blender/python/intern/bpy_app_sdl.cc b/source/blender/python/intern/bpy_app_sdl.cc index 4b83965533c..9fa2d1e05b0 100644 --- a/source/blender/python/intern/bpy_app_sdl.cc +++ b/source/blender/python/intern/bpy_app_sdl.cc @@ -51,7 +51,7 @@ static PyStructSequence_Desc app_sdl_info_desc = { ARRAY_SIZE(app_sdl_info_fields) - 1, }; -static PyObject *make_sdl_info(void) +static PyObject *make_sdl_info() { PyObject *sdl_info; int pos = 0; @@ -113,7 +113,7 @@ static PyObject *make_sdl_info(void) return sdl_info; } -PyObject *BPY_app_sdl_struct(void) +PyObject *BPY_app_sdl_struct() { PyObject *ret; diff --git a/source/blender/python/intern/bpy_app_timers.cc b/source/blender/python/intern/bpy_app_timers.cc index 555940ba94e..061268f3d46 100644 --- a/source/blender/python/intern/bpy_app_timers.cc +++ b/source/blender/python/intern/bpy_app_timers.cc @@ -116,7 +116,7 @@ static PyObject *bpy_app_timers_register(PyObject * /*self*/, PyObject *args, Py Py_INCREF(function); BLI_timer_register( - (intptr_t)function, py_timer_execute, function, py_timer_free, first_interval, persistent); + intptr_t(function), py_timer_execute, function, py_timer_free, first_interval, persistent); Py_RETURN_NONE; } @@ -129,7 +129,7 @@ PyDoc_STRVAR(bpy_app_timers_unregister_doc, " :type function: function\n"); static PyObject *bpy_app_timers_unregister(PyObject * /*self*/, PyObject *function) { - if (!BLI_timer_unregister((intptr_t)function)) { + if (!BLI_timer_unregister(intptr_t(function))) { PyErr_SetString(PyExc_ValueError, "Error: function is not registered"); return nullptr; } @@ -147,7 +147,7 @@ PyDoc_STRVAR(bpy_app_timers_is_registered_doc, " :rtype: bool\n"); static PyObject *bpy_app_timers_is_registered(PyObject * /*self*/, PyObject *function) { - const bool ret = BLI_timer_is_registered((intptr_t)function); + const bool ret = BLI_timer_is_registered(intptr_t(function)); return PyBool_FromLong(ret); } @@ -176,7 +176,7 @@ static PyModuleDef M_AppTimers_module_def = { /*m_free*/ nullptr, }; -PyObject *BPY_app_timers_module(void) +PyObject *BPY_app_timers_module() { PyObject *sys_modules = PyImport_GetModuleDict(); PyObject *mod = PyModule_Create(&M_AppTimers_module_def); diff --git a/source/blender/python/intern/bpy_app_translations.cc b/source/blender/python/intern/bpy_app_translations.cc index e3da231d5e8..c60a5067cb3 100644 --- a/source/blender/python/intern/bpy_app_translations.cc +++ b/source/blender/python/intern/bpy_app_translations.cc @@ -124,7 +124,7 @@ static void _ghashutil_keyfree(void *ptr) */ static GHash *_translations_cache = nullptr; -static void _clear_translations_cache(void) +static void _clear_translations_cache() { if (_translations_cache) { BLI_ghash_free(_translations_cache, _ghashutil_keyfree, _ghashutil_valfree); @@ -421,7 +421,7 @@ static PyStructSequence_Desc app_translations_contexts_desc = { ARRAY_SIZE(app_translations_contexts_fields) - 1, }; -static PyObject *app_translations_contexts_make(void) +static PyObject *app_translations_contexts_make() { PyObject *translations_contexts; BLT_i18n_contexts_descriptor *ctxt; @@ -837,7 +837,7 @@ static PyTypeObject BlenderAppTranslationsType = { /*tp_vectorcall*/ nullptr, }; -PyObject *BPY_app_translations_struct(void) +PyObject *BPY_app_translations_struct() { PyObject *ret; @@ -872,7 +872,7 @@ PyObject *BPY_app_translations_struct(void) return ret; } -void BPY_app_translations_end(void) +void BPY_app_translations_end() { /* In case the object remains in a module's name-space, see #44127. */ #ifdef WITH_INTERNATIONAL diff --git a/source/blender/python/intern/bpy_app_usd.cc b/source/blender/python/intern/bpy_app_usd.cc index 2e2c27659ce..c1fa2c42f27 100644 --- a/source/blender/python/intern/bpy_app_usd.cc +++ b/source/blender/python/intern/bpy_app_usd.cc @@ -34,7 +34,7 @@ static PyStructSequence_Desc app_usd_info_desc = { ARRAY_SIZE(app_usd_info_fields) - 1, }; -static PyObject *make_usd_info(void) +static PyObject *make_usd_info() { PyObject *usd_info = PyStructSequence_New(&BlenderAppUSDType); @@ -76,7 +76,7 @@ static PyObject *make_usd_info(void) return usd_info; } -PyObject *BPY_app_usd_struct(void) +PyObject *BPY_app_usd_struct() { PyStructSequence_InitType(&BlenderAppUSDType, &app_usd_info_desc); diff --git a/source/blender/python/intern/bpy_capi_utils.cc b/source/blender/python/intern/bpy_capi_utils.cc index 727596f9735..dfc75d09f43 100644 --- a/source/blender/python/intern/bpy_capi_utils.cc +++ b/source/blender/python/intern/bpy_capi_utils.cc @@ -98,13 +98,13 @@ bool BPy_errors_to_report_ex(ReportList *reports, /* Location (when available). */ "Location: %s:%d", err_prefix, - (int)err_str_len, + int(err_str_len), err_str, location_filepath, location_line_number); } else { - BKE_reportf(reports, RPT_ERROR, "%s: %.*s", err_prefix, (int)err_str_len, err_str); + BKE_reportf(reports, RPT_ERROR, "%s: %.*s", err_prefix, int(err_str_len), err_str); } /* Ensure this is _always_ printed to the output so developers don't miss exceptions. */ diff --git a/source/blender/python/intern/bpy_driver.cc b/source/blender/python/intern/bpy_driver.cc index 447eee4068b..b5329131683 100644 --- a/source/blender/python/intern/bpy_driver.cc +++ b/source/blender/python/intern/bpy_driver.cc @@ -50,7 +50,7 @@ PyObject *bpy_pydriver_Dict = nullptr; static PyObject *bpy_pydriver_Dict__whitelist = nullptr; #endif -int bpy_pydriver_create_dict(void) +int bpy_pydriver_create_dict() { PyObject *d, *mod; @@ -192,7 +192,7 @@ static void bpy_pydriver_namespace_update_self(PathResolvedRNA *anim_rna) } } -static void bpy_pydriver_namespace_clear_self(void) +static void bpy_pydriver_namespace_clear_self() { if (g_pydriver_state_prev.self) { PyDict_DelItem(bpy_pydriver_Dict, bpy_intern_str_self); @@ -201,7 +201,7 @@ static void bpy_pydriver_namespace_clear_self(void) } } -static PyObject *bpy_pydriver_depsgraph_as_pyobject(struct Depsgraph *depsgraph) +static PyObject *bpy_pydriver_depsgraph_as_pyobject(Depsgraph *depsgraph) { PointerRNA depsgraph_ptr; RNA_pointer_create(nullptr, &RNA_Depsgraph, depsgraph, &depsgraph_ptr); @@ -212,7 +212,7 @@ static PyObject *bpy_pydriver_depsgraph_as_pyobject(struct Depsgraph *depsgraph) * Adds a variable `depsgraph` to the name-space. This can then be used to obtain evaluated * data-blocks, and the current view layer and scene. See #75553. */ -static void bpy_pydriver_namespace_update_depsgraph(struct Depsgraph *depsgraph) +static void bpy_pydriver_namespace_update_depsgraph(Depsgraph *depsgraph) { /* This should never happen, but it's probably better to have None in Python * than a nullptr-wrapping Depsgraph Python struct. */ @@ -234,7 +234,7 @@ static void bpy_pydriver_namespace_update_depsgraph(struct Depsgraph *depsgraph) } } -void BPY_driver_exit(void) +void BPY_driver_exit() { if (bpy_pydriver_Dict) { /* Free the global dict used by python-drivers. */ PyDict_Clear(bpy_pydriver_Dict); @@ -257,7 +257,7 @@ void BPY_driver_exit(void) g_pydriver_state_prev.depsgraph = nullptr; } -void BPY_driver_reset(void) +void BPY_driver_reset() { PyGILState_STATE gilstate; const bool use_gil = true; /* !PyC_IsInterpreterActive(); */ @@ -702,10 +702,10 @@ float BPY_driver_exec(PathResolvedRNA *anim_rna, else { /* No need to worry about overflow here, values from RNA are within limits. */ if (PyFloat_CheckExact(driver_arg)) { - dvar->curval = (float)PyFloat_AsDouble(driver_arg); + dvar->curval = float(PyFloat_AsDouble(driver_arg)); } else if (PyLong_CheckExact(driver_arg)) { - dvar->curval = (float)PyLong_AsLong(driver_arg); + dvar->curval = float(PyLong_AsLong(driver_arg)); } else if (PyBool_Check(driver_arg)) { dvar->curval = (driver_arg == Py_True); @@ -720,7 +720,7 @@ float BPY_driver_exec(PathResolvedRNA *anim_rna, { /* Try to get variable value. */ const float tval = driver_get_variable_value(anim_eval_context, driver, dvar); - driver_arg = PyFloat_FromDouble((double)tval); + driver_arg = PyFloat_FromDouble(double(tval)); } /* Try to add to dictionary. */ @@ -808,5 +808,5 @@ retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars); return 0.0f; } - return (float)result; + return float(result); } diff --git a/source/blender/python/intern/bpy_interface.cc b/source/blender/python/intern/bpy_interface.cc index 6461208118b..bde5a5d77c0 100644 --- a/source/blender/python/intern/bpy_interface.cc +++ b/source/blender/python/intern/bpy_interface.cc @@ -217,7 +217,7 @@ void BPY_text_free_code(Text *text) } } -void BPY_modules_update(void) +void BPY_modules_update() { #if 0 /* slow, this runs all the time poll, draw etc 100's of time a sec. */ PyObject *mod = PyImport_ImportModuleLevel("bpy", nullptr, nullptr, nullptr, 0); @@ -229,7 +229,7 @@ void BPY_modules_update(void) BPY_update_rna_module(); } -bContext *BPY_context_get(void) +bContext *BPY_context_get() { return static_cast(bpy_context_module->ptr.data); } @@ -251,13 +251,13 @@ extern "C" PyObject *AUD_initPython(void); #ifdef WITH_CYCLES /* defined in cycles module */ -static PyObject *CCL_initPython(void) +static PyObject *CCL_initPython() { return (PyObject *)CCL_python_module_init(); } #endif -static struct _inittab bpy_internal_modules[] = { +static _inittab bpy_internal_modules[] = { {"mathutils", PyInit_mathutils}, #if 0 {"mathutils.geometry", PyInit_mathutils_geometry}, @@ -520,7 +520,7 @@ void BPY_python_start(bContext *C, int argc, const char **argv) #endif } -void BPY_python_end(void) +void BPY_python_end() { // fprintf(stderr, "Ending Python!\n"); PyGILState_STATE gilstate; @@ -592,7 +592,7 @@ void BPY_python_reset(bContext *C) BPY_modules_load_user(C); } -void BPY_python_use_system_env(void) +void BPY_python_use_system_env() { BLI_assert(!Py_IsInitialized()); py_use_system_env = true; @@ -958,10 +958,10 @@ bool BPY_string_is_keyword(const char *str) /* EVIL: define `text.c` functions here (declared in `BKE_text.h`). */ int text_check_identifier_unicode(const uint ch) { - return (ch < 255 && text_check_identifier((char)ch)) || Py_UNICODE_ISALNUM(ch); + return (ch < 255 && text_check_identifier(char(ch))) || Py_UNICODE_ISALNUM(ch); } int text_check_identifier_nodigit_unicode(const uint ch) { - return (ch < 255 && text_check_identifier_nodigit((char)ch)) || Py_UNICODE_ISALPHA(ch); + return (ch < 255 && text_check_identifier_nodigit(char(ch))) || Py_UNICODE_ISALPHA(ch); } diff --git a/source/blender/python/intern/bpy_interface_atexit.cc b/source/blender/python/intern/bpy_interface_atexit.cc index c916b8134bc..4abbd9455b8 100644 --- a/source/blender/python/intern/bpy_interface_atexit.cc +++ b/source/blender/python/intern/bpy_interface_atexit.cc @@ -22,7 +22,7 @@ static PyObject *bpy_atexit(PyObject * /*self*/, PyObject * /*args*/, PyObject * /*kw*/) { /* close down enough of blender at least not to crash */ - struct bContext *C = BPY_context_get(); + bContext *C = BPY_context_get(); WM_exit_ex(C, false, false); @@ -59,7 +59,7 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg) } } -void BPY_atexit_register(void) +void BPY_atexit_register() { /* atexit module owns this new function reference */ BLI_assert(func_bpy_atregister == nullptr); @@ -68,7 +68,7 @@ void BPY_atexit_register(void) atexit_func_call("register", func_bpy_atregister); } -void BPY_atexit_unregister(void) +void BPY_atexit_unregister() { BLI_assert(func_bpy_atregister != nullptr); diff --git a/source/blender/python/intern/bpy_interface_run.cc b/source/blender/python/intern/bpy_interface_run.cc index ce5778aec03..fa7a1f4e8a9 100644 --- a/source/blender/python/intern/bpy_interface_run.cc +++ b/source/blender/python/intern/bpy_interface_run.cc @@ -317,7 +317,7 @@ bool BPY_run_string_exec(bContext *C, const char *imports[], const char *expr) * in code that doesn't deal with Python data-types. * \{ */ -static void run_string_handle_error(struct BPy_RunErrInfo *err_info) +static void run_string_handle_error(BPy_RunErrInfo *err_info) { if (err_info == nullptr) { PyErr_Print(); @@ -363,7 +363,7 @@ static void run_string_handle_error(struct BPy_RunErrInfo *err_info) bool BPY_run_string_as_number(bContext *C, const char *imports[], const char *expr, - struct BPy_RunErrInfo *err_info, + BPy_RunErrInfo *err_info, double *r_value) { PyGILState_STATE gilstate; @@ -390,7 +390,7 @@ bool BPY_run_string_as_number(bContext *C, bool BPY_run_string_as_string_and_len(bContext *C, const char *imports[], const char *expr, - struct BPy_RunErrInfo *err_info, + BPy_RunErrInfo *err_info, char **r_value, size_t *r_value_len) { @@ -415,11 +415,8 @@ bool BPY_run_string_as_string_and_len(bContext *C, return ok; } -bool BPY_run_string_as_string(bContext *C, - const char *imports[], - const char *expr, - struct BPy_RunErrInfo *err_info, - char **r_value) +bool BPY_run_string_as_string( + bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, char **r_value) { size_t value_dummy_len; return BPY_run_string_as_string_and_len(C, imports, expr, err_info, r_value, &value_dummy_len); @@ -428,7 +425,7 @@ bool BPY_run_string_as_string(bContext *C, bool BPY_run_string_as_intptr(bContext *C, const char *imports[], const char *expr, - struct BPy_RunErrInfo *err_info, + BPy_RunErrInfo *err_info, intptr_t *r_value) { PyGILState_STATE gilstate; diff --git a/source/blender/python/intern/bpy_intern_string.cc b/source/blender/python/intern/bpy_intern_string.cc index 84a08f8584e..d7f85b99a10 100644 --- a/source/blender/python/intern/bpy_intern_string.cc +++ b/source/blender/python/intern/bpy_intern_string.cc @@ -36,7 +36,7 @@ PyObject *bpy_intern_str_self; PyObject *bpy_intern_str_depsgraph; PyObject *bpy_intern_str_unregister; -void bpy_intern_string_init(void) +void bpy_intern_string_init() { uint i = 0; @@ -69,7 +69,7 @@ void bpy_intern_string_init(void) BLI_assert(i == ARRAY_SIZE(bpy_intern_str_arr)); } -void bpy_intern_string_exit(void) +void bpy_intern_string_exit() { uint i = ARRAY_SIZE(bpy_intern_str_arr); while (i--) { diff --git a/source/blender/python/intern/bpy_library_load.cc b/source/blender/python/intern/bpy_library_load.cc index 4b3ee72eedc..dbb5d02653b 100644 --- a/source/blender/python/intern/bpy_library_load.cc +++ b/source/blender/python/intern/bpy_library_load.cc @@ -395,8 +395,7 @@ static bool bpy_lib_exit_lapp_context_items_cb(BlendfileLinkAppendContext *lapp_ BlendfileLinkAppendContextItem *item, void *userdata) { - struct LibExitLappContextItemsIterData *data = static_cast( - userdata); + LibExitLappContextItemsIterData *data = static_cast(userdata); /* Since `bpy_lib_exit` loops over all ID types, all items in `lapp_context` end up being looped * over for each ID type, so when it does not match the item can simply be skipped: it either has @@ -579,7 +578,7 @@ PyMethodDef BPY_library_load_method_def = { bpy_lib_load_doc, }; -int BPY_library_load_type_ready(void) +int BPY_library_load_type_ready() { if (PyType_Ready(&bpy_lib_Type) < 0) { return -1; diff --git a/source/blender/python/intern/bpy_library_write.cc b/source/blender/python/intern/bpy_library_write.cc index fd2a923e952..b86b0c4d3e2 100644 --- a/source/blender/python/intern/bpy_library_write.cc +++ b/source/blender/python/intern/bpy_library_write.cc @@ -66,14 +66,14 @@ static PyObject *bpy_lib_write(BPy_PropertyRNA *self, PyObject *args, PyObject * char filepath_abs[FILE_MAX]; PyObject *datablocks = nullptr; - const struct PyC_StringEnumItems path_remap_items[] = { + const PyC_StringEnumItems path_remap_items[] = { {BLO_WRITE_PATH_REMAP_NONE, "NONE"}, {BLO_WRITE_PATH_REMAP_RELATIVE, "RELATIVE"}, {BLO_WRITE_PATH_REMAP_RELATIVE_ALL, "RELATIVE_ALL"}, {BLO_WRITE_PATH_REMAP_ABSOLUTE, "ABSOLUTE"}, {0, nullptr}, }; - struct PyC_StringEnum path_remap = {path_remap_items, BLO_WRITE_PATH_REMAP_NONE}; + PyC_StringEnum path_remap = {path_remap_items, BLO_WRITE_PATH_REMAP_NONE}; bool use_fake_user = false, use_compress = false; diff --git a/source/blender/python/intern/bpy_msgbus.cc b/source/blender/python/intern/bpy_msgbus.cc index 115738069e1..9dbed2534e8 100644 --- a/source/blender/python/intern/bpy_msgbus.cc +++ b/source/blender/python/intern/bpy_msgbus.cc @@ -275,7 +275,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject * /*self*/, PyObject *args, P /* NOTE: we may want to have a way to pass this in. */ bContext *C = BPY_context_get(); - struct wmMsgBus *mbus = CTX_wm_message_bus(C); + wmMsgBus *mbus = CTX_wm_message_bus(C); wmMsgParams_RNA msg_key_params = {{0}}; wmMsgSubscribeValue msg_val_params = {0}; @@ -355,7 +355,7 @@ static PyObject *bpy_msgbus_publish_rna(PyObject * /*self*/, PyObject *args, PyO /* NOTE: we may want to have a way to pass this in. */ bContext *C = BPY_context_get(); - struct wmMsgBus *mbus = CTX_wm_message_bus(C); + wmMsgBus *mbus = CTX_wm_message_bus(C); wmMsgParams_RNA msg_key_params = {{0}}; if (py_msgbus_rna_key_from_py(py_sub, &msg_key_params, error_prefix) == -1) { @@ -374,7 +374,7 @@ PyDoc_STRVAR(bpy_msgbus_clear_by_owner_doc, static PyObject *bpy_msgbus_clear_by_owner(PyObject * /*self*/, PyObject *py_owner) { bContext *C = BPY_context_get(); - struct wmMsgBus *mbus = CTX_wm_message_bus(C); + wmMsgBus *mbus = CTX_wm_message_bus(C); WM_msgbus_clear_by_owner(mbus, py_owner); Py_RETURN_NONE; } @@ -407,7 +407,7 @@ static PyModuleDef _bpy_msgbus_def = { /*m_free*/ nullptr, }; -PyObject *BPY_msgbus_module(void) +PyObject *BPY_msgbus_module() { PyObject *submodule; diff --git a/source/blender/python/intern/bpy_operator.cc b/source/blender/python/intern/bpy_operator.cc index e349b1fc8f0..984588f96c7 100644 --- a/source/blender/python/intern/bpy_operator.cc +++ b/source/blender/python/intern/bpy_operator.cc @@ -448,7 +448,7 @@ static PyModuleDef bpy_ops_module = { /*m_free*/ nullptr, }; -PyObject *BPY_operator_module(void) +PyObject *BPY_operator_module() { PyObject *submodule; diff --git a/source/blender/python/intern/bpy_path.cc b/source/blender/python/intern/bpy_path.cc index ac233768f0d..60c1f39dff2 100644 --- a/source/blender/python/intern/bpy_path.cc +++ b/source/blender/python/intern/bpy_path.cc @@ -34,7 +34,7 @@ static PyModuleDef _bpy_path_module_def = { /*m_free*/ nullptr, }; -PyObject *BPyInit__bpy_path(void) +PyObject *BPyInit__bpy_path() { PyObject *submodule; diff --git a/source/blender/python/intern/bpy_props.cc b/source/blender/python/intern/bpy_props.cc index a1b1da3a54f..6081d88c950 100644 --- a/source/blender/python/intern/bpy_props.cc +++ b/source/blender/python/intern/bpy_props.cc @@ -116,7 +116,7 @@ * - #BPY_rna_props_clear_all does this on exit for all dynamic properties. */ struct BPyPropStore { - struct BPyPropStore *next, *prev; + BPyPropStore *next, *prev; /** * Only store #PyObject types, so this member can be cast to an array and iterated over. @@ -151,7 +151,7 @@ struct BPyPropStore { }; #define BPY_PROP_STORE_PY_DATA_SIZE \ - (sizeof(((struct BPyPropStore *)nullptr)->py_data) / sizeof(PyObject *)) + (sizeof(((BPyPropStore *)nullptr)->py_data) / sizeof(PyObject *)) #define ASSIGN_PYOBJECT_INCREF(a, b) \ { \ @@ -167,9 +167,9 @@ struct BPyPropStore { */ static ListBase g_bpy_prop_store_list = {nullptr, nullptr}; -static struct BPyPropStore *bpy_prop_py_data_ensure(PropertyRNA *prop) +static BPyPropStore *bpy_prop_py_data_ensure(PropertyRNA *prop) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); if (prop_store == nullptr) { prop_store = static_cast(MEM_callocN(sizeof(*prop_store), __func__)); RNA_def_py_data(prop, prop_store); @@ -183,7 +183,7 @@ static struct BPyPropStore *bpy_prop_py_data_ensure(PropertyRNA *prop) */ static void bpy_prop_py_data_remove(PropertyRNA *prop) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); if (prop_store == nullptr) { return; } @@ -427,7 +427,7 @@ struct BPyPropArrayLength { */ static int bpy_prop_array_length_parse(PyObject *o, void *p) { - struct BPyPropArrayLength *array_len_info = static_cast(p); + BPyPropArrayLength *array_len_info = static_cast(p); if (PyLong_CheckExact(o)) { int size; @@ -494,7 +494,7 @@ static int bpy_prop_array_length_parse(PyObject *o, void *p) static int bpy_prop_array_from_py_with_dims(void *values, size_t values_elem_size, PyObject *py_values, - const struct BPyPropArrayLength *array_len_info, + const BPyPropArrayLength *array_len_info, const PyTypeObject *type, const char *error_str) { @@ -508,7 +508,7 @@ static int bpy_prop_array_from_py_with_dims(void *values, } static bool bpy_prop_array_is_matrix_compatible_ex(int subtype, - const struct BPyPropArrayLength *array_len_info) + const BPyPropArrayLength *array_len_info) { return ((subtype == PROP_MATRIX) && (array_len_info->dims_len == 2) && ((array_len_info->dims[0] >= 2) && (array_len_info->dims[0] >= 4)) && @@ -516,7 +516,7 @@ static bool bpy_prop_array_is_matrix_compatible_ex(int subtype, } static bool bpy_prop_array_is_matrix_compatible(PropertyRNA *prop, - const struct BPyPropArrayLength *array_len_info) + const BPyPropArrayLength *array_len_info) { BLI_assert(RNA_property_type(prop) == PROP_FLOAT); return bpy_prop_array_is_matrix_compatible_ex(RNA_property_subtype(prop), array_len_info); @@ -525,8 +525,9 @@ static bool bpy_prop_array_is_matrix_compatible(PropertyRNA *prop, /** * Needed since the internal storage of matrices swaps row/column. */ -static void bpy_prop_array_matrix_swap_row_column_vn_vn( - float *values_dst, const float *values_src, const struct BPyPropArrayLength *array_len_info) +static void bpy_prop_array_matrix_swap_row_column_vn_vn(float *values_dst, + const float *values_src, + const BPyPropArrayLength *array_len_info) { BLI_assert(values_dst != values_src); const int dim0 = array_len_info->dims[0], dim1 = array_len_info->dims[1]; @@ -538,8 +539,8 @@ static void bpy_prop_array_matrix_swap_row_column_vn_vn( } } -static void bpy_prop_array_matrix_swap_row_column_vn( - float *values, const struct BPyPropArrayLength *array_len_info) +static void bpy_prop_array_matrix_swap_row_column_vn(float *values, + const BPyPropArrayLength *array_len_info) { const int dim0 = array_len_info->dims[0], dim1 = array_len_info->dims[1]; BLI_assert(dim0 <= 4 && dim1 <= 4); @@ -557,9 +558,9 @@ static void bpy_prop_array_matrix_swap_row_column_vn( * \{ */ /* callbacks */ -static void bpy_prop_update_fn(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop) +static void bpy_prop_update_fn(bContext *C, PointerRNA *ptr, PropertyRNA *prop) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyGILState_STATE gilstate; PyObject *py_func; PyObject *args; @@ -615,7 +616,7 @@ static void bpy_prop_update_fn(struct bContext *C, PointerRNA *ptr, PropertyRNA static bool bpy_prop_boolean_get_fn(PointerRNA *ptr, PropertyRNA *prop) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -659,7 +660,7 @@ static bool bpy_prop_boolean_get_fn(PointerRNA *ptr, PropertyRNA *prop) value = false; } else { - value = (bool)value_i; + value = bool(value_i); } Py_DECREF(ret); @@ -678,7 +679,7 @@ static bool bpy_prop_boolean_get_fn(PointerRNA *ptr, PropertyRNA *prop) static void bpy_prop_boolean_set_fn(PointerRNA *ptr, PropertyRNA *prop, bool value) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -734,7 +735,7 @@ static void bpy_prop_boolean_set_fn(PointerRNA *ptr, PropertyRNA *prop, bool val static void bpy_prop_boolean_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, bool *values) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -804,7 +805,7 @@ static void bpy_prop_boolean_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, bo static void bpy_prop_boolean_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, const bool *values) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -878,7 +879,7 @@ static void bpy_prop_boolean_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, co static int bpy_prop_int_get_fn(PointerRNA *ptr, PropertyRNA *prop) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -938,7 +939,7 @@ static int bpy_prop_int_get_fn(PointerRNA *ptr, PropertyRNA *prop) static void bpy_prop_int_set_fn(PointerRNA *ptr, PropertyRNA *prop, int value) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -994,7 +995,7 @@ static void bpy_prop_int_set_fn(PointerRNA *ptr, PropertyRNA *prop, int value) static void bpy_prop_int_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, int *values) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1064,7 +1065,7 @@ static void bpy_prop_int_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, int *v static void bpy_prop_int_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, const int *values) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1139,7 +1140,7 @@ static void bpy_prop_int_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, const static float bpy_prop_float_get_fn(PointerRNA *ptr, PropertyRNA *prop) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1199,7 +1200,7 @@ static float bpy_prop_float_get_fn(PointerRNA *ptr, PropertyRNA *prop) static void bpy_prop_float_set_fn(PointerRNA *ptr, PropertyRNA *prop, float value) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1255,7 +1256,7 @@ static void bpy_prop_float_set_fn(PointerRNA *ptr, PropertyRNA *prop, float valu static void bpy_prop_float_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, float *values) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1329,7 +1330,7 @@ static void bpy_prop_float_array_get_fn(PointerRNA *ptr, PropertyRNA *prop, floa static void bpy_prop_float_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, const float *values) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1404,7 +1405,7 @@ static void bpy_prop_float_array_set_fn(PointerRNA *ptr, PropertyRNA *prop, cons static void bpy_prop_string_get_fn(PointerRNA *ptr, PropertyRNA *prop, char *value) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1464,7 +1465,7 @@ static void bpy_prop_string_get_fn(PointerRNA *ptr, PropertyRNA *prop, char *val static int bpy_prop_string_length_fn(PointerRNA *ptr, PropertyRNA *prop) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1527,7 +1528,7 @@ static int bpy_prop_string_length_fn(PointerRNA *ptr, PropertyRNA *prop) static void bpy_prop_string_set_fn(PointerRNA *ptr, PropertyRNA *prop, const char *value) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1635,14 +1636,14 @@ static bool bpy_prop_string_visit_fn_call(PyObject *py_func, return true; } -static void bpy_prop_string_visit_for_search_fn(const struct bContext *C, +static void bpy_prop_string_visit_for_search_fn(const bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *edit_text, StringPropertySearchVisitFunc visit_fn, void *visit_user_data) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1653,7 +1654,7 @@ static void bpy_prop_string_visit_for_search_fn(const struct bContext *C, BLI_assert(prop_store != nullptr); if (C) { - bpy_context_set((struct bContext *)C, &gilstate); + bpy_context_set((bContext *)C, &gilstate); } else { gilstate = PyGILState_Ensure(); @@ -1739,7 +1740,7 @@ static void bpy_prop_string_visit_for_search_fn(const struct bContext *C, } if (C) { - bpy_context_clear((struct bContext *)C, &gilstate); + bpy_context_clear((bContext *)C, &gilstate); } else { PyGILState_Release(gilstate); @@ -1754,7 +1755,7 @@ static void bpy_prop_string_visit_for_search_fn(const struct bContext *C, static bool bpy_prop_pointer_poll_fn(PointerRNA *self, PointerRNA candidate, PropertyRNA *prop) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_self; PyObject *py_candidate; PyObject *py_func; @@ -1807,7 +1808,7 @@ static bool bpy_prop_pointer_poll_fn(PointerRNA *self, PointerRNA candidate, Pro static int bpy_prop_enum_get_fn(PointerRNA *ptr, PropertyRNA *prop) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1867,7 +1868,7 @@ static int bpy_prop_enum_get_fn(PointerRNA *ptr, PropertyRNA *prop) static void bpy_prop_enum_set_fn(PointerRNA *ptr, PropertyRNA *prop, int value) { - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func; PyObject *args; PyObject *self; @@ -1925,7 +1926,7 @@ static void bpy_prop_enum_set_fn(PointerRNA *ptr, PropertyRNA *prop, int value) static bool py_long_as_int(PyObject *py_long, int *r_int) { if (PyLong_CheckExact(py_long)) { - *r_int = (int)PyLong_AS_LONG(py_long); + *r_int = int(PyLong_AS_LONG(py_long)); return true; } @@ -2142,13 +2143,13 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, return items; } -static const EnumPropertyItem *bpy_prop_enum_itemf_fn(struct bContext *C, +static const EnumPropertyItem *bpy_prop_enum_itemf_fn(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) { PyGILState_STATE gilstate; - struct BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); + BPyPropStore *prop_store = static_cast(RNA_property_py_data_get(prop)); PyObject *py_func = prop_store->py_data.enum_data.itemf_fn; PyObject *self = nullptr; PyObject *args; @@ -2265,7 +2266,7 @@ static void bpy_prop_callback_assign_update(PropertyRNA *prop, PyObject *update_ { /* assume this is already checked for type and arg length */ if (update_fn && update_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); RNA_def_property_update_runtime(prop, reinterpret_cast(bpy_prop_update_fn)); ASSIGN_PYOBJECT_INCREF(prop_store->py_data.update_fn, update_fn); @@ -2277,7 +2278,7 @@ static void bpy_prop_callback_assign_update(PropertyRNA *prop, PyObject *update_ static void bpy_prop_callback_assign_pointer(PropertyRNA *prop, PyObject *poll_fn) { if (poll_fn && poll_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); RNA_def_property_poll_runtime(prop, reinterpret_cast(bpy_prop_pointer_poll_fn)); ASSIGN_PYOBJECT_INCREF(prop_store->py_data.pointer_data.poll_fn, poll_fn); @@ -2290,14 +2291,14 @@ static void bpy_prop_callback_assign_boolean(PropertyRNA *prop, PyObject *get_fn BooleanPropertySetFunc rna_set_fn = nullptr; if (get_fn && get_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_get_fn = bpy_prop_boolean_get_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn); } if (set_fn && set_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_set_fn = bpy_prop_boolean_set_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn); @@ -2314,14 +2315,14 @@ static void bpy_prop_callback_assign_boolean_array(PropertyRNA *prop, BooleanArrayPropertySetFunc rna_set_fn = nullptr; if (get_fn && get_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_get_fn = bpy_prop_boolean_array_get_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn); } if (set_fn && set_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_set_fn = bpy_prop_boolean_array_set_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn); @@ -2336,14 +2337,14 @@ static void bpy_prop_callback_assign_int(PropertyRNA *prop, PyObject *get_fn, Py IntPropertySetFunc rna_set_fn = nullptr; if (get_fn && get_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_get_fn = bpy_prop_int_get_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn); } if (set_fn && set_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_set_fn = bpy_prop_int_set_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn); @@ -2360,14 +2361,14 @@ static void bpy_prop_callback_assign_int_array(PropertyRNA *prop, IntArrayPropertySetFunc rna_set_fn = nullptr; if (get_fn && get_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_get_fn = bpy_prop_int_array_get_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn); } if (set_fn && set_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_set_fn = bpy_prop_int_array_set_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn); @@ -2382,14 +2383,14 @@ static void bpy_prop_callback_assign_float(PropertyRNA *prop, PyObject *get_fn, FloatPropertySetFunc rna_set_fn = nullptr; if (get_fn && get_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_get_fn = bpy_prop_float_get_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn); } if (set_fn && set_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_set_fn = bpy_prop_float_set_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn); @@ -2406,14 +2407,14 @@ static void bpy_prop_callback_assign_float_array(PropertyRNA *prop, FloatArrayPropertySetFunc rna_set_fn = nullptr; if (get_fn && get_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_get_fn = bpy_prop_float_array_get_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn); } if (set_fn && set_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_set_fn = bpy_prop_float_array_set_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn); @@ -2434,7 +2435,7 @@ static void bpy_prop_callback_assign_string(PropertyRNA *prop, StringPropertySearchFunc rna_search_fn = nullptr; if (get_fn && get_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_get_fn = bpy_prop_string_get_fn; rna_length_fn = bpy_prop_string_length_fn; @@ -2442,13 +2443,13 @@ static void bpy_prop_callback_assign_string(PropertyRNA *prop, } if (set_fn && set_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_set_fn = bpy_prop_string_set_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn); } if (search_fn) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_search_fn = bpy_prop_string_visit_for_search_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.string_data.search_fn, search_fn); @@ -2470,21 +2471,21 @@ static void bpy_prop_callback_assign_enum(PropertyRNA *prop, EnumPropertySetFunc rna_set_fn = nullptr; if (get_fn && get_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_get_fn = bpy_prop_enum_get_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.get_fn, get_fn); } if (set_fn && set_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_set_fn = bpy_prop_enum_set_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.set_fn, set_fn); } if (itemf_fn && itemf_fn != Py_None) { - struct BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); + BPyPropStore *prop_store = bpy_prop_py_data_ensure(prop); rna_itemf_fn = bpy_prop_enum_itemf_fn; ASSIGN_PYOBJECT_INCREF(prop_store->py_data.enum_data.itemf_fn, itemf_fn); } @@ -2579,7 +2580,7 @@ struct BPy_PropIDParse { */ static int bpy_prop_arg_parse_id(PyObject *o, void *p) { - struct BPy_PropIDParse *parse_data = static_cast(p); + BPy_PropIDParse *parse_data = static_cast(p); StructRNA *srna = parse_data->srna; if (!PyUnicode_Check(o)) { @@ -2614,7 +2615,7 @@ static int bpy_prop_arg_parse_id(PyObject *o, void *p) * Needed so #RNA_struct_property_tag_defines can be called on the `srna`. */ struct BPy_EnumProperty_Parse_WithSRNA { - struct BPy_EnumProperty_Parse base; + BPy_EnumProperty_Parse base; StructRNA *srna; }; @@ -2624,8 +2625,7 @@ struct BPy_EnumProperty_Parse_WithSRNA { */ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p) { - struct BPy_EnumProperty_Parse_WithSRNA *parse_data = - static_cast(p); + BPy_EnumProperty_Parse_WithSRNA *parse_data = static_cast(p); parse_data->base.items = RNA_struct_property_tag_defines(parse_data->srna); if (parse_data->base.items == nullptr) { PyErr_Format(PyExc_TypeError, @@ -4717,7 +4717,7 @@ static PyMethodDef props_methods[] = { static int props_visit(PyObject * /*self*/, visitproc visit, void *arg) { - LISTBASE_FOREACH (struct BPyPropStore *, prop_store, &g_bpy_prop_store_list) { + LISTBASE_FOREACH (BPyPropStore *, prop_store, &g_bpy_prop_store_list) { PyObject **py_data = (PyObject **)&prop_store->py_data; for (int i = 0; i < BPY_PROP_STORE_PY_DATA_SIZE; i++) { Py_VISIT(py_data[i]); @@ -4728,7 +4728,7 @@ static int props_visit(PyObject * /*self*/, visitproc visit, void *arg) static int props_clear(PyObject * /*self*/) { - LISTBASE_FOREACH (struct BPyPropStore *, prop_store, &g_bpy_prop_store_list) { + LISTBASE_FOREACH (BPyPropStore *, prop_store, &g_bpy_prop_store_list) { PyObject **py_data = (PyObject **)&prop_store->py_data; for (int i = 0; i < BPY_PROP_STORE_PY_DATA_SIZE; i++) { Py_CLEAR(py_data[i]); @@ -4758,7 +4758,7 @@ static PyModuleDef props_module = { /*m_free*/ nullptr, }; -PyObject *BPY_rna_props(void) +PyObject *BPY_rna_props() { PyObject *submodule; PyObject *submodule_dict; @@ -4794,7 +4794,7 @@ PyObject *BPY_rna_props(void) return submodule; } -void BPY_rna_props_clear_all(void) +void BPY_rna_props_clear_all() { /* Remove all user counts, so this isn't considered a leak from Python's perspective. */ props_clear(nullptr); diff --git a/source/blender/python/intern/bpy_rna.cc b/source/blender/python/intern/bpy_rna.cc index 63e2b71585d..abc019d5c0e 100644 --- a/source/blender/python/intern/bpy_rna.cc +++ b/source/blender/python/intern/bpy_rna.cc @@ -345,7 +345,7 @@ static bool rna_id_write_error(PointerRNA *ptr, PyObject *key) #endif /* USE_PEDANTIC_WRITE */ #ifdef USE_PEDANTIC_WRITE -bool pyrna_write_check(void) +bool pyrna_write_check() { return !rna_disallow_writes; } @@ -355,7 +355,7 @@ void pyrna_write_set(bool val) rna_disallow_writes = !val; } #else /* USE_PEDANTIC_WRITE */ -bool pyrna_write_check(void) +bool pyrna_write_check() { return true; } @@ -1612,7 +1612,7 @@ static int pyrna_py_to_prop( return -1; } - int param_i = (int)param; + int param_i = int(param); if (data) { RNA_property_int_clamp(ptr, prop, ¶m_i); *((int *)data) = param_i; @@ -2282,7 +2282,7 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s } else { /* No callback defined, just iterate and find the nth item. */ - const int key = (int)keynum_abs; + const int key = int(keynum_abs); PyObject *result = nullptr; bool found = false; CollectionPropertyIterator iter; @@ -3766,7 +3766,7 @@ static PyObject *pyrna_struct_is_property_overridable_library(BPy_StructRNA *sel return nullptr; } - return PyBool_FromLong((long)RNA_property_overridable_get(&self->ptr, prop)); + return PyBool_FromLong(long(RNA_property_overridable_get(&self->ptr, prop))); } PyDoc_STRVAR(pyrna_struct_property_overridable_library_set_doc, @@ -3797,7 +3797,7 @@ static PyObject *pyrna_struct_property_overridable_library_set(BPy_StructRNA *se } return PyBool_FromLong( - (long)RNA_property_overridable_library_set(&self->ptr, prop, (bool)is_overridable)); + long(RNA_property_overridable_library_set(&self->ptr, prop, bool(is_overridable)))); } PyDoc_STRVAR(pyrna_struct_path_resolve_doc, @@ -5221,7 +5221,7 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key { Py_ssize_t key_len_ssize; const char *key = PyUnicode_AsUTF8AndSize(key_ob, &key_len_ssize); - const int key_len = (int)key_len_ssize; /* Compare with same type. */ + const int key_len = int(key_len_ssize); /* Compare with same type. */ char name[256], *name_ptr; int name_len; @@ -5461,22 +5461,22 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) item = PySequence_GetItem(seq, i); switch (raw_type) { case PROP_RAW_CHAR: - ((char *)array)[i] = (char)PyLong_AsLong(item); + ((char *)array)[i] = char(PyLong_AsLong(item)); break; case PROP_RAW_SHORT: - ((short *)array)[i] = (short)PyLong_AsLong(item); + ((short *)array)[i] = short(PyLong_AsLong(item)); break; case PROP_RAW_INT: - ((int *)array)[i] = (int)PyLong_AsLong(item); + ((int *)array)[i] = int(PyLong_AsLong(item)); break; case PROP_RAW_BOOLEAN: - ((bool *)array)[i] = (int)PyLong_AsLong(item) != 0; + ((bool *)array)[i] = int(PyLong_AsLong(item)) != 0; break; case PROP_RAW_FLOAT: - ((float *)array)[i] = (float)PyFloat_AsDouble(item); + ((float *)array)[i] = float(PyFloat_AsDouble(item)); break; case PROP_RAW_DOUBLE: - ((double *)array)[i] = (double)PyFloat_AsDouble(item); + ((double *)array)[i] = double(PyFloat_AsDouble(item)); break; case PROP_RAW_UNSET: /* Should never happen. */ @@ -5648,7 +5648,7 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self, if (do_set) { for (i = 0; i < size; i++) { item = PySequence_GetItem(seq, i); - ((int *)array)[i] = (int)PyLong_AsLong(item); + ((int *)array)[i] = int(PyLong_AsLong(item)); Py_DECREF(item); } @@ -5670,7 +5670,7 @@ static PyObject *pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self, if (do_set) { for (i = 0; i < size; i++) { item = PySequence_GetItem(seq, i); - ((float *)array)[i] = (float)PyFloat_AsDouble(item); + ((float *)array)[i] = float(PyFloat_AsDouble(item)); Py_DECREF(item); } @@ -7611,7 +7611,7 @@ bool pyrna_id_CheckPyObject(PyObject *obj) return BPy_StructRNA_Check(obj) && RNA_struct_is_ID(((BPy_StructRNA *)obj)->ptr.type); } -void BPY_rna_init(void) +void BPY_rna_init() { #ifdef USE_MATHUTILS /* Register mathutils callbacks, ok to run more than once. */ mathutils_rna_array_cb_index = Mathutils_RegisterCallback(&mathutils_rna_array_cb); @@ -7664,7 +7664,7 @@ void BPY_rna_init(void) #endif } -void BPY_rna_exit(void) +void BPY_rna_exit() { #ifdef USE_PYRNA_INVALIDATE_WEAKREF /* This can help track down which kinds of data were not released. @@ -7687,7 +7687,7 @@ void BPY_rna_exit(void) /* 'bpy.data' from Python. */ static PointerRNA *rna_module_ptr = nullptr; -PyObject *BPY_rna_module(void) +PyObject *BPY_rna_module() { BPy_StructRNA *pyrna; PointerRNA ptr; @@ -7700,7 +7700,7 @@ PyObject *BPY_rna_module(void) return (PyObject *)pyrna; } -void BPY_update_rna_module(void) +void BPY_update_rna_module() { if (rna_module_ptr) { #if 0 @@ -7714,7 +7714,7 @@ void BPY_update_rna_module(void) #if 0 /* This is a way we can access doc-strings for RNA types * without having the data-types in Blender. */ -PyObject *BPY_rna_doc(void) +PyObject *BPY_rna_doc() { PointerRNA ptr; @@ -7744,8 +7744,7 @@ struct BPy_TypesModule_State { static PyObject *bpy_types_module_getattro(PyObject *self, PyObject *pyname) { - struct BPy_TypesModule_State *state = static_cast( - PyModule_GetState(self)); + BPy_TypesModule_State *state = static_cast(PyModule_GetState(self)); PointerRNA newptr; PyObject *ret; const char *name = PyUnicode_AsUTF8(pyname); @@ -7778,8 +7777,7 @@ static PyObject *bpy_types_module_getattro(PyObject *self, PyObject *pyname) static PyObject *bpy_types_module_dir(PyObject *self) { - struct BPy_TypesModule_State *state = static_cast( - PyModule_GetState(self)); + BPy_TypesModule_State *state = static_cast(PyModule_GetState(self)); PyObject *ret = PyList_New(0); RNA_PROP_BEGIN (&state->ptr, itemptr, state->prop) { @@ -7809,7 +7807,7 @@ static PyModuleDef bpy_types_module_def = { /*m_base*/ PyModuleDef_HEAD_INIT, /*m_name*/ "bpy.types", /*m_doc*/ bpy_types_module_doc, - /*m_size*/ sizeof(struct BPy_TypesModule_State), + /*m_size*/ sizeof(BPy_TypesModule_State), /*m_methods*/ bpy_types_module_methods, /*m_slots*/ nullptr, /*m_traverse*/ nullptr, @@ -7817,10 +7815,10 @@ static PyModuleDef bpy_types_module_def = { /*m_free*/ nullptr, }; -PyObject *BPY_rna_types(void) +PyObject *BPY_rna_types() { PyObject *submodule = PyModule_Create(&bpy_types_module_def); - struct BPy_TypesModule_State *state = static_cast( + BPy_TypesModule_State *state = static_cast( PyModule_GetState(submodule)); RNA_blender_rna_pointer_create(&state->ptr); @@ -7925,7 +7923,7 @@ const PointerRNA *pyrna_struct_as_ptr_or_null(PyObject *py_obj, const StructRNA int pyrna_struct_as_ptr_parse(PyObject *o, void *p) { - struct BPy_StructRNA_Parse *srna_parse = static_cast(p); + BPy_StructRNA_Parse *srna_parse = static_cast(p); BLI_assert(srna_parse->type != nullptr); srna_parse->ptr = pyrna_struct_as_ptr(o, srna_parse->type); if (srna_parse->ptr == nullptr) { @@ -7936,7 +7934,7 @@ int pyrna_struct_as_ptr_parse(PyObject *o, void *p) int pyrna_struct_as_ptr_or_null_parse(PyObject *o, void *p) { - struct BPy_StructRNA_Parse *srna_parse = static_cast(p); + BPy_StructRNA_Parse *srna_parse = static_cast(p); BLI_assert(srna_parse->type != nullptr); srna_parse->ptr = pyrna_struct_as_ptr_or_null(o, srna_parse->type); if (srna_parse->ptr == nullptr) { @@ -8793,7 +8791,7 @@ static void bpy_class_free(void *pyob_ptr) PyGILState_Release(gilstate); } -void pyrna_alloc_types(void) +void pyrna_alloc_types() { /* NOTE: This isn't essential to run on startup, since sub-types will lazy initialize. * But keep running in debug mode so we get immediate notification of bad class hierarchy @@ -8829,7 +8827,7 @@ void pyrna_alloc_types(void) #endif /* DEBUG */ } -void pyrna_free_types(void) +void pyrna_free_types() { PointerRNA ptr; PropertyRNA *prop; diff --git a/source/blender/python/intern/bpy_rna_array.cc b/source/blender/python/intern/bpy_rna_array.cc index 54204ed275b..e4ec2412064 100644 --- a/source/blender/python/intern/bpy_rna_array.cc +++ b/source/blender/python/intern/bpy_rna_array.cc @@ -36,7 +36,7 @@ struct ItemConvertArgData; -typedef void (*ItemConvertFunc)(const struct ItemConvertArgData *arg, PyObject *, char *); +typedef void (*ItemConvertFunc)(const ItemConvertArgData *arg, PyObject *, char *); typedef int (*ItemTypeCheckFunc)(PyObject *); typedef void (*RNA_SetArrayFunc)(PointerRNA *, PropertyRNA *, const char *); typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *); @@ -57,7 +57,7 @@ struct ItemConvertArgData { */ struct ItemConvert_FuncArg { ItemConvertFunc func; - struct ItemConvertArgData arg; + ItemConvertArgData arg; }; /* @@ -550,7 +550,7 @@ static int py_to_array(PyObject *seq, if (prop_is_param_dyn_alloc) { /* not freeing allocated mem, RNA_parameter_list_free() will do this */ ParameterDynAlloc *param_alloc = (ParameterDynAlloc *)param_data; - param_alloc->array_tot = (int)totitem; + param_alloc->array_tot = int(totitem); /* freeing param list will free */ param_alloc->array = MEM_callocN(item_size * totitem, "py_to_array dyn"); @@ -660,15 +660,15 @@ static int py_to_array_index(PyObject *py, return 0; } -static void py_to_float(const struct ItemConvertArgData *arg, PyObject *py, char *data) +static void py_to_float(const ItemConvertArgData *arg, PyObject *py, char *data) { const float *range = arg->float_data.range; - float value = (float)PyFloat_AsDouble(py); + float value = float(PyFloat_AsDouble(py)); CLAMP(value, range[0], range[1]); *(float *)data = value; } -static void py_to_int(const struct ItemConvertArgData *arg, PyObject *py, char *data) +static void py_to_int(const ItemConvertArgData *arg, PyObject *py, char *data) { const int *range = arg->int_data.range; int value = PyC_Long_AsI32(py); @@ -676,9 +676,9 @@ static void py_to_int(const struct ItemConvertArgData *arg, PyObject *py, char * *(int *)data = value; } -static void py_to_bool(const struct ItemConvertArgData * /*arg*/, PyObject *py, char *data) +static void py_to_bool(const ItemConvertArgData * /*arg*/, PyObject *py, char *data) { - *(bool *)data = (bool)PyObject_IsTrue(py); + *(bool *)data = bool(PyObject_IsTrue(py)); } static int py_float_check(PyObject *py) diff --git a/source/blender/python/intern/bpy_rna_callback.cc b/source/blender/python/intern/bpy_rna_callback.cc index 0fcee3efe45..fd40427620f 100644 --- a/source/blender/python/intern/bpy_rna_callback.cc +++ b/source/blender/python/intern/bpy_rna_callback.cc @@ -279,8 +279,8 @@ PyObject *pyrna_callback_classmethod_add(PyObject * /*self*/, PyObject *args) if (srna == &RNA_WindowManager) { struct { - struct BPy_EnumProperty_Parse space_type_enum; - struct BPy_EnumProperty_Parse region_type_enum; + BPy_EnumProperty_Parse space_type_enum; + BPy_EnumProperty_Parse region_type_enum; } params{}; params.space_type_enum.items = rna_enum_space_type_items; params.space_type_enum.value = SPACE_TYPE_ANY; @@ -309,8 +309,8 @@ PyObject *pyrna_callback_classmethod_add(PyObject * /*self*/, PyObject *args) } else if (RNA_struct_is_a(srna, &RNA_Space)) { struct { - struct BPy_EnumProperty_Parse region_type_enum; - struct BPy_EnumProperty_Parse event_enum; + BPy_EnumProperty_Parse region_type_enum; + BPy_EnumProperty_Parse event_enum; } params{}; params.region_type_enum.items = rna_enum_region_type_items; params.event_enum.items = region_draw_mode_items; @@ -402,7 +402,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject * /*self*/, PyObject *args) else if (RNA_struct_is_a(srna, &RNA_Space)) { const char *error_prefix = "Space.draw_handler_remove"; struct { - struct BPy_EnumProperty_Parse region_type_enum; + BPy_EnumProperty_Parse region_type_enum; } params{}; params.region_type_enum.items = rna_enum_region_type_items; diff --git a/source/blender/python/intern/bpy_rna_context.cc b/source/blender/python/intern/bpy_rna_context.cc index e7e2c16f0a3..e5ee7e186de 100644 --- a/source/blender/python/intern/bpy_rna_context.cc +++ b/source/blender/python/intern/bpy_rna_context.cc @@ -45,7 +45,7 @@ struct BPyContextTempOverride { ContextStore ctx_init; ContextStore ctx_temp; /** Bypass Python overrides set when calling an operator from Python. */ - struct bContext_PyState py_state; + bContext_PyState py_state; /** * This dictionary is used to store members that don't have special handling, * see: #bpy_context_temp_override_extract_known_args, @@ -356,7 +356,7 @@ PyMethodDef BPY_rna_context_temp_override_method_def = { bpy_context_temp_override_doc, }; -void bpy_rna_context_types_init(void) +void bpy_rna_context_types_init() { if (PyType_Ready(&BPyContextTempOverride_Type) < 0) { BLI_assert_unreachable(); diff --git a/source/blender/python/intern/bpy_rna_data.cc b/source/blender/python/intern/bpy_rna_data.cc index d0879c73c02..f3cdcb5eab1 100644 --- a/source/blender/python/intern/bpy_rna_data.cc +++ b/source/blender/python/intern/bpy_rna_data.cc @@ -177,7 +177,7 @@ PyMethodDef BPY_rna_data_context_method_def = { bpy_rna_data_context_load_doc, }; -int BPY_rna_data_context_type_ready(void) +int BPY_rna_data_context_type_ready() { if (PyType_Ready(&bpy_rna_data_context_Type) < 0) { return -1; diff --git a/source/blender/python/intern/bpy_rna_driver.cc b/source/blender/python/intern/bpy_rna_driver.cc index b36590c4966..fe10427e8e1 100644 --- a/source/blender/python/intern/bpy_rna_driver.cc +++ b/source/blender/python/intern/bpy_rna_driver.cc @@ -22,10 +22,10 @@ #include "bpy_rna_driver.h" /* own include */ -PyObject *pyrna_driver_get_variable_value(const struct AnimationEvalContext *anim_eval_context, - struct ChannelDriver *driver, - struct DriverVar *dvar, - struct DriverTarget *dtar) +PyObject *pyrna_driver_get_variable_value(const AnimationEvalContext *anim_eval_context, + ChannelDriver *driver, + DriverVar *dvar, + DriverTarget *dtar) { PyObject *driver_arg = nullptr; PointerRNA ptr; diff --git a/source/blender/python/intern/bpy_rna_gizmo.cc b/source/blender/python/intern/bpy_rna_gizmo.cc index 1702376eeb5..94e8261cede 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.cc +++ b/source/blender/python/intern/bpy_rna_gizmo.cc @@ -61,7 +61,7 @@ static int py_rna_gizmo_parse(PyObject *o, void *p) static int py_rna_gizmo_target_id_parse(PyObject *o, void *p) { - struct BPyGizmoWithTarget *gizmo_with_target = static_cast(p); + BPyGizmoWithTarget *gizmo_with_target = static_cast(p); /* Must be set by `py_rna_gizmo_parse`. */ wmGizmo *gz = gizmo_with_target->gz; BLI_assert(gz != nullptr); @@ -88,7 +88,7 @@ static int py_rna_gizmo_target_id_parse_and_ensure_is_valid(PyObject *o, void *p if (py_rna_gizmo_target_id_parse(o, p) == 0) { return 0; } - struct BPyGizmoWithTarget *gizmo_with_target = static_cast(p); + BPyGizmoWithTarget *gizmo_with_target = static_cast(p); wmGizmo *gz = gizmo_with_target->gz; wmGizmoProperty *gz_prop = gizmo_with_target->gz_prop; if (!WM_gizmo_target_property_is_valid(gz_prop)) { @@ -105,7 +105,7 @@ static int py_rna_gizmo_target_id_parse_and_ensure_is_valid(PyObject *o, void *p static int py_rna_gizmo_target_type_id_parse(PyObject *o, void *p) { - struct BPyGizmoWithTargetType *gizmo_with_target = static_cast(p); + BPyGizmoWithTargetType *gizmo_with_target = static_cast(p); /* Must be set first. */ wmGizmo *gz = gizmo_with_target->gz; BLI_assert(gz != nullptr); @@ -152,7 +152,7 @@ static void py_rna_gizmo_handler_get_cb(const wmGizmo * /*gz*/, { const PyGILState_STATE gilstate = PyGILState_Ensure(); - struct BPyGizmoHandlerUserData *data = static_cast( + BPyGizmoHandlerUserData *data = static_cast( gz_prop->custom_func.user_data); PyObject *ret = PyObject_CallObject(data->fn_slots[BPY_GIZMO_FN_SLOT_GET], nullptr); if (ret == nullptr) { @@ -203,7 +203,7 @@ static void py_rna_gizmo_handler_set_cb(const wmGizmo * /*gz*/, { const PyGILState_STATE gilstate = PyGILState_Ensure(); - struct BPyGizmoHandlerUserData *data = static_cast( + BPyGizmoHandlerUserData *data = static_cast( gz_prop->custom_func.user_data); PyObject *args = PyTuple_New(1); @@ -251,7 +251,7 @@ static void py_rna_gizmo_handler_range_get_cb(const wmGizmo * /*gz*/, wmGizmoProperty *gz_prop, void *value_p) { - struct BPyGizmoHandlerUserData *data = static_cast( + BPyGizmoHandlerUserData *data = static_cast( gz_prop->custom_func.user_data); const PyGILState_STATE gilstate = PyGILState_Ensure(); @@ -304,7 +304,7 @@ fail: static void py_rna_gizmo_handler_free_cb(const wmGizmo * /*gz*/, wmGizmoProperty *gz_prop) { - struct BPyGizmoHandlerUserData *data = static_cast( + BPyGizmoHandlerUserData *data = static_cast( gz_prop->custom_func.user_data); const PyGILState_STATE gilstate = PyGILState_Ensure(); @@ -335,7 +335,7 @@ static PyObject *bpy_gizmo_target_set_handler(PyObject * /*self*/, PyObject *arg const PyGILState_STATE gilstate = PyGILState_Ensure(); struct { - struct BPyGizmoWithTargetType gz_with_target_type; + BPyGizmoWithTargetType gz_with_target_type; PyObject *py_fn_slots[BPY_GIZMO_FN_SLOT_LEN]; } params = { {nullptr, nullptr}, @@ -443,7 +443,7 @@ PyDoc_STRVAR(bpy_gizmo_target_get_value_doc, static PyObject *bpy_gizmo_target_get_value(PyObject * /*self*/, PyObject *args, PyObject *kw) { struct { - struct BPyGizmoWithTarget gz_with_target; + BPyGizmoWithTarget gz_with_target; } params = { {nullptr, nullptr}, }; @@ -511,7 +511,7 @@ PyDoc_STRVAR(bpy_gizmo_target_set_value_doc, static PyObject *bpy_gizmo_target_set_value(PyObject * /*self*/, PyObject *args, PyObject *kw) { struct { - struct BPyGizmoWithTarget gz_with_target; + BPyGizmoWithTarget gz_with_target; PyObject *value; } params = { {nullptr, nullptr}, @@ -596,7 +596,7 @@ PyDoc_STRVAR(bpy_gizmo_target_get_range_doc, static PyObject *bpy_gizmo_target_get_range(PyObject * /*self*/, PyObject *args, PyObject *kw) { struct { - struct BPyGizmoWithTarget gz_with_target; + BPyGizmoWithTarget gz_with_target; } params = { {nullptr, nullptr}, }; diff --git a/source/blender/python/intern/bpy_rna_id_collection.cc b/source/blender/python/intern/bpy_rna_id_collection.cc index 29f387268d9..3a18794de20 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.cc +++ b/source/blender/python/intern/bpy_rna_id_collection.cc @@ -59,7 +59,7 @@ struct IDUserMapData { static int id_code_as_index(const short idcode) { - return (int)*((ushort *)&idcode); + return int(*((ushort *)&idcode)); } static bool id_check_type(const ID *id, const BLI_bitmap *types_bitmap) diff --git a/source/blender/python/intern/bpy_rna_types_capi.cc b/source/blender/python/intern/bpy_rna_types_capi.cc index ccf5289f7c5..97351f15b90 100644 --- a/source/blender/python/intern/bpy_rna_types_capi.cc +++ b/source/blender/python/intern/bpy_rna_types_capi.cc @@ -263,7 +263,7 @@ static PyMethodDef pyrna_space_methods[] = { /** \name Public API * \{ */ -void BPY_rna_types_extend_capi(void) +void BPY_rna_types_extend_capi() { /* BlendData */ ARRAY_SET_ITEMS(pyrna_blenddata_methods, diff --git a/source/blender/python/intern/bpy_traceback.cc b/source/blender/python/intern/bpy_traceback.cc index 666310fbc0e..286090c1ca8 100644 --- a/source/blender/python/intern/bpy_traceback.cc +++ b/source/blender/python/intern/bpy_traceback.cc @@ -85,7 +85,7 @@ static int parse_syntax_error(PyObject *err, if (hold < 0 && PyErr_Occurred()) { goto finally; } - *lineno = (int)hold; + *lineno = int(hold); v = _PyObject_GetAttrId(err, &PyId_offset); if (!v) { @@ -101,7 +101,7 @@ static int parse_syntax_error(PyObject *err, if (hold < 0 && PyErr_Occurred()) { goto finally; } - *offset = (int)hold; + *offset = int(hold); } if (Py_TYPE(err) == (PyTypeObject *)PyExc_SyntaxError) { diff --git a/source/blender/python/intern/bpy_utils_previews.cc b/source/blender/python/intern/bpy_utils_previews.cc index 2acc387b50b..93638ace67a 100644 --- a/source/blender/python/intern/bpy_utils_previews.cc +++ b/source/blender/python/intern/bpy_utils_previews.cc @@ -178,7 +178,7 @@ static PyModuleDef bpy_utils_previews_module = { /*m_free*/ nullptr, }; -PyObject *BPY_utils_previews_module(void) +PyObject *BPY_utils_previews_module() { PyObject *submodule; diff --git a/source/blender/python/intern/bpy_utils_units.cc b/source/blender/python/intern/bpy_utils_units.cc index d9ea3883308..27d80d95bab 100644 --- a/source/blender/python/intern/bpy_utils_units.cc +++ b/source/blender/python/intern/bpy_utils_units.cc @@ -198,10 +198,10 @@ static PyObject *bpyunits_to_value(PyObject * /*self*/, PyObject *args, PyObject } str_len = str_len * 2 + 64; - str = static_cast(PyMem_MALLOC(sizeof(*str) * (size_t)str_len)); - BLI_strncpy(str, inpt, (size_t)str_len); + str = static_cast(PyMem_MALLOC(sizeof(*str) * size_t(str_len))); + BLI_strncpy(str, inpt, size_t(str_len)); - BKE_unit_replace_string(str, (int)str_len, uref, scale, usys, ucat); + BKE_unit_replace_string(str, int(str_len), uref, scale, usys, ucat); if (!PyC_RunString_AsNumber(nullptr, str, "", &result)) { if (PyErr_Occurred()) { @@ -308,7 +308,7 @@ static PyObject *bpyunits_to_string(PyObject * /*self*/, PyObject *args, PyObjec PyObject *result; BKE_unit_value_as_string_adaptive( - buf1, sizeof(buf1), value, precision, usys, ucat, (bool)split_unit, false); + buf1, sizeof(buf1), value, precision, usys, ucat, bool(split_unit), false); if (compatible_unit) { BKE_unit_name_to_alt(buf2, sizeof(buf2), buf1, usys, ucat); @@ -350,7 +350,7 @@ static PyModuleDef bpyunits_module = { /*m_free*/ nullptr, }; -PyObject *BPY_utils_units(void) +PyObject *BPY_utils_units() { PyObject *submodule, *item; diff --git a/source/blender/python/intern/stubs.cc b/source/blender/python/intern/stubs.cc index 3bf10ffd099..3d5696bd740 100644 --- a/source/blender/python/intern/stubs.cc +++ b/source/blender/python/intern/stubs.cc @@ -13,16 +13,14 @@ /* python, will come back */ // void BPY_script_exec(void) {} // void BPY_python_start(void) {} -void BPY_pyconstraint_exec(struct bPythonConstraint * /*con*/, - struct bConstraintOb * /*cob*/, - struct ListBase * /*targets*/) +void BPY_pyconstraint_exec(bPythonConstraint * /*con*/, + bConstraintOb * /*cob*/, + ListBase * /*targets*/) { } -void BPY_pyconstraint_target(struct bPythonConstraint * /*con*/, struct bConstraintTarget * /*ct*/) -{ -} -bool BPY_is_pyconstraint(struct Text * /*text*/) +void BPY_pyconstraint_target(bPythonConstraint * /*con*/, bConstraintTarget * /*ct*/) {} +bool BPY_is_pyconstraint(Text * /*text*/) { return 0; } -void BPY_pyconstraint_update(struct Object * /*owner*/, struct bConstraint * /*con*/) {} +void BPY_pyconstraint_update(Object * /*owner*/, bConstraint * /*con*/) {} diff --git a/source/blender/python/mathutils/mathutils.cc b/source/blender/python/mathutils/mathutils.cc index 9afcf33d906..53cbfebded0 100644 --- a/source/blender/python/mathutils/mathutils.cc +++ b/source/blender/python/mathutils/mathutils.cc @@ -77,7 +77,7 @@ Py_hash_t mathutils_array_hash(const float *array, size_t array_len) x = 0x345678UL; i = 0; while (--len >= 0) { - y = _Py_HashDouble(nullptr, (double)(array[i++])); + y = _Py_HashDouble(nullptr, double(array[i++])); if (y == -1) { return -1; } @@ -395,7 +395,7 @@ int mathutils_array_parse_alloc_viseq( start = 0; for (i = 0; i < size; i++) { subseq = value_fast_items[i]; - if ((subseq_len = (int)PySequence_Size(subseq)) == -1) { + if ((subseq_len = int(PySequence_Size(subseq))) == -1) { PyErr_Format( PyExc_ValueError, "%.200s: sequence expected to have subsequences", error_prefix); PyMem_Free(*start_table); @@ -495,7 +495,7 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error * [3] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ * instead. */ -#define SIGNMASK(i) (-(int)(((uint)(i)) >> 31)) +#define SIGNMASK(i) (-int((uint(i)) >> 31)) int EXPP_FloatsAreEqual(float af, float bf, int maxDiff) { @@ -792,7 +792,7 @@ static PyModuleDef M_Mathutils_module_def = { # include "mathutils_noise.h" #endif -PyMODINIT_FUNC PyInit_mathutils(void) +PyMODINIT_FUNC PyInit_mathutils() { PyObject *mod; PyObject *submodule; diff --git a/source/blender/python/mathutils/mathutils_Color.cc b/source/blender/python/mathutils/mathutils_Color.cc index 4ef4cda8790..47230c0c17d 100644 --- a/source/blender/python/mathutils/mathutils_Color.cc +++ b/source/blender/python/mathutils/mathutils_Color.cc @@ -42,7 +42,7 @@ static PyObject *Color_to_tuple_ex(ColorObject *self, int ndigits) if (ndigits >= 0) { for (i = 0; i < COLOR_SIZE; i++) { - PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->col[i], ndigits))); + PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round(double(self->col[i]), ndigits))); } } else { diff --git a/source/blender/python/mathutils/mathutils_Euler.cc b/source/blender/python/mathutils/mathutils_Euler.cc index 84ebb7b8a54..6eeead4c783 100644 --- a/source/blender/python/mathutils/mathutils_Euler.cc +++ b/source/blender/python/mathutils/mathutils_Euler.cc @@ -76,7 +76,7 @@ static PyObject *Euler_to_tuple_ex(EulerObject *self, int ndigits) if (ndigits >= 0) { for (i = 0; i < EULER_SIZE; i++) { - PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->eul[i], ndigits))); + PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round(double(self->eul[i]), ndigits))); } } else { @@ -228,7 +228,7 @@ static PyObject *Euler_rotate_axis(EulerObject *self, PyObject *args) return nullptr; } - rotate_eulO(self->eul, self->order, (char)axis, angle); + rotate_eulO(self->eul, self->order, char(axis), angle); (void)BaseMath_WriteCallback(self); diff --git a/source/blender/python/mathutils/mathutils_Matrix.cc b/source/blender/python/mathutils/mathutils_Matrix.cc index 83a0316fb13..76eec61c792 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.cc +++ b/source/blender/python/mathutils/mathutils_Matrix.cc @@ -1592,7 +1592,7 @@ static bool matrix_invert_args_check(const MatrixObject *self, PyObject *args, b } } -static void matrix_invert_raise_degenerate(void) +static void matrix_invert_raise_degenerate() { PyErr_SetString(PyExc_ValueError, "Matrix.invert(ed): " @@ -1804,7 +1804,7 @@ static PyObject *Matrix_adjugate(MatrixObject *self) } else { PyErr_Format( - PyExc_ValueError, "Matrix adjugate(d): size (%d) unsupported", (int)self->col_num); + PyExc_ValueError, "Matrix adjugate(d): size (%d) unsupported", int(self->col_num)); return nullptr; } @@ -1992,7 +1992,7 @@ static PyObject *Matrix_determinant(MatrixObject *self) return nullptr; } - return PyFloat_FromDouble((double)matrix_determinant_internal(self)); + return PyFloat_FromDouble(double(matrix_determinant_internal(self))); } /** \} */ @@ -2869,9 +2869,9 @@ static PyObject *Matrix_matmul(PyObject *m1, PyObject *m2) for (row = 0; row < mat1->row_num; row++) { double dot = 0.0f; for (item = 0; item < mat1->col_num; item++) { - dot += (double)(MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col)); + dot += double(MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col)); } - mat[(col * mat1->row_num) + row] = (float)dot; + mat[(col * mat1->row_num) + row] = float(dot); } } @@ -2942,11 +2942,11 @@ static PyObject *Matrix_imatmul(PyObject *m1, PyObject *m2) for (row = 0; row < mat1->row_num; row++) { double dot = 0.0f; for (item = 0; item < mat1->col_num; item++) { - dot += (double)(MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col)); + dot += double(MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col)); } /* store in new matrix as overwriting original at this point will cause * subsequent iterations to use incorrect values */ - mat[(col * mat1->row_num) + row] = (float)dot; + mat[(col * mat1->row_num) + row] = float(dot); } } diff --git a/source/blender/python/mathutils/mathutils_Quaternion.cc b/source/blender/python/mathutils/mathutils_Quaternion.cc index 4fdc67599e9..f9c490ee9c3 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.cc +++ b/source/blender/python/mathutils/mathutils_Quaternion.cc @@ -81,7 +81,7 @@ static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits) if (ndigits >= 0) { for (i = 0; i < QUAT_SIZE; i++) { - PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->quat[i], ndigits))); + PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round(double(self->quat[i]), ndigits))); } } else { @@ -923,7 +923,7 @@ static int Quaternion_ass_item(QuaternionObject *self, Py_ssize_t i, PyObject *o return -1; } - f = (float)PyFloat_AsDouble(ob); + f = float(PyFloat_AsDouble(ob)); if (f == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, diff --git a/source/blender/python/mathutils/mathutils_Vector.cc b/source/blender/python/mathutils/mathutils_Vector.cc index 780d2288a96..eef3f997491 100644 --- a/source/blender/python/mathutils/mathutils_Vector.cc +++ b/source/blender/python/mathutils/mathutils_Vector.cc @@ -81,9 +81,9 @@ static int row_vector_multiplication(float r_vec[MAX_DIMENSIONS], for (col = 0; col < mat->col_num; col++) { double dot = 0.0; for (row = 0; row < mat->row_num; row++) { - dot += (double)(MATRIX_ITEM(mat, row, col) * vec_cpy[row]); + dot += double(MATRIX_ITEM(mat, row, col) * vec_cpy[row]); } - r_vec[z++] = (float)dot; + r_vec[z++] = float(dot); } return 0; } @@ -111,7 +111,7 @@ static PyObject *Vector_to_tuple_ex(VectorObject *self, int ndigits) if (ndigits >= 0) { for (i = 0; i < self->vec_num; i++) { - PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->vec[i], ndigits))); + PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round(double(self->vec[i]), ndigits))); } } else { @@ -288,7 +288,7 @@ static PyObject *C_Vector_Range(PyObject *cls, PyObject *args) return nullptr; } - range_vn_fl(vec, vec_num, (float)start, (float)step); + range_vn_fl(vec, vec_num, float(start), float(step)); return Vector_CreatePyObject_alloc(vec, vec_num, (PyTypeObject *)cls); } @@ -320,7 +320,7 @@ static PyObject *C_Vector_Linspace(PyObject *cls, PyObject *args) return nullptr; } - step = (end - start) / (float)(vec_num - 1); + step = (end - start) / float(vec_num - 1); vec = static_cast(PyMem_Malloc(vec_num * sizeof(float))); @@ -1110,9 +1110,9 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args) } for (x = 0; x < vec_num; x++) { - dot_self += (double)self->vec[x] * (double)self->vec[x]; - dot_other += (double)tvec[x] * (double)tvec[x]; - dot += (double)self->vec[x] * (double)tvec[x]; + dot_self += double(self->vec[x]) * double(self->vec[x]); + dot_other += double(tvec[x]) * double(tvec[x]); + dot += double(self->vec[x]) * double(tvec[x]); } if (!dot_self || !dot_other) { @@ -1273,13 +1273,13 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value) /* get dot products */ for (x = 0; x < vec_num; x++) { - dot += (double)(self->vec[x] * tvec[x]); - dot2 += (double)(tvec[x] * tvec[x]); + dot += double(self->vec[x] * tvec[x]); + dot2 += double(tvec[x] * tvec[x]); } /* projection */ dot /= dot2; for (x = 0; x < vec_num; x++) { - tvec[x] *= (float)dot; + tvec[x] *= float(dot); } return Vector_CreatePyObject_alloc(tvec, vec_num, Py_TYPE(self)); } @@ -1395,7 +1395,7 @@ static PyObject *Vector_slerp(VectorObject *self, PyObject *args) } /* We have sane state, execute slerp */ - cosom = (float)dot_vn_vn(self_vec, other_vec, vec_num); + cosom = float(dot_vn_vn(self_vec, other_vec, vec_num)); /* direct opposite, can't slerp */ if (UNLIKELY(cosom < (-1.0f + FLT_EPSILON))) { @@ -2081,9 +2081,9 @@ int column_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject *vec, for (row = 0; row < mat->row_num; row++) { double dot = 0.0f; for (col = 0; col < mat->col_num; col++) { - dot += (double)(MATRIX_ITEM(mat, row, col) * vec_cpy[col]); + dot += double(MATRIX_ITEM(mat, row, col) * vec_cpy[col]); } - r_vec[z++] = (float)dot; + r_vec[z++] = float(dot); } return 0; @@ -2694,7 +2694,7 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure } else if ((void)PyErr_Clear(), /* run but ignore the result */ (size_from = (size_t)mathutils_array_parse( - vec_assign, 2, 4, value, "Vector.**** = swizzle assignment")) == (size_t)-1) + vec_assign, 2, 4, value, "Vector.**** = swizzle assignment")) == size_t(-1)) { return -1; } diff --git a/source/blender/python/mathutils/mathutils_geometry.cc b/source/blender/python/mathutils/mathutils_geometry.cc index 20aa3632b15..48a8624d7d9 100644 --- a/source/blender/python/mathutils/mathutils_geometry.cc +++ b/source/blender/python/mathutils/mathutils_geometry.cc @@ -1103,7 +1103,7 @@ struct PointsInPlanes_UserData { static void points_in_planes_fn(const float co[3], int i, int j, int k, void *user_data_p) { - struct PointsInPlanes_UserData *user_data = static_cast(user_data_p); + PointsInPlanes_UserData *user_data = static_cast(user_data_p); PyList_APPEND(user_data->py_verts, Vector_CreatePyObject(co, 3, nullptr)); user_data->planes_used[i] = true; user_data->planes_used[j] = true; @@ -1377,8 +1377,8 @@ static int boxPack_FromPyObject(PyObject *value, BoxPack **r_boxarray) item_1 = PyList_GET_ITEM(list_item, 2); item_2 = PyList_GET_ITEM(list_item, 3); - box->w = (float)PyFloat_AsDouble(item_1); - box->h = (float)PyFloat_AsDouble(item_2); + box->w = float(PyFloat_AsDouble(item_1)); + box->h = float(PyFloat_AsDouble(item_2)); box->index = i; /* accounts for error case too and overwrites with own error */ @@ -1656,7 +1656,7 @@ static PyObject *M_Geometry_delaunay_2d_cdt(PyObject * /*self*/, PyObject *args) goto exit_cdt; } - in.verts_len = (int)vert_coords_len; + in.verts_len = int(vert_coords_len); in.vert_coords = in_coords; in.edges_len = edges_len; in.faces_len = faces_len; @@ -1686,8 +1686,8 @@ static PyObject *M_Geometry_delaunay_2d_cdt(PyObject * /*self*/, PyObject *args) out_edges = PyList_New(res->edges_len); for (i = 0; i < res->edges_len; i++) { item = PyTuple_New(2); - PyTuple_SET_ITEM(item, 0, PyLong_FromLong((long)res->edges[i][0])); - PyTuple_SET_ITEM(item, 1, PyLong_FromLong((long)res->edges[i][1])); + PyTuple_SET_ITEM(item, 0, PyLong_FromLong(long(res->edges[i][0]))); + PyTuple_SET_ITEM(item, 1, PyLong_FromLong(long(res->edges[i][1]))); PyList_SET_ITEM(out_edges, i, item); } PyTuple_SET_ITEM(ret_value, 1, out_edges); @@ -1844,7 +1844,7 @@ static PyModuleDef M_Geometry_module_def = { /*----------------------------MODULE INIT-------------------------*/ -PyMODINIT_FUNC PyInit_mathutils_geometry(void) +PyMODINIT_FUNC PyInit_mathutils_geometry() { PyObject *submodule = PyModule_Create(&M_Geometry_module_def); return submodule; diff --git a/source/blender/python/mathutils/mathutils_interpolate.cc b/source/blender/python/mathutils/mathutils_interpolate.cc index ee6a6cbb5b2..e8b2c912220 100644 --- a/source/blender/python/mathutils/mathutils_interpolate.cc +++ b/source/blender/python/mathutils/mathutils_interpolate.cc @@ -104,7 +104,7 @@ static PyModuleDef M_Interpolate_module_def = { /*----------------------------MODULE INIT-------------------------*/ -PyMODINIT_FUNC PyInit_mathutils_interpolate(void) +PyMODINIT_FUNC PyInit_mathutils_interpolate() { PyObject *submodule = PyModule_Create(&M_Interpolate_module_def); return submodule; diff --git a/source/blender/python/mathutils/mathutils_kdtree.cc b/source/blender/python/mathutils/mathutils_kdtree.cc index 19bee981e15..3c16a040325 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.cc +++ b/source/blender/python/mathutils/mathutils_kdtree.cc @@ -171,7 +171,7 @@ static int py_find_nearest_cb(void *user_data, int index, const float co[3], flo { UNUSED_VARS(co, dist_sq); - struct PyKDTree_NearestData *data = static_cast(user_data); + PyKDTree_NearestData *data = static_cast(user_data); PyObject *py_args = PyTuple_New(1); PyTuple_SET_ITEM(py_args, 0, PyLong_FromLong(index)); @@ -183,7 +183,7 @@ static int py_find_nearest_cb(void *user_data, int index, const float co[3], flo const int ok = PyC_ParseBool(result, &use_node); Py_DECREF(result); if (ok) { - return (int)use_node; + return int(use_node); } } @@ -230,7 +230,7 @@ static PyObject *py_kdtree_find(PyKDTree *self, PyObject *args, PyObject *kwargs BLI_kdtree_3d_find_nearest(self->obj, co, &nearest); } else { - struct PyKDTree_NearestData data = {0}; + PyKDTree_NearestData data = {0}; data.py_filter = py_filter; data.is_error = false; @@ -441,7 +441,7 @@ static PyModuleDef kdtree_moduledef = { /*m_free*/ nullptr, }; -PyMODINIT_FUNC PyInit_mathutils_kdtree(void) +PyMODINIT_FUNC PyInit_mathutils_kdtree() { PyObject *m = PyModule_Create(&kdtree_moduledef); diff --git a/source/blender/python/mathutils/mathutils_noise.cc b/source/blender/python/mathutils/mathutils_noise.cc index dfac59c871d..ea8c93eec5e 100644 --- a/source/blender/python/mathutils/mathutils_noise.cc +++ b/source/blender/python/mathutils/mathutils_noise.cc @@ -81,12 +81,12 @@ static void init_genrand(ulong s) const float range = 32; /* range in both pos/neg direction */ for (j = 0; j < ARRAY_SIZE(state_offset_vector); j++, state_offset++) { /* overflow is fine here */ - state_offset_vector[j] = (float)(int)(*state_offset) * (1.0f / ((float)INT_MAX / range)); + state_offset_vector[j] = float(int(*state_offset)) * (1.0f / (float(INT_MAX) / range)); } } } -static void next_state(void) +static void next_state() { ulong *p = state; int j; @@ -123,7 +123,7 @@ static void setRndSeed(int seed) } /* Float number in range [0, 1) using the mersenne twister random number generator. */ -static float frand(void) +static float frand() { ulong y; @@ -138,7 +138,7 @@ static float frand(void) y ^= (y << 15) & 0xefc60000UL; y ^= (y >> 18); - return (float)y / 4294967296.0f; + return float(y) / 4294967296.0f; } /*------------------------------------------------------------*/ @@ -218,7 +218,7 @@ static float turb( float amp, out, t; int i; amp = 1.0f; - out = (float)(2.0f * BLI_noise_generic_noise(1.0f, x, y, z, false, nb) - 1.0f); + out = float(2.0f * BLI_noise_generic_noise(1.0f, x, y, z, false, nb) - 1.0f); if (hard) { out = fabsf(out); } @@ -227,7 +227,7 @@ static float turb( x *= freqscale; y *= freqscale; z *= freqscale; - t = (float)(amp * (2.0f * BLI_noise_generic_noise(1.0f, x, y, z, false, nb) - 1.0f)); + t = float(amp * (2.0f * BLI_noise_generic_noise(1.0f, x, y, z, false, nb) - 1.0f)); if (hard) { t = fabsf(t); } @@ -1112,7 +1112,7 @@ static PyModuleDef M_Noise_module_def = { /*----------------------------MODULE INIT-------------------------*/ -PyMODINIT_FUNC PyInit_mathutils_noise(void) +PyMODINIT_FUNC PyInit_mathutils_noise() { PyObject *submodule = PyModule_Create(&M_Noise_module_def); diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo.cc index 5931954d797..a9947dd702d 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.cc @@ -522,7 +522,7 @@ int wm_gizmo_is_visible(wmGizmo *gz) } void WM_gizmo_calc_matrix_final_params(const wmGizmo *gz, - const struct WM_GizmoMatrixParams *params, + const WM_GizmoMatrixParams *params, float r_mat[4][4]) { const float(*const matrix_space)[4] = params->matrix_space ? params->matrix_space : diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc index 74f034197c9..0b26a322996 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc @@ -785,8 +785,9 @@ wmKeyMap *WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType * * \param name: Typically #wmGizmoGroupType.name * \param params: Typically #wmGizmoGroupType.gzmap_params */ -static wmKeyMap *WM_gizmogroup_keymap_template_select_ex( - wmKeyConfig *kc, const char *name, const struct wmGizmoMapType_Params *params) +static wmKeyMap *WM_gizmogroup_keymap_template_select_ex(wmKeyConfig *kc, + const char *name, + const wmGizmoMapType_Params *params) { /* Use area and region id since we might have multiple gizmos * with the same name in different areas/regions. */ diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.cc index dc0538254df..efd2ebb9b3d 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.cc @@ -65,7 +65,7 @@ void WM_gizmogrouptype_iter(GHashIterator *ghi) BLI_ghashIterator_init(ghi, global_gizmogrouptype_hash); } -static wmGizmoGroupType *wm_gizmogrouptype_append__begin(void) +static wmGizmoGroupType *wm_gizmogrouptype_append__begin() { wmGizmoGroupType *gzgt = static_cast( MEM_callocN(sizeof(wmGizmoGroupType), "gizmogrouptype")); @@ -170,14 +170,14 @@ static void wm_gizmogrouptype_ghash_free_cb(wmGizmoGroupType *gzgt) gizmogrouptype_free(gzgt); } -void wm_gizmogrouptype_free(void) +void wm_gizmogrouptype_free() { BLI_ghash_free( global_gizmogrouptype_hash, nullptr, (GHashValFreeFP)wm_gizmogrouptype_ghash_free_cb); global_gizmogrouptype_hash = nullptr; } -void wm_gizmogrouptype_init(void) +void wm_gizmogrouptype_init() { /* reserve size is set based on blender default setup */ global_gizmogrouptype_hash = BLI_ghash_str_new_ex("wm_gizmogrouptype_init gh", 128); diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.cc index 43af7712d18..60bd3dc3a15 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.cc @@ -168,7 +168,7 @@ static wmGizmoMap *wm_gizmomap_new_from_type_ex(wmGizmoMapType *gzmap_type, wmGi return gzmap; } -wmGizmoMap *WM_gizmomap_new_from_type(const struct wmGizmoMapType_Params *gzmap_params) +wmGizmoMap *WM_gizmomap_new_from_type(const wmGizmoMapType_Params *gzmap_params) { wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(gzmap_params); wmGizmoMap *gzmap = static_cast(MEM_callocN(sizeof(wmGizmoMap), "GizmoMap")); @@ -616,7 +616,7 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos, BLI_assert(buf_iter->id != -1); wmGizmo *gz = visible_gizmos[buf_iter->id >> 8]; float co_3d[3]; - co_screen[2] = (float)((double)buf_iter->depth / (double)UINT_MAX); + co_screen[2] = float(double(buf_iter->depth) / double(UINT_MAX)); GPU_matrix_unproject_3fv(co_screen, rv3d->viewinv, rv3d->winmat, viewport, co_3d); float select_bias = gz->select_bias; if ((gz->flag & WM_GIZMO_DRAW_NO_SCALE) == 0) { @@ -1174,7 +1174,7 @@ ListBase *wm_gizmomap_groups_get(wmGizmoMap *gzmap) void WM_gizmomap_message_subscribe(const bContext *C, wmGizmoMap *gzmap, ARegion *region, - struct wmMsgBus *mbus) + wmMsgBus *mbus) { LISTBASE_FOREACH (wmGizmoGroup *, gzgroup, &gzmap->groups) { if ((gzgroup->hide.any != 0) || (gzgroup->init_flag & WM_GIZMOGROUP_INIT_SETUP) == 0 || @@ -1225,7 +1225,7 @@ ARegion *WM_gizmomap_tooltip_init( /** \name wmGizmoMapType * \{ */ -wmGizmoMapType *WM_gizmomaptype_find(const struct wmGizmoMapType_Params *gzmap_params) +wmGizmoMapType *WM_gizmomaptype_find(const wmGizmoMapType_Params *gzmap_params) { LISTBASE_FOREACH (wmGizmoMapType *, gzmap_type, &gizmomaptypes) { if (gzmap_type->spaceid == gzmap_params->spaceid && @@ -1237,7 +1237,7 @@ wmGizmoMapType *WM_gizmomaptype_find(const struct wmGizmoMapType_Params *gzmap_p return nullptr; } -wmGizmoMapType *WM_gizmomaptype_ensure(const struct wmGizmoMapType_Params *gzmap_params) +wmGizmoMapType *WM_gizmomaptype_ensure(const wmGizmoMapType_Params *gzmap_params) { wmGizmoMapType *gzmap_type = WM_gizmomaptype_find(gzmap_params); @@ -1254,7 +1254,7 @@ wmGizmoMapType *WM_gizmomaptype_ensure(const struct wmGizmoMapType_Params *gzmap return gzmap_type; } -void wm_gizmomaptypes_free(void) +void wm_gizmomaptypes_free() { for (wmGizmoMapType *gzmap_type = static_cast(gizmomaptypes.first), *gzmap_type_next; diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.cc index 0a77a9ceedc..2a13a2a351f 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.cc @@ -308,7 +308,7 @@ void WM_gizmo_do_msg_notify_tag_refresh(bContext * /*C*/, WM_gizmomap_tag_refresh(gzmap); } -void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus, ARegion *region) +void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, wmMsgBus *mbus, ARegion *region) { if (gz->type->target_property_defs_len) { wmGizmoProperty *gz_prop_array = WM_gizmo_target_property_array(gz); @@ -342,7 +342,7 @@ void WM_gizmo_target_property_anim_autokey(bContext *C, { if (gz_prop->prop != nullptr) { Scene *scene = CTX_data_scene(C); - const float cfra = (float)scene->r.cfra; + const float cfra = float(scene->r.cfra); const int index = gz_prop->index == -1 ? 0 : gz_prop->index; ED_autokeyframe_property(C, scene, &gz_prop->ptr, gz_prop->prop, index, cfra, false); } diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.cc index 17468ed2998..2d30f90e837 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.cc @@ -72,7 +72,7 @@ void WM_gizmotype_iter(GHashIterator *ghi) BLI_ghashIterator_init(ghi, global_gizmotype_hash); } -static wmGizmoType *wm_gizmotype_append__begin(void) +static wmGizmoType *wm_gizmotype_append__begin() { wmGizmoType *gzt = static_cast(MEM_callocN(sizeof(wmGizmoType), "gizmotype")); gzt->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_GizmoProperties); @@ -179,13 +179,13 @@ static void wm_gizmotype_ghash_free_cb(wmGizmoType *gzt) WM_gizmotype_free_ptr(gzt); } -void wm_gizmotype_free(void) +void wm_gizmotype_free() { BLI_ghash_free(global_gizmotype_hash, nullptr, (GHashValFreeFP)wm_gizmotype_ghash_free_cb); global_gizmotype_hash = nullptr; } -void wm_gizmotype_init(void) +void wm_gizmotype_init() { /* reserve size is set based on blender default setup */ global_gizmotype_hash = BLI_ghash_str_new_ex("wm_gizmotype_init gh", 128); diff --git a/source/blender/windowmanager/intern/wm_cursors.cc b/source/blender/windowmanager/intern/wm_cursors.cc index 45cbaecd2a0..1621c49e973 100644 --- a/source/blender/windowmanager/intern/wm_cursors.cc +++ b/source/blender/windowmanager/intern/wm_cursors.cc @@ -425,7 +425,7 @@ void WM_cursor_time(wmWindow *win, int nr) } \ ((void)0) -void wm_init_cursor_data(void) +void wm_init_cursor_data() { /********************** NW_ARROW Cursor **************************/ BEGIN_CURSOR_BLOCK; diff --git a/source/blender/windowmanager/intern/wm_draw.cc b/source/blender/windowmanager/intern/wm_draw.cc index 617d47ad029..a366e9b7c5d 100644 --- a/source/blender/windowmanager/intern/wm_draw.cc +++ b/source/blender/windowmanager/intern/wm_draw.cc @@ -181,7 +181,7 @@ struct GrabState { int bounds[4]; }; -static bool wm_software_cursor_needed(void) +static bool wm_software_cursor_needed() { if (UNLIKELY(g_software_cursor.enabled == -1)) { g_software_cursor.enabled = !(WM_capabilities_flag() & WM_CAPABILITY_CURSOR_WARP); @@ -189,7 +189,7 @@ static bool wm_software_cursor_needed(void) return g_software_cursor.enabled; } -static bool wm_software_cursor_needed_for_window(const wmWindow *win, struct GrabState *grab_state) +static bool wm_software_cursor_needed_for_window(const wmWindow *win, GrabState *grab_state) { BLI_assert(wm_software_cursor_needed()); if (GHOST_GetCursorVisibility(static_cast(win->ghostwin))) { @@ -223,7 +223,7 @@ static void wm_software_cursor_motion_update(const wmWindow *win) g_software_cursor.xy[1] = win->eventstate->xy[1]; } -static void wm_software_cursor_motion_clear(void) +static void wm_software_cursor_motion_clear() { g_software_cursor.winid = -1; g_software_cursor.xy[0] = -1; @@ -244,7 +244,7 @@ static void wm_software_cursor_draw_bitmap(const int event_xy[2], GPU_matrix_push(); - const int scale = (int)U.pixelsize; + const int scale = int(U.pixelsize); unit_m4(gl_matrix); @@ -334,7 +334,7 @@ static void wm_software_cursor_draw_crosshair(const int event_xy[2]) immUnbindProgram(); } -static void wm_software_cursor_draw(wmWindow *win, const struct GrabState *grab_state) +static void wm_software_cursor_draw(wmWindow *win, const GrabState *grab_state) { int event_xy[2] = {UNPACK2(win->eventstate->xy)}; @@ -495,7 +495,7 @@ static void wm_region_test_gizmo_do_draw(bContext *C, } static void wm_region_test_render_do_draw(const Scene *scene, - struct Depsgraph *depsgraph, + Depsgraph *depsgraph, ScrArea *area, ARegion *region) { @@ -592,7 +592,7 @@ static const char *wm_area_name(ScrArea *area) * \{ */ struct WindowDrawCB { - struct WindowDrawCB *next, *prev; + WindowDrawCB *next, *prev; void (*draw)(const wmWindow *, void *); void *customdata; @@ -1111,7 +1111,7 @@ GPU_clear_color(0, 0, 0, 0); } if (wm_software_cursor_needed()) { - struct GrabState grab_state; + GrabState grab_state; if (wm_software_cursor_needed_for_window(win, &grab_state)) { wm_software_cursor_draw(win, &grab_state); wm_software_cursor_motion_update(win); @@ -1341,7 +1341,7 @@ bool WM_window_pixels_read_sample_from_offscreen(bContext *C, /* While this shouldn't happen, return in the case it does. */ BLI_assert((uint)pos[0] < (uint)size[0] && (uint)pos[1] < (uint)size[1]); - if (!((uint)pos[0] < (uint)size[0] && (uint)pos[1] < (uint)size[1])) { + if (!(uint(pos[0]) < uint(size[0]) && uint(pos[1]) < uint(size[1]))) { return false; } @@ -1390,7 +1390,7 @@ static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win) const wmWindowManager *wm = CTX_wm_manager(C); Scene *scene = WM_window_get_active_scene(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); - struct Depsgraph *depsgraph = BKE_scene_ensure_depsgraph(bmain, scene, view_layer); + Depsgraph *depsgraph = BKE_scene_ensure_depsgraph(bmain, scene, view_layer); bScreen *screen = WM_window_get_active_screen(win); bool do_draw = false; @@ -1439,7 +1439,7 @@ static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win) } if (wm_software_cursor_needed()) { - struct GrabState grab_state; + GrabState grab_state; if (wm_software_cursor_needed_for_window(win, &grab_state)) { if (wm_software_cursor_motion_test(win)) { return true; diff --git a/source/blender/windowmanager/intern/wm_event_query.cc b/source/blender/windowmanager/intern/wm_event_query.cc index 53852d9f6e6..f35f49a9012 100644 --- a/source/blender/windowmanager/intern/wm_event_query.cc +++ b/source/blender/windowmanager/intern/wm_event_query.cc @@ -46,7 +46,7 @@ struct FlagIdentifierPair { static void event_ids_from_flag(char *str, const int str_maxncpy, - const struct FlagIdentifierPair *flag_data, + const FlagIdentifierPair *flag_data, const int flag_data_len, const uint flag) { @@ -89,7 +89,7 @@ void WM_event_print(const wmEvent *event) char modifier_id[128]; { - struct FlagIdentifierPair flag_data[] = { + FlagIdentifierPair flag_data[] = { {"SHIFT", KM_SHIFT}, {"CTRL", KM_CTRL}, {"ALT", KM_ALT}, @@ -101,7 +101,7 @@ void WM_event_print(const wmEvent *event) char flag_id[128]; { - struct FlagIdentifierPair flag_data[] = { + FlagIdentifierPair flag_data[] = { {"SCROLL_INVERT", WM_EVENT_SCROLL_INVERT}, {"IS_REPEAT", WM_EVENT_IS_REPEAT}, {"IS_CONSECUTIVE", WM_EVENT_IS_CONSECUTIVE}, @@ -273,7 +273,7 @@ int WM_event_drag_direction(const wmEvent *event) event->xy[1] - event->prev_press_xy[1], }; - int theta = round_fl_to_int(4.0f * atan2f((float)delta[1], (float)delta[0]) / (float)M_PI); + int theta = round_fl_to_int(4.0f * atan2f(float(delta[1]), float(delta[0])) / float(M_PI)); int val = KM_DIRECTION_W; if (theta == 0) { diff --git a/source/blender/windowmanager/intern/wm_gesture.cc b/source/blender/windowmanager/intern/wm_gesture.cc index ec877f5ae72..d2e18da47f1 100644 --- a/source/blender/windowmanager/intern/wm_gesture.cc +++ b/source/blender/windowmanager/intern/wm_gesture.cc @@ -188,12 +188,12 @@ static void wm_gesture_draw_line(wmGesture *gt) immUniform1f("dash_width", 8.0f); immUniform1f("udash_factor", 0.5f); - float xmin = (float)rect->xmin; - float ymin = (float)rect->ymin; + float xmin = float(rect->xmin); + float ymin = float(rect->ymin); immBegin(GPU_PRIM_LINES, 2); immVertex2f(shdr_pos, xmin, ymin); - immVertex2f(shdr_pos, (float)rect->xmax, (float)rect->ymax); + immVertex2f(shdr_pos, float(rect->xmax), float(rect->ymax)); immEnd(); immUnbindProgram(); @@ -232,7 +232,7 @@ static void wm_gesture_draw_rect(wmGesture *gt) immUniform1f("udash_factor", 0.5f); imm_draw_box_wire_2d( - shdr_pos, (float)rect->xmin, (float)rect->ymin, (float)rect->xmax, (float)rect->ymax); + shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), float(rect->ymax)); immUnbindProgram(); @@ -252,7 +252,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f); - imm_draw_circle_fill_2d(shdr_pos, (float)rect->xmin, (float)rect->ymin, (float)rect->xmax, 40); + imm_draw_circle_fill_2d(shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), 40); immUnbindProgram(); @@ -270,7 +270,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) immUniform1f("dash_width", 4.0f); immUniform1f("udash_factor", 0.5f); - imm_draw_circle_wire_2d(shdr_pos, (float)rect->xmin, (float)rect->ymin, (float)rect->xmax, 40); + imm_draw_circle_wire_2d(shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), 40); immUnbindProgram(); } @@ -282,7 +282,7 @@ struct LassoFillData { static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data) { - struct LassoFillData *data = static_cast(user_data); + LassoFillData *data = static_cast(user_data); uchar *col = &(data->px[(y * data->width) + x]); memset(col, 0x10, x_end - x); } @@ -313,7 +313,7 @@ static void draw_filled_lasso(wmGesture *gt) const int w = BLI_rcti_size_x(&rect); const int h = BLI_rcti_size_y(&rect); uchar *pixel_buf = static_cast(MEM_callocN(sizeof(*pixel_buf) * w * h, __func__)); - struct LassoFillData lasso_fill_data = {pixel_buf, w}; + LassoFillData lasso_fill_data = {pixel_buf, w}; BLI_bitmap_draw_2d_poly_v2i_n(rect.xmin, rect.ymin, @@ -378,7 +378,7 @@ static void wm_gesture_draw_lasso(wmGesture *gt, bool filled) immBegin((gt->type == WM_GESTURE_LASSO) ? GPU_PRIM_LINE_LOOP : GPU_PRIM_LINE_STRIP, numverts); for (i = 0; i < gt->points; i++, lasso += 2) { - immVertex2f(shdr_pos, (float)lasso[0], (float)lasso[1]); + immVertex2f(shdr_pos, float(lasso[0]), float(lasso[1])); } immEnd(); @@ -411,18 +411,18 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt) immBegin(GPU_PRIM_LINES, 4); - x1 = (float)(rect->xmin - winsize_x); - y1 = (float)rect->ymin; - x2 = (float)(rect->xmin + winsize_x); + x1 = float(rect->xmin - winsize_x); + y1 = float(rect->ymin); + x2 = float(rect->xmin + winsize_x); y2 = y1; immVertex2f(shdr_pos, x1, y1); immVertex2f(shdr_pos, x2, y2); - x1 = (float)rect->xmin; - y1 = (float)(rect->ymin - winsize_y); + x1 = float(rect->xmin); + y1 = float(rect->ymin - winsize_y); x2 = x1; - y2 = (float)(rect->ymin + winsize_y); + y2 = float(rect->ymin + winsize_y); immVertex2f(shdr_pos, x1, y1); immVertex2f(shdr_pos, x2, y2); diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.cc b/source/blender/windowmanager/intern/wm_gesture_ops.cc index 7349933e3e1..ed115114838 100644 --- a/source/blender/windowmanager/intern/wm_gesture_ops.cc +++ b/source/blender/windowmanager/intern/wm_gesture_ops.cc @@ -642,8 +642,8 @@ const int (*WM_gesture_lasso_path_to_array(bContext * /*C*/, float loc[2]; RNA_float_get_array(&itemptr, "loc", loc); - mcoords[i][0] = (int)loc[0]; - mcoords[i][1] = (int)loc[1]; + mcoords[i][0] = int(loc[0]); + mcoords[i][1] = int(loc[1]); i++; } RNA_PROP_END; @@ -788,8 +788,8 @@ static void wm_gesture_straightline_do_angle_snap(rcti *rect) mul_v2_fl(line_snapped_end, line_length); add_v2_v2(line_snapped_end, line_start); - rect->xmax = (int)line_snapped_end[0]; - rect->ymax = (int)line_snapped_end[1]; + rect->xmax = int(line_snapped_end[0]); + rect->ymax = int(line_snapped_end[1]); } int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *event) diff --git a/source/blender/windowmanager/intern/wm_jobs.cc b/source/blender/windowmanager/intern/wm_jobs.cc index cb98312bb6b..5036916668d 100644 --- a/source/blender/windowmanager/intern/wm_jobs.cc +++ b/source/blender/windowmanager/intern/wm_jobs.cc @@ -262,7 +262,7 @@ static void wm_jobs_update_progress_bars(wmWindowManager *wm) /* if there are running jobs, set the global progress indicator */ if (jobs_progress > 0) { - float progress = total_progress / (float)jobs_progress; + float progress = total_progress / float(jobs_progress); LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { WM_progress_set(win, progress); diff --git a/source/blender/windowmanager/intern/wm_keymap.cc b/source/blender/windowmanager/intern/wm_keymap.cc index a167a467f9f..176c9399092 100644 --- a/source/blender/windowmanager/intern/wm_keymap.cc +++ b/source/blender/windowmanager/intern/wm_keymap.cc @@ -1140,7 +1140,7 @@ const char *WM_key_event_string(const short type, const bool compact) } const EnumPropertyItem *it; - const int i = RNA_enum_from_value(rna_enum_event_type_items, (int)type); + const int i = RNA_enum_from_value(rna_enum_event_type_items, int(type)); if (i == -1) { return ""; @@ -1321,7 +1321,7 @@ static wmKeyMapItem *wm_keymap_item_find_in_keymap(wmKeyMap *keymap, const char *opname, IDProperty *properties, const bool is_strict, - const struct wmKeyMapItemFind_Params *params) + const wmKeyMapItemFind_Params *params) { LISTBASE_FOREACH (wmKeyMapItem *, kmi, &keymap->items) { /* skip disabled keymap items [#38447] */ @@ -1410,7 +1410,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, wmOperatorCallContext /*opcontext*/, IDProperty *properties, const bool is_strict, - const struct wmKeyMapItemFind_Params *params, + const wmKeyMapItemFind_Params *params, wmKeyMap **r_keymap) { /* find keymap item in handlers */ @@ -1446,7 +1446,7 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, wmOperatorCallContext opcontext, IDProperty *properties, const bool is_strict, - const struct wmKeyMapItemFind_Params *params, + const wmKeyMapItemFind_Params *params, wmKeyMap **r_keymap) { wmWindowManager *wm = CTX_wm_manager(C); @@ -1559,7 +1559,7 @@ static wmKeyMapItem *wm_keymap_item_find(const bContext *C, wmOperatorCallContext opcontext, IDProperty *properties, bool is_strict, - const struct wmKeyMapItemFind_Params *params, + const wmKeyMapItemFind_Params *params, wmKeyMap **r_keymap) { /* XXX Hack! Macro operators in menu entry have their whole props defined, @@ -1806,7 +1806,7 @@ void WM_keyconfig_update_tag(wmKeyMap *keymap, wmKeyMapItem *kmi) } } -void WM_keyconfig_update_operatortype(void) +void WM_keyconfig_update_operatortype() { wm_keymap_update_flag |= WM_KEYMAP_UPDATE_OPERATORTYPE; } diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.cc b/source/blender/windowmanager/intern/wm_keymap_utils.cc index bd48f4144e8..9ecde232b56 100644 --- a/source/blender/windowmanager/intern/wm_keymap_utils.cc +++ b/source/blender/windowmanager/intern/wm_keymap_utils.cc @@ -509,6 +509,6 @@ bool WM_keymap_uses_event_modifier(const wmKeyMap *keymap, const int event_modif return false; } -void WM_keymap_fix_linking(void) {} +void WM_keymap_fix_linking() {} /** \} */ diff --git a/source/blender/windowmanager/intern/wm_menu_type.cc b/source/blender/windowmanager/intern/wm_menu_type.cc index f0651e0f73c..4c77f32dd83 100644 --- a/source/blender/windowmanager/intern/wm_menu_type.cc +++ b/source/blender/windowmanager/intern/wm_menu_type.cc @@ -65,13 +65,13 @@ void WM_menutype_freelink(MenuType *mt) UNUSED_VARS_NDEBUG(ok); } -void WM_menutype_init(void) +void WM_menutype_init() { /* reserve size is set based on blender default setup */ menutypes_hash = BLI_ghash_str_new_ex("menutypes_hash gh", 512); } -void WM_menutype_free(void) +void WM_menutype_free() { GHashIterator gh_iter; diff --git a/source/blender/windowmanager/intern/wm_operator_props.cc b/source/blender/windowmanager/intern/wm_operator_props.cc index 66005c6bb05..e9577db941a 100644 --- a/source/blender/windowmanager/intern/wm_operator_props.cc +++ b/source/blender/windowmanager/intern/wm_operator_props.cc @@ -42,7 +42,7 @@ void WM_operator_properties_confirm_or_exec(wmOperatorType *ot) * Extends rna_enum_fileselect_params_sort_items with a default item for operators to use. */ static const EnumPropertyItem *wm_operator_properties_filesel_sort_items_itemf( - struct bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free) + bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free) { EnumPropertyItem *items; const EnumPropertyItem default_item = { @@ -231,7 +231,7 @@ void WM_operator_properties_id_lookup_set_from_id(PointerRNA *ptr, const ID *id) PropertyRNA *prop_name = RNA_struct_find_property(ptr, "name"); if (prop_session_uuid) { - RNA_int_set(ptr, "session_uuid", (int)id->session_uuid); + RNA_int_set(ptr, "session_uuid", int(id->session_uuid)); } else if (prop_name) { RNA_string_set(ptr, "name", id->name + 2); @@ -247,7 +247,7 @@ ID *WM_operator_properties_id_lookup_from_name_or_session_uuid(Main *bmain, { PropertyRNA *prop_session_uuid = RNA_struct_find_property(ptr, "session_uuid"); if (prop_session_uuid && RNA_property_is_set(ptr, prop_session_uuid)) { - const uint32_t session_uuid = (uint32_t)RNA_property_int_get(ptr, prop_session_uuid); + const uint32_t session_uuid = uint32_t(RNA_property_int_get(ptr, prop_session_uuid)); return BKE_libblock_find_session_uuid(bmain, type, session_uuid); } @@ -633,7 +633,7 @@ void WM_operator_properties_checker_interval(wmOperatorType *ot, bool nth_can_di } void WM_operator_properties_checker_interval_from_op(wmOperator *op, - struct CheckerIntervalParams *op_params) + CheckerIntervalParams *op_params) { const int nth = RNA_int_get(op->ptr, "nth"); const int skip = RNA_int_get(op->ptr, "skip"); @@ -646,7 +646,7 @@ void WM_operator_properties_checker_interval_from_op(wmOperator *op, op_params->offset = mod_i(offset, nth + skip); } -bool WM_operator_properties_checker_interval_test(const struct CheckerIntervalParams *op_params, +bool WM_operator_properties_checker_interval_test(const CheckerIntervalParams *op_params, int depth) { return ((op_params->skip == 0) || diff --git a/source/blender/windowmanager/intern/wm_operator_type.cc b/source/blender/windowmanager/intern/wm_operator_type.cc index 1b1043ccc58..7f7a888aa0e 100644 --- a/source/blender/windowmanager/intern/wm_operator_type.cc +++ b/source/blender/windowmanager/intern/wm_operator_type.cc @@ -87,7 +87,7 @@ void WM_operatortype_iter(GHashIterator *ghi) /** \name Operator Type Append * \{ */ -static wmOperatorType *wm_operatortype_append__begin(void) +static wmOperatorType *wm_operatortype_append__begin() { wmOperatorType *ot = static_cast( MEM_callocN(sizeof(wmOperatorType), "operatortype")); @@ -173,7 +173,7 @@ bool WM_operatortype_remove(const char *idname) return true; } -void wm_operatortype_init(void) +void wm_operatortype_init() { /* reserve size is set based on blender default setup */ global_ops_hash = BLI_ghash_str_new_ex("wm_operatortype_init gh", 2048); @@ -197,7 +197,7 @@ static void operatortype_ghash_free_cb(wmOperatorType *ot) MEM_freeN(ot); } -void wm_operatortype_free(void) +void wm_operatortype_free() { BLI_ghash_free(global_ops_hash, nullptr, (GHashValFreeFP)operatortype_ghash_free_cb); global_ops_hash = nullptr; @@ -234,7 +234,7 @@ void WM_operatortype_props_advanced_end(wmOperatorType *ot) ot_prop_basic_count = -1; } -void WM_operatortype_last_properties_clear_all(void) +void WM_operatortype_last_properties_clear_all() { GHashIterator iter; diff --git a/source/blender/windowmanager/intern/wm_operator_utils.cc b/source/blender/windowmanager/intern/wm_operator_utils.cc index 600e7b4c6eb..42915c00119 100644 --- a/source/blender/windowmanager/intern/wm_operator_utils.cc +++ b/source/blender/windowmanager/intern/wm_operator_utils.cc @@ -120,12 +120,12 @@ static bool interactive_value_update(ValueInteraction *inter, const int mval_curr = event->mval[mval_axis]; const int mval_init = inter->init.mval[mval_axis]; float value_delta = (inter->init.prop_value + - (((float)(mval_curr - mval_init) / inter->context_vars.region->winx) * + ((float(mval_curr - mval_init) / inter->context_vars.region->winx) * value_range)) * value_scale; if (event->modifier & KM_CTRL) { const double snap = 0.1; - value_delta = (float)roundf((double)value_delta / snap) * snap; + value_delta = float(roundf(double(value_delta) / snap)) * snap; } if (event->modifier & KM_SHIFT) { value_delta *= 0.1f; @@ -167,18 +167,18 @@ struct ObCustomData_ForEditMode { /** This could be split into a sub-type if we support different kinds of data. */ Object **objects; uint objects_len; - struct XFormObjectData **objects_xform; + XFormObjectData **objects_xform; }; /* Internal callback to free. */ static void op_generic_value_exit(wmOperator *op) { - struct ObCustomData_ForEditMode *cd = static_cast(op->customdata); + ObCustomData_ForEditMode *cd = static_cast(op->customdata); if (cd) { interactive_value_exit(&cd->inter); for (uint ob_index = 0; ob_index < cd->objects_len; ob_index++) { - struct XFormObjectData *xod = cd->objects_xform[ob_index]; + XFormObjectData *xod = cd->objects_xform[ob_index]; if (xod != nullptr) { ED_object_data_xform_destroy(xod); } @@ -193,7 +193,7 @@ static void op_generic_value_exit(wmOperator *op) static void op_generic_value_restore(wmOperator *op) { - struct ObCustomData_ForEditMode *cd = static_cast(op->customdata); + ObCustomData_ForEditMode *cd = static_cast(op->customdata); for (uint ob_index = 0; ob_index < cd->objects_len; ob_index++) { ED_object_data_xform_restore(cd->objects_xform[ob_index]); ED_object_data_xform_tag_update(cd->objects_xform[ob_index]); @@ -221,7 +221,7 @@ static int op_generic_value_invoke(bContext *C, wmOperator *op, const wmEvent *e return OPERATOR_CANCELLED; } - struct ObCustomData_ForEditMode *cd = static_cast( + ObCustomData_ForEditMode *cd = static_cast( MEM_callocN(sizeof(*cd), __func__)); cd->launch_event = WM_userdef_event_type_from_keymap_type(event->type); cd->wait_for_input = RNA_boolean_get(op->ptr, "wait_for_input"); @@ -253,7 +253,7 @@ static int op_generic_value_invoke(bContext *C, wmOperator *op, const wmEvent *e static int op_generic_value_modal(bContext *C, wmOperator *op, const wmEvent *event) { - struct ObCustomData_ForEditMode *cd = static_cast(op->customdata); + ObCustomData_ForEditMode *cd = static_cast(op->customdata); /* Special case, check if we release the event that activated this operator. */ if ((event->type == cd->launch_event) && (event->val == KM_RELEASE)) { diff --git a/source/blender/windowmanager/intern/wm_operators.cc b/source/blender/windowmanager/intern/wm_operators.cc index acb584fe278..b55894691d9 100644 --- a/source/blender/windowmanager/intern/wm_operators.cc +++ b/source/blender/windowmanager/intern/wm_operators.cc @@ -124,7 +124,7 @@ size_t WM_operator_py_idname(char *dst, const char *src) { const char *sep = strstr(src, OP_BL_SEP_STRING); if (sep) { - const size_t sep_offset = (size_t)(sep - src); + const size_t sep_offset = size_t(sep - src); /* NOTE: we use ascii `tolower` instead of system `tolower`, because the * latter depends on the locale, and can lead to `idname` mismatch. */ @@ -143,11 +143,11 @@ size_t WM_operator_py_idname(char *dst, const char *src) size_t WM_operator_bl_idname(char *dst, const char *src) { - const size_t from_len = (size_t)strlen(src); + const size_t from_len = size_t(strlen(src)); const char *sep = strchr(src, OP_PY_SEP_CHAR); if (sep && (from_len <= OP_MAX_PY_IDNAME)) { - const size_t sep_offset = (size_t)(sep - src); + const size_t sep_offset = size_t(sep - src); memcpy(dst, src, sep_offset); BLI_str_toupper_ascii(dst, sep_offset); @@ -925,7 +925,7 @@ int WM_generic_select_modal(bContext *C, wmOperator *op, const wmEvent *event) { PropertyRNA *wait_to_deselect_prop = RNA_struct_find_property(op->ptr, "wait_to_deselect_others"); - const short init_event_type = (short)POINTER_AS_INT(op->customdata); + const short init_event_type = short(POINTER_AS_INT(op->customdata)); int ret_value = 0; /* get settings from RNA properties for operator */ @@ -937,7 +937,7 @@ int WM_generic_select_modal(bContext *C, wmOperator *op, const wmEvent *event) ret_value = op->type->exec(C, op); OPERATOR_RETVAL_CHECK(ret_value); - op->customdata = POINTER_FROM_INT((int)event->type); + op->customdata = POINTER_FROM_INT(int(event->type)); if (ret_value & OPERATOR_RUNNING_MODAL) { WM_event_add_modal_handler(C, op); } @@ -1080,7 +1080,7 @@ struct EnumSearchMenu { /** Generic enum search invoke popup. */ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *region, void *arg) { - struct EnumSearchMenu *search_menu = static_cast(arg); + EnumSearchMenu *search_menu = static_cast(arg); wmWindow *win = CTX_wm_window(C); wmOperator *op = search_menu->op; /* template_ID uses 4 * widget_unit for width, @@ -1155,7 +1155,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *region, void *arg) int WM_enum_search_invoke_previews(bContext *C, wmOperator *op, short prv_cols, short prv_rows) { - static struct EnumSearchMenu search_menu; + static EnumSearchMenu search_menu; search_menu.op = op; search_menu.use_previews = true; @@ -1169,7 +1169,7 @@ int WM_enum_search_invoke_previews(bContext *C, wmOperator *op, short prv_cols, int WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/) { - static struct EnumSearchMenu search_menu; + static EnumSearchMenu search_menu; search_menu.op = op; UI_popup_block_invoke(C, wm_enum_search_menu, &search_menu, nullptr); return OPERATOR_INTERFACE; @@ -1747,8 +1747,7 @@ struct SearchPopupInit_Data { static uiBlock *wm_block_search_menu(bContext *C, ARegion *region, void *userdata) { - const struct SearchPopupInit_Data *init_data = static_cast( - userdata); + const SearchPopupInit_Data *init_data = static_cast(userdata); static char search[256] = ""; uiBlock *block = UI_block_begin(C, region, "_popup", UI_EMBOSS); @@ -2232,7 +2231,7 @@ static void radial_control_update_header(wmOperator *op, bContext *C) SNPRINTF(msg, "%s: %0.4f", ui_name, rc->current_value); break; case PROP_PIXEL: - SNPRINTF(msg, "%s: %d", ui_name, (int)rc->current_value); /* XXX: round to nearest? */ + SNPRINTF(msg, "%s: %d", ui_name, int(rc->current_value)); /* XXX: round to nearest? */ break; case PROP_PERCENTAGE: SNPRINTF(msg, "%s: %3.1f%%", ui_name, rc->current_value); @@ -2413,7 +2412,7 @@ static void radial_control_paint_curve(uint pos, Brush *br, float radius, int li { GPU_line_width(2.0f); immUniformColor4f(0.8f, 0.8f, 0.8f, 0.85f); - float step = (radius * 2.0f) / (float)line_segments; + float step = (radius * 2.0f) / float(line_segments); BKE_curvemapping_init(br->curve); immBegin(GPU_PRIM_LINES, line_segments * 2); for (int i = 0; i < line_segments; i++) { @@ -2491,7 +2490,7 @@ static void radial_control_paint_cursor(bContext * /*C*/, int x, int y, void *cu x = rc->initial_co[0]; y = rc->initial_co[1]; } - GPU_matrix_translate_2f((float)x, (float)y); + GPU_matrix_translate_2f(float(x), float(y)); GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); @@ -2524,15 +2523,15 @@ static void radial_control_paint_cursor(bContext * /*C*/, int x, int y, void *cu /* draw original angle line */ GPU_matrix_rotate_3f(RAD2DEGF(rc->initial_value), 0.0f, 0.0f, 1.0f); immBegin(GPU_PRIM_LINES, 2); - immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f); - immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); + immVertex2f(pos, float(WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE), 0.0f); + immVertex2f(pos, float(WM_RADIAL_CONTROL_DISPLAY_SIZE), 0.0f); immEnd(); /* draw new angle line */ GPU_matrix_rotate_3f(RAD2DEGF(rc->current_value - rc->initial_value), 0.0f, 0.0f, 1.0f); immBegin(GPU_PRIM_LINES, 2); - immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f); - immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); + immVertex2f(pos, float(WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE), 0.0f); + immVertex2f(pos, float(WM_RADIAL_CONTROL_DISPLAY_SIZE), 0.0f); immEnd(); GPU_matrix_pop(); @@ -2931,9 +2930,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even applyNumInput(&rc->num_input, &numValue); if (rc->subtype == PROP_ANGLE) { - numValue = fmod(numValue, 2.0f * (float)M_PI); + numValue = fmod(numValue, 2.0f * float(M_PI)); if (numValue < 0.0f) { - numValue += 2.0f * (float)M_PI; + numValue += 2.0f * float(M_PI); } } @@ -2997,8 +2996,8 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even } } else { - delta[0] = (float)(rc->initial_mouse[0] - event->xy[0]); - delta[1] = (float)(rc->initial_mouse[1] - event->xy[1]); + delta[0] = float(rc->initial_mouse[0] - event->xy[0]); + delta[1] = float(rc->initial_mouse[1] - event->xy[1]); if (rc->zoom_prop) { RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom); delta[0] /= zoom[0]; @@ -3019,7 +3018,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even case PROP_PIXEL: new_value = dist; if (snap) { - new_value = ((int)new_value + 5) / 10 * 10; + new_value = (int(new_value) + 5) / 10 * 10; } break; case PROP_PERCENTAGE: @@ -3027,25 +3026,25 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even WM_RADIAL_CONTROL_DISPLAY_WIDTH) * 100.0f; if (snap) { - new_value = (int)(new_value + 2.5f) / 5 * 5; + new_value = int(new_value + 2.5f) / 5 * 5; } break; case PROP_FACTOR: new_value = (WM_RADIAL_CONTROL_DISPLAY_SIZE - dist) / WM_RADIAL_CONTROL_DISPLAY_WIDTH; if (snap) { - new_value = ((int)ceil(new_value * 10.0f) * 10.0f) / 100.0f; + new_value = (int(ceil(new_value * 10.0f)) * 10.0f) / 100.0f; } /* Invert new value to increase the factor moving the mouse to the right */ new_value = 1 - new_value; break; case PROP_ANGLE: - new_value = atan2f(delta[1], delta[0]) + (float)M_PI + angle_precision; - new_value = fmod(new_value, 2.0f * (float)M_PI); + new_value = atan2f(delta[1], delta[0]) + float(M_PI) + angle_precision; + new_value = fmod(new_value, 2.0f * float(M_PI)); if (new_value < 0.0f) { - new_value += 2.0f * (float)M_PI; + new_value += 2.0f * float(M_PI); } if (snap) { - new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10 * 10); + new_value = DEG2RADF((int(RAD2DEGF(new_value)) + 5) / 10 * 10); } break; default: @@ -3092,9 +3091,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even applyNumInput(&rc->num_input, &numValue); if (rc->subtype == PROP_ANGLE) { - numValue = fmod(numValue, 2.0f * (float)M_PI); + numValue = fmod(numValue, 2.0f * float(M_PI)); if (numValue < 0.0f) { - numValue += 2.0f * (float)M_PI; + numValue += 2.0f * float(M_PI); } } @@ -3276,7 +3275,7 @@ static const EnumPropertyItem redraw_timer_type_items[] = { static void redraw_timer_step(bContext *C, Scene *scene, - struct Depsgraph *depsgraph, + Depsgraph *depsgraph, wmWindow *win, ScrArea *area, ARegion *region, @@ -3366,14 +3365,14 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) wmWindowManager *wm = CTX_wm_manager(C); const int type = RNA_enum_get(op->ptr, "type"); const int iter = RNA_int_get(op->ptr, "iterations"); - const double time_limit = (double)RNA_float_get(op->ptr, "time_limit"); + const double time_limit = double(RNA_float_get(op->ptr, "time_limit")); const int cfra = scene->r.cfra; const char *infostr = ""; /* NOTE: Depsgraph is used to update scene for a new state, so no need to ensure evaluation * here. */ - struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); WM_cursor_wait(true); @@ -3800,7 +3799,7 @@ static void WM_OT_stereo3d_set(wmOperatorType *ot) /** \name Operator Registration & Keymaps * \{ */ -void wm_operatortypes_register(void) +void wm_operatortypes_register() { WM_operatortype_append(WM_OT_window_close); WM_operatortype_append(WM_OT_window_new); @@ -4089,7 +4088,7 @@ static const EnumPropertyItem *rna_id_itemf(bool *r_free, /* Show collection color tag icons in menus. */ if (id_type == ID_GR) { - item_tmp.icon = UI_icon_color_from_collection((struct Collection *)id); + item_tmp.icon = UI_icon_color_from_collection((Collection *)id); } RNA_enum_item_add(&item, &totitem, &item_tmp); diff --git a/source/blender/windowmanager/intern/wm_panel_type.cc b/source/blender/windowmanager/intern/wm_panel_type.cc index ae8db1993eb..680418a6338 100644 --- a/source/blender/windowmanager/intern/wm_panel_type.cc +++ b/source/blender/windowmanager/intern/wm_panel_type.cc @@ -57,13 +57,13 @@ void WM_paneltype_remove(PanelType *pt) UNUSED_VARS_NDEBUG(ok); } -void WM_paneltype_init(void) +void WM_paneltype_init() { /* reserve size is set based on blender default setup */ g_paneltypes_hash = BLI_ghash_str_new_ex("g_paneltypes_hash gh", 512); } -void WM_paneltype_clear(void) +void WM_paneltype_clear() { BLI_ghash_free(g_paneltypes_hash, nullptr, nullptr); } diff --git a/source/blender/windowmanager/intern/wm_platform_support.cc b/source/blender/windowmanager/intern/wm_platform_support.cc index 905f78da5df..9da247258ed 100644 --- a/source/blender/windowmanager/intern/wm_platform_support.cc +++ b/source/blender/windowmanager/intern/wm_platform_support.cc @@ -96,7 +96,7 @@ static void wm_platform_support_create_link(char *link) BLI_dynstr_free(ds); } -bool WM_platform_support_perform_checks(void) +bool WM_platform_support_perform_checks() { char title[WM_PLATFORM_SUPPORT_TEXT_SIZE]; char message[WM_PLATFORM_SUPPORT_TEXT_SIZE]; diff --git a/source/blender/windowmanager/intern/wm_playanim.cc b/source/blender/windowmanager/intern/wm_playanim.cc index 93a47ad7767..2ceb84a9d78 100644 --- a/source/blender/windowmanager/intern/wm_playanim.cc +++ b/source/blender/windowmanager/intern/wm_playanim.cc @@ -89,8 +89,8 @@ static AUD_Device *audio_device = nullptr; static CLG_LogRef LOG = {"wm.playanim"}; struct PlayState; -static void playanim_window_zoom(struct PlayState *ps, const float zoom_offset); -static bool playanim_window_font_scale_from_dpi(struct PlayState *ps); +static void playanim_window_zoom(PlayState *ps, const float zoom_offset); +static bool playanim_window_font_scale_from_dpi(PlayState *ps); /* -------------------------------------------------------------------- */ /** \name Local Utilities @@ -113,7 +113,7 @@ static bool buffer_from_filepath(const char *filepath, void **r_mem, size_t *r_s bool success = false; uchar *mem = nullptr; const size_t size = BLI_file_descriptor_size(file); - if (UNLIKELY(size == (size_t)-1)) { + if (UNLIKELY(size == size_t(-1))) { CLOG_WARN(&LOG, "failure '%s' to access size '%s'", strerror(errno), filepath); } else if (r_mem && UNLIKELY(!(mem = static_cast(MEM_mallocN(size, __func__))))) { @@ -272,7 +272,7 @@ static void playanim_window_get_size(GHOST_WindowHandle ghost_window, int *r_wid GHOST_DisposeRectangle(bounds); } -static void playanim_gl_matrix(void) +static void playanim_gl_matrix() { /* unified matrix, note it affects offset for drawing */ /* NOTE: cannot use GPU_matrix_ortho_2d_set here because shader ignores. */ @@ -307,7 +307,7 @@ static void playanim_event_qual_update(GhostData *ghost_data) } struct PlayAnimPict { - struct PlayAnimPict *next, *prev; + PlayAnimPict *next, *prev; uchar *mem; int size; /** The allocated file-path to the image. */ @@ -385,7 +385,7 @@ static void frame_cache_touch(PlayAnimPict *pic) BLI_addhead(&g_frame_cache.pics, pic->frame_cache_node); } -static bool frame_cache_limit_exceeded(void) +static bool frame_cache_limit_exceeded() { return g_frame_cache.memory_limit ? (g_frame_cache.pics_size_in_memory > g_frame_cache.memory_limit) : @@ -446,7 +446,7 @@ static PlayAnimPict *playanim_step(PlayAnimPict *playanim, int step) return playanim; } -static int pupdate_time(void) +static int pupdate_time() { static double ltime; @@ -630,8 +630,8 @@ static void playanim_toscreen_ex(GHOST_WindowHandle ghost_window, * if it does, this function displays a warning along with the file-path that failed. */ if (ibuf) { /* Size within window. */ - float span_x = (draw_zoom * ibuf->x) / (float)display_ctx->size[0]; - float span_y = (draw_zoom * ibuf->y) / (float)display_ctx->size[1]; + float span_x = (draw_zoom * ibuf->x) / float(display_ctx->size[0]); + float span_y = (draw_zoom * ibuf->y) / float(display_ctx->size[1]); /* offset within window */ float offs_x = 0.5f * (1.0f - span_x); @@ -730,8 +730,8 @@ static void playanim_toscreen(PlayState *ps, const PlayAnimPict *picture, ImBuf { float indicator_factor = -1.0f; if (ps->indicator) { - indicator_factor = picture->frame / (double)(((PlayAnimPict *)picsbase.last)->frame - - ((PlayAnimPict *)picsbase.first)->frame); + indicator_factor = picture->frame / double(((PlayAnimPict *)picsbase.last)->frame - + ((PlayAnimPict *)picsbase.first)->frame); } int fontid = -1; @@ -759,7 +759,7 @@ static void build_pict_list_from_anim(GhostData *ghost_data, const char *filepath_first) { /* OCIO_TODO: support different input color space */ - struct anim *anim = IMB_open_anim(filepath_first, IB_rect, 0, nullptr); + anim *anim = IMB_open_anim(filepath_first, IB_rect, 0, nullptr); if (anim == nullptr) { CLOG_WARN(&LOG, "couldn't open anim '%s'", filepath_first); return; @@ -901,7 +901,7 @@ static void build_pict_list(GhostData *ghost_data, *loading_p = false; } -static void update_sound_fps(void) +static void update_sound_fps() { #ifdef WITH_AUDASPACE if (playback_handle) { @@ -1401,8 +1401,8 @@ static bool ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) playanim_window_get_size(ghost_window, &ps->display_ctx.size[0], &ps->display_ctx.size[1]); GHOST_ActivateWindowDrawingContext(ghost_window); - zoomx = (float)ps->display_ctx.size[0] / ps->ibufx; - zoomy = (float)ps->display_ctx.size[1] / ps->ibufy; + zoomx = float(ps->display_ctx.size[0]) / ps->ibufx; + zoomy = float(ps->display_ctx.size[1]) / ps->ibufy; /* zoom always show entire image */ ps->zoom = MIN2(zoomx, zoomy); @@ -1502,7 +1502,7 @@ static bool playanim_window_font_scale_from_dpi(PlayState *ps) { const float scale = (GHOST_GetDPIHint(ps->ghost_data.window) / 96.0f); const float font_size_base = 11.0f; /* Font size un-scaled. */ - const int font_size = (int)(font_size_base * scale) + 0.5f; + const int font_size = int(font_size_base * scale) + 0.5f; if (ps->font_size != font_size) { BLF_size(ps->fontid, font_size); ps->font_size = font_size; @@ -1612,7 +1612,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv) case 'c': { #ifdef USE_FRAME_CACHE_LIMIT const int memory_in_mb = max_ii(0, atoi(argv[2])); - g_frame_cache.memory_limit = (size_t)memory_in_mb * (1024 * 1024); + g_frame_cache.memory_limit = size_t(memory_in_mb) * (1024 * 1024); #endif argc--; argv++; @@ -1640,7 +1640,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv) if (IMB_isanim(filepath)) { /* OCIO_TODO: support different input color spaces */ - struct anim *anim; + anim *anim; anim = IMB_open_anim(filepath, IB_rect, 0, nullptr); if (anim) { ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE); @@ -1735,14 +1735,14 @@ static char *wm_main_playanim_intern(int argc, const char **argv) #ifdef WITH_AUDASPACE source = AUD_Sound_file(filepath); { - struct anim *anim_movie = ((PlayAnimPict *)picsbase.first)->anim; + anim *anim_movie = ((PlayAnimPict *)picsbase.first)->anim; if (anim_movie) { short frs_sec = 25; float frs_sec_base = 1.0; IMB_anim_get_fps(anim_movie, &frs_sec, &frs_sec_base, true); - fps_movie = (double)frs_sec / (double)frs_sec_base; + fps_movie = double(frs_sec) / double(frs_sec_base); /* enforce same fps for movie as sound */ swaptime = ps.fstep / fps_movie; } diff --git a/source/blender/windowmanager/intern/wm_subwindow.cc b/source/blender/windowmanager/intern/wm_subwindow.cc index ff654e2beb8..b32359f39e6 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.cc +++ b/source/blender/windowmanager/intern/wm_subwindow.cc @@ -117,9 +117,9 @@ void wmGetProjectionMatrix(float mat[4][4], const rcti *winrct) int height = BLI_rcti_size_y(winrct) + 1; orthographic_m4(mat, -GLA_PIXEL_OFS, - (float)width - GLA_PIXEL_OFS, + float(width) - GLA_PIXEL_OFS, -GLA_PIXEL_OFS, - (float)height - GLA_PIXEL_OFS, + float(height) - GLA_PIXEL_OFS, GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT, GPU_MATRIX_ORTHO_CLIP_FAR_DEFAULT); } diff --git a/source/blender/windowmanager/intern/wm_surface.cc b/source/blender/windowmanager/intern/wm_surface.cc index 75e6f44ce66..cfbce2028ff 100644 --- a/source/blender/windowmanager/intern/wm_surface.cc +++ b/source/blender/windowmanager/intern/wm_surface.cc @@ -51,7 +51,7 @@ void wm_surfaces_do_depsgraph(bContext *C) wm_surfaces_iter(C, wm_surface_do_depsgraph_fn); } -void wm_surface_clear_drawable(void) +void wm_surface_clear_drawable() { if (g_drawable) { WM_system_gpu_context_release(g_drawable->system_gpu_context); @@ -90,7 +90,7 @@ void wm_surface_make_drawable(wmSurface *surface) } } -void wm_surface_reset_drawable(void) +void wm_surface_reset_drawable() { BLI_assert(BLI_thread_is_main()); BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); @@ -116,7 +116,7 @@ void wm_surface_remove(wmSurface *surface) MEM_freeN(surface); } -void wm_surfaces_free(void) +void wm_surfaces_free() { wm_surface_clear_drawable(); diff --git a/source/blender/windowmanager/intern/wm_toolsystem.cc b/source/blender/windowmanager/intern/wm_toolsystem.cc index 8c219c8151b..1880b1bd2bc 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.cc +++ b/source/blender/windowmanager/intern/wm_toolsystem.cc @@ -189,10 +189,10 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre Scene *scene = WM_window_get_active_scene(win); BKE_paint_ensure_from_paintmode(scene, paint_mode); Paint *paint = BKE_paint_get_active_from_paintmode(scene, paint_mode); - struct Brush *brush = BKE_paint_toolslots_brush_get(paint, slot_index); + Brush *brush = BKE_paint_toolslots_brush_get(paint, slot_index); if (brush == nullptr) { /* Could make into a function. */ - brush = (struct Brush *)BKE_libblock_find_name(bmain, ID_BR, items[i].name); + brush = (Brush *)BKE_libblock_find_name(bmain, ID_BR, items[i].name); if (brush && slot_index == BKE_brush_tool_get(brush, paint)) { /* pass */ } @@ -348,7 +348,7 @@ void WM_toolsystem_ref_set_from_runtime(bContext *C, } { - struct wmMsgBus *mbus = CTX_wm_message_bus(C); + wmMsgBus *mbus = CTX_wm_message_bus(C); WM_msg_publish_rna_prop(mbus, &workspace->id, workspace, WorkSpace, tools); } } @@ -390,7 +390,7 @@ void WM_toolsystem_ref_sync_from_context(Main *bmain, WorkSpace *workspace, bToo const EnumPropertyItem *items = BKE_paint_get_tool_enum_from_paintmode(paint_mode); if (paint && paint->brush && items) { const ID *brush = (ID *)paint->brush; - const char tool_type = BKE_brush_tool_get((struct Brush *)brush, paint); + const char tool_type = BKE_brush_tool_get((Brush *)brush, paint); const int i = RNA_enum_from_value(items, tool_type); /* Possible when loading files from the future. */ if (i != -1) { diff --git a/source/blender/windowmanager/intern/wm_tooltip.cc b/source/blender/windowmanager/intern/wm_tooltip.cc index e500fb2f215..165cb1c854f 100644 --- a/source/blender/windowmanager/intern/wm_tooltip.cc +++ b/source/blender/windowmanager/intern/wm_tooltip.cc @@ -25,7 +25,7 @@ #include "PIL_time.h" static double g_tooltip_time_closed; -double WM_tooltip_time_closed(void) +double WM_tooltip_time_closed() { return g_tooltip_time_closed; } diff --git a/source/blender/windowmanager/intern/wm_uilist_type.cc b/source/blender/windowmanager/intern/wm_uilist_type.cc index 395854a571a..8dfd89e8b30 100644 --- a/source/blender/windowmanager/intern/wm_uilist_type.cc +++ b/source/blender/windowmanager/intern/wm_uilist_type.cc @@ -122,12 +122,12 @@ void WM_uilisttype_remove_ptr(Main *bmain, uiListType *ult) UNUSED_VARS_NDEBUG(ok); } -void WM_uilisttype_init(void) +void WM_uilisttype_init() { uilisttypes_hash = BLI_ghash_str_new_ex("uilisttypes_hash gh", 16); } -void WM_uilisttype_free(void) +void WM_uilisttype_free() { GHashIterator gh_iter; GHASH_ITER (gh_iter, uilisttypes_hash) { diff --git a/source/blender/windowmanager/intern/wm_utils.cc b/source/blender/windowmanager/intern/wm_utils.cc index 35ceceb7364..c0b1bef923b 100644 --- a/source/blender/windowmanager/intern/wm_utils.cc +++ b/source/blender/windowmanager/intern/wm_utils.cc @@ -25,7 +25,7 @@ void WM_generic_callback_free(wmGenericCallback *callback) MEM_freeN(callback); } -static void do_nothing(struct bContext * /*C*/, void * /*user_data*/) {} +static void do_nothing(bContext * /*C*/, void * /*user_data*/) {} wmGenericCallback *WM_generic_callback_steal(wmGenericCallback *callback) { diff --git a/source/blender/windowmanager/intern/wm_window.cc b/source/blender/windowmanager/intern/wm_window.cc index 5f1ae329652..f0102f32775 100644 --- a/source/blender/windowmanager/intern/wm_window.cc +++ b/source/blender/windowmanager/intern/wm_window.cc @@ -499,7 +499,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) * and to give hint of unsaved changes for a user warning mechanism in case of OS application * terminate request (e.g. OS Shortcut Alt+F4, Command+Q, (...), or session end). */ GHOST_SetWindowModifiedState(static_cast(win->ghostwin), - (bool)!wm->file_saved); + bool(!wm->file_saved)); } } @@ -534,7 +534,7 @@ void WM_window_set_dpi(const wmWindow *win) U.dpi = auto_dpi * U.ui_scale * (72.0 / 96.0f); /* Automatically set larger pixel size for high DPI. */ - int pixelsize = max_ii(1, (int)(U.dpi / 64)); + int pixelsize = max_ii(1, int(U.dpi / 64)); /* User adjustment for pixel size. */ pixelsize = max_ii(1, pixelsize + U.ui_line_width); @@ -546,7 +546,7 @@ void WM_window_set_dpi(const wmWindow *win) /* Widget unit is 20 pixels at 1X scale. This consists of 18 user-scaled units plus * left and right borders of line-width (pixel-size). */ - U.widget_unit = (int)roundf(18.0f * U.scale_factor) + (2 * pixelsize); + U.widget_unit = int(roundf(18.0f * U.scale_factor)) + (2 * pixelsize); } /** @@ -1214,7 +1214,7 @@ void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win) } } -void wm_window_reset_drawable(void) +void wm_window_reset_drawable() { BLI_assert(BLI_thread_is_main()); BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); @@ -1726,7 +1726,7 @@ void wm_ghost_init(bContext *C) GHOST_UseWindowFocus(wm_init_state.window_focus); } -void wm_ghost_init_background(void) +void wm_ghost_init_background() { /* TODO: move this to `wm_init_exit.cc`. */ @@ -1745,7 +1745,7 @@ void wm_ghost_init_background(void) GHOST_SystemInitDebug(g_system, debug); } -void wm_ghost_exit(void) +void wm_ghost_exit() { if (g_system) { GHOST_DisposeSystem(g_system); @@ -1753,7 +1753,7 @@ void wm_ghost_exit(void) g_system = nullptr; } -const char *WM_ghost_backend(void) +const char *WM_ghost_backend() { #if !(defined(WIN32) || defined(__APPLE__)) return g_system_backend_id ? g_system_backend_id : "NONE"; @@ -1864,7 +1864,7 @@ void wm_test_opengl_deprecation_warning(bContext *C) message_shown = true; } -eWM_CapabilitiesFlag WM_capabilities_flag(void) +eWM_CapabilitiesFlag WM_capabilities_flag() { static eWM_CapabilitiesFlag flag = eWM_CapabilitiesFlag(-1); if (flag != -1) { @@ -2129,15 +2129,15 @@ void WM_clipboard_text_set(const char *buf, bool selection) } } -bool WM_clipboard_image_available(void) +bool WM_clipboard_image_available() { if (G.background) { return false; } - return (bool)GHOST_hasClipboardImage(); + return bool(GHOST_hasClipboardImage()); } -ImBuf *WM_clipboard_image_get(void) +ImBuf *WM_clipboard_image_get() { if (G.background) { return nullptr; @@ -2169,7 +2169,7 @@ bool WM_clipboard_image_set(ImBuf *ibuf) free_byte_buffer = true; } - bool success = (bool)GHOST_putClipboardImage((uint *)ibuf->byte_buffer.data, ibuf->x, ibuf->y); + bool success = bool(GHOST_putClipboardImage((uint *)ibuf->byte_buffer.data, ibuf->x, ibuf->y)); if (free_byte_buffer) { /* Remove the byte buffer if we added it. */ @@ -2310,19 +2310,19 @@ void WM_init_state_size_set(int stax, int stay, int sizx, int sizy) wm_init_state.override_flag |= WIN_OVERRIDE_GEOM; } -void WM_init_state_fullscreen_set(void) +void WM_init_state_fullscreen_set() { wm_init_state.windowstate = GHOST_kWindowStateFullScreen; wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE; } -void WM_init_state_normal_set(void) +void WM_init_state_normal_set() { wm_init_state.windowstate = GHOST_kWindowStateNormal; wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE; } -void WM_init_state_maximized_set(void) +void WM_init_state_maximized_set() { wm_init_state.windowstate = GHOST_kWindowStateMaximized; wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE; @@ -2344,7 +2344,7 @@ void WM_init_native_pixels(bool do_it) /** \name Cursor API * \{ */ -void WM_init_input_devices(void) +void WM_init_input_devices() { if (UNLIKELY(!g_system)) { return; @@ -2396,13 +2396,13 @@ int WM_window_pixels_x(const wmWindow *win) { float f = GHOST_GetNativePixelSize(static_cast(win->ghostwin)); - return (int)(f * (float)win->sizex); + return int(f * float(win->sizex)); } int WM_window_pixels_y(const wmWindow *win) { float f = GHOST_GetNativePixelSize(static_cast(win->ghostwin)); - return (int)(f * (float)win->sizey); + return int(f * float(win->sizey)); } void WM_window_rect_calc(const wmWindow *win, rcti *r_rect) @@ -2672,7 +2672,7 @@ void wm_window_IME_end(wmWindow *win) /** \name Direct GPU Context Management * \{ */ -void *WM_system_gpu_context_create(void) +void *WM_system_gpu_context_create() { /* On Windows there is a problem creating contexts that share resources (almost any object, * including legacy display lists, but also textures) with a context which is current in another diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus.cc b/source/blender/windowmanager/message_bus/intern/wm_message_bus.cc index e0b57989ff1..f885a7c20d4 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus.cc +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus.cc @@ -35,16 +35,16 @@ static wmMsgTypeInitFn wm_msg_init_fn[WM_MSG_TYPE_NUM] = { WM_msgtypeinfo_init_static, }; -void WM_msgbus_types_init(void) +void WM_msgbus_types_init() { for (uint i = 0; i < WM_MSG_TYPE_NUM; i++) { wm_msg_init_fn[i](&wm_msg_types[i]); } } -struct wmMsgBus *WM_msgbus_create(void) +wmMsgBus *WM_msgbus_create() { - struct wmMsgBus *mbus = static_cast(MEM_callocN(sizeof(*mbus), __func__)); + wmMsgBus *mbus = static_cast(MEM_callocN(sizeof(*mbus), __func__)); const uint gset_reserve = 512; for (uint i = 0; i < WM_MSG_TYPE_NUM; i++) { wmMsgTypeInfo *info = &wm_msg_types[i]; @@ -54,7 +54,7 @@ struct wmMsgBus *WM_msgbus_create(void) return mbus; } -void WM_msgbus_destroy(struct wmMsgBus *mbus) +void WM_msgbus_destroy(wmMsgBus *mbus) { for (uint i = 0; i < WM_MSG_TYPE_NUM; i++) { wmMsgTypeInfo *info = &wm_msg_types[i]; @@ -63,7 +63,7 @@ void WM_msgbus_destroy(struct wmMsgBus *mbus) MEM_freeN(mbus); } -void WM_msgbus_clear_by_owner(struct wmMsgBus *mbus, void *owner) +void WM_msgbus_clear_by_owner(wmMsgBus *mbus, void *owner) { wmMsgSubscribeKey *msg_key, *msg_key_next; for (msg_key = static_cast(mbus->messages.first); msg_key; @@ -101,7 +101,7 @@ void WM_msgbus_clear_by_owner(struct wmMsgBus *mbus, void *owner) } } -void WM_msg_dump(struct wmMsgBus *mbus, const char *info_str) +void WM_msg_dump(wmMsgBus *mbus, const char *info_str) { printf(">>>> %s\n", info_str); LISTBASE_FOREACH (wmMsgSubscribeKey *, key, &mbus->messages) { @@ -112,7 +112,7 @@ void WM_msg_dump(struct wmMsgBus *mbus, const char *info_str) printf("<<<< %s\n", info_str); } -void WM_msgbus_handle(struct wmMsgBus *mbus, struct bContext *C) +void WM_msgbus_handle(wmMsgBus *mbus, bContext *C) { if (mbus->messages_tag_count == 0) { // printf("msgbus: skipping\n"); @@ -140,7 +140,7 @@ void WM_msgbus_handle(struct wmMsgBus *mbus, struct bContext *C) // printf("msgbus: keys=%u values=%u\n", a, b); } -wmMsgSubscribeKey *WM_msg_subscribe_with_key(struct wmMsgBus *mbus, +wmMsgSubscribeKey *WM_msg_subscribe_with_key(wmMsgBus *mbus, const wmMsgSubscribeKey *msg_key_test, const wmMsgSubscribeValue *msg_val_params) { @@ -175,7 +175,7 @@ wmMsgSubscribeKey *WM_msg_subscribe_with_key(struct wmMsgBus *mbus, return key; } -void WM_msg_publish_with_key(struct wmMsgBus *mbus, wmMsgSubscribeKey *msg_key) +void WM_msg_publish_with_key(wmMsgBus *mbus, wmMsgSubscribeKey *msg_key) { CLOG_INFO(WM_LOG_MSGBUS_SUB, 2, @@ -196,7 +196,7 @@ void WM_msg_publish_with_key(struct wmMsgBus *mbus, wmMsgSubscribeKey *msg_key) } } -void WM_msg_id_update(struct wmMsgBus *mbus, ID *id_src, ID *id_dst) +void WM_msg_id_update(wmMsgBus *mbus, ID *id_src, ID *id_dst) { for (uint i = 0; i < WM_MSG_TYPE_NUM; i++) { wmMsgTypeInfo *info = &wm_msg_types[i]; @@ -206,7 +206,7 @@ void WM_msg_id_update(struct wmMsgBus *mbus, ID *id_src, ID *id_dst) } } -void WM_msg_id_remove(struct wmMsgBus *mbus, const ID *id) +void WM_msg_id_remove(wmMsgBus *mbus, const ID *id) { for (uint i = 0; i < WM_MSG_TYPE_NUM; i++) { wmMsgTypeInfo *info = &wm_msg_types[i]; diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.cc b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.cc index 828656d33de..4362570da0d 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.cc +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.cc @@ -30,8 +30,8 @@ BLI_INLINE uint void_hash_uint(const void *key) { - size_t y = (size_t)key >> sizeof(void *); - return (uint)y; + size_t y = size_t(key) >> sizeof(void *); + return uint(y); } static uint wm_msg_rna_gset_hash(const void *key_p) @@ -86,7 +86,7 @@ static void wm_msg_rna_repr(FILE *stream, const wmMsgSubscribeKey *msg_key) BLI_listbase_count(&m->head.values)); } -static void wm_msg_rna_update_by_id(struct wmMsgBus *mbus, ID *id_src, ID *id_dst) +static void wm_msg_rna_update_by_id(wmMsgBus *mbus, ID *id_src, ID *id_dst) { GSet *gs = mbus->messages_gset[WM_MSG_TYPE_RNA]; GSetIterator gs_iter; @@ -173,7 +173,7 @@ static void wm_msg_rna_update_by_id(struct wmMsgBus *mbus, ID *id_src, ID *id_ds } } -static void wm_msg_rna_remove_by_id(struct wmMsgBus *mbus, const ID *id) +static void wm_msg_rna_remove_by_id(wmMsgBus *mbus, const ID *id) { GSet *gs = mbus->messages_gset[WM_MSG_TYPE_RNA]; GSetIterator gs_iter; @@ -223,8 +223,7 @@ void WM_msgtypeinfo_init_rna(wmMsgTypeInfo *msgtype_info) /** \name RNA API * \{ */ -wmMsgSubscribeKey_RNA *WM_msg_lookup_rna(struct wmMsgBus *mbus, - const wmMsgParams_RNA *msg_key_params) +wmMsgSubscribeKey_RNA *WM_msg_lookup_rna(wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params) { wmMsgSubscribeKey_RNA key_test; key_test.msg.params = *msg_key_params; @@ -232,7 +231,7 @@ wmMsgSubscribeKey_RNA *WM_msg_lookup_rna(struct wmMsgBus *mbus, BLI_gset_lookup(mbus->messages_gset[WM_MSG_TYPE_RNA], &key_test)); } -void WM_msg_publish_rna_params(struct wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params) +void WM_msg_publish_rna_params(wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params) { wmMsgSubscribeKey_RNA *key; @@ -280,7 +279,7 @@ void WM_msg_publish_rna_params(struct wmMsgBus *mbus, const wmMsgParams_RNA *msg } } -void WM_msg_publish_rna(struct wmMsgBus *mbus, PointerRNA *ptr, PropertyRNA *prop) +void WM_msg_publish_rna(wmMsgBus *mbus, PointerRNA *ptr, PropertyRNA *prop) { wmMsgParams_RNA params{}; params.ptr = *ptr; @@ -288,7 +287,7 @@ void WM_msg_publish_rna(struct wmMsgBus *mbus, PointerRNA *ptr, PropertyRNA *pro WM_msg_publish_rna_params(mbus, ¶ms); } -void WM_msg_subscribe_rna_params(struct wmMsgBus *mbus, +void WM_msg_subscribe_rna_params(wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params, const wmMsgSubscribeValue *msg_val_params, const char *id_repr) @@ -324,7 +323,7 @@ void WM_msg_subscribe_rna_params(struct wmMsgBus *mbus, } } -void WM_msg_subscribe_rna(struct wmMsgBus *mbus, +void WM_msg_subscribe_rna(wmMsgBus *mbus, PointerRNA *ptr, const PropertyRNA *prop, const wmMsgSubscribeValue *msg_val_params, @@ -344,7 +343,7 @@ void WM_msg_subscribe_rna(struct wmMsgBus *mbus, * \note While we could have a separate type for ID's, use RNA since there is enough overlap. * \{ */ -void WM_msg_subscribe_ID(struct wmMsgBus *mbus, +void WM_msg_subscribe_ID(wmMsgBus *mbus, ID *id, const wmMsgSubscribeValue *msg_val_params, const char *id_repr) @@ -354,7 +353,7 @@ void WM_msg_subscribe_ID(struct wmMsgBus *mbus, WM_msg_subscribe_rna_params(mbus, &msg_key_params, msg_val_params, id_repr); } -void WM_msg_publish_ID(struct wmMsgBus *mbus, ID *id) +void WM_msg_publish_ID(wmMsgBus *mbus, ID *id) { wmMsgParams_RNA msg_key_params = {{nullptr}}; RNA_id_pointer_create(id, &msg_key_params.ptr); diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.cc b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.cc index 82d9d121d0b..0a826ef42c0 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.cc +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.cc @@ -75,7 +75,7 @@ void WM_msgtypeinfo_init_static(wmMsgTypeInfo *msgtype_info) /* -------------------------------------------------------------------------- */ -wmMsgSubscribeKey_Static *WM_msg_lookup_static(struct wmMsgBus *mbus, +wmMsgSubscribeKey_Static *WM_msg_lookup_static(wmMsgBus *mbus, const wmMsgParams_Static *msg_key_params) { wmMsgSubscribeKey_Static key_test; @@ -84,7 +84,7 @@ wmMsgSubscribeKey_Static *WM_msg_lookup_static(struct wmMsgBus *mbus, BLI_gset_lookup(mbus->messages_gset[WM_MSG_TYPE_STATIC], &key_test)); } -void WM_msg_publish_static_params(struct wmMsgBus *mbus, const wmMsgParams_Static *msg_key_params) +void WM_msg_publish_static_params(wmMsgBus *mbus, const wmMsgParams_Static *msg_key_params) { CLOG_INFO(WM_LOG_MSGBUS_PUB, 2, "static(event=%d)", msg_key_params->event); @@ -94,14 +94,14 @@ void WM_msg_publish_static_params(struct wmMsgBus *mbus, const wmMsgParams_Stati } } -void WM_msg_publish_static(struct wmMsgBus *mbus, int event) +void WM_msg_publish_static(wmMsgBus *mbus, int event) { wmMsgParams_Static params{}; params.event = event; WM_msg_publish_static_params(mbus, ¶ms); } -void WM_msg_subscribe_static_params(struct wmMsgBus *mbus, +void WM_msg_subscribe_static_params(wmMsgBus *mbus, const wmMsgParams_Static *msg_key_params, const wmMsgSubscribeValue *msg_val_params, const char *id_repr) @@ -117,7 +117,7 @@ void WM_msg_subscribe_static_params(struct wmMsgBus *mbus, WM_msg_subscribe_with_key(mbus, &msg_key_test.head, msg_val_params); } -void WM_msg_subscribe_static(struct wmMsgBus *mbus, +void WM_msg_subscribe_static(wmMsgBus *mbus, int event, const wmMsgSubscribeValue *msg_val_params, const char *id_repr) diff --git a/source/blender/windowmanager/xr/intern/wm_xr.cc b/source/blender/windowmanager/xr/intern/wm_xr.cc index 148eaebc9ee..5da7db99842 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr.cc +++ b/source/blender/windowmanager/xr/intern/wm_xr.cc @@ -145,7 +145,7 @@ bool wm_xr_events_handle(wmWindowManager *wm) /** \name XR Runtime Data * \{ */ -wmXrRuntimeData *wm_xr_runtime_data_create(void) +wmXrRuntimeData *wm_xr_runtime_data_create() { wmXrRuntimeData *runtime = static_cast( MEM_callocN(sizeof(*runtime), __func__)); diff --git a/source/blender/windowmanager/xr/intern/wm_xr_action.cc b/source/blender/windowmanager/xr/intern/wm_xr_action.cc index 8bf961e520c..a2f820021b3 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_action.cc +++ b/source/blender/windowmanager/xr/intern/wm_xr_action.cc @@ -74,7 +74,7 @@ static wmXrAction *action_create(const char *action_name, action->name = BLI_strdup(action_name); action->type = type; - const uint count = (uint)BLI_listbase_count(user_paths); + const uint count = uint(BLI_listbase_count(user_paths)); uint subaction_idx = 0; action->count_subaction_paths = count; @@ -240,7 +240,7 @@ bool WM_xr_action_create(wmXrData *xr, action_flag, haptic_flag); - const uint count = (uint)BLI_listbase_count(user_paths); + const uint count = uint(BLI_listbase_count(user_paths)); uint subaction_idx = 0; char **subaction_paths = static_cast( @@ -335,7 +335,7 @@ bool WM_xr_action_binding_create(wmXrData *xr, const eXrAxisFlag *axis_flags, const wmXrPose *poses) { - const uint count = (uint)BLI_listbase_count(user_paths); + const uint count = uint(BLI_listbase_count(user_paths)); BLI_assert(count == (uint)BLI_listbase_count(component_paths)); GHOST_XrActionBindingInfo *binding_infos = static_cast( @@ -479,7 +479,7 @@ bool WM_xr_action_state_get(const wmXrData *xr, return false; } - r_state->type = (int)action->type; + r_state->type = int(action->type); /* Find the action state corresponding to the subaction path. */ for (uint i = 0; i < action->count_subaction_paths; ++i) { diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.cc b/source/blender/windowmanager/xr/intern/wm_xr_draw.cc index 53504bb10da..364b7ef2141 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_draw.cc +++ b/source/blender/windowmanager/xr/intern/wm_xr_draw.cc @@ -335,7 +335,7 @@ static void wm_xr_controller_aim_draw(const XrSessionSettings *settings, wmXrSes GPU_depth_test(GPU_DEPTH_LESS_EQUAL); GPU_blend(GPU_BLEND_ALPHA); - immBegin(GPU_PRIM_LINES, (uint)BLI_listbase_count(&state->controllers) * 2); + immBegin(GPU_PRIM_LINES, uint(BLI_listbase_count(&state->controllers)) * 2); LISTBASE_FOREACH (wmXrController *, controller, &state->controllers) { const float(*mat)[4] = controller->aim_mat; @@ -359,7 +359,7 @@ static void wm_xr_controller_aim_draw(const XrSessionSettings *settings, wmXrSes GPU_depth_test(GPU_DEPTH_NONE); GPU_blend(GPU_BLEND_NONE); - immBegin(GPU_PRIM_LINES, (uint)BLI_listbase_count(&state->controllers) * 6); + immBegin(GPU_PRIM_LINES, uint(BLI_listbase_count(&state->controllers)) * 6); LISTBASE_FOREACH (wmXrController *, controller, &state->controllers) { const float(*mat)[4] = controller->aim_mat; diff --git a/source/blender/windowmanager/xr/intern/wm_xr_operators.cc b/source/blender/windowmanager/xr/intern/wm_xr_operators.cc index 4c64776fbd6..eef918a3be3 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_operators.cc +++ b/source/blender/windowmanager/xr/intern/wm_xr_operators.cc @@ -1523,7 +1523,7 @@ static void WM_OT_xr_navigation_reset(wmOperatorType *ot) /** \name Operator Registration * \{ */ -void wm_xr_operatortypes_register(void) +void wm_xr_operatortypes_register() { WM_operatortype_append(WM_OT_xr_session_toggle); WM_operatortype_append(WM_OT_xr_navigation_grab); diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.cc b/source/blender/windowmanager/xr/intern/wm_xr_session.cc index 9d44d1ff87b..2ce6f5bedb0 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_session.cc +++ b/source/blender/windowmanager/xr/intern/wm_xr_session.cc @@ -51,7 +51,7 @@ static CLG_LogRef LOG = {"wm.xr"}; /* -------------------------------------------------------------------- */ -static void wm_xr_session_create_cb(void) +static void wm_xr_session_create_cb() { Main *bmain = G_MAIN; wmWindowManager *wm = static_cast(bmain->wm.first); @@ -986,7 +986,7 @@ static bool wm_xr_session_action_test_bimanual(const wmXrSessionState *session_s bool bimanual = false; *r_subaction_idx_other = (subaction_idx == 0) ? - (uint)min_ii(1, action->count_subaction_paths - 1) : + uint(min_ii(1, action->count_subaction_paths - 1)) : 0; switch (action->type) { @@ -1115,7 +1115,7 @@ static void wm_xr_session_events_dispatch(wmXrData *xr, return; } - const int64_t time_now = (int64_t)(PIL_check_seconds_timer() * 1000); + const int64_t time_now = int64_t(PIL_check_seconds_timer() * 1000); ListBase *active_modal_actions = &action_set->active_modal_actions; ListBase *active_haptic_actions = &action_set->active_haptic_actions; @@ -1457,7 +1457,7 @@ static void wm_xr_session_surface_free_data(wmSurface *surface) g_xr_surface = nullptr; } -static wmSurface *wm_xr_session_surface_create(void) +static wmSurface *wm_xr_session_surface_create() { if (g_xr_surface) { BLI_assert(false); @@ -1487,7 +1487,7 @@ static wmSurface *wm_xr_session_surface_create(void) return surface; } -void *wm_xr_session_gpu_binding_context_create(void) +void *wm_xr_session_gpu_binding_context_create() { wmSurface *surface = wm_xr_session_surface_create(); @@ -1513,7 +1513,7 @@ void wm_xr_session_gpu_binding_context_destroy(GHOST_ContextHandle /*context*/) WM_main_add_notifier(NC_WM | ND_XR_DATA_CHANGED, nullptr); } -ARegionType *WM_xr_surface_controller_region_type_get(void) +ARegionType *WM_xr_surface_controller_region_type_get() { if (g_xr_surface) { wmXrSurfaceData *data = static_cast(g_xr_surface->customdata);