|
![](/i/fill.gif) |
In article <chrishuff-DDBC53.06140904112000@news.povray.org>, Chris
Huff <chr### [at] mac com> wrote:
> I'm having a hard time getting it to work though...I suspect the problem
> is in my parsing code, though I'm not sure why it is misbehaving.
I found the problem, a rather nasty bug in Copy_Spline(). It allocates
room for the spline data, but doesn't copy the old data to the new
spline. I have no idea how this wasn't noticed before...the fixed
version is below(all that was needed was the addition of one line, the
call to memcpy()). I am still not sure it is right, I have never used
memcpy() before, but it works. :-)
SPLINE2 * Copy_Spline(SPLINE2 * se)
{
SPLINE2 * New;
New = (SPLINE2 *)POV_MALLOC(sizeof(SPLINE2), "spline");
New->SplineEntries =
POV_MALLOC(se->Number_Of_Entries*sizeof(SPLINE_ENTRY), "spline entry");
memcpy(New->SplineEntries, se->SplineEntries,
se->Number_Of_Entries*sizeof(SPLINE_ENTRY));
New->Number_Of_Entries = se->Number_Of_Entries;
New->Type = se->Type;
return New;
}
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |