Browse Source

fix various issues reported by scan-build

audio_region_bpm_change_fix
Alexandros Theodotou 11 months ago
parent
commit
ece4a65d62
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 2
      .github/workflows/msys2.yml
  2. 20
      inc/audio/track.h
  3. 1
      inc/audio/transport.h
  4. 20
      inc/utils/objects.h
  5. 16
      src/audio/engine.c
  6. 4
      src/audio/exporter.c
  7. 4
      src/audio/graph_node.c
  8. 10
      src/audio/group_target_track.c
  9. 20
      src/audio/port.c
  10. 4
      src/audio/track.c
  11. 5
      src/audio/transport.c
  12. 1
      src/gui/backend/arranger_object.c
  13. 46
      src/gui/backend/arranger_selections.c
  14. 21
      src/gui/backend/mixer_selections.c
  15. 6
      src/gui/widgets/channel_sends_expander.c
  16. 21
      src/gui/widgets/dialogs/bounce_dialog.c
  17. 22
      src/gui/widgets/dialogs/export_dialog.c
  18. 23
      src/gui/widgets/plugin_strip_expander.c
  19. 1
      src/gui/widgets/region.c
  20. 28
      src/plugins/carla/carla_discovery.c
  21. 26
      src/utils/file.c
  22. 24
      tests/plugins/carla_discovery.c

2
.github/workflows/msys2.yml

@ -75,7 +75,7 @@ jobs: @@ -75,7 +75,7 @@ jobs:
run: |
cd /c/src/zrythm-installer
meson build -Ddistro=windows10-msys
ninja -C build run-mingw-lilv mingw-carla-ucrt64-build mingw-carla-mingw32-build
ninja -C build run-mingw-lilv mingw-carla-ucrt64-build mingw-carla-mingw32-build run-mingw-libpanel
- name: Replace non-ASCII chars in TRANSLATORS
run: |
cd /c/src/zrythm

20
inc/audio/track.h

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/**
* \file

1
inc/audio/transport.h

@ -402,6 +402,7 @@ static const cyaml_schema_value_t transport_schema = { @@ -402,6 +402,7 @@ static const cyaml_schema_value_t transport_schema = {
/**
* Initialize transport
*/
NONNULL
Transport *
transport_new (AudioEngine * engine);

20
inc/utils/objects.h

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2019-2021 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2019-2021 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#ifndef __UTILS_OBJECTS_H__
#define __UTILS_OBJECTS_H__

16
src/audio/engine.c

