Commit: ae3073323e92a1773fb253bd1c5d6c92b826e1e0 Author: Campbell Barton Date: Fri Nov 4 18:37:25 2022 +1100 Branches: master https://developer.blender.org/rBae3073323e92a1773fb253bd1c5d6c92b826e1e0
Cleanup: use bool instead of short for job stop & do_update arguments Since these values are only ever 0/1, use bool type. =================================================================== M source/blender/blenkernel/BKE_dynamicpaint.h M source/blender/blenkernel/BKE_sound.h M source/blender/blenkernel/BKE_tracking.h M source/blender/blenkernel/intern/dynamicpaint.c M source/blender/blenkernel/intern/sound.c M source/blender/blenkernel/intern/tracking_solver.c M source/blender/draw/engines/eevee/eevee_lightcache.c M source/blender/draw/engines/eevee/eevee_lightcache.h M source/blender/draw/intern/draw_manager_shader.c M source/blender/editors/gpencil/gpencil_trace_ops.c M source/blender/editors/interface/interface_icons.c M source/blender/editors/object/object_bake.c M source/blender/editors/object/object_bake_api.c M source/blender/editors/object/object_modifier.cc M source/blender/editors/object/object_remesh.cc M source/blender/editors/physics/dynamicpaint_ops.c M source/blender/editors/physics/physics_fluid.c M source/blender/editors/physics/physics_pointcache.c M source/blender/editors/render/render_internal.cc M source/blender/editors/render/render_preview.cc M source/blender/editors/render/render_shading.cc M source/blender/editors/space_clip/clip_editor.c M source/blender/editors/space_clip/clip_ops.c M source/blender/editors/space_clip/tracking_ops_solve.c M source/blender/editors/space_clip/tracking_ops_track.c M source/blender/editors/space_file/filelist.cc M source/blender/editors/space_file/fsmenu.c M source/blender/editors/space_node/node_edit.cc M source/blender/editors/space_sequencer/sequencer_drag_drop.c M source/blender/editors/space_sequencer/sequencer_preview.c M source/blender/editors/space_sequencer/sequencer_proxy.c M source/blender/editors/space_sequencer/sequencer_thumbnails.c M source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c M source/blender/imbuf/IMB_imbuf.h M source/blender/imbuf/intern/indexer.c M source/blender/io/alembic/exporter/abc_export_capi.cc M source/blender/io/alembic/intern/alembic_capi.cc M source/blender/io/usd/intern/usd_capi_export.cc M source/blender/io/usd/intern/usd_capi_import.cc M source/blender/makesdna/DNA_node_types.h M source/blender/render/RE_multires_bake.h M source/blender/render/RE_pipeline.h M source/blender/render/intern/multires_bake.c M source/blender/render/intern/pipeline.cc M source/blender/render/intern/render_types.h M source/blender/sequencer/SEQ_proxy.h M source/blender/sequencer/SEQ_render.h M source/blender/sequencer/intern/proxy.c M source/blender/sequencer/intern/proxy_job.c M source/blender/sequencer/intern/render.c M source/blender/windowmanager/WM_api.h M source/blender/windowmanager/intern/wm_jobs.c =================================================================== diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index 109d3e6d977..431bc11b07f 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -119,7 +119,7 @@ struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings int dynamicPaint_createUVSurface(struct Scene *scene, struct DynamicPaintSurface *surface, float *progress, - short *do_update); + bool *do_update); /** * Calculate a single frame and included sub-frames for surface. */ diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 11c37a74a54..f0bb530e32b 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -170,7 +170,7 @@ int BKE_sound_scene_playing(struct Scene *scene); void BKE_sound_free_waveform(struct bSound *sound); -void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, short *stop); +void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, bool *stop); void BKE_sound_update_scene(struct Depsgraph *depsgraph, struct Scene *scene); diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index 89f30ce8ef8..70c1049b5d7 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -657,8 +657,8 @@ void BKE_tracking_reconstruction_context_free(struct MovieReconstructContext *co * callback in libmv side and passing to an interface. */ void BKE_tracking_reconstruction_solve(struct MovieReconstructContext *context, - short *stop, - short *do_update, + bool *stop, + bool *do_update, float *progress, char *stats_message, int message_size); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index b9cec17b6e0..e0ae3f42be6 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2790,7 +2790,7 @@ static bool dynamicPaint_symmetrizeAdjData(PaintAdjData *ed, int active_points) int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, float *progress, - short *do_update) + bool *do_update) { /* Antialias jitter point relative coords */ const int aa_samples = (surface->flags & MOD_DPAINT_ANTIALIAS) ? 5 : 1; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 1aef42ef037..51a20cf1e35 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -1025,7 +1025,7 @@ void BKE_sound_free_waveform(bSound *sound) sound->tags &= ~SOUND_TAGS_WAVEFORM_NO_RELOAD; } -void BKE_sound_read_waveform(Main *bmain, bSound *sound, short *stop) +void BKE_sound_read_waveform(Main *bmain, bSound *sound, bool *stop) { bool need_close_audio_handles = false; if (sound->playback_handle == NULL) { @@ -1041,8 +1041,11 @@ void BKE_sound_read_waveform(Main *bmain, bSound *sound, short *stop) int length = info.length * SOUND_WAVE_SAMPLES_PER_SECOND; waveform->data = MEM_mallocN(sizeof(float[3]) * length, "SoundWaveform.samples"); + /* Ideally this would take a boolean argument. */ + short stop_i16 = *stop; waveform->length = AUD_readSound( - sound->playback_handle, waveform->data, length, SOUND_WAVE_SAMPLES_PER_SECOND, stop); + sound->playback_handle, waveform->data, length, SOUND_WAVE_SAMPLES_PER_SECOND, &stop_i16); + *stop = stop_i16 != 0; } else { /* Create an empty waveform here if the sound couldn't be @@ -1381,7 +1384,7 @@ int BKE_sound_scene_playing(Scene *UNUSED(scene)) void BKE_sound_read_waveform(Main *bmain, bSound *sound, /* NOLINTNEXTLINE: readability-non-const-parameter. */ - short *stop) + bool *stop) { UNUSED_VARS(sound, stop, bmain); } diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c index 11041b4c0fd..e784c39ba08 100644 --- a/source/blender/blenkernel/intern/tracking_solver.c +++ b/source/blender/blenkernel/intern/tracking_solver.c @@ -56,8 +56,8 @@ typedef struct MovieReconstructContext { } MovieReconstructContext; typedef struct ReconstructProgressData { - short *stop; - short *do_update; + bool *stop; + bool *do_update; float *progress; char *stats_message; int message_size; @@ -465,8 +465,8 @@ static void reconstructionOptionsFromContext(libmv_ReconstructionOptions *recons } void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, - short *stop, - short *do_update, + bool *stop, + bool *do_update, float *progress, char *stats_message, int message_size) diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index 9bf0cce2af2..26a264c1716 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -142,7 +142,7 @@ typedef struct EEVEE_LightBake { struct GPUTexture *dummy_layer_color; int total, done; /* to compute progress */ - short *stop, *do_update; + bool *stop, *do_update; float *progress; /** For only handling the resources. */ @@ -778,7 +778,7 @@ wmJob *EEVEE_lightbake_job_create(struct wmWindowManager *wm, } if (old_lbake->stop != NULL) { - *old_lbake->stop = 1; + *old_lbake->stop = true; } BLI_mutex_unlock(old_lbake->mutex); } @@ -1359,13 +1359,13 @@ static bool lightbake_do_sample(EEVEE_LightBake *lbake, DRW_custom_pipeline(&draw_engine_eevee_type, depsgraph, render_callback, lbake); lbake->done += 1; *lbake->progress = lbake->done / (float)lbake->total; - *lbake->do_update = 1; + *lbake->do_update = true; eevee_lightbake_context_disable(lbake); return true; } -void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float *progress) +void EEVEE_lightbake_job(void *custom_data, bool *stop, bool *do_update, float *progress) { EEVEE_LightBake *lbake = (EEVEE_LightBake *)custom_data; Depsgraph *depsgraph = lbake->depsgraph; @@ -1394,8 +1394,8 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float /* Resource allocation can fail. Early exit in this case. */ if (lbake->lcache->flag & LIGHTCACHE_INVALID) { - *lbake->stop = 1; - *lbake->do_update = 1; + *lbake->stop = true; + *lbake->do_update = true; lbake->lcache->flag &= ~LIGHTCACHE_BAKING; eevee_lightbake_context_disable(lbake); eevee_lightbake_delete_resources(lbake); diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.h b/source/blender/draw/engines/eevee/eevee_lightcache.h index 4e94e1914a7..73961f1919d 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.h +++ b/source/blender/draw/engines/eevee/eevee_lightcache.h @@ -42,7 +42,7 @@ void *EEVEE_lightbake_job_data_alloc(struct Main *bmain, int frame); void EEVEE_lightbake_job_data_free(void *custom_data); void EEVEE_lightbake_update(void *custom_data); -void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float *progress); +void EEVEE_lightbake_job(void *custom_data, bool *stop, bool *do_update, float *progress); /** * This is to update the world irradiance and reflection contribution from diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c index 40b05dff51f..85701a10f4b 100644 --- a/source/blender/draw/intern/draw_manager_shader.c +++ b/source/blender/draw/intern/draw_manager_shader.c @@ -64,8 +64,8 @@ static void drw_deferred_shader_compilation_exec( void *custom_data, /* Cannot be const, this function implements wm_jobs_start_callback. * NOLINTNEXTLINE: readability-non-const-parameter. */ - short *stop, - short *UNUSED(do_update), + bool *stop, + bool *UNUSED(do_update), float *UNUSED(progress)) { GPU_render_begin(); diff --git a/source/blender/editors/gpencil/gpencil_trace_ops.c b/source/blender/editors/gpencil/gpencil_trace_ops.c index 36165c6b7c0..1a18e10412e 100644 --- a/source/blender/editors/gpencil/gpencil_trace_ops.c +++ b/source/blender/editors/gpencil/gpencil_trace_ops.c @@ -45,7 +45,7 @@ typedef struct TraceJob { /* from wmJob */ struct Object *owner; - short *stop, *do_update; + bool *stop, *do_update; float *progress; bContext *C; @@ -198,7 +198,7 @@ static void trace_initialize_job_data(TraceJob *trace_job) } } -static void trace_start_job(void *customdata, short *stop, short *do_update, float *progress) +static void trace_start_job(void *customdata, bool *stop, bool *do_update, float *progress) { TraceJob *trace_job = customdata; @@ -257,7 +257,7 @@ static void trace_start_job(void *customdata, short *stop, short *do_update, flo trace_job->success = !trace_job->was_canceled; *do_update = true; - *stop = 0; + *stop = false; } static void trace_end_job(void *customdata) @@ -339,7 +339,7 @@ static int gpencil_trace_image_exec(bContext *C, wmOperator *op) ED_object_base_activate(job->C, job->base_active); if ((job->image->source == IMA_SRC_FILE) || (job->frame_num > 0)) { - short stop = 0, do_update @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs