diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
commit | feb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch) | |
tree | e15d7e751af4e3c42e77ea955d91db4cf27a71cf /examples/h5_ref_compat.c | |
parent | bdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff) | |
download | hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2 |
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'examples/h5_ref_compat.c')
-rw-r--r-- | examples/h5_ref_compat.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/examples/h5_ref_compat.c b/examples/h5_ref_compat.c index a1fbf96..a47a14b 100644 --- a/examples/h5_ref_compat.c +++ b/examples/h5_ref_compat.c @@ -10,12 +10,12 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - /* - * The example below illustrates the use of the new API with a file that was - * written using the old-style reference API, showing how one can take - * advantage of the automatic type conversion from old reference type to new - * reference type. - */ +/* + * The example below illustrates the use of the new API with a file that was + * written using the old-style reference API, showing how one can take + * advantage of the automatic type conversion from old reference type to new + * reference type. + */ #include <stdlib.h> @@ -24,22 +24,23 @@ #define H5FILE_NAME "refer_deprec.h5" -#define NDIMS 1 /* Number of dimensions */ -#define BUF_SIZE 4 /* Size of example buffer */ -#define NREFS 1 /* Number of references */ +#define NDIMS 1 /* Number of dimensions */ +#define BUF_SIZE 4 /* Size of example buffer */ +#define NREFS 1 /* Number of references */ int -main(void) { - hid_t file1, dset1, space1; - hsize_t dset1_dims[NDIMS] = { BUF_SIZE }; - int dset_buf[BUF_SIZE]; - - hid_t dset2, space2; - hsize_t dset2_dims[NDIMS] = { NREFS }; - hobj_ref_t ref_buf[NREFS] = { 0 }; - H5R_ref_t new_ref_buf[NREFS] = { 0 }; +main(void) +{ + hid_t file1, dset1, space1; + hsize_t dset1_dims[NDIMS] = {BUF_SIZE}; + int dset_buf[BUF_SIZE]; + + hid_t dset2, space2; + hsize_t dset2_dims[NDIMS] = {NREFS}; + hobj_ref_t ref_buf[NREFS] = {0}; + H5R_ref_t new_ref_buf[NREFS] = {0}; H5O_type_t obj_type; - int i; + int i; for (i = 0; i < BUF_SIZE; i++) dset_buf[i] = i; @@ -48,8 +49,7 @@ main(void) { file1 = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); space1 = H5Screate_simple(NDIMS, dset1_dims, NULL); - dset1 = H5Dcreate2(file1, "dataset1", H5T_NATIVE_INT, space1, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + dset1 = H5Dcreate2(file1, "dataset1", H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_buf); H5Dclose(dset1); H5Sclose(space1); @@ -62,7 +62,7 @@ main(void) { /* Store reference in separate dataset using deprecated reference type */ space2 = H5Screate_simple(NDIMS, dset2_dims, NULL); - dset2 = H5Dcreate2(file1, "references", H5T_STD_REF_OBJ, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dset2 = H5Dcreate2(file1, "references", H5T_STD_REF_OBJ, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(dset2, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf); H5Dclose(dset2); H5Sclose(space2); @@ -87,4 +87,3 @@ main(void) { assert(dset_buf[i] == i); return 0; } - |