From 52650784331844f8a92c5e9c4ba443a468743867 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 May 2022 13:27:22 -0400 Subject: Suppress new warnings in clang-tidy 13 --- plugins/eg-metro.lv2/metro.c | 4 ++-- plugins/eg-params.lv2/state_map.h | 2 +- plugins/eg-sampler.lv2/sampler_ui.c | 8 ++++++-- plugins/eg-scope.lv2/examploscope.c | 5 +++-- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/eg-metro.lv2/metro.c b/plugins/eg-metro.lv2/metro.c index 7ffea24..264f2c7 100644 --- a/plugins/eg-metro.lv2/metro.c +++ b/plugins/eg-metro.lv2/metro.c @@ -212,7 +212,7 @@ static void play(Metro* self, uint32_t begin, uint32_t end) { float* const output = self->ports.output; - const uint32_t frames_per_beat = 60.0f / self->bpm * self->rate; + const uint32_t frames_per_beat = (uint32_t)(60.0f / self->bpm * self->rate); if (self->speed == 0.0f) { memset(output, 0, (end - begin) * sizeof(float)); @@ -289,7 +289,7 @@ update_position(Metro* self, const LV2_Atom_Object* obj) const float frames_per_beat = (float)(60.0 / self->bpm * self->rate); const float bar_beats = ((LV2_Atom_Float*)beat)->body; const float beat_beats = bar_beats - floorf(bar_beats); - self->elapsed_len = beat_beats * frames_per_beat; + self->elapsed_len = (uint32_t)(beat_beats * frames_per_beat); if (self->elapsed_len < self->attack_len) { self->state = STATE_ATTACK; } else if (self->elapsed_len < self->attack_len + self->decay_len) { diff --git a/plugins/eg-params.lv2/state_map.h b/plugins/eg-params.lv2/state_map.h index f534f60..4a00d2f 100644 --- a/plugins/eg-params.lv2/state_map.h +++ b/plugins/eg-params.lv2/state_map.h @@ -48,7 +48,7 @@ state_map_cmp(const void* a, const void* b) /** Helper macro for terse state map initialisation. */ #define STATE_MAP_INIT(type, ptr) \ - (LV2_ATOM__##type), (sizeof(*ptr) - sizeof(LV2_Atom)), (ptr) + (LV2_ATOM__##type), (sizeof(*(ptr)) - sizeof(LV2_Atom)), (ptr) /** Initialise a state map. diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c index 533e720..630fc22 100644 --- a/plugins/eg-sampler.lv2/sampler_ui.c +++ b/plugins/eg-sampler.lv2/sampler_ui.c @@ -365,7 +365,7 @@ port_event(LV2UI_Handle handle, const LV2_Atom_Object* obj = (const LV2_Atom_Object*)atom; if (obj->body.otype == ui->uris.patch_Set) { const char* path = read_set_file(&ui->uris, obj); - if (path && (!ui->filename || strcmp(path, ui->filename))) { + if (path && (!ui->filename || !!strcmp(path, ui->filename))) { g_free(ui->filename); ui->filename = g_strdup(path); gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(ui->file_button), @@ -447,11 +447,15 @@ extension_data(const char* uri) { static const LV2UI_Show_Interface show = {ui_show, ui_hide}; static const LV2UI_Idle_Interface idle = {ui_idle}; + if (!strcmp(uri, LV2_UI__showInterface)) { return &show; - } else if (!strcmp(uri, LV2_UI__idleInterface)) { + } + + if (!strcmp(uri, LV2_UI__idleInterface)) { return &idle; } + return NULL; } diff --git a/plugins/eg-scope.lv2/examploscope.c b/plugins/eg-scope.lv2/examploscope.c index ec013a1..8bc4ca1 100644 --- a/plugins/eg-scope.lv2/examploscope.c +++ b/plugins/eg-scope.lv2/examploscope.c @@ -249,7 +249,7 @@ run(LV2_Handle handle, uint32_t n_samples) // Add UI state as properties lv2_atom_forge_key(&self->forge, self->uris.ui_spp); - lv2_atom_forge_int(&self->forge, self->ui_spp); + lv2_atom_forge_int(&self->forge, (int32_t)self->ui_spp); lv2_atom_forge_key(&self->forge, self->uris.ui_amp); lv2_atom_forge_float(&self->forge, self->ui_amp); lv2_atom_forge_key(&self->forge, self->uris.param_sampleRate); @@ -295,7 +295,8 @@ run(LV2_Handle handle, uint32_t n_samples) for (uint32_t c = 0; c < self->n_channels; ++c) { if (self->ui_active) { // If UI is active, send raw audio data to UI - tx_rawaudio(&self->forge, &self->uris, c, n_samples, self->input[c]); + tx_rawaudio( + &self->forge, &self->uris, (int32_t)c, n_samples, self->input[c]); } // If not processing audio in-place, forward audio if (self->input[c] != self->output[c]) { -- cgit v1.2.1