diff --git a/source/creator/creator.cc b/source/creator/creator.cc index 680281d4a75..4fe35ab91eb 100644 --- a/source/creator/creator.cc +++ b/source/creator/creator.cc @@ -6,8 +6,8 @@ * \ingroup creator */ -#include -#include +#include +#include #ifdef WIN32 # include "utfconv.h" @@ -79,7 +79,7 @@ # include "FRS_freestyle.h" #endif -#include +#include #ifdef __FreeBSD__ # include @@ -142,7 +142,7 @@ static void callback_mem_error(const char *errorStr) fflush(stderr); } -static void main_callback_setup(void) +static void main_callback_setup() { /* Error output from the guarded allocation routines. */ MEM_set_error_callback(callback_mem_error); @@ -166,7 +166,7 @@ struct CreatorAtExitData { static void callback_main_atexit(void *user_data) { - struct CreatorAtExitData *app_init_data = static_cast(user_data); + CreatorAtExitData *app_init_data = static_cast(user_data); #ifndef WITH_PYTHON_MODULE if (app_init_data->ba) { @@ -297,7 +297,7 @@ int main(int argc, /* --- end declarations --- */ /* Ensure we free data on early-exit. */ - struct CreatorAtExitData app_init_data = {nullptr}; + CreatorAtExitData app_init_data = {nullptr}; BKE_blender_atexit_register(callback_main_atexit, &app_init_data); /* Un-buffered `stdout` makes `stdout` and `stderr` better synchronized, and helps @@ -369,7 +369,7 @@ int main(int argc, #ifdef BUILD_DATE { time_t temp_time = build_commit_timestamp; - struct tm *tm = gmtime(&temp_time); + tm *tm = gmtime(&temp_time); if (LIKELY(tm)) { strftime(build_commit_date, sizeof(build_commit_date), "%Y-%m-%d", tm); strftime(build_commit_time, sizeof(build_commit_time), "%H:%M", tm); diff --git a/source/creator/creator_args.cc b/source/creator/creator_args.cc index 470e689af81..1f8861408fd 100644 --- a/source/creator/creator_args.cc +++ b/source/creator/creator_args.cc @@ -8,9 +8,9 @@ #ifndef WITH_PYTHON_MODULE -# include -# include -# include +# include +# include +# include # include "MEM_guardedalloc.h" @@ -99,7 +99,7 @@ struct BuildDefs { bool with_xr_openxr; }; -static void build_defs_init(struct BuildDefs *build_defs, bool force_all) +static void build_defs_init(BuildDefs *build_defs, bool force_all) { if (force_all) { bool *var_end = (bool *)(build_defs + 1); @@ -180,7 +180,7 @@ static bool parse_int_relative(const char *str, *r_err_msg = msg; return false; } - *r_value = (int)value; + *r_value = int(value); return true; } @@ -284,7 +284,7 @@ static bool parse_int_strict_range(const char *str, *r_err_msg = msg; return false; } - *r_value = (int)value; + *r_value = int(value); return true; } @@ -438,9 +438,7 @@ struct BlendePyContextStore { bool has_win; }; -static void arg_py_context_backup(bContext *C, - struct BlendePyContextStore *c_py, - const char *script_id) +static void arg_py_context_backup(bContext *C, BlendePyContextStore *c_py, const char *script_id) { c_py->wm = CTX_wm_manager(C); c_py->scene = CTX_data_scene(C); @@ -458,7 +456,7 @@ static void arg_py_context_backup(bContext *C, } } -static void arg_py_context_restore(bContext *C, struct BlendePyContextStore *c_py) +static void arg_py_context_restore(bContext *C, BlendePyContextStore *c_py) { /* script may load a file, check old data is valid before using */ if (c_py->has_win) { @@ -477,7 +475,7 @@ static void arg_py_context_restore(bContext *C, struct BlendePyContextStore *c_p /* macro for context setup/reset */ # define BPY_CTX_SETUP(_cmd) \ { \ - struct BlendePyContextStore py_c; \ + BlendePyContextStore py_c; \ arg_py_context_backup(C, &py_c, argv[1]); \ { \ _cmd; \ @@ -504,7 +502,7 @@ static void arg_py_context_restore(bContext *C, struct BlendePyContextStore *c_p * * \{ */ -static void print_version_full(void) +static void print_version_full() { printf("Blender %s\n", BKE_blender_version_string()); # ifdef BUILD_DATE @@ -522,7 +520,7 @@ static void print_version_full(void) # endif } -static void print_version_short(void) +static void print_version_short() { # ifdef BUILD_DATE /* NOTE: We include built time since sometimes we need to tell broken from @@ -550,7 +548,7 @@ static int arg_handle_print_version(int /*argc*/, const char ** /*argv*/, void * static void print_help(bArgs *ba, bool all) { - struct BuildDefs defs; + BuildDefs defs; build_defs_init(&defs, all); /* All printing must go via `PRINT` macro. */ @@ -851,7 +849,7 @@ static const char arg_handle_python_set_doc_disable[] = static int arg_handle_python_set(int /*argc*/, const char ** /*argv*/, void *data) { - if ((bool)data) { + if (bool(data)) { G.f |= G_FLAG_SCRIPT_AUTOEXEC; } else { @@ -902,7 +900,7 @@ static const char arg_handle_background_mode_set_doc[] = static int arg_handle_background_mode_set(int /*argc*/, const char ** /*argv*/, void * /*data*/) { print_version_short(); - G.background = 1; + G.background = true; return 0; } @@ -1325,7 +1323,7 @@ static const char arg_handle_factory_startup_set_doc[] = "Skip reading the '" BLENDER_STARTUP_FILE "' in the users home directory."; static int arg_handle_factory_startup_set(int /*argc*/, const char ** /*argv*/, void * /*data*/) { - G.factory_startup = 1; + G.factory_startup = true; G.f |= G_FLAG_USERPREF_NO_SAVE_ON_EXIT; return 0; } @@ -2026,7 +2024,7 @@ static int arg_handle_python_text_run(int argc, const char **argv, void *data) if (argc > 1) { Main *bmain = CTX_data_main(C); /* Make the path absolute because its needed for relative linked blends to be found */ - struct Text *text = (struct Text *)BKE_libblock_find_name(bmain, ID_TXT, argv[1]); + Text *text = (Text *)BKE_libblock_find_name(bmain, ID_TXT, argv[1]); bool ok; if (text) { @@ -2123,7 +2121,7 @@ static int arg_handle_python_exit_code_set(int argc, const char **argv, void * / return 1; } - app_state.exit_code_on_error.python = (uchar)exit_code; + app_state.exit_code_on_error.python = uchar(exit_code); return 1; } fprintf(stderr, "\nError: you must specify an exit code number '%s'.\n", arg_id); @@ -2293,7 +2291,7 @@ void main_args_setup(bContext *C, bArgs *ba, bool all) /** A version of `CB` that uses `all`, needed when the doc-string depends on build options. */ # define CB_ALL(a) (all ? a##_doc_all : a##_doc), a - struct BuildDefs defs; + BuildDefs defs; build_defs_init(&defs, all); /* end argument processing after -- */ diff --git a/source/creator/creator_signals.cc b/source/creator/creator_signals.cc index ed0b90fe869..980bd9411eb 100644 --- a/source/creator/creator_signals.cc +++ b/source/creator/creator_signals.cc @@ -12,7 +12,7 @@ # ifndef _GNU_SOURCE # define _GNU_SOURCE # endif -# include +# include # endif # if (defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__))) @@ -25,9 +25,9 @@ # include # endif -# include -# include -# include +# include +# include +# include # include "BLI_sys_types.h" @@ -47,7 +47,7 @@ # include "BKE_main.h" # include "BKE_report.h" -# include +# include # ifdef WITH_PYTHON # include "BPY_extern_python.h" /* BPY_python_backtrace */ @@ -216,7 +216,7 @@ static void sig_handle_abort(int /*signum*/) BKE_tempdir_session_purge(); } -void main_signal_setup(void) +void main_signal_setup() { if (app_state.signal.use_crash_handler) { # ifdef WIN32 @@ -238,7 +238,7 @@ void main_signal_setup(void) } } -void main_signal_setup_background(void) +void main_signal_setup_background() { /* for all platforms, even windows has it! */ BLI_assert(G.background); @@ -248,7 +248,7 @@ void main_signal_setup_background(void) signal(SIGINT, sig_handle_blender_esc); } -void main_signal_setup_fpe(void) +void main_signal_setup_fpe() { # if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE) /* zealous but makes float issues a heck of a lot easier to find!