diff options
author | David Robillard <d@drobilla.net> | 2020-12-16 16:54:00 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-16 16:54:00 +0100 |
commit | 326ecdf238921dc12645f2c31f4882499a387aa0 (patch) | |
tree | 124fc0bd4c96204f7587ec20bdde70221f19ca24 /plugins/eg-scope.lv2 | |
parent | bf4ceb41a88f9adcaa5ec77db6e37f904c43d158 (diff) | |
download | lv2-326ecdf238921dc12645f2c31f4882499a387aa0.tar.xz |
Add assertions for atom buffer sizes
This avoids warnings about potential null pointer dereferences, which is true,
but in this case the buffer are static so it's really a programming error if
there is ever an overrun.
Diffstat (limited to 'plugins/eg-scope.lv2')
-rw-r--r-- | plugins/eg-scope.lv2/examploscope_ui.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/eg-scope.lv2/examploscope_ui.c b/plugins/eg-scope.lv2/examploscope_ui.c index 48ffec4..32584a4 100644 --- a/plugins/eg-scope.lv2/examploscope_ui.c +++ b/plugins/eg-scope.lv2/examploscope_ui.c @@ -105,6 +105,8 @@ send_ui_state(LV2UI_Handle handle) LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_object( &ui->forge, &frame, 0, ui->uris.ui_State); + assert(msg); + // msg[samples-per-pixel] = integer lv2_atom_forge_key(&ui->forge, ui->uris.ui_spp); lv2_atom_forge_int(&ui->forge, ui->stride); @@ -137,6 +139,9 @@ send_ui_disable(LV2UI_Handle handle) LV2_Atom_Forge_Frame frame; LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_object( &ui->forge, &frame, 0, ui->uris.ui_Off); + + assert(msg); + lv2_atom_forge_pop(&ui->forge, &frame); ui->write(ui->controller, 0, @@ -161,6 +166,9 @@ send_ui_enable(LV2UI_Handle handle) LV2_Atom_Forge_Frame frame; LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_object( &ui->forge, &frame, 0, ui->uris.ui_On); + + assert(msg); + lv2_atom_forge_pop(&ui->forge, &frame); ui->write(ui->controller, 0, |