examples/*:
- type cast malloc() result
This commit is contained in:
@@ -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++) {
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -26,7 +26,7 @@ static Timer*
|
||||
new (
|
||||
void
|
||||
) {
|
||||
Timer* this = malloc (sizeof (Timer));
|
||||
Timer* this = (Timer*)malloc (sizeof (Timer));
|
||||
*this = Timer_;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ static Timer*
|
||||
new (
|
||||
void
|
||||
) {
|
||||
Timer* this = malloc (sizeof (Timer));
|
||||
Timer* this = (Timer*)malloc (sizeof (Timer));
|
||||
*this = Timer_;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ static Timer*
|
||||
new (
|
||||
void
|
||||
) {
|
||||
Timer* self = malloc (sizeof (Timer));
|
||||
Timer* self = (Timer*)malloc (sizeof (Timer));
|
||||
*self = Timer_;
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ static Timer*
|
||||
new (
|
||||
void
|
||||
) {
|
||||
Timer* this = malloc (sizeof (Timer));
|
||||
Timer* this = (Timer*)malloc (sizeof (Timer));
|
||||
*this = Timer_;
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user