From 8da6458c6b806b8bc998d7b8399a8e00c9be1358 Mon Sep 17 00:00:00 2001 From: Karl Smith Date: Thu, 31 Aug 2017 22:12:22 +0000 Subject: [PATCH] Fix bug in deleted_list_init; fix ez_delimited_read dates without times; remove many C warnings - mostly unused variables but also invalid match of scan format to args git-svn-id: file:///home/users/tmap/svn/repos/ferret/trunk@24162 fdbf22ae-c210-0410-be80-ca943da6b8f8 --- fer/ccr/EF_InternalUtil.c | 22 +++------ fer/ccr/binaryRead.c | 11 +---- fer/ccr/copy_buffered_window.c | 10 +--- fer/ccr/fermain_c.c | 4 -- fer/ccr/ferret_dispatch_c.c | 1 - fer/ccr/grab_image_xwd.c | 66 ++------------------------- fer/ccr/put_frame.c | 8 ---- fer/ccr/replace_bad_data_sub.c | 1 - fer/ccr/unmap_animate_window.c | 2 +- fer/ccr/wgif.c | 10 ++-- fer/ccr/xfer_c_ptrs.c | 1 + fer/efi/date_decode.c | 6 +-- fmt/src/NCF_Util.c | 10 ---- fmt/src/cd_read_scale.c | 4 +- fmt/src/cd_read_sub.c | 2 +- fmt/src/deleted_list_init.c | 2 +- fmt/src/ez_delimited_read.c | 28 ++++-------- fmt/src/string_array_find_caseblind.c | 2 +- fmt/src/string_array_init.c | 2 +- fmt/src/tm_world_recur.c | 7 --- ppl/tmapadds/resize_xgks_window.c | 22 +-------- ppl/tmapadds/set_background.c | 11 ----- ppl/tmapadds/wait_on_resize.c | 10 +--- 23 files changed, 39 insertions(+), 203 deletions(-) diff --git a/fer/ccr/EF_InternalUtil.c b/fer/ccr/EF_InternalUtil.c index 380029462..a667f6868 100644 --- a/fer/ccr/EF_InternalUtil.c +++ b/fer/ccr/EF_InternalUtil.c @@ -1281,7 +1281,6 @@ static int continue_efcn_scan(int gfcn_num_internal) { char allpaths[8192]=""; char cmd[EF_MAX_DESCRIPTION_LENGTH]=""; int count=0; - int status=LIST_OK; int i_intEF; char *extension; @@ -1964,8 +1963,7 @@ void FORTRAN(efcn_get_custom_axes)( int *id_ptr, int *cx_list_ptr, int *status ) canjump = 1; - sprintf(tempText, ""); - strcat(tempText, ef_ptr->name); + strcpy(tempText, ef_ptr->name); strcat(tempText, "_custom_axes_"); if (!internally_linked) { @@ -2114,8 +2112,7 @@ void FORTRAN(efcn_get_result_limits)( int *id_ptr, int *mr_list_ptr, int *cx_lis canjump = 1; - sprintf(tempText, ""); - strcat(tempText, ef_ptr->name); + strcpy(tempText, ef_ptr->name); strcat(tempText, "_result_limits_"); if (!internally_linked) { @@ -2214,7 +2211,7 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m ExternalFunction *ef_ptr=NULL; ExternalFunctionInternals *i_ptr=NULL; DFTYPE *arg_ptr[EF_MAX_COMPUTE_ARGS]; - int xyzt=0, i=0, j=0; + int i=0, j=0; int size=0; int nargs=0; char tempText[EF_MAX_NAME_LENGTH]=""; @@ -2335,8 +2332,7 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m } else if (i_ptr->num_work_arrays > 0) { - sprintf(tempText, ""); - strcat(tempText, ef_ptr->name); + strcpy(tempText, ef_ptr->name); strcat(tempText, "_work_size_"); if (!internally_linked) { @@ -2451,8 +2447,7 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m * Now go ahead and call the external function's "_compute_" function, * prototyping it for the number of arguments expected. */ - sprintf(tempText, ""); - strcat(tempText, ef_ptr->name); + strcpy(tempText, ef_ptr->name); strcat(tempText, "_compute_"); switch ( i_ptr->num_reqd_args + i_ptr->num_work_arrays ) { @@ -2937,7 +2932,6 @@ int FORTRAN(efcn_get_id)( char name[] ) int FORTRAN(efcn_match_template)( int *id_ptr, char template[] ) { ExternalFunction *ef_ptr=NULL; - int status=LIST_OK; int EF_LT_MT_return; static int return_val=0; /* static because it needs to exist after the return statement */ @@ -3405,7 +3399,7 @@ void FORTRAN(ef_err_bail_out)(int *id_ptr, char *text) int EF_New( ExternalFunction *this ) { ExternalFunctionInternals *i_ptr=NULL; - int status=LIST_OK, i=0, j=0; + int i=0, j=0; static int return_val=0; /* static because it needs to exist after the return statement */ @@ -3476,13 +3470,10 @@ int EF_New( ExternalFunction *this ) void EF_store_globals(int *mr_list_ptr, int *cx_list_ptr, int *mres_ptr, DFTYPE *bad_flag_ptr) { - int i=0; - GLOBAL_mr_list_ptr = mr_list_ptr; GLOBAL_cx_list_ptr = cx_list_ptr; GLOBAL_mres_ptr = mres_ptr; GLOBAL_bad_flag_ptr = bad_flag_ptr; - } void FORTRAN(efcn_pass_arg_ptr)(int *iarg, DFTYPE *arg_ptr) { @@ -3527,7 +3518,6 @@ ExternalFunction *ef_ptr_from_id_ptr(int *id_ptr) int EF_ListTraverse_fprintf( char *data, char *curr ) { - FILE *File_ptr=(FILE *)data; ExternalFunction *ef_ptr=(ExternalFunction *)curr; fprintf(stderr, "path = \"%s\", name = \"%s\", id = %d, internals_ptr = %ld\n", diff --git a/fer/ccr/binaryRead.c b/fer/ccr/binaryRead.c index 75a50325d..299c65baa 100644 --- a/fer/ccr/binaryRead.c +++ b/fer/ccr/binaryRead.c @@ -182,12 +182,6 @@ static FileInfo *createBinaryReader(char *name, int lengths[MAXDIMS], int permut return fi; } -static void deleteVar(VarInfo *theVar) { - /* paranoia */ - memset(theVar, 0, sizeof(VarInfo)); - FerMem_Free(theVar, __FILE__, __LINE__); -} - static void deleteBinaryReader(FileInfo *fi){ FerMem_Free(fi->vars, __FILE__, __LINE__); fi->vars = NULL; @@ -200,7 +194,6 @@ static void deleteBinaryReader(FileInfo *fi){ static int addVar(FileInfo *fi, DFTYPE *data, int type, int doRead){ VarInfo *theVar = 0; - int i; if (fi->vars == (VarInfo *)0){ fi->vars = FerMem_Malloc(sizeof(VarInfo), __FILE__, __LINE__); @@ -247,7 +240,7 @@ static void SWAP(unsigned char *p1, unsigned char *p2) } /* switch the order of the bytes in a long integer */ -static int SWAP32(void *i_in) +static void SWAP32(void *i_in) { unsigned char *inptr = (unsigned char *)i_in; SWAP(inptr, &inptr[3]); @@ -261,7 +254,7 @@ static void SWAP16(void *i_in) SWAP(inptr, &inptr[1]); } -static double SWAP64(void *i_in) +static void SWAP64(void *i_in) { unsigned char *inptr = (unsigned char *)i_in; SWAP(inptr, &inptr[7]); diff --git a/fer/ccr/copy_buffered_window.c b/fer/ccr/copy_buffered_window.c index cb64cefeb..7999b5b62 100644 --- a/fer/ccr/copy_buffered_window.c +++ b/fer/ccr/copy_buffered_window.c @@ -48,13 +48,9 @@ void FORTRAN(copy_buffered_window)(int *ws_id, int *anim_id) { - WS_STATE_ENTRY *ws, *anim, *temp_win; + WS_STATE_ENTRY *ws, *anim; unsigned width, height; - XWindowAttributes win_info, anim_win_info; - int src_absx, src_absy, dest_absx, dest_absy; - int screen, tmp_id; - Window dummywin; - Pixmap pixmap; + XWindowAttributes win_info; /* determine the XGKS ws state entry structure from ws_id */ ws = OPEN_WSID (*ws_id); @@ -69,8 +65,6 @@ void FORTRAN(copy_buffered_window)(int *ws_id, int *anim_id) exit(1); } - screen = DefaultScreen(ws->dpy); - width = win_info.width; height = win_info.height; diff --git a/fer/ccr/fermain_c.c b/fer/ccr/fermain_c.c index 271602f35..09237717f 100644 --- a/fer/ccr/fermain_c.c +++ b/fer/ccr/fermain_c.c @@ -212,7 +212,6 @@ int main(int oargc, char *oargv[]) int journalfile = 1; int verify_flag = 1; int len_str; - int uvar_dset; int bat_mode; its_script = 0; @@ -418,9 +417,7 @@ static void command_line_run() FILE *fp = 0; char init_command[2176], script_file[2048], *home = getenv("HOME"); int ipath = 0; - int len_str = 0; int script_resetmem = 0; - double rmem_size; /* turn on ^C interrupts */ /* 10/97 *kob* add check for gui now that there is only one main program */ @@ -462,7 +459,6 @@ static void command_line_run() strcat( init_command, " "); } if (arg_pos !=0) { - len_str = strlen(init_command); strcat( init_command, script_args ); } strcat( init_command, "; EXIT/PROGRAM"); diff --git a/fer/ccr/ferret_dispatch_c.c b/fer/ccr/ferret_dispatch_c.c index 90073d5a6..e33b84119 100644 --- a/fer/ccr/ferret_dispatch_c.c +++ b/fer/ccr/ferret_dispatch_c.c @@ -67,7 +67,6 @@ void ferret_dispatch_c(char *init_command, smPtr sBuffer) { int flag_buff_size = NUMFLAGS; int TEXTLENGTH_size = TEXTLENGTH; - int NUMDOUBLES_size = NUMDOUBLES; /* call the FORTRAN program that actually does the FERRET command */ /* all arguments must be pointers for FORTRAN */ diff --git a/fer/ccr/grab_image_xwd.c b/fer/ccr/grab_image_xwd.c index 3846d22ab..ab108ca79 100644 --- a/fer/ccr/grab_image_xwd.c +++ b/fer/ccr/grab_image_xwd.c @@ -125,19 +125,17 @@ #define FEEP_VOLUME 0 +#include "ferret.h" #include "FerMem.h" /* Setable Options */ static int format = ZPixmap; -static Bool nobdrs = False; static Bool on_root = False; -static Bool standard_out = True; /* static Bool debug = False; */ static Bool use_installed = False; static long add_pixel_value = 0; -static int Image_Size(XImage *image); static int Get_XColors(XWindowAttributes *win_info, XImage *image, XColor **colors, Display *dpy); static int endian_type (void) @@ -145,21 +143,6 @@ static int endian_type (void) return (*(short *) "AZ")& 255; } -static long parse_long(char *s) -{ - char *fmt = "%lu"; - long retval = 0L; - int thesign = 1; - - if (s && s[0]) { - if (s[0] == '-') s++, thesign = -1; - if (s[0] == '0') s++, fmt = "%lo"; - if (s[0] == 'x' || s[0] == 'X') s++, fmt = "%lx"; - (void) sscanf (s, fmt, &retval); - } - return (thesign * retval); -} - /* * Window_Dump: dump a window to a file which must already be open for * writting. @@ -167,11 +150,7 @@ static long parse_long(char *s) void Window_Dump(Window window, Display *dpy, char *outfile, char *type) { - unsigned long swaptest = 1; XColor *colors = NULL; - unsigned buffer_size; - int win_name_size; - int header_size; int ncolors, i; char *win_name; Bool got_win_name; @@ -181,7 +160,6 @@ void Window_Dump(Window window, Display *dpy, char *outfile, char *type) int absx, absy, x, y; unsigned width, height; int dwidth, dheight; - int bw; Window dummywin; int *r, *g, *b; void (*func)(); @@ -227,19 +205,7 @@ void Window_Dump(Window window, Display *dpy, char *outfile, char *type) win_info.y = absy; width = win_info.width; height = win_info.height; - bw = 0; - -/* If borders are taken into account with unmapped windows, things crash. - this check on borders in xwd code not needed here. - if (!nobdrs) { - absx -= win_info.border_width; - absy -= win_info.border_width; - bw = win_info.border_width; - width += (2 * bw); - height += (2 * bw); - } -*/ dwidth = DisplayWidth (dpy, screen); dheight = DisplayHeight (dpy, screen); @@ -258,9 +224,6 @@ void Window_Dump(Window window, Display *dpy, char *outfile, char *type) got_win_name = True; } - /* sizeof(char) is included for the null string terminator. */ - win_name_size = strlen(win_name) + sizeof(char); - /* * Snarf the pixmap with XGetImage. */ @@ -294,11 +257,6 @@ void Window_Dump(Window window, Display *dpy, char *outfile, char *type) if (add_pixel_value != 0) XAddPixel (image, add_pixel_value); - /* - * Determine the pixmap size. - */ - buffer_size = Image_Size(image); - /* if (debug) outl("xwd: Getting Colors.\n");*/ ncolors = Get_XColors(&win_info, image, &colors,dpy); @@ -376,18 +334,6 @@ void Window_Dump(Window window, Display *dpy, char *outfile, char *type) XDestroyImage(image); } -/* - * Determine the pixmap size. - */ - -static int Image_Size(XImage *image) -{ - if (image->format != ZPixmap) - return(image->bytes_per_line * image->height * image->depth); - - return(image->bytes_per_line * image->height); -} - #define lowbit(x) ((x) & (~(x) + 1)) #define lowbyte(x) ((x) & (~(x) + 8)) @@ -400,8 +346,6 @@ static int Get_XColors(XWindowAttributes *win_info, XImage *image, XColor **colo unsigned long pixel; unsigned char *cptr,tmp_cptr; - Pixel pmask = 0xff000000; - Bool reverse_bytes; Colormap cmap = win_info->colormap; @@ -426,7 +370,7 @@ static int Get_XColors(XWindowAttributes *win_info, XImage *image, XColor **colo win_info->visual->class == TrueColor) { int nunique_colors; - char ind; + int ind; char *color_indices = (char *) image->data; unsigned int *color_values = (unsigned int *) image->data; /* int npixels = image->bytes_per_line * image->height; */ @@ -462,18 +406,18 @@ static int Get_XColors(XWindowAttributes *win_info, XImage *image, XColor **colo /* see if this pixel matches a known color index */ ind = 0; - while ( (ind < (int) nunique_colors) + while ( (ind < nunique_colors) && (color_values[i] != (*colors)[ind].pixel) ) ind++; /* store unique color just found */ - if (ind == (int)nunique_colors ) { + if (ind == nunique_colors ) { (*colors)[ind].pixel = color_values[i]; nunique_colors++; } /* replace color with index pointer in image structure */ /* (Read the image as color_values. Write it as color_indices) */ - color_indices[i] = ind; + color_indices[i] = (char) ind; } diff --git a/fer/ccr/put_frame.c b/fer/ccr/put_frame.c index 02da4dcb8..2625508f9 100644 --- a/fer/ccr/put_frame.c +++ b/fer/ccr/put_frame.c @@ -67,17 +67,10 @@ void FORTRAN(put_frame)(int *ws_id, char *filename, char *errstr, char *format, int *status) { WS_STATE_ENTRY *ws; - Display *mydisplay; - Window mywindow; /* determine the XGKS ws state entry structure from ws_id */ ws = OPEN_WSID (*ws_id); -/* the next 2 lines are diagnostic - mydisplay = ws->dpy; - mywindow = ws->win; -*/ - /* call up the capture routine */ /* Errors internal to Window_Dump com out in errstr */ Window_Dump(ws->win,ws->dpy,filename,format); @@ -92,7 +85,6 @@ void FORTRAN(put_frame)(int *ws_id, char *filename, char *errstr, char *format, void FORTRAN(put_frame_batch)(int *ws_id, char *filename, char *format, int *transp, DFTYPE *red, DFTYPE *green, DFTYPE *blue, char *errmsg, int *status) { - char oldfilename[BUFSIZ]; WS_STATE_ENTRY *ws = OPEN_WSID(*ws_id); *status = 0; diff --git a/fer/ccr/replace_bad_data_sub.c b/fer/ccr/replace_bad_data_sub.c index 297423336..38650ce28 100644 --- a/fer/ccr/replace_bad_data_sub.c +++ b/fer/ccr/replace_bad_data_sub.c @@ -53,7 +53,6 @@ void FORTRAN(replace_bad_data_sub)(DFTYPE *old_bad, DFTYPE *src, int *size, DFTYPE *new_bad) { int i; - double tmp; if (isnan(*old_bad)) { for (i=0; i<*size; i++) diff --git a/fer/ccr/unmap_animate_window.c b/fer/ccr/unmap_animate_window.c index 882e90337..7fcb32081 100644 --- a/fer/ccr/unmap_animate_window.c +++ b/fer/ccr/unmap_animate_window.c @@ -44,7 +44,7 @@ #include "gks_implem.h" #include "ferret.h" -FORTRAN(unmap_animate_window)(void) +void FORTRAN(unmap_animate_window)(void) { WindowMapping(0); } diff --git a/fer/ccr/wgif.c b/fer/ccr/wgif.c index cca747637..9e36da360 100644 --- a/fer/ccr/wgif.c +++ b/fer/ccr/wgif.c @@ -93,11 +93,11 @@ typedef unsigned char char_type; /**************************************************************************/ /* static char_type *data; */ static char_type *data; -static int iwidth, iheight, image_offset; +static int iwidth, iheight; /**************************************************************************/ typedef int (* ifunptr)(int,int); /* Pointer to function returning an int */ -static int GIFEncode( FILE *, int, int, int, int, int, int[], int[], int[], ifunptr ); +static void GIFEncode( FILE *, int, int, int, int, int, int[], int[], int[], ifunptr ); static int GetPixel( int, int ); static void Putword( int, FILE * ); static void wcompress( int, FILE *, ifunptr ); @@ -113,7 +113,7 @@ static void output( code_int ); void wGIF(FILE *fp, XImage *image, int r[], int g[], int b[]) { - int x,y; + int x; /* Set global variables needed for GetPixel routine */ /* cast image-> data to unsigned character ptr. 6/12/96 *kob* */ @@ -228,7 +228,7 @@ ifunptr getpixel; -static int GIFEncode( fp, GWidth, GHeight, GInterlace, Background, +static void GIFEncode( fp, GWidth, GHeight, GInterlace, Background, BitsPerPixel, Red, Green, Blue, GetPixelFunc ) FILE *fp; @@ -373,7 +373,6 @@ static unsigned short codetab [HSIZE]; #define CodeTabOf(i) codetab[i] static code_int hsize = HSIZE; /* for dynamic table sizing */ -static count_int fsize; /* * To save much memory, we overlay the table used by compress() with those @@ -389,7 +388,6 @@ static count_int fsize; #define de_stack ((char_type *)&tab_suffixof((code_int)1< #include "ferret.h" +#include "FerMem.h" void FORTRAN(xfer_c_ptrs)(char ***src_ptr, int *src_del, int *src_offset, char ***dst_ptr, int *dst_del, int *dst_offset, int *nptr) diff --git a/fer/efi/date_decode.c b/fer/efi/date_decode.c index a78027e9d..a9db85465 100644 --- a/fer/efi/date_decode.c +++ b/fer/efi/date_decode.c @@ -44,7 +44,7 @@ 5/2007 *acm* Fixing bug 1510. Return the result as an argument rather than a return from function; under 64-bit the return always yielded 0. -/* *acm* 1/12 - Ferret 6.8 ifdef double_p for double-precision ferret, see the +* *acm* 1/12 - Ferret 6.8 ifdef double_p for double-precision ferret, see the * definition of macro DFTYPE in ferret.h. */ @@ -59,7 +59,7 @@ void FORTRAN(date_decode)(char *strdate, DFTYPE *res) int id,im,iy, ok, status; char str3[4],str1[2]; char months[13][4] = {"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"}; - DFTYPE rdum, adate; + DFTYPE rdum; double days_1900 = 59958230400.0 / (60.*60.*24.); if (sscanf(strdate,"%d/%d/%d%1s",&im,&id,&iy,str1) == 3) @@ -99,7 +99,7 @@ void FORTRAN(date_decode)(char *strdate, DFTYPE *res) } if (ok) { - adate = FORTRAN(days_from_day0)(&days_1900,&iy,&im,&id,&rdum,&status); + FORTRAN(days_from_day0)(&days_1900,&iy,&im,&id,&rdum,&status); *res = rdum; } else diff --git a/fmt/src/NCF_Util.c b/fmt/src/NCF_Util.c index bedc5a6f8..e61aca158 100644 --- a/fmt/src/NCF_Util.c +++ b/fmt/src/NCF_Util.c @@ -1490,7 +1490,6 @@ int FORTRAN(ncf_add_var)( int *dset, int *varid, int *type, int *coordvar, int status; int newvar; LIST *vlist; - LIST_ELEMENT *lp; /* * Get the dataset pointer. @@ -1966,7 +1965,6 @@ int FORTRAN(ncf_rename_var)( int *dset, int *varid, char newvarname[] ) int FORTRAN(ncf_rename_dim)( int *dset, int *dimid, char newdimname[] ) { ncdset *nc_ptr; - int status; /* * Get the dataset pointer. @@ -2158,7 +2156,6 @@ int FORTRAN(ncf_delete_var_att)( int *dset, int *varid, char attname[] ) ncvar *var_ptr; int status; int att_to_remove; - LIST *varlist; LIST *varattlist; /* @@ -2262,7 +2259,6 @@ int FORTRAN(ncf_set_var_out_flag)( int *dset, int *varid, int *all_outflag ) { ncvar *var_ptr; ncatt *att_ptr; - int status; LIST *varattlist; /* Get the variable */ @@ -2392,7 +2388,6 @@ int FORTRAN(ncf_transfer_att)( int *dset1, int *varid1, int *iatt, int *dset2, i int status; int i; LIST *varattlist1; - LIST *varattlist2; /* Get the variable varid1 in dset1 */ var_ptr1 = ncf_get_ds_var_ptr(dset1, varid1); @@ -2428,7 +2423,6 @@ int FORTRAN(ncf_transfer_att)( int *dset1, int *varid1, int *iatt, int *dset2, i return -1; } } - varattlist2 = var_ptr2->varattlist; /* Increment number of attributes for varid2 */ var_ptr2->natts = var_ptr2->natts + 1; @@ -2475,7 +2469,6 @@ int FORTRAN(ncf_delete_var)( int *dset, char *varname ) int status; int ivar; LIST *varlist; - LIST *uvgridList; /* Find the dataset based on its integer ID */ nc_ptr = ncf_get_ds_ptr(dset); @@ -2916,7 +2909,6 @@ int FORTRAN(ncf_next_uvar_grid_in_list)( int *LIST_dset, int *uvarid, int *ith, ncvar *var_ptr; LIST *uvgridList; uvarGrid *uvgrid_ptr; - int count; int i; /* @@ -2941,7 +2933,6 @@ int FORTRAN(ncf_next_uvar_grid_in_list)( int *LIST_dset, int *uvarid, int *ith, * Return the ith grid */ list_mvfront(uvgridList); - count = 1; for (i = 0; i < *ith; i++) { uvgrid_ptr = (uvarGrid *) list_curr(uvgridList); *grid = uvgrid_ptr->grid; @@ -3205,7 +3196,6 @@ int FORTRAN(ncf_get_uvar_grid_list_len)( int *LIST_dset, int *uvarid, int *uvgri int status; LIST *varlist; LIST *uvgridlist; - uvarGrid *uvgrid_ptr; /* * Get the list of variables, find pointer to variable varid. diff --git a/fmt/src/cd_read_scale.c b/fmt/src/cd_read_scale.c index e19fd1f7f..2a6a22158 100644 --- a/fmt/src/cd_read_scale.c +++ b/fmt/src/cd_read_scale.c @@ -79,12 +79,10 @@ void FORTRAN(cd_read_scale)(int *cdfid, int *varid, int *dims, DFTYPE *offset, D size_t start[NFERDIMSP1], count[NFERDIMSP1]; ptrdiff_t stride[NFERDIMSP1], imap[NFERDIMSP1]; - int tmp, i, maxstrlen, ndimsp, *dimids; - size_t bufsiz; + int tmp, i; int ndim = *dims - 1; /* C referenced to zero */ int vid = *varid; nc_type vtyp; - int n_sections; int ntotal; int scale_it; double *data_double; diff --git a/fmt/src/cd_read_sub.c b/fmt/src/cd_read_sub.c index 2e0c76c16..3e362fdf2 100644 --- a/fmt/src/cd_read_sub.c +++ b/fmt/src/cd_read_sub.c @@ -98,7 +98,7 @@ void FORTRAN(cd_read_sub)(int *cdfid, int *varid, int *dims, ptrdiff_t stride[7], imap[7], tmp_ptrdiff_t; int i, ndimsp, *dimids; - size_t bufsiz, tmp, tmpstride, maxstrlen; + size_t bufsiz, tmp, maxstrlen; char *pbuff; int ndim = 0; int indim = *dims; diff --git a/fmt/src/deleted_list_init.c b/fmt/src/deleted_list_init.c index e441ac592..bdd92f273 100644 --- a/fmt/src/deleted_list_init.c +++ b/fmt/src/deleted_list_init.c @@ -84,7 +84,7 @@ void FORTRAN(deleted_list_init)(void **deleted_list_header, int *int_array, int p->prev = NULL; p->next = head->undel_list_head; head->undel_list_head = p; - if ( p->next = NULL ) { + if ( p->next != NULL ) { p->next->prev = p; } } diff --git a/fmt/src/ez_delimited_read.c b/fmt/src/ez_delimited_read.c index 357022838..939025b98 100644 --- a/fmt/src/ez_delimited_read.c +++ b/fmt/src/ez_delimited_read.c @@ -87,7 +87,7 @@ static int decode_file(char* fname, char *recptr, char *delims, int *skip, int* maxrec, int* reclen, int* nfields, int field_type[], int* nrec, DFTYPE** numeric_fields, char*** text_fields, DFTYPE bad_flags[], int* status); -static int decodeRec(char *recptr, char *delims, int* nfields, int field_type[], int rec, +static void decodeRec(char *recptr, char *delims, int* nfields, int field_type[], int rec, DFTYPE** numeric_fields, char*** text_fields, DFTYPE bad_flags[], int* status); static void analRec(char *recptr, char *delims, int* nfields, int field_type[], int max_fields); static char *nexstrtok(char *s1, char *s2); @@ -371,7 +371,7 @@ int FORTRAN(anal_file) (char* fname, char *recptr, char *delims, int* skip, * */ -static int decodeRec(char *recptr, char *delims, int* nfields, int field_type[], int rec, +static void decodeRec(char *recptr, char *delims, int* nfields, int field_type[], int rec, DFTYPE** numeric_fields, char*** text_fields, DFTYPE bad_flags[], int* status) { @@ -562,19 +562,13 @@ static int decodeRec(char *recptr, char *delims, int* nfields, int field_type[], } /* check for yyyymmdd date */ - else if ( (sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,&idummy4,&idummy5,&dummy,str1) >= 4) + else if ( (sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,str1) == 3) && idummy1>0 && idummy3>=1 && idummy3<=12 && idummy2>=1 && idummy2<=31 ) { - ndum = sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,&idummy4,&idummy5,&dummy,str1); - tpart = -999; - if (ndum == 6) tpart = idummy4 + idummy5/60. + dummy/3600.; - if (ndum == 5) tpart = idummy4 + idummy5/60.; - (*(numeric_fields+i))[rec] = FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status); - (*(numeric_fields+i))[rec] = rdum + tpart/24.; - if (tpart == -999) (*(numeric_fields+i))[rec] = bad_flags[i]; + (*(numeric_fields+i))[rec] = rdum; if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i]; } else @@ -695,19 +689,13 @@ static int decodeRec(char *recptr, char *delims, int* nfields, int field_type[], } /* add check for yyyyddmm euro date *kob* */ - else if ( (sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,&idummy4,&idummy5,&dummy,str1) >= 4) + else if ( (sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,str1) == 3) && idummy1>0 && idummy3>=1 && idummy3<=12 && idummy2>=1 && idummy2<=31 ) { - ndum = sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,&idummy4,&idummy5,&dummy,str1); - tpart = -999; - if (ndum == 6) tpart = idummy4 + idummy5/60. + dummy/3600.; - if (ndum == 5) tpart = idummy4 + idummy5/60.; - (*(numeric_fields+i))[rec] = FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy3,&idummy2,&rdum,status); - (*(numeric_fields+i))[rec] = rdum + tpart/24.; - if (tpart == -999) (*(numeric_fields+i))[rec] = bad_flags[i]; + (*(numeric_fields+i))[rec] = rdum; if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i]; } else (*(numeric_fields+i))[rec] = bad_flags[i]; @@ -790,7 +778,7 @@ static void analRec(char *recptr, char *delims, int* nfields, int field_type[], char *p, *pnext, pstart[256], str1[2], latlon1[2]; double dummy; - int idummy1, idummy2, idummy3, i, nfields_in; + int idummy1, idummy2, idummy3, nfields_in; p = recptr; nfields_in = *nfields; @@ -1000,7 +988,7 @@ void FORTRAN(get_delimited_info) (int *nfields, int field_type[], char *delim, DelimFileInfo **ptr) { - int i,iout; + int i; DelimFileInfo *fi = *ptr; *nfields = fi->nfields; diff --git a/fmt/src/string_array_find_caseblind.c b/fmt/src/string_array_find_caseblind.c index 266af2eae..f9f234fc9 100644 --- a/fmt/src/string_array_find_caseblind.c +++ b/fmt/src/string_array_find_caseblind.c @@ -53,7 +53,7 @@ void FORTRAN(string_array_find_caseblind)(void **string_array_header, char *test SA_Head * head; List_Node *bucket, *p; char * model_string; - int match=0, is_quoted=0; + int match; head = *string_array_header; if( head != NULL ){ diff --git a/fmt/src/string_array_init.c b/fmt/src/string_array_init.c index 3459cf064..2e85b634e 100644 --- a/fmt/src/string_array_init.c +++ b/fmt/src/string_array_init.c @@ -50,7 +50,7 @@ void FORTRAN(string_array_init)(void **string_array_header, int *array_size, int *string_size, char *string_array) { - int i,j; + int j; int true_len, hash_value; SA_Head * head; List_Node * p; diff --git a/fmt/src/tm_world_recur.c b/fmt/src/tm_world_recur.c index 5e681395a..1f4a1569f 100644 --- a/fmt/src/tm_world_recur.c +++ b/fmt/src/tm_world_recur.c @@ -87,8 +87,6 @@ double FORTRAN(tm_world_recur)(int *isubscript, int *iaxis, int *where_in_box, i { double tempwld, tm_world; int isub, rmod; - double showd; - int showi; int axis = *iaxis; /* these FORTRAN arrs start at 0 like C */ int line_len = line_dim[axis]; int is_subspan; @@ -111,11 +109,6 @@ double FORTRAN(tm_world_recur)(int *isubscript, int *iaxis, int *where_in_box, i new_ss = (int)line_start[axis] +(*isubscript-1)*(int)line_delta[axis]; - showi = axis; - showd = line_start[axis]; - showd = line_delta[axis]; - showi = new_ss; - showi = line_parent[axis]; if ( line_regular[axis] || *where_in_box==BOX_MIDDLE ) { tm_world = FORTRAN(tm_world_recur) diff --git a/ppl/tmapadds/resize_xgks_window.c b/ppl/tmapadds/resize_xgks_window.c index 5c98b90aa..be573cc6a 100644 --- a/ppl/tmapadds/resize_xgks_window.c +++ b/ppl/tmapadds/resize_xgks_window.c @@ -73,18 +73,9 @@ void FORTRAN(resize_xgks_window)(int *ws_id, float *x, float *y, int *ix, int *iy) { WS_STATE_ENTRY *ws; - - Display **dpy; - Window *win; - GC *gc; - - XEvent evnt; Gpoint size; - float xf,yf,aspect; - - int xw_event,scr; - time_t t0,t_now,*tp; + int scr; /*****************************************************************************/ @@ -117,17 +108,6 @@ void FORTRAN(resize_xgks_window)(int *ws_id, float *x, float *y, int *ix, int *i if (ws){ if (ws->ewstype == X_WIN && ws->dpy){ XResizeWindow (ws->dpy,ws->win,*ix,*iy); - tp = &t_now; - t0 = time(0); - -/* - * do { - * xw_event = XCheckWindowEvent (ws->dpy,ws->win,StructureNotifyMask,&evnt); - * time (tp); - * } while (xw_event && (t_now - t0 < 3)); - * - */ - } else if (ws->ewstype == MO){ int type = ws->mf.cgmo->type; if (type == MF_GIF){ diff --git a/ppl/tmapadds/set_background.c b/ppl/tmapadds/set_background.c index 435fce676..fbd8589e4 100644 --- a/ppl/tmapadds/set_background.c +++ b/ppl/tmapadds/set_background.c @@ -61,14 +61,7 @@ void FORTRAN(set_background)(int *ws_id, int *ndx) { WS_STATE_ENTRY *ws; - - Display **dpy; - Window *win; - GC *gc; - - Gint val; int scr; - int stat; /****************************************************************************/ @@ -83,7 +76,3 @@ void FORTRAN(set_background)(int *ws_id, int *ndx) } } - - - - diff --git a/ppl/tmapadds/wait_on_resize.c b/ppl/tmapadds/wait_on_resize.c index e9d4a323f..b029bb8fa 100644 --- a/ppl/tmapadds/wait_on_resize.c +++ b/ppl/tmapadds/wait_on_resize.c @@ -59,21 +59,13 @@ void FORTRAN(wait_on_resize)(int *ws_id) { WS_STATE_ENTRY *ws; - - Display **dpy; - Window *win; - GC *gc; - XEvent evnt; - - int xw_event,scr; + int xw_event; time_t t0,t_now,*tp; /*****************************************************************************/ ws = OPEN_WSID (*ws_id); - scr = DefaultScreen (ws->dpy); - tp = &t_now; t0 = time(0); do {