From: <and...@us...> - 2011-10-20 22:54:23
|
Revision: 11992 http://plplot.svn.sourceforge.net/plplot/?rev=11992&view=rev Author: andrewross Date: 2011-10-20 22:54:16 +0000 (Thu, 20 Oct 2011) Log Message: ----------- Few more fixed warnings for C examples. Modified Paths: -------------- trunk/examples/c/x19c.c trunk/examples/c/x20c.c trunk/examples/c/x27c.c trunk/examples/c++/x27.cc Modified: trunk/examples/c/x19c.c =================================================================== --- trunk/examples/c/x19c.c 2011-10-20 22:02:21 UTC (rev 11991) +++ trunk/examples/c/x19c.c 2011-10-20 22:54:16 UTC (rev 11992) @@ -70,8 +70,8 @@ void geolocation_labeler( PLINT axis, PLFLT value, char *label, PLINT length, PLPointer data ) { - const char *direction_label; - PLFLT label_val; + const char *direction_label = NULL; + PLFLT label_val = 0.0; if ( axis == PL_Y_AXIS ) { @@ -108,11 +108,11 @@ if ( axis == PL_Y_AXIS && value == 0.0 ) { // A special case for the equator - snprintf( label, length, "%s", direction_label ); + snprintf( label, (size_t) length, "%s", direction_label ); } else { - snprintf( label, length, "%.0f%s", fabs( label_val ), direction_label ); + snprintf( label, (size_t) length, "%.0f%s", fabs( label_val ), direction_label ); } } Modified: trunk/examples/c/x20c.c =================================================================== --- trunk/examples/c/x20c.c 2011-10-20 22:02:21 UTC (rev 11991) +++ trunk/examples/c/x20c.c 2011-10-20 22:54:16 UTC (rev 11992) @@ -346,10 +346,10 @@ } // printf("width=%d height=%d num_col=%d\n", w, h, *num_col); - img = (unsigned char *) malloc( w * h * sizeof ( char ) ); + img = (unsigned char *) malloc( (size_t) (w * h) * sizeof ( char ) ); plAlloc2dGrid( &imf, w, h ); - if ( fread( img, sizeof ( char ), w * h, fp ) != w * h ) + if ( (int) fread( img, sizeof ( char ), (size_t) (w * h), fp ) != w * h ) { fclose( fp ); free( img ); Modified: trunk/examples/c/x27c.c =================================================================== --- trunk/examples/c/x27c.c 2011-10-20 22:02:21 UTC (rev 11991) +++ trunk/examples/c/x27c.c 2011-10-20 22:54:16 UTC (rev 11992) @@ -163,11 +163,11 @@ PLFLT phi; PLFLT phiw; PLFLT dphi; - PLFLT xmin; - PLFLT xmax; + PLFLT xmin = 0.0; + PLFLT xmax = 0.0; PLFLT xrange_adjust; - PLFLT ymin; - PLFLT ymax; + PLFLT ymin = 0.0; + PLFLT ymax = 0.0; PLFLT yrange_adjust; // Fill the coordinates @@ -175,7 +175,7 @@ // Proper termination of the angle loop very near the beginning // point, see // http://mathforum.org/mathimages/index.php/Hypotrochoid. - windings = (PLINT) ( abs( params[1] ) / gcd( (PLINT) params[0], (PLINT) params[1] ) ); + windings = (int) ( abs( (int) params[1] ) / gcd( (PLINT) params[0], (PLINT) params[1] ) ); steps = NPNT / windings; dphi = 2.0 * PI / (PLFLT) steps; Modified: trunk/examples/c++/x27.cc =================================================================== --- trunk/examples/c++/x27.cc 2011-10-20 22:02:21 UTC (rev 11991) +++ trunk/examples/c++/x27.cc 2011-10-20 22:54:16 UTC (rev 11992) @@ -170,11 +170,11 @@ PLFLT phi; PLFLT phiw; PLFLT dphi; - PLFLT xmin; - PLFLT xmax; + PLFLT xmin = 0.0; + PLFLT xmax = 0.0; PLFLT xrange_adjust; - PLFLT ymin; - PLFLT ymax; + PLFLT ymin = 0.0; + PLFLT ymax = 0.0; PLFLT yrange_adjust; // Fill the coordinates This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |