From 2c169e55d2f12ad2b8c84ef6edcbdb93d3d43449 Mon Sep 17 00:00:00 2001 From: tradke Date: Tue, 7 Jan 2003 10:26:26 +0000 Subject: Fixed compiler warnings for non-MPI configurations. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@268 ebee0441-1374-4afa-a3b5-247f3ba15b9a --- src/DumpVar.c | 28 ++++++++++++++-------------- src/RestoreFile.c | 18 ++++++++++-------- 2 files changed, 24 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/DumpVar.c b/src/DumpVar.c index e014212..8c29137 100644 --- a/src/DumpVar.c +++ b/src/DumpVar.c @@ -217,13 +217,13 @@ static int WriteGS (const cGH *GH, const ioRequest *request, IOFile file) } fakeGH; - ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); + ioUtilGH = CCTK_GHExtension (GH, "IO"); myproc = CCTK_MyProc (GH); nprocs = CCTK_nProcs (GH); fullname = CCTK_FullName (request->vindex); hdatatypesize = CCTK_VarTypeSize (request->hdatatype); - buffer = (char *) calloc (nprocs, hdatatypesize); + buffer = calloc (nprocs, hdatatypesize); memcpy (buffer + myproc*hdatatypesize, CCTK_VarDataPtrI (GH, request->timelevel, request->vindex), hdatatypesize); @@ -315,12 +315,12 @@ static int WriteGS (const cGH *GH, const ioRequest *request, IOFile file) @@*/ static int WriteGA (const cGH *GH, const ioRequest *request, IOFile file) { - int i, myproc, mapping, hdatasize, retval; + int i, mapping, hdatasize, retval; void *hdata; char *fullname; const ioGH *ioUtilGH; #ifdef CCTK_MPI - int nprocs; + int myproc, nprocs; int *hsize_chunk; void *tmpd; MPI_Comm comm; @@ -382,8 +382,7 @@ static int WriteGA (const cGH *GH, const ioRequest *request, IOFile file) } /* dump data held on I/O processor */ - myproc = CCTK_MyProc (GH); - ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); + ioUtilGH = CCTK_GHExtension (GH, "IO"); if (ioUtilGH->ioproc_every == 1) { EachProcDump (GH, request, hdata, file); @@ -391,6 +390,7 @@ static int WriteGA (const cGH *GH, const ioRequest *request, IOFile file) #ifdef CCTK_MPI else { + myproc = CCTK_MyProc (GH); nprocs = CCTK_nProcs (GH); comm = PUGH_pGH (GH)->PUGH_COMM_WORLD; mpitype = PUGH_MPIDataType (PUGH_pGH (GH), request->hdatatype); @@ -400,7 +400,7 @@ static int WriteGA (const cGH *GH, const ioRequest *request, IOFile file) if (ioUtilGH->unchunked) { /* need to copy CCTK_INT[] to int[] */ - hsize_chunk = (int *) malloc (request->hdim * sizeof (int)); + hsize_chunk = malloc (request->hdim * sizeof (int)); /* first calculate the local size and reserve the chunk */ for (i = 0; i < request->hdim; i++) @@ -534,7 +534,7 @@ static void AddCommonAttributes (const cGH *GH, const ioRequest *request, DECLARE_CCTK_PARAMETERS - itmp = (CCTK_INT4 *) malloc (request->hdim * sizeof (CCTK_INT4)); + itmp = malloc (request->hdim * sizeof (CCTK_INT4)); name = CCTK_FullName (request->vindex); FLEXIO_ERROR (IOwriteAttribute (file, "name", FLEXIO_CHAR, @@ -563,12 +563,12 @@ static void AddCommonAttributes (const cGH *GH, const ioRequest *request, /* FIXME: This is hardcoded for cartesian coordinate systems. A better solution would be to be able to query the coordinate system which is associated with the variable. */ - ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); + ioUtilGH = CCTK_GHExtension (GH, "IO"); sprintf (coord_system_name, "cart%dd", request->hdim); if (CCTK_GroupTypeFromVarI (request->vindex) == CCTK_GF && CCTK_CoordSystemHandle (coord_system_name) >= 0) { - dtmp = (CCTK_REAL *) malloc (3 * request->hdim * sizeof (CCTK_REAL)); + dtmp = malloc (3 * request->hdim * sizeof (CCTK_REAL)); for (i = 0; i < request->hdim; i++) { CCTK_CoordRange (GH, &dtmp[i], &dtmp[i + request->hdim], i + 1, @@ -652,7 +652,7 @@ static void AddChunkAttributes (const cGH *GH, const ioRequest *request, return; } - itmp = (CCTK_INT4 *) malloc (2 * request->hdim * sizeof (CCTK_INT4)); + itmp = malloc (2 * request->hdim * sizeof (CCTK_INT4)); /* copy from CCTK_INT[] to CCTK_INT4[] */ for (i = 0; i < request->hdim; i++) @@ -699,7 +699,7 @@ static void EachProcDump (const cGH *GH, const ioRequest *request, void *hdata, /* copy from CCTK_INT[] to int[] */ - chunk_dims = (int *) malloc (request->hdim * sizeof (int)); + chunk_dims = malloc (request->hdim * sizeof (int)); for (i = 0; i < request->hdim; i++) { chunk_dims[i] = request->hsize_chunk[i]; @@ -741,7 +741,7 @@ static void ProcDump (const cGH *GH, const ioRequest *request, void *hdata, /* copy from CCTK_INT[] to int[] */ - chunk_origin = (int *) malloc (2*request->hdim * sizeof (int)); + chunk_origin = malloc (2*request->hdim * sizeof (int)); chunk_dims = chunk_origin + request->hdim; for (i = 0; i < request->hdim; i++) { @@ -749,7 +749,7 @@ static void ProcDump (const cGH *GH, const ioRequest *request, void *hdata, chunk_dims[i] = request->hsize_chunk[request->hdim + i]; } - ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); + ioUtilGH = CCTK_GHExtension (GH, "IO"); if (ioUtilGH->unchunked) { /* unchunked data */ diff --git a/src/RestoreFile.c b/src/RestoreFile.c index 2f27bcc..688c926 100644 --- a/src/RestoreFile.c +++ b/src/RestoreFile.c @@ -32,7 +32,7 @@ CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_RestoreFile_c) /* The maximum number of dimensions we can deal with. There's no routine provided by the IEEEIO lib to query the number of dims from a dataset. */ -#define MAXDIM 10 +#define MAXDIM 10 /******************************************************************** @@ -87,13 +87,13 @@ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file); @@*/ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file) { - int vindex, gtype, timelevel, iteration, myproc, nprocs; + int vindex, gtype, timelevel, iteration, myproc; int nDatasets, currentDataset; - const pGH *pughGH; const ioGH *ioUtilGH; char *fullname; #ifdef CCTK_MPI - int i, proc; + int i, proc, nprocs; + const pGH *pughGH; pGExtras *extras; CCTK_INT info[3]; int dim, npoints, vtype; @@ -109,11 +109,13 @@ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file) /* suppress compiler warnings about potentially uninitialized variables */ nDatasets = 0; - pughGH = (const pGH *) PUGH_pGH (GH); - ioUtilGH = (const ioGH *) CCTK_GHExtension (GH, "IO"); - myproc = CCTK_MyProc (GH); + ioUtilGH = CCTK_GHExtension (GH, "IO"); + +#ifdef CCTK_MPI + pughGH = (const pGH *) PUGH_pGH (GH); nprocs = CCTK_nProcs (GH); +#endif /* all I/O procs determine the number of datasets in their checkpoint files */ if (myproc == file->ioproc) @@ -215,7 +217,7 @@ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file) /* get the dimension of the variable */ dim = CCTK_GroupDimI (CCTK_GroupIndexFromVarI (vindex)); - chunkorigin = (int *) malloc (2*dim * sizeof (int)); + chunkorigin = malloc (2*dim * sizeof (int)); chunkdims = chunkorigin + dim; /* read my own data directly into data, -- cgit v1.2.3