POV-Ray : Newsgroups : povray.unofficial.patches : Announce: SkyPOV 0.1 : Re: Announce: SkyPOV 0.1 Server Time
30 Jul 2024 22:22:34 EDT (-0400)
  Re: Announce: SkyPOV 0.1  
From: Chris Huff
Date: 4 Nov 2000 07:26:41
Message: <chrishuff-5D700A.07295104112000@news.povray.org>
In article <chrishuff-DDBC53.06140904112000@news.povray.org>, Chris 
Huff <chr### [at] maccom> 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] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.