From c2b2ff1d0dd3fa976278f07064594dde9f2dfee6 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Fri, 3 Jun 2022 19:04:53 -0600 Subject: [PATCH] cppcheck fixes discovered by Andrew --- cinelerra-5.1/cinelerra/cropvideo.C | 2 ++ cinelerra-5.1/cinelerra/dbwindow.C | 4 ++-- cinelerra-5.1/cinelerra/formatwindow.C | 6 ++++++ cinelerra-5.1/cinelerra/pluginmessages.h | 26 ++++++++++++------------ cinelerra-5.1/cinelerra/pluginprefs.C | 2 ++ cinelerra-5.1/cinelerra/recordengine.C | 20 ++++++++++++++++++ cinelerra-5.1/cinelerra/scale.C | 10 +++++++++ 7 files changed, 55 insertions(+), 15 deletions(-) diff --git a/cinelerra-5.1/cinelerra/cropvideo.C b/cinelerra-5.1/cinelerra/cropvideo.C index 72aa0b9d..08adc485 100644 --- a/cinelerra-5.1/cinelerra/cropvideo.C +++ b/cinelerra-5.1/cinelerra/cropvideo.C @@ -87,10 +87,12 @@ void CropVideo::run() int CropVideo::load_defaults() { +return 0; } int CropVideo::save_defaults() { +return 0; } CropVideoWindow::CropVideoWindow(MWindow *mwindow, CropVideo *thread) diff --git a/cinelerra-5.1/cinelerra/dbwindow.C b/cinelerra-5.1/cinelerra/dbwindow.C index 98070234..4bf9d0ca 100644 --- a/cinelerra-5.1/cinelerra/dbwindow.C +++ b/cinelerra-5.1/cinelerra/dbwindow.C @@ -840,8 +840,8 @@ DbWindowItem(int id, const char *source, const char *title, DbWindowItem:: ~DbWindowItem() { - delete source; - delete title; + delete [] source; + delete [] title; } #define CmprFn(nm,key) int DbWindowGUI:: \ diff --git a/cinelerra-5.1/cinelerra/formatwindow.C b/cinelerra-5.1/cinelerra/formatwindow.C index 67f7416d..c3726c3c 100644 --- a/cinelerra-5.1/cinelerra/formatwindow.C +++ b/cinelerra-5.1/cinelerra/formatwindow.C @@ -142,6 +142,7 @@ FormatQuality::~FormatQuality() int FormatQuality::handle_event() { asset->quality = get_value(); +return 0; } @@ -152,6 +153,7 @@ FormatBits::~FormatBits() {} int FormatBits::handle_event() { asset->bits = get_bits(); +return 0; } @@ -162,6 +164,7 @@ FormatDither::~FormatDither() {} int FormatDither::handle_event() { *dither = get_value(); +return 0; } @@ -174,6 +177,7 @@ FormatSigned::~FormatSigned() {} int FormatSigned::handle_event() { asset->signed_ = get_value(); +return 0; } @@ -188,6 +192,7 @@ int FormatHILO::handle_event() { asset->byte_order = get_value() ^ 1; lohi->update(get_value() ^ 1); +return 0; } FormatLOHI::FormatLOHI(int x, int y, FormatHILO *hilo, Asset *asset) @@ -202,5 +207,6 @@ int FormatLOHI::handle_event() { asset->byte_order = get_value(); hilo->update(get_value() ^ 1); +return 0; } diff --git a/cinelerra-5.1/cinelerra/pluginmessages.h b/cinelerra-5.1/cinelerra/pluginmessages.h index f45c9bd1..0a63dd90 100644 --- a/cinelerra-5.1/cinelerra/pluginmessages.h +++ b/cinelerra-5.1/cinelerra/pluginmessages.h @@ -32,19 +32,19 @@ public: PluginMessages(int input_flag, int output_flag, int message_id = -1); ~PluginMessages(); - send_message(char *text); - receive_message(char *text); - - send_message(int command, char *text); - send_message(long command, long value); - send_message(long command, long value1, long value2); - send_message(int command); - - receive_message(); // returns the command - receive_message(int *command, char *text); - receive_message(int *command, long *value); - receive_message(long *value1, long *value2); - receive_message(int *command, long *value1, long *value2); + void send_message(char *text); + void receive_message(char *text); + + void send_message(int command, char *text); + void send_message(long command, long value); + void send_message(long command, long value1, long value2); + void send_message(int command); + + void receive_message(); // returns the command + void receive_message(int *command, char *text); + void receive_message(int *command, long *value); + void receive_message(long *value1, long *value2); + void receive_message(int *command, long *value1, long *value2); Messages *messages; int input_flag, output_flag; diff --git a/cinelerra-5.1/cinelerra/pluginprefs.C b/cinelerra-5.1/cinelerra/pluginprefs.C index 2a3f7878..b8167bb2 100644 --- a/cinelerra-5.1/cinelerra/pluginprefs.C +++ b/cinelerra-5.1/cinelerra/pluginprefs.C @@ -93,6 +93,7 @@ PluginGlobalPathText::~PluginGlobalPathText() {} int PluginGlobalPathText::handle_event() { strcpy(pwindow->thread->preferences->global_plugin_dir, get_text()); +return 0; } @@ -110,4 +111,5 @@ PluginLocalPathText::~PluginLocalPathText() {} int PluginLocalPathText::handle_event() { strcpy(pwindow->thread->preferences->local_plugin_dir, get_text()); +return 0; } diff --git a/cinelerra-5.1/cinelerra/recordengine.C b/cinelerra-5.1/cinelerra/recordengine.C index 2fb14891..9e604596 100644 --- a/cinelerra-5.1/cinelerra/recordengine.C +++ b/cinelerra-5.1/cinelerra/recordengine.C @@ -127,6 +127,7 @@ int RecordEngine::initialize() current_jump_jumps[2] = 60; current_jump_jumps[3] = 80; current_jump_jumps[4] = 100; +return 0; } int RecordEngine::run_script(FileXML *script) @@ -199,6 +200,7 @@ long RecordEngine::get_dc_offset(int offset) int RecordEngine::set_dc_offset(long new_offset, int number) { adevice->set_dc_offset(new_offset, number); +return 0; } long int RecordEngine::get_dc_offset(long *dc_offset, RecordGUIDCOffsetText **dc_offset_text) @@ -210,6 +212,7 @@ int RecordEngine::set_gui(RecordGUI *gui) { this->gui = gui; update_position(current_position); +return 0; } int RecordEngine::get_duplex_enable() @@ -491,11 +494,13 @@ int RecordEngine::close_output_devices() int RecordEngine::lock_window() { gui->lock_window(); +return 0; } int RecordEngine::unlock_window() { gui->unlock_window(); +return 0; } int RecordEngine::update_position(long new_position) @@ -523,6 +528,7 @@ int RecordEngine::update_position(long new_position) gui->update_next_label(next_label); } +return 0; } int RecordEngine::goto_prev_label() @@ -540,6 +546,7 @@ int RecordEngine::goto_prev_label() update_position(new_position); } } +return 0; } int RecordEngine::goto_next_label() @@ -588,6 +595,7 @@ int RecordEngine::calibrate_dc_offset(long new_value, int channel) int RecordEngine::reset_over() { +return 0; } int RecordEngine::set_done(int value) @@ -595,6 +603,7 @@ int RecordEngine::set_done(int value) stop_operation(1); stop_monitor(); gui->set_done(value); +return 0; } int RecordEngine::start_over() @@ -623,6 +632,7 @@ int RecordEngine::start_over() record->startsource_frame = 0; } } +return 0; } int RecordEngine::change_channel(Channel *channel) @@ -648,6 +658,7 @@ int RecordEngine::get_format(char *string) { File file; strcpy(string, file.formattostr(mwindow->plugindb, asset->format)); + return 0; } int RecordEngine::get_samplerate() { return asset->rate; } int RecordEngine::get_bits() { return asset->bits; } @@ -665,25 +676,30 @@ float RecordEngine::get_frames_per_foot() { /* return mwindow->preferences->fram int RecordEngine::set_monitor_video(int value) { +return 0; } int RecordEngine::set_monitor_audio(int value) { +return 0; } int RecordEngine::set_record_mode(char *text) { record->record_mode = text_to_mode(text); +return 0; } int RecordEngine::get_record_mode(char *text) { mode_to_text(text, record->record_mode); +return 0; } int RecordEngine::get_record_mode() { return record->record_mode; +return 0; } int RecordEngine::mode_to_text(char *string, int mode) @@ -694,6 +710,7 @@ int RecordEngine::mode_to_text(char *string, int mode) case 1: sprintf(string, _("Timed")); break; case 2: sprintf(string, _("Loop")); break; } +return 0; } int RecordEngine::text_to_mode(char *string) @@ -701,6 +718,7 @@ int RecordEngine::text_to_mode(char *string) if(!strcasecmp(string, _("Untimed"))) return 0; if(!strcasecmp(string, _("Timed"))) return 1; if(!strcasecmp(string, _("Loop"))) return 2; +return 0; } long RecordEngine::get_current_delay() @@ -718,11 +736,13 @@ int RecordEngine::reset_current_delay() { current_jump_delay = 0; current_jump_jump = current_jump_jumps[current_jump_delay]; +return 0; } int RecordEngine::set_loop_duration() { record->set_loop_duration((long)record->get_samplerate() * (atol(gui->loop_sec->get_text()) + atol(gui->loop_min->get_text()) * 60 + atol(gui->loop_hr->get_text()) * 3600)); +return 0; } diff --git a/cinelerra-5.1/cinelerra/scale.C b/cinelerra-5.1/cinelerra/scale.C index 860c46fb..7d682bcb 100644 --- a/cinelerra-5.1/cinelerra/scale.C +++ b/cinelerra-5.1/cinelerra/scale.C @@ -47,6 +47,7 @@ Scale::~Scale() int Scale::handle_event() { thread->start(); +return 0; } ScaleThread::ScaleThread(MWindow *mwindow) @@ -189,6 +190,7 @@ int ScaleThread::update_aspect(ScaleWindow *window) sprintf(string, "%.0f", aspect_h); window->aspect_h->update(string); } +return 0; } @@ -307,6 +309,7 @@ int ScaleSizeText::handle_event() if(*output > 10000) *output = 10000; *output *= -1; thread->update_window(); +return 0; } ScaleOffsetText::ScaleOffsetText(int x, int y, ScaleThread *thread, int *output) @@ -320,6 +323,7 @@ int ScaleOffsetText::handle_event() if(*output > 10000) *output = 10000; if(*output < -10000) *output = -10000; thread->update_window(1); +return 0; } ScaleRatioText::ScaleRatioText(int x, int y, ScaleThread *thread, float *output) @@ -334,6 +338,7 @@ int ScaleRatioText::handle_event() if(*output < -10000) *output = -10000; *output *= -1; thread->update_window(); +return 0; } @@ -346,6 +351,7 @@ ScaleConstrain::~ScaleConstrain() {} int ScaleConstrain::handle_event() { thread->constrain_ratio = get_value(); +return 0; } ScaleData::ScaleData(int x, int y, ScaleThread *thread) @@ -356,6 +362,7 @@ int ScaleData::handle_event() { thread->scale_data = get_value(); thread->update_window(); +return 0; } @@ -371,6 +378,7 @@ int ScaleAspectAuto::handle_event() { thread->auto_aspect = get_value(); thread->update_aspect(thread->window); +return 0; } @@ -389,6 +397,7 @@ ScaleAspectW::~ScaleAspectW() int ScaleAspectW::handle_event() { *output = atof(get_text()); +return 0; } @@ -405,6 +414,7 @@ ScaleAspectH::~ScaleAspectH() int ScaleAspectH::handle_event() { *output = atof(get_text()); +return 0; } -- 2.26.2