@ -277,11 +277,13 @@ engine_process_events (AudioEngine * self) @@ -277,11 +277,13 @@ engine_process_events (AudioEngine * self)
/*g_debug ("%d EVENTS, waiting for pause", num_events);*/
EngineState state;
bool need_resume = false;
if (self->activated && num_events > 0)
{
/* pause engine */
engine_wait_for_pause (
self, &state, Z_F_FORCE);
need_resume = true;
}
/*g_debug ("waited");*/
@ -344,7 +346,7 @@ engine_process_events (AudioEngine * self) @@ -344,7 +346,7 @@ engine_process_events (AudioEngine * self)
/*g_usleep (8000);*/
/*project_validate (PROJECT);*/
if (self->activated && num_events > 0)
if (self->activated && need_resume)
{
/* continue engine */
engine_resume (self, &state);
@ -1132,22 +1134,22 @@ engine_resume ( @@ -1132,22 +1134,22 @@ engine_resume (
{
g_message ("resuming engine...");
TRANSPORT->loop = state->looping;
Transport * xport = self->transport;
xport->loop = state->looping;
if (state->playing)
{
position_update_frames_from_ticks (
&TRANSPORT->playhead_before_pause);
&xport->playhead_before_pause);
transport_move_playhead (
TRANSPORT,
&TRANSPORT->playhead_before_pause,
xport, &xport->playhead_before_pause,
F_NO_PANIC, F_NO_SET_CUE_POINT,
F_NO_PUBLISH_EVENTS);
transport_request_roll (TRANSPORT, true);
transport_request_roll (xport, true);
}
else
{
transport_request_pause (TRANSPORT, true);
transport_request_pause (xport, true);
}
g_atomic_int_set (

4
src/audio/exporter.c

@ -1,7 +1,5 @@ @@ -1,7 +1,5 @@
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/*
* Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
*/
#include "zrythm-config.h"

4
src/audio/graph_node.c

@ -266,6 +266,10 @@ process_node ( @@ -266,6 +266,10 @@ process_node (
port
== AUDIO_ENGINE->midi_editor_manual_press)
{
g_return_if_fail (
AUDIO_ENGINE
->midi_editor_manual_press
->midi_events);
midi_events_dequeue (
AUDIO_ENGINE
->midi_editor_manual_press

10
src/audio/group_target_track.c

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: © 2020-2021 Alexandros Theodotou <alex@zrythm.org>
// SPDX-FileCopyrightText: © 2020-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include <stdlib.h>
@ -24,8 +24,8 @@ group_target_track_init_loaded (Track * self) @@ -24,8 +24,8 @@ group_target_track_init_loaded (Track * self)
if (self->num_children == 0)
{
self->children_size = 1;
self->children = calloc (
(size_t) self->children_size, sizeof (int));
self->children = object_new_n (
(size_t) self->children_size, unsigned int);
}
}
@ -33,8 +33,8 @@ void @@ -33,8 +33,8 @@ void
group_target_track_init (Track * self)
{
self->children_size = 1;
self->children = calloc (
(size_t) self->children_size, sizeof (int));
self->children = object_new_n (
(size_t) self->children_size, unsigned int);
}
/**

20
src/audio/port.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "zrythm-config.h"

4
src/audio/track.c

@ -3049,6 +3049,10 @@ add_region_if_in_range ( @@ -3049,6 +3049,10 @@ add_region_if_in_range (
regions[(*count)++] = region;
return;
}
else
{
g_return_if_fail (p1 && p2);
}
/* start inside */
if (

5
src/audio/transport.c

@ -130,10 +130,7 @@ transport_new (AudioEngine * engine) @@ -130,10 +130,7 @@ transport_new (AudioEngine * engine)
self->audio_engine = engine;
self->schema_version = TRANSPORT_SCHEMA_VERSION;
if (engine)
{
engine->transport = self;
}
engine->transport = self;
// set initial total number of beats
// this is applied to the ruler

1
src/gui/backend/arranger_object.c

@ -3057,6 +3057,7 @@ arranger_object_split ( @@ -3057,6 +3057,7 @@ arranger_object_split (
size_t num_frames =
(size_t) r2_local_end.frames
* prev_r2_clip->channels;
z_return_if_fail_cmp (num_frames, >, 0);
float frames[num_frames];
dsp_copy (
&frames[0],

46
src/gui/backend/arranger_selections.c

@ -1478,12 +1478,6 @@ arranger_selections_clear ( @@ -1478,12 +1478,6 @@ arranger_selections_clear (
return;
}
int i;
TimelineSelections * ts;
ChordSelections * cs;
MidiArrangerSelections * mas;
AutomationSelections * as;
/* use caches because ts->* will be operated on. */
#define REMOVE_OBJS(sel, sc) \
{ \
@ -1491,12 +1485,12 @@ arranger_selections_clear ( @@ -1491,12 +1485,12 @@ arranger_selections_clear (
"%s", "clearing " #sc " selections"); \
int num_##sc##s = sel->num_##sc##s; \
ArrangerObject * sc##s[num_##sc##s]; \
for (i = 0; i < num_##sc##s; i++) \
for (int i = 0; i < num_##sc##s; i++) \
{ \
sc##s[i] = \
(ArrangerObject *) sel->sc##s[i]; \
} \
for (i = 0; i < num_##sc##s; i++) \
for (int i = 0; i < num_##sc##s; i++) \
{ \
ArrangerObject * sc = sc##s[i]; \
arranger_selections_remove_object ( \
@ -1516,22 +1510,34 @@ arranger_selections_clear ( @@ -1516,22 +1510,34 @@ arranger_selections_clear (
switch (self->type)
{
case TYPE (TIMELINE):
ts = (TimelineSelections *) self;
REMOVE_OBJS (ts, region);
REMOVE_OBJS (ts, scale_object);
REMOVE_OBJS (ts, marker);
{
TimelineSelections * ts =
(TimelineSelections *) self;
REMOVE_OBJS (ts, region);
REMOVE_OBJS (ts, scale_object);
REMOVE_OBJS (ts, marker);
}
break;
case TYPE (MIDI):
mas = (MidiArrangerSelections *) self;
REMOVE_OBJS (mas, midi_note);
{
MidiArrangerSelections * mas =
(MidiArrangerSelections *) self;
REMOVE_OBJS (mas, midi_note);
}
break;
case TYPE (AUTOMATION):
as = (AutomationSelections *) self;
REMOVE_OBJS (as, automation_point);
{
AutomationSelections * as =
(AutomationSelections *) self;
REMOVE_OBJS (as, automation_point);
}
break;
case TYPE (CHORD):
cs = (ChordSelections *) self;
REMOVE_OBJS (cs, chord_object);
{
ChordSelections * cs =
(ChordSelections *) self;
REMOVE_OBJS (cs, chord_object);
}
break;
case TYPE (AUDIO):
{
@ -2465,6 +2471,10 @@ arranger_selections_paste_to_pos ( @@ -2465,6 +2471,10 @@ arranger_selections_paste_to_pos (
{
g_return_if_fail (IS_ARRANGER_SELECTIONS (self));
/* FIXME this is not free'd properly and also
* its objects are directly used. its objects
* must be cloned if used and then this whole
* instance should be freed */
ArrangerSelections * clone_sel =
arranger_selections_clone (self);
g_return_if_fail (clone_sel);

21
src/gui/backend/mixer_selections.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2019-2021 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "gui/backend/event.h"
#include "gui/backend/event_manager.h"
@ -619,6 +603,7 @@ mixer_selections_clone ( @@ -619,6 +603,7 @@ mixer_selections_clone (
"failed to clone plugin %s: %s",
pl->setting->descr->name, err->message);
g_error_free_and_null (err);
mixer_selections_free (ms);
return NULL;
}
ms->slots[i] = src->slots[i];

6
src/gui/widgets/channel_sends_expander.c

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: © 2020-2021 Alexandros Theodotou <alex@zrythm.org>
// SPDX-FileCopyrightText: © 2020-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "audio/channel.h"
@ -84,7 +84,9 @@ channel_sends_expander_widget_setup ( @@ -84,7 +84,9 @@ channel_sends_expander_widget_setup (
}
}
if (track != self->track || position != self->position)
if (
track
&& (track != self->track || position != self->position))
{
/* remove children */
z_gtk_widget_destroy_all_children (

21
src/gui/widgets/dialogs/bounce_dialog.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2020-2022 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2020-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "audio/engine.h"
#include "audio/exporter.h"
@ -70,6 +54,7 @@ on_bounce_clicked ( @@ -70,6 +54,7 @@ on_bounce_clicked (
if (self->bounce_to_file)
{
/* TODO */
g_return_if_reached ();
}
else
{

22
src/gui/widgets/dialogs/export_dialog.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "audio/engine.h"
#include "audio/exporter.h"
@ -935,6 +919,8 @@ on_export_clicked ( @@ -935,6 +919,8 @@ on_export_clicked (
g_debug ("~ finished bouncing mixdown ~");
}
free (tracks);
}
/**

23
src/gui/widgets/plugin_strip_expander.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2020-2021 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2020-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "audio/channel.h"
#include "audio/track.h"
@ -102,6 +86,7 @@ void @@ -102,6 +86,7 @@ void
plugin_strip_expander_widget_refresh (
PluginStripExpanderWidget * self)
{
g_return_if_fail (self->track);
for (int i = 0; i < STRIP_SIZE; i++)
{
switch (self->slot_type)
@ -179,6 +164,8 @@ plugin_strip_expander_widget_setup ( @@ -179,6 +164,8 @@ plugin_strip_expander_widget_setup (
PluginStripExpanderPosition position,
Track * track)
{
g_return_if_fail (track);
/* set name and icon */
char fullstr[200];
bool is_midi = false;

1
src/gui/widgets/region.c

@ -1474,6 +1474,7 @@ region_draw ( @@ -1474,6 +1474,7 @@ region_draw (
arranger_object_get_arranger (obj);
Track * track = arranger_object_get_track (obj);
g_return_if_fail (IS_TRACK_AND_NONNULL (track));
/* set color */
GdkRGBA color;

28
src/plugins/carla/carla_discovery.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2020-2021 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2020-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "zrythm-config.h"
@ -525,7 +509,13 @@ z_carla_discovery_create_au_descriptor_from_string ( @@ -525,7 +509,13 @@ z_carla_discovery_create_au_descriptor_from_string (
id, plugin_info);
g_free (plugin_info);
if (!descriptors || !descriptors[0])
return NULL;
{
if (descriptors)
{
free (descriptors);
}
return NULL;
}
PluginDescriptor * descr = descriptors[0];
free (descriptors);

26
src/utils/file.c

@ -1,24 +1,11 @@ @@ -1,24 +1,11 @@
// SPDX-FileCopyrightText: © 2021 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
/*
* Copyright (C) 2021 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* ---
*
* Copyright 2007-2021 David Robillard <d@drobilla.net>
*
* Permission to use, copy, modify, and/or distribute this software for any
@ -32,6 +19,10 @@ @@ -32,6 +19,10 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* SPDX-License-Identifier: ISC
*
* ---
*/
#include "zrythm-config.h"
@ -140,6 +131,7 @@ file_symlink ( @@ -140,6 +131,7 @@ file_symlink (
char * target =
file_path_relative_to (old_path, new_path);
ret = symlink (target, new_path);
g_free (target);
#endif
return ret;

24
tests/plugins/carla_discovery.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2021 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2021-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "zrythm-test-config.h"
@ -65,13 +49,13 @@ test_mock_au_plugin_scan (void) @@ -65,13 +49,13 @@ test_mock_au_plugin_scan (void)
g_message (
"Scanned AU plugin %s",
descriptor->name);
plugin_descriptor_free (descriptor);
}
else
{
g_message ("Skipped AU plugin at %u", i);
}
plugin_descriptor_free (descriptor);
}
#endif

Loading…
Cancel
Save