From 6ebc5374842d400ade76a772e1253645fefdac94 Mon Sep 17 00:00:00 2001 From: knarf Date: Sun, 21 Aug 2011 03:55:03 +0000 Subject: fix compiler warnings git-svn-id: http://svn.cactuscode.org/arrangements/CactusIO/IOJpeg/trunk@140 eff87b29-5268-4891-90a3-a07138403961 --- src/Write.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/Write.c b/src/Write.c index 498f5b9..ccd824a 100644 --- a/src/Write.c +++ b/src/Write.c @@ -76,13 +76,13 @@ static void *RefineData (CCTK_INT input_dims[2], const void *input_data); int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) { const ioJpegGH *myGH; - int i, mapping, total_hsize; - int dir, dir_i, dir_j, maxdir, myproc, groupindex; + int mapping, total_hsize; + int dir_i, dir_j, maxdir, myproc, groupindex; cGroup gdata; char *fullname; CCTK_INT origin[3], direction[6], hsize[2]; const CCTK_INT extent[2] = {-1, -1}; - void *hdata, *outdata; + void *hdata; CCTK_REAL min, max; const CCTK_INT htype = CCTK_VARIABLE_REAL; DECLARE_CCTK_PARAMETERS @@ -123,14 +123,14 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) } else if (CCTK_Equals (colormap, "auto")) { - i = CCTK_LocalArrayReductionHandle ("minimum"); + int i = CCTK_LocalArrayReductionHandle ("minimum"); CCTK_ReduceGridArrays (GH, 0, i, -1, 1, input_array , 1, input_array_type_codes, value_min); i = CCTK_LocalArrayReductionHandle ("maximum"); CCTK_ReduceGridArrays (GH, 0, i, -1, 1, input_array , 1, input_array_type_codes, value_max); } else if (CCTK_Equals (colormap, "auto-old")) { - i = CCTK_ReductionHandle ("minimum"); + int i = CCTK_ReductionHandle ("minimum"); CCTK_Reduce (GH, 0, i, 1, CCTK_VARIABLE_REAL, &min, 1, vindex); i = CCTK_ReductionHandle ("maximum"); CCTK_Reduce (GH, 0, i, 1, CCTK_VARIABLE_REAL, &max, 1, vindex); @@ -148,7 +148,7 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) { /* now do the actual I/O looping over all directions */ - for (dir = 0; dir < maxdir; dir++) + for (int dir = 0; dir < maxdir; dir++) { /* get the directions to span the hyperslab */ if (dir == 0) @@ -194,13 +194,13 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) { // Sanity check // (if this fails, we requested an insane number of grid points) - int max = INT_MAX; + int imax = INT_MAX; int d; for (d=0; d<2; ++d) { - assert (hsize[d] >= 0 && hsize[d] <= max); - if (hsize[d] > 0) max /= hsize[d]; + assert (hsize[d] >= 0 && hsize[d] <= imax); + if (hsize[d] > 0) imax /= hsize[d]; } - assert (CCTK_VarTypeSize (gdata.vartype) <= max); + assert (CCTK_VarTypeSize (gdata.vartype) <= imax); } total_hsize = hsize[0] * hsize[1] * CCTK_VarTypeSize (gdata.vartype); assert (total_hsize >= 0); @@ -217,7 +217,7 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) hdata = myproc == 0 ? malloc (total_hsize) : NULL; /* get the hyperslab */ - i = Hyperslab_Get (GH, mapping, 0, vindex, 0, htype, hdata); + int i = Hyperslab_Get (GH, mapping, 0, vindex, 0, htype, hdata); if (i) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, @@ -233,6 +233,7 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) if (i == 0) { /* refine the 2D slice if requested */ + void *outdata; outdata = refinement_factor > 1 ? RefineData (hsize, hdata) : hdata; if (! outdata) { @@ -266,15 +267,12 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) CCTK_INT * restrict inputs; CCTK_INT * restrict output_types; CCTK_POINTER * restrict outputs; - CCTK_INT * restrict operation_codes; - CCTK_INT * restrict time_deriv_order; const int nvars = 1; int npoints; int n; - int i, j, k; - int d; + int i, j; int ierr; CCTK_REAL *outdata; @@ -391,7 +389,6 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) if (myproc==0) { const int dir = 0; - CCTK_INT hsize[2]; hsize[0] = array2d_npoints_i; hsize[1] = array2d_npoints_j; -- cgit v1.2.3