From fcc0740b8cfec93f889634f3db3952fc757b91f3 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Sun, 6 Jan 2019 00:19:03 +0100 Subject: [PATCH] C++ and parallel-hdf5 compilation fixes. --- src/common_io.c | 14 +++++++------- src/parallel_io.c | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/common_io.c b/src/common_io.c index 6cce7e21aa..e6c0d016f4 100644 --- a/src/common_io.c +++ b/src/common_io.c @@ -399,19 +399,19 @@ void io_write_cell_offsets(hid_t h_grp, const int cdim[3], /* Temporary memory for the cell-by-cell information */ double* centres = NULL; - centres = malloc(3 * nr_cells * sizeof(double)); + centres = (double*)malloc(3 * nr_cells * sizeof(double)); /* Count of particles in each cell */ long long *count_part = NULL, *count_gpart = NULL, *count_spart = NULL; - count_part = malloc(nr_cells * sizeof(long long)); - count_gpart = malloc(nr_cells * sizeof(long long)); - count_spart = malloc(nr_cells * sizeof(long long)); + count_part = (long long*)malloc(nr_cells * sizeof(long long)); + count_gpart = (long long*)malloc(nr_cells * sizeof(long long)); + count_spart = (long long*)malloc(nr_cells * sizeof(long long)); /* Global offsets of particles in each cell */ long long *offset_part = NULL, *offset_gpart = NULL, *offset_spart = NULL; - offset_part = malloc(nr_cells * sizeof(long long)); - offset_gpart = malloc(nr_cells * sizeof(long long)); - offset_spart = malloc(nr_cells * sizeof(long long)); + offset_part = (long long*)malloc(nr_cells * sizeof(long long)); + offset_gpart = (long long*)malloc(nr_cells * sizeof(long long)); + offset_spart = (long long*)malloc(nr_cells * sizeof(long long)); /* Offsets of the 0^th element */ offset_part[0] = 0; diff --git a/src/parallel_io.c b/src/parallel_io.c index b62422d22f..0c6514b6b4 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -984,7 +984,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6], /* Open header to write simulation properties */ /* message("Writing file header..."); */ - h_grp = H5Gcreate(h_file, "/Header", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + hid_t h_grp = + H5Gcreate(h_file, "/Header", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (h_grp < 0) error("Error while creating file header\n"); /* Convert basic output information to snapshot units */ -- GitLab