From: <and...@us...> - 2011-08-03 14:40:31
|
Revision: 11846 http://plplot.svn.sourceforge.net/plplot/?rev=11846&view=rev Author: andrewross Date: 2011-08-03 14:40:25 +0000 (Wed, 03 Aug 2011) Log Message: ----------- Slightly cleaner fix to plfill. Also fix a typo bug in plfill3 which would have caused a crash for large numbers of points. Modified Paths: -------------- trunk/src/plfill.c Modified: trunk/src/plfill.c =================================================================== --- trunk/src/plfill.c 2011-08-03 14:20:40 UTC (rev 11845) +++ trunk/src/plfill.c 2011-08-03 14:40:25 UTC (rev 11846) @@ -134,7 +134,7 @@ { PLINT _xpoly[PL_MAXPOLY], _ypoly[PL_MAXPOLY]; PLINT *xpoly, *ypoly; - PLINT i; + PLINT i, npts; PLFLT xt, yt; if ( plsc->level < 3 ) @@ -147,6 +147,7 @@ plabort( "plfill: Not enough points in object" ); return; } + npts = n; if ( n > PL_MAXPOLY - 1 ) { xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof ( PLINT ) ); @@ -181,7 +182,7 @@ plP_plfclp( xpoly, ypoly, n, plsc->clpxmi, plsc->clpxma, plsc->clpymi, plsc->clpyma, plP_fill ); - if ( xpoly != _xpoly ) + if ( npts > PL_MAXPOLY - 1 ) { free( xpoly ); free( ypoly ); @@ -227,7 +228,7 @@ { tx = (PLFLT *) malloc( ( n + 1 ) * sizeof ( PLFLT ) ); ty = (PLFLT *) malloc( ( n + 1 ) * sizeof ( PLFLT ) ); - ty = (PLFLT *) malloc( ( n + 1 ) * sizeof ( PLFLT ) ); + tz = (PLFLT *) malloc( ( n + 1 ) * sizeof ( PLFLT ) ); xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof ( PLINT ) ); ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof ( PLINT ) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |