summaryrefslogtreecommitdiffstats
path: root/test/gen_new_array.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test/gen_new_array.c
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'test/gen_new_array.c')
-rw-r--r--test/gen_new_array.c68
1 files changed, 33 insertions, 35 deletions
diff --git a/test/gen_new_array.c b/test/gen_new_array.c
index 041b691..605b421 100644
--- a/test/gen_new_array.c
+++ b/test/gen_new_array.c
@@ -28,18 +28,17 @@
*/
#include "hdf5.h"
-#define TESTFILE "tarrnew.h5"
+#define TESTFILE "tarrnew.h5"
/* 1-D array datatype */
-#define ARRAY1_RANK 1
+#define ARRAY1_RANK 1
#define ARRAY1_DIM1 4
/* 2-D dataset with fixed dimensions */
-#define SPACE1_RANK 2
-#define SPACE1_DIM1 8
-#define SPACE1_DIM2 9
+#define SPACE1_RANK 2
+#define SPACE1_DIM1 8
+#define SPACE1_DIM2 9
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -59,75 +58,75 @@
int
main(void)
{
- typedef struct { /* Typedef for compound datatype */
- short i;
- float f[ARRAY1_DIM1];
- long l[ARRAY1_DIM1];
+ typedef struct { /* Typedef for compound datatype */
+ short i;
+ float f[ARRAY1_DIM1];
+ long l[ARRAY1_DIM1];
double d;
} s3_t;
- hid_t file, space, type, arr_type, dset;
- hsize_t tdims1[] = {ARRAY1_DIM1};
- hsize_t cur_dim[SPACE1_RANK]={SPACE1_DIM1,SPACE1_DIM2};
- herr_t ret; /* Generic return value */
+ hid_t file, space, type, arr_type, dset;
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ hsize_t cur_dim[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2};
+ herr_t ret; /* Generic return value */
/* Create the file */
file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file<0)
+ if (file < 0)
printf("file<0!\n");
/* Create the dataspace (for both datasets) */
space = H5Screate_simple(SPACE1_RANK, cur_dim, NULL);
- if(space<0)
+ if (space < 0)
printf("space<0!\n");
/* Create the compound datatype with array fields */
type = H5Tcreate(H5T_COMPOUND, sizeof(s3_t));
- if(type<0)
+ if (type < 0)
printf("type<0!\n");
/* Insert integer field */
- ret = H5Tinsert (type, "i", HOFFSET(s3_t,i), H5T_NATIVE_SHORT);
- if(ret<0)
+ ret = H5Tinsert(type, "i", HOFFSET(s3_t, i), H5T_NATIVE_SHORT);
+ if (ret < 0)
printf("field 1 insert<0!\n");
/* Creat the array datatype */
arr_type = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1);
- if(arr_type < 0)
+ if (arr_type < 0)
printf("arr_type<0!\n");
/* Insert float array field */
- ret = H5Tinsert (type, "f", HOFFSET(s3_t,f), arr_type);
- if(ret<0)
+ ret = H5Tinsert(type, "f", HOFFSET(s3_t, f), arr_type);
+ if (ret < 0)
printf("field 3 insert<0!\n");
/* Close array datatype */
- ret = H5Tclose (arr_type);
- if(ret<0)
+ ret = H5Tclose(arr_type);
+ if (ret < 0)
printf("field 3 array close<0!\n");
/* Creat the array datatype */
arr_type = H5Tarray_create2(H5T_NATIVE_LONG, ARRAY1_RANK, tdims1);
- if(arr_type < 0)
+ if (arr_type < 0)
printf("arr_type<0!\n");
/* Insert long array field */
- ret = H5Tinsert (type, "l", HOFFSET(s3_t,l), arr_type);
- if(ret<0)
+ ret = H5Tinsert(type, "l", HOFFSET(s3_t, l), arr_type);
+ if (ret < 0)
printf("field 3 insert<0!\n");
/* Close array datatype */
- ret = H5Tclose (arr_type);
- if(ret<0)
+ ret = H5Tclose(arr_type);
+ if (ret < 0)
printf("field 3 array close<0!\n");
/* Insert double field */
- ret = H5Tinsert (type, "d", HOFFSET(s3_t,d), H5T_NATIVE_DOUBLE);
- if(ret<0)
+ ret = H5Tinsert(type, "d", HOFFSET(s3_t, d), H5T_NATIVE_DOUBLE);
+ if (ret < 0)
printf("field 4 insert<0!\n");
/* Create the dataset with compound array fields */
dset = H5Dcreate2(file, "Dataset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset<0)
+ if (dset < 0)
printf("dset<0!\n");
H5Dclose(dset);
@@ -136,12 +135,12 @@ main(void)
/* Create the compound datatype with array fields */
type = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1);
- if(type < 0)
+ if (type < 0)
printf("type<0!\n");
/* Create the dataset with array datatype */
dset = H5Dcreate2(file, "Dataset2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset<0)
+ if (dset < 0)
printf("dset<0!\n");
H5Dclose(dset);
@@ -153,4 +152,3 @@ main(void)
return 0;
}
-