[LV2] [PATCH 1/5] add eg05-scope example plugin

Robin Gareus robin at gareus.org
Fri Dec 20 11:20:23 PST 2013


On 12/15/2013 10:00 PM, David Robillard wrote:
> On Mon, 2013-12-09 at 20:41 +0100, Robin Gareus wrote:
> [...]
>>  plugins/eg05-scope.lv2/examploscope_ui.c   |  629 ++++++++++++++++++++++++++++
> 
> There seems to be broken atom logic in this code:
> 
> if (/* ... */
>     2 == lv2_atom_object_get(obj,
>                              ui->uris.channelID, &a0,
>                              ui->uris.audioData, &a1,
>                              NULL)
>     && a0->type == ui->uris.atom_Int
>     && a1->type == ui->uris.atom_Vector) {
>     /* ... */
>     
>     LV2_Atom_Vector* vof = (LV2_Atom_Vector*)LV2_ATOM_BODY(a1);
> 
> So, a1 is a atom_Vector, but you're casting the *body* of that atom to
> LV2_Atom_Vector, which includes an atom header.  I think the subsequent
> size calculation and getting of floats is incorrect and bad data is
> being passed to the drawing functions.

Think again :) ..and if in doubt just printf() it.

The ->size of the LV2_Atom is only about the payload and does not
include the header itself in the count. The original version was
correct. fix attached.

Cheers!
robin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eg05-fix_nelem_calc.diff
Type: text/x-patch
Size: 615 bytes
Desc: not available
URL: <http://lists.lv2plug.in/pipermail/devel-lv2plug.in/attachments/20131220/cd0659ed/attachment-0002.bin>


More information about the Devel mailing list