examples/*:

- type cast malloc() result
This commit is contained in:
2016-02-09 10:10:57 +01:00
parent a07d4101a2
commit 5714c390ec
6 changed files with 14 additions and 14 deletions
+5 -5
View File
@@ -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++) {
+5 -5
View File
@@ -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++) {
+1 -1
View File
@@ -26,7 +26,7 @@ static Timer*
new (
void
) {
Timer* this = malloc (sizeof (Timer));
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}
+1 -1
View File
@@ -24,7 +24,7 @@ static Timer*
new (
void
) {
Timer* this = malloc (sizeof (Timer));
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}
+1 -1
View File
@@ -27,7 +27,7 @@ static Timer*
new (
void
) {
Timer* self = malloc (sizeof (Timer));
Timer* self = (Timer*)malloc (sizeof (Timer));
*self = Timer_;
return self;
}
+1 -1
View File
@@ -22,7 +22,7 @@ static Timer*
new (
void
) {
Timer* this = malloc (sizeof (Timer));
Timer* this = (Timer*)malloc (sizeof (Timer));
*this = Timer_;
return this;
}