From: <ai...@us...> - 2009-08-28 17:45:21
|
Revision: 10356 http://plplot.svn.sourceforge.net/plplot/?rev=10356&view=rev Author: airwin Date: 2009-08-28 17:45:15 +0000 (Fri, 28 Aug 2009) Log Message: ----------- Coarsen fuzzy range checks so they will work even in the single-precision (32-bit floating point) case. Thanks to Arjen for pointing out this potential issue. Modified Paths: -------------- trunk/src/plctrl.c Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-08-28 17:07:01 UTC (rev 10355) +++ trunk/src/plctrl.c 2009-08-28 17:45:15 UTC (rev 10356) @@ -56,6 +56,10 @@ #define BUFFER_SIZE 256 +/* small epsilon for fuzzy range checks that is still large enough to + work even in the single precision floating point case.*/ +#define FUZZ_EPSILON 1.e-4 + /* Static functions */ /* Used by any external init code to suggest a path */ @@ -1254,7 +1258,7 @@ break; } /* fuzzy range check. */ - if(*(*a+i) < -1.e-12 || *(*a+i) > (1. + 1.e-12)) { + if(*(*a+i) < -FUZZ_EPSILON || *(*a+i) > (1. + FUZZ_EPSILON)) { err = 1; break; } else if(*(*a+i) < 0.) { @@ -1442,10 +1446,10 @@ b[i] = (PLFLT)b_i/255.; a[i] = 1.0; pos[i] = 0.01*(PLFLT)pos_i; - fuzzy_range_check(r[i], 0., 1., 1.e-12, 1); - fuzzy_range_check(g[i], 0., 1., 1.e-12, 2); - fuzzy_range_check(b[i], 0., 1., 1.e-12, 3); - fuzzy_range_check(pos[i], 0., 1., 1.e-12, 4); + fuzzy_range_check(r[i], 0., 1., FUZZ_EPSILON, 1); + 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) { /* Next to oldest tk format with rev specified. */ rev[i] = (PLBOOL)rev_i; @@ -1477,14 +1481,14 @@ 1. except for the hls colour space case where the first coordinate is checked within range from 0. to 360.*/ if(rgb) { - fuzzy_range_check(r[i], 0., 1., 1.e-12, 5); + fuzzy_range_check(r[i], 0., 1., FUZZ_EPSILON, 5); } else { - fuzzy_range_check(r[i], 0., 360., 360.e-12, 6); + fuzzy_range_check(r[i], 0., 360., (360.*FUZZ_EPSILON), 6); } - fuzzy_range_check(g[i], 0., 1., 1.e-12, 7); - fuzzy_range_check(b[i], 0., 1., 1.e-12, 8); - fuzzy_range_check(a[i], 0., 1., 1.e-12, 9); - fuzzy_range_check(pos[i], 0., 1., 1.e-12, 10); + fuzzy_range_check(g[i], 0., 1., FUZZ_EPSILON, 7); + fuzzy_range_check(b[i], 0., 1., FUZZ_EPSILON, 8); + fuzzy_range_check(a[i], 0., 1., FUZZ_EPSILON, 9); + fuzzy_range_check(pos[i], 0., 1., FUZZ_EPSILON, 10); rev[i] = (PLBOOL)rev_i; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2009-09-21 21:02:49
|
Revision: 10450 http://plplot.svn.sourceforge.net/plplot/?rev=10450&view=rev Author: hezekiahcarty Date: 2009-09-21 21:02:38 +0000 (Mon, 21 Sep 2009) Log Message: ----------- Check for nan (not a number) values in plcol1 to avoid potential segfaults Modified Paths: -------------- trunk/src/plctrl.c Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-09-21 19:22:41 UTC (rev 10449) +++ trunk/src/plctrl.c 2009-09-21 21:02:38 UTC (rev 10450) @@ -161,7 +161,7 @@ plabort("plcol1: Please call plinit first"); return; } - if (col1 < 0 || col1 > 1) { + if (col1 < 0 || col1 > 1 || isnan(col1)) { char buffer[BUFFER_SIZE]; snprintf(buffer, BUFFER_SIZE, "plcol1: Invalid color map position: %f", (PLFLT) col1); plabort(buffer); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-11-16 12:01:16
|
Revision: 10595 http://plplot.svn.sourceforge.net/plplot/?rev=10595&view=rev Author: andrewross Date: 2009-11-16 12:01:06 +0000 (Mon, 16 Nov 2009) Log Message: ----------- plFindCommand should search in source_tree/scripts not build_tree/scripts since that is where the scripts are located. Modified Paths: -------------- trunk/src/plctrl.c Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-11-15 13:39:12 UTC (rev 10594) +++ trunk/src/plctrl.c 2009-11-16 12:01:06 UTC (rev 10595) @@ -1846,7 +1846,7 @@ * Looks for the specified executable file. Search path: * if command invoked in the build tree: * build_tree/tk (plserver lies there - needed for the tk driver) - * build_tree/scripts (plpr lies there - needed for the tk driver) + * source_tree/scripts (plpr lies there - needed for the tk driver) * else * PLPLOT_BIN_ENV = $(PLPLOT_BIN) * current directory @@ -1870,7 +1870,7 @@ return fs; else { - plGetName( BUILD_DIR, "scripts", fn, &fs ); + plGetName( SOURCE_DIR, "scripts", fn, &fs ); if ( !plFindName( fs )) return fs; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-11-26 06:46:54
|
Revision: 12753 http://sourceforge.net/p/plplot/code/12753 Author: airwin Date: 2013-11-26 06:46:51 +0000 (Tue, 26 Nov 2013) Log Message: ----------- Slightly improve commentary and debug messages. Modified Paths: -------------- trunk/src/plctrl.c Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2013-11-26 06:45:44 UTC (rev 12752) +++ trunk/src/plctrl.c 2013-11-26 06:46:51 UTC (rev 12753) @@ -2439,6 +2439,8 @@ // Malloc space for filespec free_mem( *filespec ); + // Be slightly generous since 3 (two delimiters + NULL byte) should be + // enough. lfilespec = strlen( dir ) + strlen( subdir ) + strlen( filename ) + 10; if ( ( *filespec = (char *) malloc( lfilespec ) ) == NULL ) { @@ -2457,7 +2459,7 @@ strcat_delim( *filespec ); strcat( *filespec, filename ); } - pldebug( "plGetName", "Length of full pathname of file to be found is %zu\n", lfilespec ); + pldebug( "plGetName", "Maximum length of full pathname of file to be found is %zu\n", lfilespec - 1 ); pldebug( "plGetName", "Full pathname of file to be found is %s\n", *filespec ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2013-12-12 21:29:56
|
Revision: 12858 http://sourceforge.net/p/plplot/code/12858 Author: andrewross Date: 2013-12-12 21:29:52 +0000 (Thu, 12 Dec 2013) Log Message: ----------- Fix from Phil Rosenberg for compile errors in plplot versions of snprintf and snscanf if the library versions are not available. Modified Paths: -------------- trunk/src/plctrl.c Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2013-12-12 19:53:59 UTC (rev 12857) +++ trunk/src/plctrl.c 2013-12-12 21:29:52 UTC (rev 12858) @@ -3000,8 +3000,8 @@ va_list args; va_start( args, format ); - ret = vsprintf( buffer, fmt, args ); - va_end( argptr ); + ret = vsprintf( buffer, format, args ); + va_end( args ); // Check if overrun occured if ( ret > n - 1 ) @@ -3030,10 +3030,10 @@ { int ret; - va_list argptr; - va_start( argptr, format ); - ret = vsscanf( buffer, fmt, args ); - va_end( argptr ); + va_list args; + va_start( args, format ); + ret = vsscanf( buffer, format, args ); + va_end( args ); return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2014-01-27 01:30:33
|
Revision: 12960 http://sourceforge.net/p/plplot/code/12960 Author: airwin Date: 2014-01-27 01:30:31 +0000 (Mon, 27 Jan 2014) Log Message: ----------- Improve warnings when drawing mode setting/getting not supported by a device. Modified Paths: -------------- trunk/src/plctrl.c Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2014-01-26 02:50:33 UTC (rev 12959) +++ trunk/src/plctrl.c 2014-01-27 01:30:31 UTC (rev 12960) @@ -2041,7 +2041,7 @@ { if ( !plsc->dev_modeset ) { - plwarn( "plsdrawmode: Mode setting is not supported" ); + plwarn( "plsdrawmode: Mode setting is not supported by this device" ); } else if ( plsc->level > 0 ) { @@ -2060,13 +2060,13 @@ //! @returns Current drawing mode //! PLINT -c_plgdrawmode() +c_plgdrawmode( void ) { PLINT mode; if ( !plsc->dev_modeset ) { - plwarn( "plgdrawmode: Mode getting is not supported" ); + plwarn( "plgdrawmode: Mode getting is not supported by this device" ); mode = PL_DRAWMODE_UNKNOWN; } else if ( plsc->level > 0 ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |