From: <and...@us...> - 2011-10-19 11:05:23
|
Revision: 11975 http://plplot.svn.sourceforge.net/plplot/?rev=11975&view=rev Author: andrewross Date: 2011-10-19 11:05:10 +0000 (Wed, 19 Oct 2011) Log Message: ----------- Another big round of code changes to fix compiler warnings. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c trunk/bindings/tcl/tclMatrix.c trunk/bindings/tk/plframe.c trunk/bindings/tk/plr.c trunk/bindings/tk/plserver.c trunk/bindings/tk/pltkd.h trunk/bindings/tk/tcpip.c trunk/bindings/tk/tcpip.h trunk/bindings/tk/tkMain.c trunk/drivers/cairo.c trunk/drivers/ps.c trunk/drivers/tk.c trunk/drivers/tkwin.c trunk/drivers/xwin.c trunk/examples/c++/x29.cc trunk/examples/tk/xtk01.c trunk/examples/tk/xtk02.c trunk/examples/tk/xtk04.c trunk/include/pdf.h trunk/include/plplot.h trunk/include/plxwd.h trunk/lib/csa/csa.c trunk/lib/nn/delaunay.c trunk/lib/nn/hash.c trunk/lib/nn/istack.c trunk/lib/nn/lpi.c trunk/lib/nn/nnai.c trunk/lib/nn/nncommon.c trunk/lib/nn/nnpi.c trunk/src/pdfutils.c trunk/src/plctrl.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2011-10-19 07:04:09 UTC (rev 11974) +++ trunk/bindings/tcl/tclAPI.c 2011-10-19 11:05:10 UTC (rev 11975) @@ -70,6 +70,8 @@ static int plimagefrCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plstripcCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plslabelfuncCmd( ClientData, Tcl_Interp *, int, const char ** ); +void mapform( PLINT n, PLFLT *x, PLFLT *y ); +PLFLT tclMatrix_feval( PLINT i, PLINT j, PLPointer p ); // // The following structure defines all of the commands in the PLplot/Tcl @@ -78,17 +80,17 @@ typedef struct Command { - int ( *proc )(); // Procedure to process command. - ClientData clientData; // Arbitrary value to pass to proc. - int *deleteProc; // Procedure to invoke when deleting - // command. - ClientData deleteData; // Arbitrary value to pass to deleteProc - // (usually the same as clientData). + int ( *proc )( void *, struct Tcl_Interp *, int, const char ** ); // Procedure to process command. + ClientData clientData; // Arbitrary value to pass to proc. + int *deleteProc; // Procedure to invoke when deleting + // command. + ClientData deleteData; // Arbitrary value to pass to deleteProc + // (usually the same as clientData). } Command; typedef struct { - char *name; + const char *name; int ( *proc )( void *, struct Tcl_Interp *, int, const char ** ); } CmdInfo; @@ -163,13 +165,13 @@ static void Append_Cmdlist( Tcl_Interp *interp ) { - static int inited = 0; - static char** namelist; - int i, j, ncmds = sizeof ( Cmds ) / sizeof ( CmdInfo ); + static int inited = 0; + static const char** namelist; + int i, j, ncmds = sizeof ( Cmds ) / sizeof ( CmdInfo ); if ( !inited ) { - namelist = (char **) malloc( ncmds * sizeof ( char * ) ); + namelist = (const char **) malloc( (size_t) ncmds * sizeof ( char * ) ); for ( i = 0; i < ncmds; i++ ) namelist[i] = Cmds[i].name; @@ -181,7 +183,7 @@ { if ( strcmp( namelist[i], namelist[j] ) > 0 ) { - char *t = namelist[i]; + const char *t = namelist[i]; namelist[i] = namelist[j]; namelist[j] = t; } @@ -391,7 +393,7 @@ PlbasicInit( Tcl_Interp *interp ) { int debug = plsc->debug; - char *libDir = NULL; + const char *libDir = NULL; static char initScript[] = "tcl_findLibrary plplot " VERSION " \"\" plplot.tcl PL_LIBRARY pllibrary"; #ifdef PLPLOT_EXTENDED_SEARCH @@ -470,7 +472,7 @@ Tcl_ResetResult( interp ); } else - libDir = (char *) Tcl_GetVar( interp, "pllibrary", TCL_GLOBAL_ONLY ); + libDir = Tcl_GetVar( interp, "pllibrary", TCL_GLOBAL_ONLY ); } #ifdef TCL_DIR @@ -504,7 +506,7 @@ Tcl_ResetResult( interp ); } else - libDir = (char *) Tcl_GetVar( interp, "pllibrary", TCL_GLOBAL_ONLY ); + libDir = Tcl_GetVar( interp, "pllibrary", TCL_GLOBAL_ONLY ); } // Last chance, current directory @@ -1584,7 +1586,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -1624,7 +1626,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -1732,7 +1734,7 @@ y = maty->fdata; clev = matlev->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -1780,7 +1782,7 @@ clev = matlev->fdata; nlev = matlev->n[0]; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -1822,7 +1824,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -1863,7 +1865,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -1959,7 +1961,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -2000,7 +2002,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -2108,7 +2110,7 @@ y = maty->fdata; clev = matlev->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -2156,7 +2158,7 @@ clev = matlev->fdata; nlev = matlev->n[0]; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -2198,7 +2200,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -2239,7 +2241,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -2347,7 +2349,7 @@ y = maty->fdata; clev = matlev->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -2395,7 +2397,7 @@ clev = matlev->fdata; nlev = matlev->n[0]; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -2437,7 +2439,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -2478,7 +2480,7 @@ x = matx->fdata; y = maty->fdata; - z = (PLFLT **) malloc( nx * sizeof ( PLFLT * ) ); + z = (PLFLT **) malloc( (size_t) nx * sizeof ( PLFLT * ) ); for ( i = 0; i < nx; i++ ) z[i] = &matz->fdata[ I2D( i, 0 ) ]; } @@ -3506,11 +3508,11 @@ } else { - int len; + size_t len; const char *data = argc > 2 ? argv[2] : 0; tcl_xform_interp = interp; - tcl_xform_procname = strdup( argv[1] ); + tcl_xform_procname = plstrdup( argv[1] ); len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname ); tcl_xform_code = malloc( len ); @@ -3949,11 +3951,11 @@ if ( return_code != TCL_OK ) { - strncpy( string, "ERROR", string_length ); + strncpy( string, "ERROR", (size_t) string_length ); } else { - strncpy( string, Tcl_GetStringResult( tcl_interp ), string_length ); + strncpy( string, Tcl_GetStringResult( tcl_interp ), (size_t) string_length ); } Tcl_DecrRefCount( label_objs[1] ); @@ -4000,13 +4002,13 @@ else { plslabelfunc( labelform, NULL ); - label_objs[0] = Tcl_NewStringObj( argv[1], strlen( argv[1] ) ); + label_objs[0] = Tcl_NewStringObj( argv[1], (int) strlen( argv[1] ) ); Tcl_IncrRefCount( label_objs[0] ); } if ( argc == 3 ) { - label_objs[3] = Tcl_NewStringObj( argv[2], strlen( argv[2] ) ); // Should change with Tcl_Obj interface + label_objs[3] = Tcl_NewStringObj( argv[2], (int) strlen( argv[2] ) ); // Should change with Tcl_Obj interface Tcl_IncrRefCount( label_objs[3] ); } else @@ -4043,7 +4045,7 @@ } else { - array = (int *) malloc( sizeof ( int ) * ( *number ) ); + array = (int *) malloc( sizeof ( int ) * (size_t) ( *number ) ); for ( i = 0; i < ( *number ); i++ ) { Tcl_ListObjIndex( interp, list, i, &elem ); @@ -4070,7 +4072,7 @@ } else { - array = (double *) malloc( sizeof ( double ) * ( *number ) ); + array = (double *) malloc( sizeof ( double ) * (size_t) ( *number ) ); for ( i = 0; i < ( *number ); i++ ) { Tcl_ListObjIndex( interp, list, i, &elem ); @@ -4100,7 +4102,7 @@ } else { - array = (char **) malloc( sizeof ( char* ) * ( *number ) ); + array = (char **) malloc( sizeof ( char* ) * (size_t) ( *number ) ); array[0] = (char *) malloc( sizeof ( char ) * ( strlen( list_strings ) + 1 ) ); idx = 0; for ( i = 0; i < ( *number ); i++ ) @@ -4109,7 +4111,7 @@ string = Tcl_GetStringFromObj( elem, &length ); array[i] = array[0] + idx; - strncpy( array[i], string, length ); + strncpy( array[i], string, (size_t) length ); idx += length + 1; array[0][idx - 1] = '\0'; } @@ -4138,13 +4140,11 @@ char **text; char **symbols; - char string[20]; int number_opts; int number_texts; int dummy; double value; - Tcl_Obj *result; Tcl_Obj *data[2]; if ( argc != 29 ) Modified: trunk/bindings/tcl/tclMatrix.c =================================================================== --- trunk/bindings/tcl/tclMatrix.c 2011-10-19 07:04:09 UTC (rev 11974) +++ trunk/bindings/tcl/tclMatrix.c 2011-10-19 11:05:10 UTC (rev 11975) @@ -151,11 +151,11 @@ for ( i = 1; i < argc; i++ ) { c = argv[i][0]; - length = strlen( argv[i] ); + length = (int) strlen( argv[i] ); // If found, set persist variable and compress argv-list - if ( ( c == '-' ) && ( strncmp( argv[i], "-persist", length ) == 0 ) ) + if ( ( c == '-' ) && ( strncmp( argv[i], "-persist", (size_t) length ) == 0 ) ) { persist = 1; argc--; @@ -206,15 +206,15 @@ argc--; argv++; c = argv[0][0]; - length = strlen( argv[0] ); + length = (int) strlen( argv[0] ); - if ( ( c == 'f' ) && ( strncmp( argv[0], "float", length ) == 0 ) ) + if ( ( c == 'f' ) && ( strncmp( argv[0], "float", (size_t) length ) == 0 ) ) { matPtr->type = TYPE_FLOAT; matPtr->put = MatrixPut_f; matPtr->get = MatrixGet_f; } - else if ( ( c == 'i' ) && ( strncmp( argv[0], "int", length ) == 0 ) ) + else if ( ( c == 'i' ) && ( strncmp( argv[0], "int", (size_t) length ) == 0 ) ) { matPtr->type = TYPE_INT; matPtr->put = MatrixPut_i; @@ -287,13 +287,13 @@ switch ( matPtr->type ) { case TYPE_FLOAT: - matPtr->fdata = (Mat_float *) malloc( matPtr->len * sizeof ( Mat_float ) ); + matPtr->fdata = (Mat_float *) malloc( (size_t) ( matPtr->len ) * sizeof ( Mat_float ) ); for ( i = 0; i < matPtr->len; i++ ) matPtr->fdata[i] = 0.0; break; case TYPE_INT: - matPtr->idata = (Mat_int *) malloc( matPtr->len * sizeof ( Mat_int ) ); + matPtr->idata = (Mat_int *) malloc( (size_t) ( matPtr->len ) * sizeof ( Mat_int ) ); for ( i = 0; i < matPtr->len; i++ ) matPtr->idata[i] = 0; break; @@ -550,12 +550,12 @@ argc--; argv++; c = argv[0][0]; - length = strlen( argv[0] ); + length = (int) strlen( argv[0] ); // dump -- send a nicely formatted listing of the array contents to stdout // (very helpful for debugging) - if ( ( c == 'd' ) && ( strncmp( argv[0], "dump", length ) == 0 ) ) + if ( ( c == 'd' ) && ( strncmp( argv[0], "dump", (size_t) length ) == 0 ) ) { for ( i = nmin[0]; i <= nmax[0]; i++ ) { @@ -578,7 +578,7 @@ // delete -- delete the array - else if ( ( c == 'd' ) && ( strncmp( argv[0], "delete", length ) == 0 ) ) + else if ( ( c == 'd' ) && ( strncmp( argv[0], "delete", (size_t) length ) == 0 ) ) { #ifdef DEBUG fprintf( stderr, "Deleting array %s\n", name ); @@ -590,9 +590,9 @@ // filter // Only works on 1d matrices - else if ( ( c == 'f' ) && ( strncmp( argv[0], "filter", length ) == 0 ) ) + else if ( ( c == 'f' ) && ( strncmp( argv[0], "filter", (size_t) length ) == 0 ) ) { - Mat_float *tmp; + Mat_float *tmpMat; int ifilt, nfilt; if ( argc != 2 ) @@ -610,36 +610,36 @@ return TCL_ERROR; } - nfilt = atoi( argv[1] ); - tmp = (Mat_float *) malloc( ( matPtr->len + 2 ) * sizeof ( Mat_float ) ); + nfilt = atoi( argv[1] ); + tmpMat = (Mat_float *) malloc( (size_t) ( matPtr->len + 2 ) * sizeof ( Mat_float ) ); for ( ifilt = 0; ifilt < nfilt; ifilt++ ) { // Set up temporary filtering array. Use even boundary conditions. - j = 0; tmp[j] = matPtr->fdata[0]; + j = 0; tmpMat[j] = matPtr->fdata[0]; for ( i = 0; i < matPtr->len; i++ ) { - j++; tmp[j] = matPtr->fdata[i]; + j++; tmpMat[j] = matPtr->fdata[i]; } - j++; tmp[j] = matPtr->fdata[matPtr->len - 1]; + j++; tmpMat[j] = matPtr->fdata[matPtr->len - 1]; // Apply 3-point binomial filter for ( i = 0; i < matPtr->len; i++ ) { j = i + 1; - matPtr->fdata[i] = 0.25 * ( tmp[j - 1] + 2 * tmp[j] + tmp[j + 1] ); + matPtr->fdata[i] = 0.25 * ( tmpMat[j - 1] + 2 * tmpMat[j] + tmpMat[j + 1] ); } } - free( (void *) tmp ); + free( (void *) tmpMat ); return TCL_OK; } // help - else if ( ( c == 'h' ) && ( strncmp( argv[0], "help", length ) == 0 ) ) + else if ( ( c == 'h' ) && ( strncmp( argv[0], "help", (size_t) length ) == 0 ) ) { Tcl_AppendResult( interp, "So you really thought there'd be help, eh? Sucker.", @@ -649,7 +649,7 @@ // info - else if ( ( c == 'i' ) && ( strncmp( argv[0], "info", length ) == 0 ) ) + else if ( ( c == 'i' ) && ( strncmp( argv[0], "info", (size_t) length ) == 0 ) ) { for ( i = 0; i < matPtr->dim; i++ ) { @@ -665,7 +665,7 @@ // max - else if ( ( c == 'm' ) && ( strncmp( argv[0], "max", length ) == 0 ) ) + else if ( ( c == 'm' ) && ( strncmp( argv[0], "max", (size_t) length ) == 0 ) ) { int len; if ( argc < 1 || argc > 2 ) @@ -706,7 +706,7 @@ // min - else if ( ( c == 'm' ) && ( strncmp( argv[0], "min", length ) == 0 ) ) + else if ( ( c == 'm' ) && ( strncmp( argv[0], "min", (size_t) length ) == 0 ) ) { int len; if ( argc < 1 || argc > 2 ) @@ -748,7 +748,7 @@ // redim // Only works on 1d matrices - else if ( ( c == 'r' ) && ( strncmp( argv[0], "redim", length ) == 0 ) ) + else if ( ( c == 'r' ) && ( strncmp( argv[0], "redim", (size_t) length ) == 0 ) ) { int newlen; void *data; @@ -772,7 +772,7 @@ switch ( matPtr->type ) { case TYPE_FLOAT: - data = realloc( matPtr->fdata, newlen * sizeof ( Mat_float ) ); + data = realloc( matPtr->fdata, (size_t) newlen * sizeof ( Mat_float ) ); if ( data == NULL ) { Tcl_AppendResult( interp, "redim failed!", @@ -785,7 +785,7 @@ break; case TYPE_INT: - data = realloc( matPtr->idata, newlen * sizeof ( Mat_int ) ); + data = realloc( matPtr->idata, (size_t) newlen * sizeof ( Mat_int ) ); if ( data == NULL ) { Tcl_AppendResult( interp, "redim failed!", @@ -804,7 +804,7 @@ // scale // Only works on 1d matrices - else if ( ( c == 's' ) && ( strncmp( argv[0], "scale", length ) == 0 ) ) + else if ( ( c == 's' ) && ( strncmp( argv[0], "scale", (size_t) length ) == 0 ) ) { Mat_float scale; @@ -833,7 +833,7 @@ case TYPE_INT: for ( i = 0; i < matPtr->len; i++ ) - matPtr->idata[i] *= scale; + matPtr->idata[i] = (Mat_int) ( (Mat_float) ( matPtr->idata[i] ) * scale ); break; } return TCL_OK; @@ -845,7 +845,7 @@ tclMatrixXtnsnDescr *p = head; for (; p; p = p->next ) { - if ( ( c == p->cmd[0] ) && ( strncmp( argv[0], p->cmd, length ) == 0 ) ) + if ( ( c == p->cmd[0] ) && ( strncmp( argv[0], p->cmd, (size_t) length ) == 0 ) ) { #ifdef DEBUG printf( "found a match, invoking %s\n", p->cmd ); @@ -980,7 +980,7 @@ if ( ( strlen( string ) > 2 ) && ( strncmp( string, "0x", 2 ) == 0 ) ) { - matPtr->idata[index] = strtoul( &string[2], NULL, 16 ); + matPtr->idata[index] = (Mat_int) strtoul( &string[2], NULL, 16 ); } else matPtr->idata[index] = atoi( string ); Modified: trunk/bindings/tk/plframe.c =================================================================== --- trunk/bindings/tk/plframe.c 2011-10-19 07:04:09 UTC (rev 11974) +++ trunk/bindings/tk/plframe.c 2011-10-19 11:05:10 UTC (rev 11975) @@ -212,7 +212,7 @@ static Tk_ConfigSpec configSpecs[] = { { TK_CONFIG_BORDER, "-background", "background", "Background", DEF_PLFRAME_BG_COLOR, Tk_Offset( PlFrame, border ), - TK_CONFIG_COLOR_ONLY }, + TK_CONFIG_COLOR_ONLY, NULL }, // // {TK_CONFIG_COLOR, (char *) NULL, (char *) NULL, (char *) NULL, // (char *) NULL, Tk_Offset(PlFrame, bgColor), @@ -221,11 +221,11 @@ #ifndef MAC_TCL { TK_CONFIG_COLOR, "-plbg", "plbackground", "Plbackground", DEF_PLFRAME_BG_COLOR, Tk_Offset( PlFrame, bgColor ), - TK_CONFIG_COLOR_ONLY }, + TK_CONFIG_COLOR_ONLY, NULL }, #endif { TK_CONFIG_BORDER, "-background", "background", "Background", DEF_PLFRAME_BG_MONO, Tk_Offset( PlFrame, border ), - TK_CONFIG_MONO_ONLY }, + TK_CONFIG_MONO_ONLY, NULL }, // // {TK_CONFIG_COLOR, (char *) NULL, (char *) NULL, (char *) NULL, // (char *) NULL, Tk_Offset(PlFrame, bgColor), @@ -234,36 +234,36 @@ #ifndef MAC_TCL { TK_CONFIG_COLOR, "-plbg", (char *) NULL, (char *) NULL, DEF_PLFRAME_BG_MONO, Tk_Offset( PlFrame, bgColor ), - TK_CONFIG_MONO_ONLY }, + TK_CONFIG_MONO_ONLY, NULL }, #endif { TK_CONFIG_SYNONYM, "-bd", "borderWidth", (char *) NULL, - (char *) NULL, 0, 0 }, + (char *) NULL, 0, 0, NULL }, { TK_CONFIG_SYNONYM, "-bg", "background", (char *) NULL, - (char *) NULL, 0, 0 }, + (char *) NULL, 0, 0, NULL }, { TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_PLFRAME_BORDER_WIDTH, Tk_Offset( PlFrame, borderWidth ), 0 }, + DEF_PLFRAME_BORDER_WIDTH, Tk_Offset( PlFrame, borderWidth ), 0, NULL }, { TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor", - DEF_PLFRAME_CURSOR, Tk_Offset( PlFrame, cursor ), TK_CONFIG_NULL_OK }, + DEF_PLFRAME_CURSOR, Tk_Offset( PlFrame, cursor ), TK_CONFIG_NULL_OK, NULL }, { TK_CONFIG_STRING, "-bopcmd", "bopcmd", "PgCommand", - (char *) NULL, Tk_Offset( PlFrame, bopCmd ), TK_CONFIG_NULL_OK }, + (char *) NULL, Tk_Offset( PlFrame, bopCmd ), TK_CONFIG_NULL_OK, NULL }, { TK_CONFIG_STRING, "-eopcmd", "eopcmd", "PgCommand", - (char *) NULL, Tk_Offset( PlFrame, eopCmd ), TK_CONFIG_NULL_OK }, + (char *) NULL, Tk_Offset( PlFrame, eopCmd ), TK_CONFIG_NULL_OK, NULL }, { TK_CONFIG_PIXELS, "-height", "height", "Height", - DEF_PLFRAME_HEIGHT, Tk_Offset( PlFrame, height ), 0 }, + DEF_PLFRAME_HEIGHT, Tk_Offset( PlFrame, height ), 0, NULL }, { TK_CONFIG_RELIEF, "-relief", "relief", "Relief", - DEF_PLFRAME_RELIEF, Tk_Offset( PlFrame, relief ), 0 }, + DEF_PLFRAME_RELIEF, Tk_Offset( PlFrame, relief ), 0, NULL }, { TK_CONFIG_PIXELS, "-width", "width", "Width", - DEF_PLFRAME_WIDTH, Tk_Offset( PlFrame, width ), 0 }, + DEF_PLFRAME_WIDTH, Tk_Offset( PlFrame, width ), 0, NULL }, { TK_CONFIG_BOOLEAN, "-xhairs", (char *) NULL, (char *) NULL, - "0", Tk_Offset( PlFrame, xhairs ), TK_CONFIG_DONT_SET_DEFAULT }, + "0", Tk_Offset( PlFrame, xhairs ), TK_CONFIG_DONT_SET_DEFAULT, NULL }, { TK_CONFIG_BOOLEAN, "-rubberband", (char *) NULL, (char *) NULL, - "0", Tk_Offset( PlFrame, rband ), TK_CONFIG_DONT_SET_DEFAULT }, + "0", Tk_Offset( PlFrame, rband ), TK_CONFIG_DONT_SET_DEFAULT, NULL }, { TK_CONFIG_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", - (char *) NULL, Tk_Offset( PlFrame, xScrollCmd ), TK_CONFIG_NULL_OK }, + (char *) NULL, Tk_Offset( PlFrame, xScrollCmd ), TK_CONFIG_NULL_OK, NULL }, { TK_CONFIG_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", - (char *) NULL, Tk_Offset( PlFrame, yScrollCmd ), TK_CONFIG_NULL_OK }, + (char *) NULL, Tk_Offset( PlFrame, yScrollCmd ), TK_CONFIG_NULL_OK, NULL }, { TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL, - (char *) NULL, 0, 0 } + (char *) NULL, 0, 0, NULL } }; // Forward declarations for procedures defined later in this file: @@ -540,7 +540,7 @@ } Tk_Preserve( (ClientData) plFramePtr ); c = argv[1][0]; - length = strlen( argv[1] ); + length = (int) strlen( argv[1] ); // First, before anything else, we have to set the stream to be the one that // corresponds to this widget. @@ -548,14 +548,14 @@ // cmd -- issue a command to the PLplot library - if ( ( c == 'c' ) && ( strncmp( argv[1], "cmd", length ) == 0 ) ) + if ( ( c == 'c' ) && ( strncmp( argv[1], "cmd", (size_t) length ) == 0 ) ) { result = Cmd( interp, plFramePtr, argc - 2, argv + 2 ); } // cget - else if ( ( c == 'c' ) && ( strncmp( argv[1], "cget", length ) == 0 ) ) + else if ( ( c == 'c' ) && ( strncmp( argv[1], "cget", (size_t) length ) == 0 ) ) { if ( argc > 2 ) { @@ -573,7 +573,7 @@ // configure - else if ( ( c == 'c' ) && ( strncmp( argv[1], "configure", length ) == 0 ) ) + else if ( ( c == 'c' ) && ( strncmp( argv[1], "configure", (size_t) length ) == 0 ) ) { if ( argc == 2 ) { @@ -595,8 +595,8 @@ // double buffering else if ( ( c == 'd' ) && - ( ( strncmp( argv[1], "db", length ) == 0 ) || - ( strncmp( argv[1], "doublebuffering", length == 0 ) ) ) ) + ( ( strncmp( argv[1], "db", (size_t) length ) == 0 ) || + ( strncmp( argv[1], "doublebuffering", (size_t) length == 0 ) ) ) ) { PLBufferingCB bcb; @@ -625,7 +625,7 @@ // closelink -- Close a binary data link previously opened with openlink - else if ( ( c == 'c' ) && ( strncmp( argv[1], "closelink", length ) == 0 ) ) + else if ( ( c == 'c' ) && ( strncmp( argv[1], "closelink", (size_t) length ) == 0 ) ) { if ( argc > 2 ) { @@ -642,7 +642,7 @@ // draw -- rubber-band draw used in region selection - else if ( ( c == 'd' ) && ( strncmp( argv[1], "draw", length ) == 0 ) ) + else if ( ( c == 'd' ) && ( strncmp( argv[1], "draw", (size_t) length ) == 0 ) ) { if ( argc == 2 ) { @@ -659,31 +659,31 @@ // color-manipulating commands, grouped together for convenience - else if ( ( ( c == 'g' ) && ( ( strncmp( argv[1], "gcmap0", length ) == 0 ) || - ( strncmp( argv[1], "gcmap1", length ) == 0 ) ) ) || - ( ( c == 's' ) && ( ( strncmp( argv[1], "scmap0", length ) == 0 ) || - ( strncmp( argv[1], "scmap1", length ) == 0 ) || - ( strncmp( argv[1], "scol0", length ) == 0 ) || - ( strncmp( argv[1], "scol1", length ) == 0 ) ) ) ) + else if ( ( ( c == 'g' ) && ( ( strncmp( argv[1], "gcmap0", (size_t) length ) == 0 ) || + ( strncmp( argv[1], "gcmap1", (size_t) length ) == 0 ) ) ) || + ( ( c == 's' ) && ( ( strncmp( argv[1], "scmap0", (size_t) length ) == 0 ) || + ( strncmp( argv[1], "scmap1", (size_t) length ) == 0 ) || + ( strncmp( argv[1], "scol0", (size_t) length ) == 0 ) || + ( strncmp( argv[1], "scol1", (size_t) length ) == 0 ) ) ) ) result = ColorManip( interp, plFramePtr, argc - 1, argv + 1 ); // info -- returns requested info - else if ( ( c == 'i' ) && ( strncmp( argv[1], "info", length ) == 0 ) ) + else if ( ( c == 'i' ) && ( strncmp( argv[1], "info", (size_t) length ) == 0 ) ) { result = Info( interp, plFramePtr, argc - 2, argv + 2 ); } // orient -- Set plot orientation - else if ( ( c == 'o' ) && ( strncmp( argv[1], "orient", length ) == 0 ) ) + else if ( ( c == 'o' ) && ( strncmp( argv[1], "orient", (size_t) length ) == 0 ) ) { result = Orient( interp, plFramePtr, argc - 2, argv + 2 ); } // openlink -- Open a binary data link (FIFO or socket) - else if ( ( c == 'o' ) && ( strncmp( argv[1], "openlink", length ) == 0 ) ) + else if ( ( c == 'o' ) && ( strncmp( argv[1], "openlink", (size_t) length ) == 0 ) ) { if ( argc < 3 ) { @@ -700,21 +700,21 @@ // page -- change or return output page setup - else if ( ( c == 'p' ) && ( strncmp( argv[1], "page", length ) == 0 ) ) + else if ( ( c == 'p' ) && ( strncmp( argv[1], "page", (size_t) length ) == 0 ) ) { result = Page( interp, plFramePtr, argc - 2, argv + 2 ); } // print -- prints plot - else if ( ( c == 'p' ) && ( strncmp( argv[1], "print", length ) == 0 ) ) + else if ( ( c == 'p' ) && ( strncmp( argv[1], "print", (size_t) length ) == 0 ) ) { result = Print( interp, plFramePtr, argc - 2, argv + 2 ); } // redraw -- redraw plot - else if ( ( c == 'r' ) && ( strncmp( argv[1], "redraw", length ) == 0 ) ) + else if ( ( c == 'r' ) && ( strncmp( argv[1], "redraw", (size_t) length ) == 0 ) ) { if ( argc > 2 ) { @@ -731,28 +731,28 @@ // report -- find out useful info about the plframe (GMF) - else if ( ( c == 'r' ) && ( strncmp( argv[1], "report", length ) == 0 ) ) + else if ( ( c == 'r' ) && ( strncmp( argv[1], "report", (size_t) length ) == 0 ) ) { result = report( interp, plFramePtr, argc - 2, argv + 2 ); } // save -- saves plot to the specified plot file type - else if ( ( c == 's' ) && ( strncmp( argv[1], "save", length ) == 0 ) ) + else if ( ( c == 's' ) && ( strncmp( argv[1], "save", (size_t) length ) == 0 ) ) { result = Save( interp, plFramePtr, argc - 2, argv + 2 ); } // view -- change or return window into plot - else if ( ( c == 'v' ) && ( strncmp( argv[1], "view", length ) == 0 ) ) + else if ( ( c == 'v' ) && ( strncmp( argv[1], "view", (size_t) length ) == 0 ) ) { result = View( interp, plFramePtr, argc - 2, argv + 2 ); } // xscroll -- horizontally scroll window into plot - else if ( ( c == 'x' ) && ( strncmp( argv[1], "xscroll", length ) == 0 ) ) + else if ( ( c == 'x' ) && ( strncmp( argv[1], "xscroll", (size_t) length ) == 0 ) ) { if ( argc == 2 || argc > 3 ) { @@ -769,7 +769,7 @@ // yscroll -- vertically scroll window into plot - else if ( ( c == 'y' ) && ( strncmp( argv[1], "yscroll", length ) == 0 ) ) + else if ( ( c == 'y' ) && ( strncmp( argv[1], "yscroll", (size_t) length ) == 0 ) ) { if ( argc == 2 || argc > 3 ) { @@ -1012,20 +1012,20 @@ { int x0_old, x1_old, y0_old, y1_old, x0_new, x1_new, y0_new, y1_new; - x0_old = plFramePtr->pldis.x; - y0_old = plFramePtr->pldis.y; - x1_old = x0_old + plFramePtr->pldis.width; - y1_old = y0_old + plFramePtr->pldis.height; + x0_old = (int) plFramePtr->pldis.x; + y0_old = (int) plFramePtr->pldis.y; + x1_old = x0_old + (int) plFramePtr->pldis.width; + y1_old = y0_old + (int) plFramePtr->pldis.height; x0_new = event->x; y0_new = event->y; x1_new = x0_new + event->width; y1_new = y0_new + event->height; - plFramePtr->pldis.x = MIN( x0_old, x0_new ); - plFramePtr->pldis.y = MIN( y0_old, y0_new ); - plFramePtr->pldis.width = MAX( x1_old, x1_new ) - plFramePtr->pldis.x; - plFramePtr->pldis.height = MAX( y1_old, y1_new ) - plFramePtr->pldis.y; + plFramePtr->pldis.x = (unsigned int) MIN( x0_old, x0_new ); + plFramePtr->pldis.y = (unsigned int) MIN( y0_old, y0_new ); + plFramePtr->pldis.width = (unsigned int) MAX( x1_old, x1_new ) - plFramePtr->pldis.x; + plFramePtr->pldis.height = (unsigned int) MAX( y1_old, y1_new ) - plFramePtr->pldis.y; } // Invoke DoWhenIdle handler to redisplay widget. @@ -1377,11 +1377,11 @@ if ( plFramePtr->drawing_xhairs ) UpdateXhairs( plFramePtr ); - plFramePtr->xhair_x[0].x = xmin; plFramePtr->xhair_x[0].y = y0; - plFramePtr->xhair_x[1].x = xmax; plFramePtr->xhair_x[1].y = y0; + plFramePtr->xhair_x[0].x = (short) xmin; plFramePtr->xhair_x[0].y = (short) y0; + plFramePtr->xhair_x[1].x = (short) xmax; plFramePtr->xhair_x[1].y = (short) y0; - plFramePtr->xhair_y[0].x = x0; plFramePtr->xhair_y[0].y = ymin; - plFramePtr->xhair_y[1].x = x0; plFramePtr->xhair_y[1].y = ymax; + plFramePtr->xhair_y[0].x = (short) x0; plFramePtr->xhair_y[0].y = (short) ymin; + plFramePtr->xhair_y[1].x = (short) x0; plFramePtr->xhair_y[1].y = (short) ymax; UpdateXhairs( plFramePtr ); } @@ -1430,8 +1430,8 @@ win_y >= 0 && win_y < Tk_Height( tkwin ) ) { // Okay, pointer is in our window. - plFramePtr->rband_pt[0].x = win_x; - plFramePtr->rband_pt[0].y = win_y; + plFramePtr->rband_pt[0].x = (short) win_x; + plFramePtr->rband_pt[0].y = (short) win_y; DrawRband( plFramePtr, win_x, win_y ); plFramePtr->drawing_rband = 1; @@ -1510,7 +1510,7 @@ if ( plFramePtr->drawing_rband ) UpdateRband( plFramePtr ); - plFramePtr->rband_pt[1].x = x0; plFramePtr->rband_pt[1].y = y0; + plFramePtr->rband_pt[1].x = (short) x0; plFramePtr->rband_pt[1].y = (short) y0; UpdateRband( plFramePtr ); } @@ -1563,7 +1563,7 @@ if ( !plFramePtr->tkwin_initted ) { plsstrm( plFramePtr->ipls ); - plsxwin( Tk_WindowId( tkwin ) ); + plsxwin( (PLINT) Tk_WindowId( tkwin ) ); plspause( 0 ); plinit(); // plplot_ccmap is statically defined in plxwd.h. Note that @@ -1739,8 +1739,8 @@ else if ( ( plFramePtr->width != plFramePtr->prevWidth ) || ( plFramePtr->height != plFramePtr->prevHeight ) ) { - plFramePtr->pldis.width = plFramePtr->width; - plFramePtr->pldis.height = plFramePtr->height; + plFramePtr->pldis.width = (unsigned int) plFramePtr->width; + plFramePtr->pldis.height = (unsigned int) plFramePtr->height; plsstrm( plFramePtr->ipls ); pl_cmd( PLESC_RESIZE, (void *) &( plFramePtr->pldis ) ); @@ -1766,10 +1766,10 @@ // Reset window bounds so that next time they are set fresh - plFramePtr->pldis.x = Tk_X( tkwin ) + Tk_Width( tkwin ); - plFramePtr->pldis.y = Tk_Y( tkwin ) + Tk_Height( tkwin ); - plFramePtr->pldis.width = -Tk_Width( tkwin ); - plFramePtr->pldis.height = -Tk_Height( tkwin ); + plFramePtr->pldis.x = (unsigned int) ( Tk_X( tkwin ) + Tk_Width( tkwin ) ); + plFramePtr->pldis.y = (unsigned int) ( Tk_Y( tkwin ) + Tk_Height( tkwin ) ); + plFramePtr->pldis.width = (unsigned int) ( -Tk_Width( tkwin ) ); + plFramePtr->pldis.height = (unsigned int) ( -Tk_Height( tkwin ) ); } // Update graphic crosshairs if necessary @@ -1829,9 +1829,9 @@ ( pls->cmap0[i].g != g ) || ( pls->cmap0[i].b != b ) ) { - pls->cmap0[i].r = r; - pls->cmap0[i].g = g; - pls->cmap0[i].b = b; + pls->cmap0[i].r = (unsigned char) r; + pls->cmap0[i].g = (unsigned char) g; + pls->cmap0[i].b = (unsigned char) b; *p_changed = 1; } @@ -1960,12 +1960,12 @@ plsstrm( plFramePtr->ipls ); c = argv[0][0]; - length = strlen( argv[0] ); + length = (int) strlen( argv[0] ); // gcmap0 -- get color map 0 // first arg is number of colors, the rest are hex number specifications - if ( ( c == 'g' ) && ( strncmp( argv[0], "gcmap0", length ) == 0 ) ) + if ( ( c == 'g' ) && ( strncmp( argv[0], "gcmap0", (size_t) length ) == 0 ) ) { int i; unsigned long plcolor; @@ -1975,9 +1975,9 @@ Tcl_AppendElement( interp, str ); for ( i = 0; i < pls->ncol0; i++ ) { - plcolor = ( ( pls->cmap0[i].r << 16 ) | - ( pls->cmap0[i].g << 8 ) | - ( pls->cmap0[i].b ) ); + plcolor = (unsigned long) ( ( pls->cmap0[i].r << 16 ) | + ( pls->cmap0[i].g << 8 ) | + ( pls->cmap0[i].b ) ); sprintf( str, "#%06lx", ( plcolor & 0xFFFFFF ) ); Tcl_AppendElement( interp, str ); @@ -1989,7 +1989,7 @@ // first arg is number of control points // the rest are hex number specifications followed by positions (0-100) - else if ( ( c == 'g' ) && ( strncmp( argv[0], "gcmap1", length ) == 0 ) ) + else if ( ( c == 'g' ) && ( strncmp( argv[0], "gcmap1", (size_t) length ) == 0 ) ) { int i; unsigned long plcolor; @@ -2011,7 +2011,7 @@ g1 = MAX( 0, MIN( 255, (int) ( 256. * g ) ) ); b1 = MAX( 0, MIN( 255, (int) ( 256. * b ) ) ); - plcolor = ( ( r1 << 16 ) | ( g1 << 8 ) | ( b1 ) ); + plcolor = (unsigned long) ( ( r1 << 16 ) | ( g1 << 8 ) | ( b1 ) ); sprintf( str, "#%06lx", ( plcolor & 0xFFFFFF ) ); Tcl_AppendElement( interp, str ); @@ -2028,7 +2028,7 @@ // scmap0 -- set color map 0 // first arg is number of colors, the rest are hex number specifications - else if ( ( c == 's' ) && ( strncmp( argv[0], "scmap0", length ) == 0 ) ) + else if ( ( c == 's' ) && ( strncmp( argv[0], "scmap0", (size_t) length ) == 0 ) ) { int i, changed = 1, ncol0 = atoi( argv[1] ); char *col; @@ -2063,7 +2063,7 @@ // scmap1 -- set color map 1 // first arg is number of colors, the rest are hex number specifications - else if ( ( c == 's' ) && ( strncmp( argv[0], "scmap1", length ) == 0 ) ) + else if ( ( c == 's' ) && ( strncmp( argv[0], "scmap1", (size_t) length ) == 0 ) ) { int i, changed = 1, ncp1 = atoi( argv[1] ); char *col, *pos, *rev; @@ -2098,8 +2098,7 @@ if ( changed ) { - PLStream *pls = plFramePtr->pls; - pls->ncp1 = ncp1; + plFramePtr->pls->ncp1 = ncp1; plcmap1_calc(); } } @@ -2107,7 +2106,7 @@ // scol0 -- set single color in cmap0 // first arg is the color number, the next is the color in hex - else if ( ( c == 's' ) && ( strncmp( argv[0], "scol0", length ) == 0 ) ) + else if ( ( c == 's' ) && ( strncmp( argv[0], "scol0", (size_t) length ) == 0 ) ) { int i = atoi( argv[1] ), changed = 1; @@ -2128,7 +2127,7 @@ // scol1 -- set color of control point in cmap1 // first arg is the control point, the next two are the color in hex and pos - else if ( ( c == 's' ) && ( strncmp( argv[0], "scol1", length ) == 0 ) ) + else if ( ( c == 's' ) && ( strncmp( argv[0], "scol1", (size_t) length ) == 0 ) ) { int i = atoi( argv[1] ), changed = 1; @@ -2354,7 +2353,7 @@ register Tk_Window tkwin = plFramePtr->tkwin; int result = TCL_OK; char c = argv[0][0]; - int length = strlen( argv[0] ); + int length = (int) strlen( argv[0] ); // Make sure widget has been initialized before going any further @@ -2365,14 +2364,14 @@ // init -- sets up for rubber-band drawing - if ( ( c == 'i' ) && ( strncmp( argv[0], "init", length ) == 0 ) ) + if ( ( c == 'i' ) && ( strncmp( argv[0], "init", (size_t) length ) == 0 ) ) { Tk_DefineCursor( tkwin, plFramePtr->xhair_cursor ); } // end -- ends rubber-band drawing - else if ( ( c == 'e' ) && ( strncmp( argv[0], "end", length ) == 0 ) ) + else if ( ( c == 'e' ) && ( strncmp( argv[0], "end", (size_t) length ) == 0 ) ) { Tk_DefineCursor( tkwin, plFramePtr->cursor ); if ( plFramePtr->continue_draw ) @@ -2389,7 +2388,7 @@ // rect -- draw a rectangle, used to select rectangular areas // first draw erases old outline - else if ( ( c == 'r' ) && ( strncmp( argv[0], "rect", length ) == 0 ) ) + else if ( ( c == 'r' ) && ( strncmp( argv[0], "rect", (size_t) length ) == 0 ) ) { if ( argc < 5 ) { @@ -2421,11 +2420,11 @@ XSync( Tk_Display( tkwin ), 0 ); } - plFramePtr->pts[0].x = x0; plFramePtr->pts[0].y = y0; - plFramePtr->pts[1].x = x1; plFramePtr->pts[1].y = y0; - plFramePtr->pts[2].x = x1; plFramePtr->pts[2].y = y1; - plFramePtr->pts[3].x = x0; plFramePtr->pts[3].y = y1; - plFramePtr->pts[4].x = x0; plFramePtr->pts[4].y = y0; + plFramePtr->pts[0].x = (short) x0; plFramePtr->pts[0].y = (short) y0; + plFramePtr->pts[1].x = (short) x1; plFramePtr->pts[1].y = (short) y0; + plFramePtr->pts[2].x = (short) x1; plFramePtr->pts[2].y = (short) y1; + plFramePtr->pts[3].x = (short) x0; plFramePtr->pts[3].y = (short) y1; + plFramePtr->pts[4].x = (short) x0; plFramePtr->pts[4].y = (short) y0; XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ), plFramePtr->xorGC, plFramePtr->pts, 5, @@ -2463,11 +2462,11 @@ } c = argv[0][0]; - length = strlen( argv[0] ); + length = (int) strlen( argv[0] ); // devkeys -- return list of supported device keywords - if ( ( c == 'd' ) && ( strncmp( argv[0], "devkeys", length ) == 0 ) ) + if ( ( c == 'd' ) && ( strncmp( argv[0], "devkeys", (size_t) length ) == 0 ) ) { int i = 0; while ( plFramePtr->devName[i] != NULL ) @@ -2478,7 +2477,7 @@ // devkeys -- return list of supported device types - else if ( ( c == 'd' ) && ( strncmp( argv[0], "devnames", length ) == 0 ) ) + else if ( ( c == 'd' ) && ( strncmp( argv[0], "devnames", (size_t) length ) == 0 ) ) { int i = 0; while ( plFramePtr->devDesc[i] != NULL ) @@ -2516,13 +2515,13 @@ register PLiodev *iodev = plr->iodev; char c = argv[0][0]; - int length = strlen( argv[0] ); + int length = (int) strlen( argv[0] ); dbug_enter( "Openlink" ); // Open fifo - if ( ( c == 'f' ) && ( strncmp( argv[0], "fifo", length ) == 0 ) ) + if ( ( c == 'f' ) && ( strncmp( argv[0], "fifo", (size_t) length ) == 0 ) ) { if ( argc < 1 ) { @@ -2544,7 +2543,7 @@ // Open socket - else if ( ( c == 's' ) && ( strncmp( argv[0], "socket", length ) == 0 ) ) + else if ( ( c == 's' ) && ( strncmp( argv[0], "socket", (size_t) length ) == 0 ) ) { if ( argc < 1 ) { @@ -2728,7 +2727,7 @@ if ( pdfs->bp == 0 ) return TCL_OK; - plr->nbytes = pdfs->bp; + plr->nbytes = (int) pdfs->bp; pdfs->bp = 0; result = process_data( interp, plFramePtr ); } @@ -2984,11 +2983,11 @@ } c = argv[0][0]; - length = strlen( argv[0] ); + length = (int) strlen( argv[0] ); // save to specified device & file - if ( ( c == 'a' ) && ( strncmp( argv[0], "as", length ) == 0 ) ) + if ( ( c == 'a' ) && ( strncmp( argv[0], "as", (size_t) length ) == 0 ) ) { if ( argc < 3 ) { @@ -3045,7 +3044,7 @@ // close save file - else if ( ( c == 'c' ) && ( strncmp( argv[0], "close", length ) == 0 ) ) + else if ( ( c == 'c' ) && ( strncmp( argv[0], "close", (size_t) length ) == 0 ) ) { if ( !plFramePtr->ipls_save ) { @@ -3104,12 +3103,12 @@ } c = argv[0][0]; - length = strlen( argv[0] ); + length = (int) strlen( argv[0] ); // view bounds -- return relative device coordinates of bounds on current // plot window - if ( ( c == 'b' ) && ( strncmp( argv[0], "bounds", length ) == 0 ) ) + if ( ( c == 'b' ) && ( strncmp( argv[0], "bounds", (size_t) length ) == 0 ) ) { char result_str[128]; xl = 0.; yl = 0.; @@ -3122,7 +3121,7 @@ // view reset -- Resets plot - if ( ( c == 'r' ) && ( strncmp( argv[0], "reset", length ) == 0 ) ) + if ( ( c == 'r' ) && ( strncmp( argv[0], "reset", (size_t) length ) == 0 ) ) { xl = 0.; yl = 0.; xr = 1.; yr = 1.; @@ -3132,7 +3131,7 @@ // view select -- set window into plot space // Specifies in terms of plot window coordinates, not device coordinates - else if ( ( c == 's' ) && ( strncmp( argv[0], "select", length ) == 0 ) ) + else if ( ( c == 's' ) && ( strncmp( argv[0], "select", (size_t) length ) == 0 ) ) { if ( argc < 5 ) { @@ -3151,7 +3150,7 @@ // view zoom -- set window into plot space incrementally (zoom) // Here we need to take the page (device) offsets into account - else if ( ( c == 'z' ) && ( strncmp( argv[0], "zoom", length ) == 0 ) ) + else if ( ( c == 'z' ) && ( strncmp( argv[0], "zoom", (size_t) length ) == 0 ) ) { if ( argc < 5 ) { @@ -3363,8 +3362,8 @@ return; totalUnits = height; - firstUnit = 0.5 + (PLFLT) height * ( 1. - plFramePtr->yr ); - lastUnit = 0.5 + (PLFLT) height * ( 1. - plFramePtr->yl ); + firstUnit = (int) ( 0.5 + (PLFLT) height * ( 1. - plFramePtr->yr ) ); + lastUnit = (int) ( 0.5 + (PLFLT) height * ( 1. - plFramePtr->yl ) ); windowUnits = lastUnit - firstUnit; sprintf( string, " %d %d %d %d", totalUnits, windowUnits, firstUnit, lastUnit ); @@ -3395,8 +3394,8 @@ return; totalUnits = width; - firstUnit = 0.5 + (PLFLT) width * plFramePtr->xl; - lastUnit = 0.5 + (PLFLT) width * plFramePtr->xr; + firstUnit = (int) ( 0.5 + (PLFLT) width * plFramePtr->xl ); + lastUnit = (int) ( 0.5 + (PLFLT) width * plFramePtr->xr ); windowUnits = lastUnit - firstUnit; sprintf( string, " %d %d %d %d", totalUnits, windowUnits, firstUnit, lastUnit ); Modified: trunk/bindings/tk/plr.c =================================================================== --- trunk/bindings/tk/plr.c 2011-10-19 07:04:09 UTC (rev 11974) +++ trunk/bindings/tk/plr.c 2011-10-19 11:05:10 UTC (rev 11975) @@ -116,7 +116,7 @@ dbug_enter( "plr_process" ); - while ( plr->pdfs->bp < plr->nbytes ) + while ( plr->pdfs->bp < (size_t) plr->nbytes ) { plr_cmd( c = plr_get( plr ) ); csave = c; @@ -217,28 +217,28 @@ if ( !strcmp( tag, "xmin" ) ) { plr_rd( pdf_rd_2bytes( plr->pdfs, &dum_ushort ) ); - plr->xmin = dum_ushort; + plr->xmin = (short) dum_ushort; continue; } if ( !strcmp( tag, "xmax" ) ) { plr_rd( pdf_rd_2bytes( plr->pdfs, &dum_ushort ) ); - plr->xmax = dum_ushort; + plr->xmax = (short) dum_ushort; continue; } if ( !strcmp( tag, "ymin" ) ) { plr_rd( pdf_rd_2bytes( plr->pdfs, &dum_ushort ) ); - plr->ymin = dum_ushort; + plr->ymin = (short) dum_ushort; continue; } if ( !strcmp( tag, "ymax" ) ) { plr_rd( pdf_rd_2bytes( plr->pdfs, &dum_ushort ) ); - plr->ymax = dum_ushort; + plr->ymax = (short) dum_ushort; continue; } @@ -290,7 +290,7 @@ plr_cmd( get_ncoords( plr, x + npts, y + npts, 1 ) ); npts++; - if ( npts == PL_MAXPOLY || ( plr->pdfs->bp == plr->nbytes ) ) + if ( npts == PL_MAXPOLY || ( plr->pdfs->bp == (size_t) plr->nbytes ) ) break; plr_cmd( c1 = plr_get( plr ) ); @@ -337,8 +337,8 @@ if ( n > PL_MAXPOLY ) { - xs = (short *) malloc( sizeof ( short ) * n ); - ys = (short *) malloc( sizeof ( short ) * n ); + xs = (short *) malloc( sizeof ( short ) * (size_t) n ); + ys = (short *) malloc( sizeof ( short ) * (size_t) n ); } else { @@ -428,7 +428,7 @@ case PLSTATE_COLOR0: { short icol0; - plr_rd( pdf_rd_2bytes( plr->pdfs, &icol0 ) ); + plr_rd( pdf_rd_2bytes( plr->pdfs, (unsigned short *) &icol0 ) ); if ( icol0 == PL_RGB_COLOR ) { Modified: trunk/bindings/tk/plserver.c =================================================================== --- trunk/bindings/tk/plserver.c 2011-10-19 07:04:09 UTC (rev 11974) +++ trunk/bindings/tk/plserver.c 2011-10-19 11:05:10 UTC (rev 11975) @@ -98,7 +98,7 @@ int i, myargc = argc; const char *myargv[20]; Tcl_Interp *interp; - char *helpmsg = "Command-specific options:"; + const char *helpmsg = "Command-specific options:"; #ifdef DEBUG fprintf( stderr, "Program %s called with arguments :\n", argv[0] ); Modified: trunk/bindings/tk/pltkd.h =================================================================== --- trunk/bindings/tk/pltkd.h 2011-10-19 07:04:09 UTC (rev 11974) +++ trunk/bindings/tk/pltkd.h 2011-10-19 11:05:10 UTC (rev 11975) @@ -32,9 +32,9 @@ int exit_eventloop; // Break out of event loop int pass_thru; // Skip normal error termination char *cmdbuf; // Command buffer - int cmdbuf_len; // and its length + size_t cmdbuf_len; // and its length PLiodev *iodev; // I/O device info - char *updatecmd; // Name of update command + const char *updatecmd; // Name of update command pid_t child_pid; // PID for child process int instr; // Instruction timer int max_instr; // Limit before issuing an update Modified: trunk/bindings/tk/tcpip.c =================================================================== --- trunk/bindings/tk/tcpip.c 2011-10-19 07:04:09 UTC (rev 11974) +++ trunk/bindings/tk/tcpip.c 2011-10-19 11:05:10 UTC (rev 11975) @@ -84,7 +84,6 @@ #ifdef caddr_t #undef caddr_t #endif -#define PLARGS( a ) ( ) #include <stdio.h> #include <stdlib.h> @@ -97,6 +96,7 @@ #include <unistd.h> #endif +#include "plplot.h" #include "tcpip.h" #include <tcl.h> #include <tk.h> @@ -108,7 +108,7 @@ #include <sys/uio.h> #include <errno.h> -extern int errno; +//extern int errno; #ifndef MIN #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) @@ -139,11 +139,13 @@ static PartialRead *partial[MAX_OPEN_FILES]; -static void pl_FreeReadBuffer PLARGS( (int fd) ); -static void pl_Unread PLARGS( ( int fd, char *buffer, - int numBytes, int copy ) ); -static int pl_Read PLARGS( ( int fd, char *buffer, int numReq ) ); +static void pl_FreeReadBuffer( int fd ); +static void pl_Unread( int fd, char *buffer, int numBytes, int copy ); +static int pl_Read( int fd, char *buffer, int numReq ); +int pl_PacketReceive( Tcl_Interp * interp, PLiodev *iodev, PDFstrm *pdfs ); +int pl_PacketSend( Tcl_Interp * interp, PLiodev *iodev, PDFstrm *pdfs ); + // //-------------------------------------------------------------------------- // @@ -162,8 +164,7 @@ // static void -pl_FreeReadBuffer( fd ) -int fd; +pl_FreeReadBuffer( int fd ) { PartialRead *readList; @@ -194,20 +195,20 @@ // static void -pl_Unread( fd, buffer, numBytes, copy ) -int fd; // File descriptor -char *buffer; // Data to unget -int numBytes; // Number of bytes to unget -int copy; // Should we copy the data, or use this - // buffer? +pl_Unread( int fd, char *buffer, int numBytes, int copy ) +//int fd; // File descriptor +//char *buffer; // Data to unget +//int numBytes; // Number of bytes to unget +//int copy; // Should we copy the data, or use this +// buffer? { PartialRead *new; new = (PartialRead *) malloc( sizeof ( PartialRead ) ); if ( copy ) { - new->buffer = (char *) malloc( numBytes ); - memcpy( new->buffer, buffer, numBytes ); + new->buffer = (char *) malloc( (size_t) numBytes ); + memcpy( new->buffer, buffer, (size_t) numBytes ); } else { @@ -238,10 +239,10 @@ // static int -pl_Read( fd, buffer, numReq ) -int fd; // File descriptor to read from -char *buffer; // Place to put the data -int numReq; // Number of bytes to get +pl_Read( int fd, char *buffer, int numReq ) +//int fd; // File descriptor to read from +//char *buffer; // Place to put the data +//int numReq; // Number of bytes to get { PartialRead *readList; PartialRead *tmp; @@ -256,7 +257,7 @@ // if ( readList == NULL ) { - numRead = read( fd, buffer, numReq ); + numRead = (int) read( fd, buffer, (size_t) numReq ); #ifdef DEBUG { int j; @@ -282,7 +283,7 @@ { numToCopy = numReq - numRead; } - memcpy( buffer + numRead, readList->buffer + readList->offset, numToCopy ); + memcpy( buffer + numRead, readList->buffer + readList->offset, (size_t) numToCopy ); // // Consume the data @@ -305,7 +306,7 @@ if ( ( numRead < numReq ) ) { numToCopy = numReq - numRead; - numRead += read( fd, buffer + numRead, numToCopy ); + numRead += (int) read( fd, buffer + numRead, (size_t) numToCopy ); } return numRead; @@ -334,9 +335,7 @@ //-------------------------------------------------------------------------- static char * -get_inet( listptr, length ) -char **listptr; -int length; +get_inet( char ** listptr, int length ) { struct in_addr *ptr; @@ -347,11 +346,7 @@ } int -plHost_ID( clientData, interp, argc, argv ) -ClientData clientData; -Tcl_Interp *interp; -int argc; -char **argv; +plHost_ID( ClientData clientData, Tcl_Interp *interp, int argc, char **argv ) { register struct hostent *hostptr; char hostname[100]; @@ -403,16 +398,13 @@ //-------------------------------------------------------------------------- // int -pl_PacketReceive( interp, iodev, pdfs ) -Tcl_Interp * interp; -PLiodev *iodev; -PDFstrm *pdfs; +pl_PacketReceive( Tcl_Interp *interp, PLiodev *iodev, PDFstrm *pdfs ) { int j, numRead; unsigned int packetLen, header[2]; int headerSize; unsigned char hbuf[8]; - char *errMsg; + const char *errMsg; pdfs->bp = 0; @@ -453,15 +445,15 @@ j = 0; header[0] = 0; - header[0] |= hbuf[j++] << 24; - header[0] |= hbuf[j++] << 16; - header[0] |= hbuf[j++] << 8; + header[0] |= (unsigned int) ( hbuf[j++] << 24 ); + header[0] |= (unsigned int) ( hbuf[j++] << 16 ); + header[0] |= (unsigned int) ( hbuf[j++] << 8 ); header[0] |= hbuf[j++]; header[1] = 0; - header[1] |= hbuf[j++] << 24; - header[1] |= hbuf[j++] << 16; - header[1] |= hbuf[j++] << 8; + header[1] |= (unsigned int) ( hbuf[j++] << 24 ); + header[1] |= (unsigned int) ( hbuf[j++] << 16 ); + header[1] |= (unsigned int) ( hbuf[j++] << 8 ); header[1] |= hbuf[j++]; // @@ -478,7 +470,7 @@ ": badly formatted packet", (char *) NULL ); return TCL_ERROR; } - packetLen = header[1] - headerSize; + packetLen = header[1] - (unsigned int) headerSize; // // Expand the size of the buffer, as needed. @@ -501,7 +493,7 @@ if ( iodev->type == 0 ) { - numRead = pl_Read( iodev->fd, (char *) pdfs->buffer, packetLen ); + numRead = pl_Read( iodev->fd, (char *) pdfs->buffer, (int) packetLen ); } else { @@ -537,7 +529,7 @@ return TCL_OK; } - pdfs->bp = numRead; + pdfs->bp = (size_t) numRead; #ifdef DEBUG fprintf( stderr, "received %d byte packet starting with:", numRead ); for ( j = 0; j < 4; j++ ) @@ -569,7 +561,7 @@ // Record the error before closing the file if ( numRead != 0 ) { - errMsg = (char *) Tcl_PosixError( interp ); + errMsg = Tcl_PosixError( interp ); } else { @@ -622,15 +614,12 @@ // int -pl_PacketSend( interp, iodev, pdfs ) -Tcl_Interp * interp; -PLiodev *iodev; -PDFstrm *pdfs; +pl_PacketSend( Tcl_Interp * interp, PLiodev *iodev, PDFstrm *pdfs ) { int j, numSent; unsigned char hbuf[8]; unsigned int packetLen, header[2]; - int len; + size_t len; char *buffer, tmp[256]; // @@ -640,7 +629,7 @@ // Next packetLen-8 bytes are buffer contents. // - packetLen = pdfs->bp + 8; + packetLen = (unsigned int) pdfs->bp + 8; header[0] = PACKET_MAGIC; header[1] = packetLen; @@ -652,15 +641,15 @@ j = 0; - hbuf[j++] = ( header[0] & (unsigned long) 0xFF000000 ) >> 24; - hbuf[j++] = ( header[0] & (unsigned long) 0x00FF0000 ) >> 16; - hbuf[j++] = ( header[0] & (unsigned long) 0x0000FF00 ) >> 8; - hbuf[j++] = ( header[0] & (unsigned long) 0x000000FF ); + hbuf[j++] = (unsigned char) ( ( header[0] & (unsigned long) 0xFF000000 ) >> 24 ); + hbuf[j++] = (unsigned char) ( ( header[0] & (unsigned long) 0x00FF0000 ) >> 16 ); + hbuf[j++] = (unsigned char) ( ( header[0] & (unsigned long) 0x0000FF00 ) >> 8 ); + hbuf[j++] = (unsigned char) ( header[0] & (unsigned long) 0x000000FF ); - hbuf[j++] = ( header[1] & (unsigned long) 0xFF000000 ) >> 24; - hbuf[j++] = ( header[1] & (unsigned long) 0x00FF0000 ) >> 16; - hbuf[j++] = ( header[1] & (unsigned long) 0x0000FF00 ) >> 8; - hbuf[j++] = ( header[1] & (unsigned long) 0x000000FF ); + hbuf[j++] = (unsigned char) ( ( header[1] & (unsigned long) 0xFF000000 ) >> 24 ); + hbuf[j++] = (unsigned char) ( ( header[1] & (unsigned long) 0x00FF0000 ) >> 16 ); + hbuf[j++] = (unsigned char) ( ( header[1] & (unsigned long) 0x0000FF00 ) >> 8 ); + hbuf[j++] = (unsigned char) ( header[1] & (unsigned long) 0x000000FF ); // // Send it off, with error checking. @@ -675,14 +664,14 @@ memcpy( buffer + 8, (char *) pdfs->buffer, pdfs->bp ); #ifdef DEBUG - fprintf( stderr, "sending %d byte packet starting with:", len ); + fprintf( stderr, "sending %z byte packet starting with:", len ); for ( j = 0; j < 12; j++ ) { fprintf( stderr, " %x", 0x000000FF & (unsigned long) buffer[j] ); } fprintf( stderr, "\n" ); #endif - numSent = write( iodev->fd, buffer, len ); + numSent = (int) write( iodev->fd, buffer, len ); free( buffer ); Modified: trunk/bindings/tk/tcpip.h =================================================================== --- trunk/bindings/tk/tcpip.h 2011-10-19 07:04:09 UTC (rev 11974) +++ trunk/bindings/tk/tcpip.h 2011-10-19 11:05:10 UTC (rev 11975) @@ -16,13 +16,11 @@ // Modified version of the "Tdp_PacketSend" command. PLDLLIMPEXP_TCLTK int -pl_PacketSend PLARGS( ( Tcl_Interp * interp, PLiodev * iodev, - PDFstrm * pdfs ) ); +pl_PacketSend( Tcl_Interp * interp, PLiodev * iodev, PDFstrm * pdfs ); // Modified version of the "Tdp_PacketReceive" command. PLDLLIMPEXP_TCLTK int -pl_PacketReceive PLARGS( ( Tcl_Interp * interp, PLiodev * iodev, - PDFstrm * pdfs ) ); +pl_PacketReceive( Tcl_Interp * interp, PLiodev * iodev, PDFstrm * pdfs ); #endif // __TCPIP_H__ Modified: trunk/bindings/tk/tkMain.c =================================================================== --- trunk/bindings/tk/tkMain.c 2011-10-19 07:04:09 UTC (rev 11974) +++ trunk/bindings/tk/tkMain.c 2011-10-19 11:05:10 UTC (rev 11975) @@ -180,8 +180,8 @@ pltkMain( int argc, const char **argv, char *RcFileName, int ( *AppInit )( Tcl_Interp *interp ) ) { - char *args, *... [truncated message content] |