diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-10 18:03:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-10 18:03:35 (GMT) |
commit | 5b7c8c7a7d0b40e36a744f7e1dc68cd189e321b2 (patch) | |
tree | 4428663a3634b9959ccf31eb6d8173e008d474a9 | |
parent | 4a9ea60adc72f66d290da5b890bc3b480ea4f914 (diff) | |
download | hdf5-5b7c8c7a7d0b40e36a744f7e1dc68cd189e321b2.zip hdf5-5b7c8c7a7d0b40e36a744f7e1dc68cd189e321b2.tar.gz hdf5-5b7c8c7a7d0b40e36a744f7e1dc68cd189e321b2.tar.bz2 |
[svn-r24772] Description:
Correct some dynamically sized arrays that fail on Windows.
Tested on:
Mac OSX/64 10.9.2 (amazon) w/parallel
-rw-r--r-- | testpar/t_coll_chunk.c | 12 | ||||
-rw-r--r-- | testpar/t_dset.c | 24 |
2 files changed, 24 insertions, 12 deletions
diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 61b25f8..45fe3da 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -620,9 +620,9 @@ coll_chunktest(const char* filename, MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - size_t num_points; /* for point selection */ - hsize_t *coords =NULL; /* for point selection */ - hsize_t current_dims; /* for point selection */ + size_t num_points; /* for point selection */ + hsize_t *coords = NULL; /* for point selection */ + hsize_t current_dims; /* for point selection */ int i; /* set up MPI parameters */ @@ -1033,9 +1033,9 @@ coll_chunktest(const char* filename, VRFY((status >= 0),"H5Fclose"); /* release data buffers */ - if (coords) free(coords); - if (data_array1) HDfree(data_array1); - if (data_origin1) HDfree(data_origin1); + if(coords) HDfree(coords); + if(data_array1) HDfree(data_array1); + if(data_origin1) HDfree(data_origin1); } diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 3929ff3..b3ec4b8 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -561,9 +561,9 @@ dataset_writeAll(void) hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ - size_t num_points = dim1; /* for point selection */ - hsize_t coords [RANK*dim1]; /* for point selection */ - hsize_t current_dims; /* for point selection */ + size_t num_points; /* for point selection */ + hsize_t *coords = NULL; /* for point selection */ + hsize_t current_dims; /* for point selection */ int i; herr_t ret; /* Generic return value */ @@ -580,6 +580,11 @@ dataset_writeAll(void) MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + /* set up the coords array selection */ + num_points = dim1; + coords = (hsize_t *)HDmalloc(dim1 * RANK * sizeof(hsize_t)); + VRFY((coords != NULL), "coords malloc succeeded"); + /* allocate memory for data buffer */ data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); @@ -1058,6 +1063,7 @@ dataset_writeAll(void) H5Fclose(fid); /* release data buffers */ + if(coords) HDfree(coords); if(data_array1) HDfree(data_array1); } @@ -1088,9 +1094,9 @@ dataset_readAll(void) hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ - size_t num_points = dim1; /* for point selection */ - hsize_t coords [RANK*dim0*dim1]; /* for point selection */ - hsize_t current_dims; /* for point selection */ + size_t num_points; /* for point selection */ + hsize_t *coords = NULL; /* for point selection */ + hsize_t current_dims; /* for point selection */ int i,j,k; herr_t ret; /* Generic return value */ @@ -1107,6 +1113,11 @@ dataset_readAll(void) MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + /* set up the coords array selection */ + num_points = dim1; + coords = (hsize_t *)HDmalloc(dim0 * dim1 * RANK * sizeof(hsize_t)); + VRFY((coords != NULL), "coords malloc succeeded"); + /* allocate memory for data buffer */ data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); @@ -1461,6 +1472,7 @@ dataset_readAll(void) H5Fclose(fid); /* release data buffers */ + if(coords) HDfree(coords); if(data_array1) HDfree(data_array1); if(data_origin1) HDfree(data_origin1); } |