summaryrefslogtreecommitdiffstats
path: root/test/testmeta.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/testmeta.c
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'test/testmeta.c')
-rw-r--r--test/testmeta.c108
1 files changed, 54 insertions, 54 deletions
diff --git a/test/testmeta.c b/test/testmeta.c
index 9a40e6f..fee1954 100644
--- a/test/testmeta.c
+++ b/test/testmeta.c
@@ -22,35 +22,35 @@
* but the H5Gcreate2 error does not.
*/
-
#include "h5test.h"
-#define FILEN "testmeta.h5"
+#define FILEN "testmeta.h5"
-#define CHUNK_SIZE 512
+#define CHUNK_SIZE 512
-#define NDATAARRAYS 3
+#define NDATAARRAYS 3
/*#define NPOINTS 2048*/
-#define NPOINTS 20
-#define NEXTARRAYS 10
-#define NDATAOBJECTS 100000
+#define NPOINTS 20
+#define NEXTARRAYS 10
+#define NDATAOBJECTS 100000
-int main(void)
+int
+main(void)
{
- hid_t file_id, prop_id, memspace_id, type_id;
- hid_t group_id;
- hid_t dataset_id, dataspace_id;
- herr_t status;
- hsize_t dims[1];
- hsize_t maxdims[1];
- float data[NPOINTS];
- float floatval;
- unsigned numdataobj = 0;
- unsigned i, j;
- char name[80];
- hsize_t start[1] = {0};
- hsize_t stride[1] = {1};
- hsize_t count[1] = {1};
+ hid_t file_id, prop_id, memspace_id, type_id;
+ hid_t group_id;
+ hid_t dataset_id, dataspace_id;
+ herr_t status;
+ hsize_t dims[1];
+ hsize_t maxdims[1];
+ float data[NPOINTS];
+ float floatval;
+ unsigned numdataobj = 0;
+ unsigned i, j;
+ char name[80];
+ hsize_t start[1] = {0};
+ hsize_t stride[1] = {1};
+ hsize_t count[1] = {1};
/* Create a file */
file_id = H5Fcreate(FILEN, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -60,8 +60,8 @@ int main(void)
dataspace_id = H5Screate(H5S_SCALAR);
/* Create dataset */
- dataset_id = H5Dcreate2(file_id, "/NumDataObj",
- H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset_id = H5Dcreate2(file_id, "/NumDataObj", H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
/* Write value to NumDataObj dataset */
status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj);
@@ -74,17 +74,18 @@ int main(void)
/* Set up for extendible dataset */
prop_id = H5Pcreate(H5P_DATASET_CREATE);
dims[0] = CHUNK_SIZE;
- status = H5Pset_chunk(prop_id, 1, dims);
+ status = H5Pset_chunk(prop_id, 1, dims);
/* Create dataspace */
- dims[0] = 1;
- maxdims[0] = H5S_UNLIMITED;
+ dims[0] = 1;
+ maxdims[0] = H5S_UNLIMITED;
dataspace_id = H5Screate_simple(1, dims, maxdims);
- for(i = 0; i < NEXTARRAYS; i++) {
+ for (i = 0; i < NEXTARRAYS; i++) {
/* Create dataset */
sprintf(name, "/ExtArray%06d", i);
- dataset_id = H5Dcreate2(file_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT);
+ dataset_id =
+ H5Dcreate2(file_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT);
/* Close the identifier */
status = H5Dclose(dataset_id);
@@ -98,7 +99,7 @@ int main(void)
group_id = H5Gcreate2(file_id, "/DataArray", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(group_id);
- for(j = 0; j < NDATAOBJECTS; j++) {
+ for (j = 0; j < NDATAOBJECTS; j++) {
/* Removed print statement as it would lock system resources on Windows */
/*
* HDprintf("\rWriting Object #%d of %d", j+1, NDATAOBJECTS);
@@ -109,23 +110,24 @@ int main(void)
/* Create group to hold data arrays for this object */
HDsprintf(name, "/DataArray/%06d", j);
group_id = H5Gcreate2(file_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(group_id < 0) {
+ if (group_id < 0) {
HDfprintf(stderr, "Failed to create DataArray group.\n");
status = H5Fclose(file_id);
return -1;
}
/* Loop over data arrays */
- for(i = 0; i < NDATAARRAYS; i++) {
+ for (i = 0; i < NDATAARRAYS; i++) {
/* Create dataspace */
- dims[0]=NPOINTS;
- maxdims[0]=NPOINTS;
- dataspace_id = H5Screate_simple(1 ,dims, maxdims);
+ dims[0] = NPOINTS;
+ maxdims[0] = NPOINTS;
+ dataspace_id = H5Screate_simple(1, dims, maxdims);
/* Create dataset */
HDsprintf(name, "DataArray%06d", i);
- dataset_id = H5Dcreate2(group_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dataset_id < 0) {
+ dataset_id = H5Dcreate2(group_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
+ if (dataset_id < 0) {
HDfprintf(stderr, "Failed to create DataArray dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -133,7 +135,7 @@ int main(void)
/* Write the data array data */
status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- if(status < 0) {
+ if (status < 0) {
HDfprintf(stderr, "Failed to write DataArray dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -146,7 +148,7 @@ int main(void)
/* Open NumDataObj dataset */
dataset_id = H5Dopen2(file_id, "/NumDataObj", H5P_DEFAULT);
- if(dataset_id < 0) {
+ if (dataset_id < 0) {
HDfprintf(stderr, "Failed to open NumDataObj dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -154,8 +156,8 @@ int main(void)
/* Write value to NumDataObj dataset */
numdataobj = j + 1;
- status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj);
- if(status < 0) {
+ status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj);
+ if (status < 0) {
HDfprintf(stderr, "Failed to write NumDataObj dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -166,11 +168,11 @@ int main(void)
status = H5Gclose(group_id);
/* Extend attribute arrays */
- for(i = 0; i < NEXTARRAYS; i++) {
+ for (i = 0; i < NEXTARRAYS; i++) {
/* Open extendable dataset */
HDsprintf(name, "/ExtArray%06d", i);
dataset_id = H5Dopen2(file_id, name, H5P_DEFAULT);
- if(dataset_id < 0) {
+ if (dataset_id < 0) {
HDfprintf(stderr, "Failed to open ExtArray dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -178,25 +180,25 @@ int main(void)
/* Extend attribute dataset */
dims[0] = (hsize_t)j + 1;
- status = H5Dset_extent(dataset_id, dims);
- if(status < 0) {
+ status = H5Dset_extent(dataset_id, dims);
+ if (status < 0) {
HDfprintf(stderr, "Failed to extend DataArray dataset.\n");
status = H5Fclose(file_id);
return -1;
} /* end if */
/* Select element and write value to attribute dataset */
- dims[0] = 1;
- memspace_id = H5Screate_simple(1, dims, dims);
+ dims[0] = 1;
+ memspace_id = H5Screate_simple(1, dims, dims);
dataspace_id = H5Dget_space(dataset_id);
- type_id = H5Dget_type(dataset_id);
+ type_id = H5Dget_type(dataset_id);
start[0] = 0;
- status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, start, stride, count, NULL);
+ status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, start, stride, count, NULL);
start[0] = (hssize_t)j;
- status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, stride, count, NULL);
- status = H5Dwrite(dataset_id, type_id, memspace_id, dataspace_id, H5P_DEFAULT, &floatval);
- if(status < 0) {
+ status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, stride, count, NULL);
+ status = H5Dwrite(dataset_id, type_id, memspace_id, dataspace_id, H5P_DEFAULT, &floatval);
+ if (status < 0) {
HDfprintf(stderr, "Failed to write DataArray dataset.\n");
status = H5Fclose(file_id);
return -1;
@@ -210,7 +212,6 @@ int main(void)
}
}
-
/* Close the file */
status = H5Fclose(file_id);
@@ -218,4 +219,3 @@ int main(void)
return 0;
}
-