From: <and...@us...> - 2013-12-09 13:20:07
|
Revision: 12827 http://sourceforge.net/p/plplot/code/12827 Author: andrewross Date: 2013-12-09 13:20:01 +0000 (Mon, 09 Dec 2013) Log Message: ----------- Fix up a load of compiler warnings (testing full build with the compiler standards / warnings flags suggested in README.release). Modified Paths: -------------- trunk/bindings/f95/scstubs.c trunk/bindings/java/plplotjavac.i trunk/bindings/lua/plplotluac.i trunk/bindings/qt_gui/plqt.cpp trunk/bindings/swig-support/plplotcapi.i trunk/bindings/tk/tkMain.c trunk/drivers/cairo.c trunk/drivers/ntk.c trunk/drivers/ps.c trunk/examples/c/x22c.c trunk/examples/c++/x22.cc trunk/examples/f95/x22f.f90 trunk/src/plmap.c trunk/src/plstdio.c Modified: trunk/bindings/f95/scstubs.c =================================================================== --- trunk/bindings/f95/scstubs.c 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/bindings/f95/scstubs.c 2013-12-09 13:20:01 UTC (rev 12827) @@ -169,6 +169,7 @@ void PLMTEX37( const char *side, PLFLT *disp, PLFLT *pos, PLFLT *just, const char *text ); void PLPARSEOPTS7( int *numargs, const char *iargs, PLINT *mode, PLINT *maxindex ); void PLPAT( PLINT *nlin, PLINT *inc, PLINT *del ); +void PLPATH( PLINT *n, PLFLT *x1, PLFLT *y1, PLFLT *x2, PLFLT *y2 ); void PLPOIN( PLINT *n, PLFLT *x, PLFLT *y, PLINT *code ); void PLPOIN3( PLINT *n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT *code ); void PLPOLY3( PLINT *n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL *ifcc ); Modified: trunk/bindings/java/plplotjavac.i =================================================================== --- trunk/bindings/java/plplotjavac.i 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/bindings/java/plplotjavac.i 2013-12-09 13:20:01 UTC (rev 12827) @@ -56,7 +56,7 @@ %{ static JavaVM *cached_jvm = NULL; - SWIGEXPORT JNIEXPORT jint JNICALL JNI_OnLoad( JavaVM *jvm, void *reserved ) + SWIGEXPORT JNIEXPORT jint JNICALL JNI_OnLoad( JavaVM *jvm, void * PL_UNUSED( reserved ) ) { cached_jvm = jvm; return JNI_VERSION_1_2; @@ -1424,10 +1424,12 @@ jobject labelClass = 0; jobject labelClassRef = 0; + void label_java( PLINT axis, PLFLT value, char *string, PLINT len, PLPointer data ); + // C label plotting callback function which calls the java // label function in a PLCallbackLabel labelClassobelID // bject. - void label_java( PLINT axis, PLFLT value, char *string, PLINT len, PLPointer data ) + void label_java( PLINT axis, PLFLT value, char *string, PLINT len, PLPointer PL_UNUSED( data ) ) { jstring javaString; const char *nativeString; @@ -1478,7 +1480,7 @@ { javaString = (jstring) ( *cbenv )->CallObjectMethod( cbenv, labelClass, labelID, jaxis, jvalue ); nativeString = ( *cbenv )->GetStringUTFChars( cbenv, javaString, 0 ); - strncpy( string, nativeString, len ); + strncpy( string, nativeString, (size_t) len ); ( *cbenv )->ReleaseStringUTFChars( cbenv, javaString, nativeString ); } else @@ -1524,6 +1526,8 @@ %{ jobject ctClass = 0; jobject ctClassRef = 0; + + void ct_java( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ); // C coordinate transform callback function which calls the java // coordinate transform function in a PLCallbackCoordTrans object. Modified: trunk/bindings/lua/plplotluac.i =================================================================== --- trunk/bindings/lua/plplotluac.i 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/bindings/lua/plplotluac.i 2013-12-09 13:20:01 UTC (rev 12827) @@ -334,6 +334,7 @@ { LUA_FREE_ARRAY( $1 ); } +%typemap( default ) ( const PLFLT * ArrayCkNull, PLINT n ) { $1 = NULL; $2 = 0; } // no count, but check consistency with previous @@ -371,6 +372,7 @@ } } %typemap( freearg ) const PLFLT * ArrayCkNull { LUA_FREE_ARRAY( $1 ); } +%typemap( default ) const PLFLT * ArrayCkNull { $1 = NULL; } // No length but remember size to check others @@ -407,7 +409,6 @@ LUA_FREE_ARRAY( $1 ); } -%typemap( default ) const PLFLT * ArrayCkNull { $1 = NULL; } // with trailing count %typemap( in ) ( const PLFLT * Array, PLINT n ) @@ -510,6 +511,8 @@ %{ + PLFLT** read_double_Matrix( lua_State* L, int index, int* nx, int *ny ); + PLFLT** read_double_Matrix( lua_State* L, int index, int* nx, int *ny ) { int i, j; @@ -779,6 +782,8 @@ //-------------------------------------------------------------------------- %{ + void mapform( PLINT n, PLFLT* x, PLFLT* y ); + static lua_State* myL = NULL; static char mapform_funcstr[255]; @@ -859,11 +864,16 @@ typedef PLFLT ( *f2eval_func )( PLINT, PLINT, PLPointer ); typedef void ( *label_func )( PLINT, PLFLT, char*, PLINT, PLPointer ); +// Function prototypes + void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void * pltr_data ); + void myct( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void * pltr_data ); + void mylabel( PLINT axis, PLFLT value, char* label, PLINT length, PLPointer data ); + static char mypltr_funcstr[255]; // This is the callback that gets handed to the C code. // It, in turn, calls the Lua callback - void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ) + void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void * PL_UNUSED( pltr_data ) ) { *tx = 0; *ty = 0; @@ -907,7 +917,7 @@ // This is the callback that gets handed to the C code. // It, in turn, calls the Lua callback - void myct( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ) + void myct( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void * PL_UNUSED( pltr_data ) ) { *tx = 0; *ty = 0; @@ -947,12 +957,10 @@ return; } - static char label_funcstr[255]; + static char mylabel_funcstr[255]; - void mylabel( PLINT axis, PLFLT value, char* label, PLINT length, PLPointer data ) + void mylabel( PLINT axis, PLFLT value, char* label, PLINT length, PLPointer PL_UNUSED( data ) ) { - PLFLT *xtemp, *ytemp; - int len, i; // check Lua state if ( myL == NULL ) @@ -962,19 +970,19 @@ } // push functions and arguments - lua_getglobal( myL, label_funcstr ); // function to be called + lua_getglobal( myL, mylabel_funcstr ); // function to be called lua_pushnumber( myL, axis ); // push 1st argument lua_pushnumber( myL, value ); // push 1st argument // do the call (2 arguments, 1 result) if ( lua_pcall( myL, 2, 1, 0 ) != 0 ) fprintf( stderr, "error running function `%s':%s", - label_funcstr, lua_tostring( myL, -1 ) ); + mylabel_funcstr, lua_tostring( myL, -1 ) ); // retrieve results if ( !lua_isstring( myL, -1 ) ) { - fprintf( stderr, "function `%s' must return a string as result", label_funcstr ); + fprintf( stderr, "function `%s' must return a string as result", mylabel_funcstr ); return; } strncpy( label, lua_tostring( myL, -1 ), length ); @@ -1021,7 +1029,7 @@ %typemap( in ) label_func lf { $1 = NULL; - label_funcstr[0] = '\0'; + mylabel_funcstr[0] = '\0'; if ( lua_isnil( L, $input ) ) { @@ -1030,7 +1038,7 @@ else if ( lua_isstring( L, $input ) ) { $1 = mylabel; - strncpy( label_funcstr, lua_tostring( L, $input ), 255 ); + strncpy( mylabel_funcstr, lua_tostring( L, $input ), 255 ); myL = L; } else @@ -1415,7 +1423,9 @@ LUA_FREE_ARRAY( $2 ); } +%typemap( default ) ( PLBOOL deffalse ) { $1 = 0; } + //-------------------------------------------------------------------------- // Renames //-------------------------------------------------------------------------- Modified: trunk/bindings/qt_gui/plqt.cpp =================================================================== --- trunk/bindings/qt_gui/plqt.cpp 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/bindings/qt_gui/plqt.cpp 2013-12-09 13:20:01 UTC (rev 12827) @@ -1118,12 +1118,12 @@ mouseEvent( event ); } -void QtPLWidget::mouseReleaseEvent( QMouseEvent * event ) +void QtPLWidget::mouseReleaseEvent( QMouseEvent * PL_UNUSED( event ) ) { //mouseEvent( event ); } -void QtPLWidget::mouseMoveEvent( QMouseEvent * event ) +void QtPLWidget::mouseMoveEvent( QMouseEvent * PL_UNUSED ( event ) ) { //mouseEvent( event ); } Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/bindings/swig-support/plplotcapi.i 2013-12-09 13:20:01 UTC (rev 12827) @@ -764,7 +764,7 @@ plstyl( PLINT n, const PLINT *Array, const PLINT *ArrayCk ); void -plsvect( const PLFLT *ArrayNull, const PLFLT *ArrayCkNull, PLINT n, PLBOOL fill ); +plsvect( const PLFLT *ArrayNull, const PLFLT *ArrayCkNull, PLINT n, PLBOOL deffalse ); void plsvpa( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); Modified: trunk/bindings/tk/tkMain.c =================================================================== --- trunk/bindings/tk/tkMain.c 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/bindings/tk/tkMain.c 2013-12-09 13:20:01 UTC (rev 12827) @@ -154,7 +154,7 @@ // Forward declarations for procedures defined later in this file: // -static void Prompt _ANSI_ARGS_( ( Tcl_Interp * interp, int partial ) ); +static void Prompt _ANSI_ARGS_( ( Tcl_Interp * interploc, int partial ) ); static void StdinProc _ANSI_ARGS_( ( ClientData clientData, int mask ) ); @@ -582,8 +582,8 @@ // static void -Prompt( interp, partial ) -Tcl_Interp * interp; // Interpreter to use for prompting. +Prompt( interploc, partial ) +Tcl_Interp * interploc; // Interpreter to use for prompting. int partial; // Non-zero means there already // exists a partial command, so use // the secondary prompt. @@ -591,7 +591,7 @@ const char *promptCmd; int code; - promptCmd = Tcl_GetVar( interp, + promptCmd = Tcl_GetVar( interploc, partial ? "tcl_prompt2" : "tcl_prompt1", TCL_GLOBAL_ONLY ); if ( promptCmd == NULL ) { @@ -603,12 +603,12 @@ } else { - code = Tcl_Eval( interp, promptCmd ); + code = Tcl_Eval( interploc, promptCmd ); if ( code != TCL_OK ) { - Tcl_AddErrorInfo( interp, + Tcl_AddErrorInfo( interploc, "\n (script that generates prompt)" ); - fprintf( stderr, "%s\n", Tcl_GetStringResult( interp ) ); + fprintf( stderr, "%s\n", Tcl_GetStringResult( interploc ) ); goto defaultPrompt; } } Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/drivers/cairo.c 2013-12-09 13:20:01 UTC (rev 12827) @@ -528,9 +528,9 @@ void plD_esc_cairo( PLStream *pls, PLINT op, void *ptr ) { - PLCairo *aStream; + //PLCairo *aStream; - aStream = (PLCairo *) pls->dev; + //aStream = (PLCairo *) pls->dev; switch ( op ) { Modified: trunk/drivers/ntk.c =================================================================== --- trunk/drivers/ntk.c 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/drivers/ntk.c 2013-12-09 13:20:01 UTC (rev 12827) @@ -101,19 +101,19 @@ static PLGraphicsIn gin; static void -tk_cmd( char *cmd ) +tk_cmd( const char *gcmd ) { static char scmd[10000]; if ( local ) - Tcl_Eval( interp, cmd ); + Tcl_Eval( interp, gcmd ); else { // the -async option makes it block, some times! but is *much* faster! // and was working OK till now :( // sprintf(scmd, "send -async %s {%s}", rem_interp, cmd); // - sprintf( scmd, "send %s {%s}", rem_interp, cmd ); // mess! make it more efficient + sprintf( scmd, "send %s {%s}", rem_interp, gcmd ); // mess! make it more efficient if ( Tcl_Eval( interp, scmd ) != TCL_OK ) fprintf( stderr, "%s\n", Tcl_GetStringResult( interp ) ); } @@ -306,7 +306,7 @@ Tcl_Eval( interp, "tk scaling" ); // pixels per mm ppm = (PLFLT) atof( Tcl_GetStringResult( interp ) ) / ( 25.4 / 72. ); plP_setpxl( ppm, ppm ); - plP_setphy( xmin, xmax * scale, ymin, ymax * scale ); + plP_setphy( xmin, (PLINT) ( xmax * scale ), ymin, (PLINT) ( ymax * scale ) ); tk_cmd( "update" ); } @@ -344,7 +344,7 @@ } void -plD_polyline_ntk( PLStream *pls, short *xa, short *ya, PLINT npts ) +plD_polyline_ntk( PLStream * PL_UNUSED( pls ), short *xa, short *ya, PLINT npts ) { PLINT i, j; @@ -363,7 +363,7 @@ // an event loop has to be designed, getcursor() and waitforpage() are just experimental static void -waitforpage( PLStream *pls ) +waitforpage( PLStream * PL_UNUSED( pls ) ) { int key = 0, st = 0; // why can't I bind to the canvas? or even any frame? @@ -426,7 +426,7 @@ } static void -getcursor( PLStream *pls, PLGraphicsIn *ptr ) +getcursor( PLStream * PL_UNUSED( pls ), PLGraphicsIn *ptr ) { int st = 0; @@ -462,9 +462,9 @@ tk_cmd( "set yloc" ); sscanf( Tcl_GetStringResult( interp ), "%d", &gin.pY ); tk_cmd( "set bloc" ); - sscanf( Tcl_GetStringResult( interp ), "%d", &gin.button ); + sscanf( Tcl_GetStringResult( interp ), "%ud", &gin.button ); tk_cmd( "set sloc" ); - sscanf( Tcl_GetStringResult( interp ), "%d", &gin.state ); + sscanf( Tcl_GetStringResult( interp ), "%ud", &gin.state ); gin.dX = (PLFLT) gin.pX / xmax; gin.dY = 1. - (PLFLT) gin.pY / ymax; @@ -486,8 +486,8 @@ { PLINT i, j; short *xa, *ya; - Pixmap bitmap; - static unsigned char bit_pat[] = { + //Pixmap bitmap; + static const unsigned char bit_pat[] = { 0x24, 0x01, 0x92, 0x00, 0x49, 0x00, 0x24, 0x00, 0x12, 0x00, 0x09, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff @@ -496,8 +496,8 @@ switch ( op ) { case PLESC_DASH: - xa = (short *) malloc( sizeof ( short ) * pls->dev_npts ); - ya = (short *) malloc( sizeof ( short ) * pls->dev_npts ); + xa = (short *) malloc( sizeof ( short ) * ( size_t ) pls->dev_npts ); + ya = (short *) malloc( sizeof ( short ) * ( size_t ) pls->dev_npts ); for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; @@ -547,8 +547,8 @@ { if ( pls->patt != 0 ) { - Tk_DefineBitmap( interp, Tk_GetUid( "foo" ), bit_pat, 16, 16 ); - bitmap = Tk_GetBitmap( interp, mainw, Tk_GetUid( "patt" ) ); + Tk_DefineBitmap( interp, Tk_GetUid( "foo" ), (const char *) bit_pat, 16, 16 ); + //bitmap = Tk_GetBitmap( interp, mainw, Tk_GetUid( "patt" ) ); } j = sprintf( cmd, "$plf.f2.c%d create polygon ", ccanv ); for ( i = 0; i < pls->dev_npts; i++ ) Modified: trunk/drivers/ps.c =================================================================== --- trunk/drivers/ps.c 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/drivers/ps.c 2013-12-09 13:20:01 UTC (rev 12827) @@ -594,9 +594,9 @@ switch ( op ) { case PLSTATE_WIDTH: { - int width = + int width = (int) ( ( pls->width < MIN_WIDTH ) ? DEF_WIDTH : - ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width; + ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width ); fprintf( OF, " S\n%d W", width ); Modified: trunk/examples/c/x22c.c =================================================================== --- trunk/examples/c/x22c.c 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/examples/c/x22c.c 2013-12-09 13:20:01 UTC (rev 12827) @@ -26,7 +26,9 @@ #include "plcdemos.h" void circulation( void ); -void constriction( int ); +void constriction( int astyle ); +void transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ); +void constriction2( void ); void potential( void ); void f2mnmx( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fnmin, PLFLT *fnmax ); @@ -197,7 +199,7 @@ int i, j; PLFLT dx, dy, x, y; PLFLT xmin, xmax, ymin, ymax; - PLFLT Q, b, dbdx; + PLFLT Q, b; PLcGrid2 cgrid2; PLFLT **u, **v; const int nx = 20; Modified: trunk/examples/c++/x22.cc =================================================================== --- trunk/examples/c++/x22.cc 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/examples/c++/x22.cc 2013-12-09 13:20:01 UTC (rev 12827) @@ -171,7 +171,7 @@ int i, j; PLFLT dx, dy, x, y; PLFLT xmin, xmax, ymin, ymax; - PLFLT Q, b, dbdx; + PLFLT Q, b; #define NC 11 int nc = NC; PLFLT clev[NC]; Modified: trunk/examples/f95/x22f.f90 =================================================================== --- trunk/examples/f95/x22f.f90 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/examples/f95/x22f.f90 2013-12-09 13:20:01 UTC (rev 12827) @@ -186,7 +186,7 @@ real(kind=plflt) dx, dy, xx, yy real(kind=plflt) xmin, xmax, ymin, ymax - real(kind=plflt) Q, b, dbdx, scaling + real(kind=plflt) Q, b, scaling real(kind=plflt) u(nx, ny), v(nx, ny), xg(nx,ny), yg(nx,ny) real(kind=plflt) clev(nc); common /transform_data/ ymax Modified: trunk/src/plmap.c =================================================================== --- trunk/src/plmap.c 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/src/plmap.c 2013-12-09 13:20:01 UTC (rev 12827) @@ -50,8 +50,10 @@ SHPHandle OpenShapeFile( const char *fn ); +#ifdef HAVE_SAHOOKS static void CustomErrors( const char *message ); +#endif #endif @@ -473,6 +475,7 @@ //! found //-------------------------------------------------------------------------- #ifdef HAVE_SHAPELIB +#ifdef HAVE_SAHOOKS // Our thanks to Frank Warmerdam, the developer of shapelib for suggesting // this approach for quieting shapelib "Unable to open" error messages. static @@ -481,6 +484,7 @@ if ( strstr( message, "Unable to open" ) == NULL ) fprintf( stderr, "%s\n", message ); } +#endif SHPHandle OpenShapeFile( const char *fn ) @@ -496,7 +500,7 @@ // Using ancient version of shapelib without SAHooks or SHPOpenLL. // For this case live with the misleading "Unable to open" error // messages. - int sHooks; + // int sHooks; #define SHPOpenLL( a, b, c ) SHPOpen( a, b ) #endif Modified: trunk/src/plstdio.c =================================================================== --- trunk/src/plstdio.c 2013-12-08 01:07:56 UTC (rev 12826) +++ trunk/src/plstdio.c 2013-12-09 13:20:01 UTC (rev 12827) @@ -277,13 +277,11 @@ plwarn( "Creating fifos not supported on this platform" ); return NULL; #else - FILE *fd; const char *tmpdir; char *template; char *dirname; const char *tmpname = "plplot_dir_XXXXXX"; const char *fifoname = "plplot_fifo"; - int flags; #if defined ( MSDOS ) || defined ( WIN32 ) tmpdir = getenv( "TEMP" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |