[PD-dev] [ pure-data-Patches-2317572 ] [bugfix] garray_resize should use int

SourceForge.net noreply at sourceforge.net
Tue Aug 3 05:41:26 CEST 2010


Patches item #2317572, was opened at 2008-11-20 05:49
Message generated for change (Comment added) made by millerpuckette
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=2317572&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: bugfix
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: IOhannes m zmlnig (zmoelnig)
Assigned to: Miller Puckette (millerpuckette)
Summary: [bugfix] garray_resize should use int

Initial Comment:
currently the function to resize arrays is "garray_resize(t_garray *x, t_floatarg f)".
using "float32" as resize-arguments is a bad idea, especially in comparision to "garray_getfloatwords(t_garray *x, int *size, t_word **vec)".

a real problem occured when using [soundfiler] with "-resize" (and "-maxsize") for bigger soundfiles: soundfiler refused to load a soundfile into an array, because resizing "failed".
the "failure" was due to passing the wantedsize to resize() in float32 (losing precision) and then comparing the wantedsize with the gotsize (in int32).
since the sizes differed, [soundfiler] would issue a "resize failed".

the attached patch changes the resize-function to "garray_resize(t_garray *x, int size)".

this might be a bit problematic, as this function is exposed in m_pd.h and thus might break binary compatibility with externals.

an alternative (though not as elegant, imho) solution would be to add another method garray_resize_i() and use this new function throughout internally.

----------------------------------------------------------------------

>Comment By: Miller Puckette (millerpuckette)
Date: 2010-08-02 20:41

Message:
renamed it garray_resize_long to keep garray_resize backward compatible.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=2317572&group_id=55736



More information about the Pd-dev mailing list