From 5714c390ec96f9decbf3e00472fbb7f23b2576db Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 9 Feb 2016 10:10:57 +0100 Subject: [PATCH] examples/*: - type cast malloc() result --- examples/H5/read_file_attribs.c | 10 +++++----- examples/H5/read_step_attribs.c | 10 +++++----- examples/H5Fed/tetmesh_adjacencies.c | 2 +- examples/H5Fed/tetmesh_read.c | 2 +- examples/H5Fed/tetmesh_read_tags.c | 2 +- examples/H5Fed/tetmesh_write_tags.c | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/H5/read_file_attribs.c b/examples/H5/read_file_attribs.c index a4626b4..e998b57 100644 --- a/examples/H5/read_file_attribs.c +++ b/examples/H5/read_file_attribs.c @@ -33,13 +33,13 @@ main ( h5_size_t len; H5GetFileAttribInfoByName (f, ATTR_STRING, NULL, &len); - char* attr_string = malloc (len+1); + char* attr_string = (char*)malloc (len+1); H5ReadFileAttribString (f, ATTR_STRING, attr_string); printf ("%s: %s\n", ATTR_STRING, attr_string); free (attr_string); H5GetFileAttribInfoByName (f, ATTR_INT32, NULL, &len); - int32_t* attr_int32 = malloc (sizeof(*attr_int32)*len); + int32_t* attr_int32 = (char*)malloc (sizeof(*attr_int32)*len); H5ReadFileAttribInt32 (f, ATTR_INT32, attr_int32); printf ("%s:", ATTR_INT32); for (int i = 0; i < len; i++) { @@ -49,7 +49,7 @@ main ( free (attr_int32); H5GetFileAttribInfoByName (f, ATTR_INT64, NULL, &len); - int64_t* attr_int64 = malloc (sizeof(*attr_int64)*len); + int64_t* attr_int64 = (int64_t*)malloc (sizeof(*attr_int64)*len); H5ReadFileAttribInt64 (f, ATTR_INT64, attr_int64); printf ("%s:", ATTR_INT64); for (int i = 0; i < len; i++) { @@ -59,7 +59,7 @@ main ( free (attr_int64); H5GetFileAttribInfoByName (f, ATTR_FLOAT32, NULL, &len); - h5_float32_t* attr_float32 = malloc (sizeof(*attr_float32)*len); + h5_float32_t* attr_float32 = (h5_float32_t*)malloc (sizeof(*attr_float32)*len); H5ReadFileAttribFloat32 (f, ATTR_FLOAT32, attr_float32); printf ("%s:", ATTR_FLOAT32); for (int i = 0; i < len; i++) { @@ -69,7 +69,7 @@ main ( free (attr_float32); H5GetFileAttribInfoByName (f, ATTR_FLOAT64, NULL, &len); - h5_float64_t* attr_float64 = malloc (sizeof(*attr_float64)*len); + h5_float64_t* attr_float64 = (h5_float64_t*)malloc (sizeof(*attr_float64)*len); H5ReadFileAttribFloat64 (f, ATTR_FLOAT64, attr_float64); printf ("%s:", ATTR_FLOAT64); for (int i = 0; i < len; i++) { diff --git a/examples/H5/read_step_attribs.c b/examples/H5/read_step_attribs.c index 87da5bf..231275f 100644 --- a/examples/H5/read_step_attribs.c +++ b/examples/H5/read_step_attribs.c @@ -32,13 +32,13 @@ main ( H5SetStep (f, 1); H5GetStepAttribInfoByName (f, ATTR_STRING, NULL, &len); - char* attr_string = malloc (len+1); + char* attr_string = (char*)malloc (len+1); H5ReadStepAttribString (f, ATTR_STRING, attr_string); printf ("%s: %s\n", ATTR_STRING, attr_string); free (attr_string); H5GetStepAttribInfoByName (f, ATTR_INT32, NULL, &len); - int32_t* attr_int32 = malloc (sizeof(*attr_int32)*len); + int32_t* attr_int32 = (int32_t*)malloc (sizeof(*attr_int32)*len); H5ReadStepAttribInt32 (f, ATTR_INT32, attr_int32); printf ("%s:", ATTR_INT32); for (int i = 0; i < len; i++) { @@ -48,7 +48,7 @@ main ( free (attr_int32); H5GetStepAttribInfoByName (f, ATTR_INT64, NULL, &len); - int64_t* attr_int64 = malloc (sizeof(*attr_int64)*len); + int64_t* attr_int64 = (int64_t*)malloc (sizeof(*attr_int64)*len); H5ReadStepAttribInt64 (f, ATTR_INT64, attr_int64); printf ("%s:", ATTR_INT64); for (int i = 0; i < len; i++) { @@ -58,7 +58,7 @@ main ( free (attr_int64); H5GetStepAttribInfoByName (f, ATTR_FLOAT32, NULL, &len); - h5_float32_t* attr_float32 = malloc (sizeof(*attr_float32)*len); + h5_float32_t* attr_float32 = (h5_float32_t*)malloc (sizeof(*attr_float32)*len); H5ReadStepAttribFloat32 (f, ATTR_FLOAT32, attr_float32); printf ("%s:", ATTR_FLOAT32); for (int i = 0; i < len; i++) { @@ -68,7 +68,7 @@ main ( free (attr_float32); H5GetStepAttribInfoByName (f, ATTR_FLOAT64, NULL, &len); - h5_float64_t* attr_float64 = malloc (sizeof(*attr_float64)*len); + h5_float64_t* attr_float64 = (h5_float64_t*)malloc (sizeof(*attr_float64)*len); H5ReadStepAttribFloat64 (f, ATTR_FLOAT64, attr_float64); printf ("%s:", ATTR_FLOAT64); for (int i = 0; i < len; i++) { diff --git a/examples/H5Fed/tetmesh_adjacencies.c b/examples/H5Fed/tetmesh_adjacencies.c index cd16a34..e7faf06 100644 --- a/examples/H5Fed/tetmesh_adjacencies.c +++ b/examples/H5Fed/tetmesh_adjacencies.c @@ -26,7 +26,7 @@ static Timer* new ( void ) { - Timer* this = malloc (sizeof (Timer)); + Timer* this = (Timer*)malloc (sizeof (Timer)); *this = Timer_; return this; } diff --git a/examples/H5Fed/tetmesh_read.c b/examples/H5Fed/tetmesh_read.c index 568e945..4dd2a01 100644 --- a/examples/H5Fed/tetmesh_read.c +++ b/examples/H5Fed/tetmesh_read.c @@ -24,7 +24,7 @@ static Timer* new ( void ) { - Timer* this = malloc (sizeof (Timer)); + Timer* this = (Timer*)malloc (sizeof (Timer)); *this = Timer_; return this; } diff --git a/examples/H5Fed/tetmesh_read_tags.c b/examples/H5Fed/tetmesh_read_tags.c index ad6cbbd..bf37416 100644 --- a/examples/H5Fed/tetmesh_read_tags.c +++ b/examples/H5Fed/tetmesh_read_tags.c @@ -27,7 +27,7 @@ static Timer* new ( void ) { - Timer* self = malloc (sizeof (Timer)); + Timer* self = (Timer*)malloc (sizeof (Timer)); *self = Timer_; return self; } diff --git a/examples/H5Fed/tetmesh_write_tags.c b/examples/H5Fed/tetmesh_write_tags.c index 58945e7..3c5f49c 100644 --- a/examples/H5Fed/tetmesh_write_tags.c +++ b/examples/H5Fed/tetmesh_write_tags.c @@ -22,7 +22,7 @@ static Timer* new ( void ) { - Timer* this = malloc (sizeof (Timer)); + Timer* this = (Timer*)malloc (sizeof (Timer)); *this = Timer_; return this; }