From: <and...@us...> - 2013-12-11 00:45:36
|
Revision: 12841 http://sourceforge.net/p/plplot/code/12841 Author: andrewross Date: 2013-12-11 00:45:33 +0000 (Wed, 11 Dec 2013) Log Message: ----------- Fix plscmap1l(a) and plspal so they assume the rev array is one element shorter than the coordinate arrays, consistent with the documentation and actual usage of this array. Modified Paths: -------------- trunk/src/plctrl.c Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2013-12-10 23:52:18 UTC (rev 12840) +++ trunk/src/plctrl.c 2013-12-11 00:45:33 UTC (rev 12841) @@ -698,7 +698,11 @@ if ( alt_hue_path == NULL ) plsc->cmap1cp[n].alt_hue_path = 0; else - plsc->cmap1cp[n].alt_hue_path = alt_hue_path[n]; + if ( n != npts-1 ) + plsc->cmap1cp[n].alt_hue_path = alt_hue_path[n]; + else + // Note final element is unused, so we set to zero for completeness. + plsc->cmap1cp[n].alt_hue_path = 0; } // Calculate and set color map @@ -780,7 +784,11 @@ if ( alt_hue_path == NULL ) plsc->cmap1cp[n].alt_hue_path = 0; else - plsc->cmap1cp[n].alt_hue_path = alt_hue_path[n]; + if ( n != npts-1 ) + plsc->cmap1cp[n].alt_hue_path = alt_hue_path[n]; + else + // Note final element is unused, so we set to zero for completeness. + plsc->cmap1cp[n].alt_hue_path = 0; } // Calculate and set color map @@ -1681,7 +1689,7 @@ bi = (PLINT *) malloc( (size_t) number_colors * sizeof ( PLINT ) ); a = (PLFLT *) malloc( (size_t) number_colors * sizeof ( PLFLT ) ); pos = (PLFLT *) malloc( (size_t) number_colors * sizeof ( PLFLT ) ); - alt_hue_path = (PLBOOL *) malloc( (size_t) number_colors * sizeof ( PLBOOL ) ); + alt_hue_path = (PLBOOL *) malloc( (size_t) ( number_colors - 1 ) * sizeof ( PLBOOL ) ); if ( format_version == 0 ) { @@ -1718,7 +1726,7 @@ fuzzy_range_check( g[i], 0., 1., FUZZ_EPSILON, 2 ); fuzzy_range_check( b[i], 0., 1., FUZZ_EPSILON, 3 ); fuzzy_range_check( pos[i], 0., 1., FUZZ_EPSILON, 4 ); - if ( return_sscanf == 5 ) + if ( ( return_sscanf == 5 ) && ( i != number_colors - 1 ) ) { // Next to oldest tk format with alt_hue_path specified. alt_hue_path[i] = (PLBOOL) alt_hue_path_i; @@ -1772,7 +1780,8 @@ fuzzy_range_check( a[i], 0., 1., FUZZ_EPSILON, 9 ); fuzzy_range_check( pos[i], 0., 1., FUZZ_EPSILON, 10 ); - alt_hue_path[i] = (PLBOOL) alt_hue_path_i; + if ( i != number_colors - 1 ) + alt_hue_path[i] = (PLBOOL) alt_hue_path_i; } } fclose( fp ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |