diff options
author | David Robillard <d@drobilla.net> | 2025-02-10 15:27:55 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2025-02-10 15:47:54 -0500 |
commit | 4285fab0c0b14cbbcf9ddbe29d274c0c55a04edd (patch) | |
tree | bbb72e2cf7df6072f4fed15b140a0e6c5b8af7a5 | |
parent | 3e1e609d89fb1954bd497ae8021a3b6c0aad31f6 (diff) | |
download | lv2-4285fab0c0b14cbbcf9ddbe29d274c0c55a04edd.tar.xz |
-rw-r--r-- | include/lv2/atom/forge.h | 2 | ||||
-rw-r--r-- | include/lv2/atom/util.h | 2 | ||||
-rw-r--r-- | plugins/eg-sampler.lv2/sampler_ui.c | 4 | ||||
-rw-r--r-- | plugins/eg-scope.lv2/examploscope_ui.c | 14 | ||||
-rw-r--r-- | test/test_forge_overflow.c | 8 |
5 files changed, 15 insertions, 15 deletions
diff --git a/include/lv2/atom/forge.h b/include/lv2/atom/forge.h index b9dff85..58b7512 100644 --- a/include/lv2/atom/forge.h +++ b/include/lv2/atom/forge.h @@ -492,7 +492,7 @@ lv2_atom_forge_vector(LV2_Atom_Forge* forge, const void* elems) { const LV2_Atom_Vector a = { - {(uint32_t)sizeof(LV2_Atom_Vector_Body) + n_elems * child_size, + {(uint32_t)sizeof(LV2_Atom_Vector_Body) + (n_elems * child_size), forge->Vector}, {child_size, child_type}}; const LV2_Atom_Forge_Ref out = lv2_atom_forge_write(forge, &a, sizeof(a)); diff --git a/include/lv2/atom/util.h b/include/lv2/atom/util.h index 4b9e80d..9a3d8a3 100644 --- a/include/lv2/atom/util.h +++ b/include/lv2/atom/util.h @@ -251,7 +251,7 @@ static inline LV2_Atom_Property_Body* lv2_atom_object_next(const LV2_Atom_Property_Body* i) { const LV2_Atom* const value = - (const LV2_Atom*)((const uint8_t*)i + 2 * sizeof(uint32_t)); + (const LV2_Atom*)((const uint8_t*)i + (2 * sizeof(uint32_t))); return (LV2_Atom_Property_Body*)((const uint8_t*)i + lv2_atom_pad_size( (uint32_t)sizeof(LV2_Atom_Property_Body) + diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c index b02082a..769dde0 100644 --- a/plugins/eg-sampler.lv2/sampler_ui.c +++ b/plugins/eg-sampler.lv2/sampler_ui.c @@ -183,13 +183,13 @@ on_canvas_expose(GtkWidget* widget, GdkEventExpose* event, gpointer data) // Draw line through top peaks for (int i = 0; i < n_peaks; ++i) { const float peak = peaks[i]; - cairo_line_to(cr, i * scale, mid_y + (peak / 2.0f) * size.height); + cairo_line_to(cr, i * scale, mid_y + ((peak / 2.0f) * size.height)); } // Continue through bottom peaks for (int i = n_peaks - 1; i >= 0; --i) { const float peak = peaks[i]; - cairo_line_to(cr, i * scale, mid_y - (peak / 2.0f) * size.height); + cairo_line_to(cr, i * scale, mid_y - ((peak / 2.0f) * size.height)); } // Close shape diff --git a/plugins/eg-scope.lv2/examploscope_ui.c b/plugins/eg-scope.lv2/examploscope_ui.c index 2ad42dc..50b8f4c 100644 --- a/plugins/eg-scope.lv2/examploscope_ui.c +++ b/plugins/eg-scope.lv2/examploscope_ui.c @@ -220,10 +220,10 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) * - (DAHEIGHT / 2) * (VAL) * (GAIN) * ) */ - const float chn_y_offset = DAHEIGHT * c + DAHEIGHT * 0.5f - 0.5f; - const float chn_y_scale = DAHEIGHT * 0.5f * gain; + const float chn_y_offset = (DAHEIGHT * c) + (DAHEIGHT * 0.5f) - 0.5f; + const float chn_y_scale = (DAHEIGHT * 0.5f) * gain; -#define CYPOS(VAL) (chn_y_offset - (VAL) * chn_y_scale) +#define CYPOS(VAL) (chn_y_offset - ((VAL) * chn_y_scale)) cairo_save(cr); @@ -293,15 +293,15 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) // Channel separator if (c > 0) { cairo_set_source_rgba(cr, .5, .5, .5, 1.0); - cairo_move_to(cr, 0, DAHEIGHT * c - .5); - cairo_line_to(cr, DAWIDTH, DAHEIGHT * c - .5); + cairo_move_to(cr, 0, (DAHEIGHT * c) - .5); + cairo_line_to(cr, DAWIDTH, (DAHEIGHT * c) - .5); cairo_stroke(cr); } // Zero scale line cairo_set_source_rgba(cr, .3, .3, .7, .5); - cairo_move_to(cr, 0, DAHEIGHT * (c + .5) - .5); - cairo_line_to(cr, DAWIDTH, DAHEIGHT * (c + .5) - .5); + cairo_move_to(cr, 0, (DAHEIGHT * (c + .5)) - .5); + cairo_line_to(cr, DAWIDTH, (DAHEIGHT * (c + .5)) - .5); cairo_stroke(cr); } diff --git a/test/test_forge_overflow.c b/test/test_forge_overflow.c index 8f6ee03..7e97ae4 100644 --- a/test/test_forge_overflow.c +++ b/test/test_forge_overflow.c @@ -90,7 +90,7 @@ test_literal_overflow(void) static int test_sequence_overflow(void) { - static const size_t size = sizeof(LV2_Atom_Sequence) + 6 * sizeof(LV2_Atom); + static const size_t size = sizeof(LV2_Atom_Sequence) + (6 * sizeof(LV2_Atom)); LV2_URID_Map map = {NULL, urid_map}; // Test over a range that fails in the sequence header and event components @@ -121,7 +121,7 @@ test_sequence_overflow(void) static int test_vector_head_overflow(void) { - static const size_t size = sizeof(LV2_Atom_Vector) + 3 * sizeof(LV2_Atom); + static const size_t size = sizeof(LV2_Atom_Vector) + (3 * sizeof(LV2_Atom)); LV2_URID_Map map = {NULL, urid_map}; // Test over a range that fails in the vector header and elements @@ -154,7 +154,7 @@ test_vector_head_overflow(void) static int test_vector_overflow(void) { - static const size_t size = sizeof(LV2_Atom_Vector) + 3 * sizeof(LV2_Atom); + static const size_t size = sizeof(LV2_Atom_Vector) + (3 * sizeof(LV2_Atom)); static const int32_t vec[] = {1, 2, 3}; LV2_URID_Map map = {NULL, urid_map}; @@ -181,7 +181,7 @@ test_vector_overflow(void) static int test_tuple_overflow(void) { - static const size_t size = sizeof(LV2_Atom_Tuple) + 3 * sizeof(LV2_Atom); + static const size_t size = sizeof(LV2_Atom_Tuple) + (3 * sizeof(LV2_Atom)); LV2_URID_Map map = {NULL, urid_map}; // Test over a range that fails in the tuple header and elements |