summaryrefslogtreecommitdiffstats
path: root/hl/examples/ptExampleFL.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 /hl/examples/ptExampleFL.c
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'hl/examples/ptExampleFL.c')
-rw-r--r--hl/examples/ptExampleFL.c88
1 files changed, 43 insertions, 45 deletions
diff --git a/hl/examples/ptExampleFL.c b/hl/examples/ptExampleFL.c
index ba7a3a0..66f2040 100644
--- a/hl/examples/ptExampleFL.c
+++ b/hl/examples/ptExampleFL.c
@@ -23,82 +23,80 @@
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
- hid_t fid; /* File identifier */
- hid_t ptable; /* Packet table identifier */
+ hid_t fid; /* File identifier */
+ hid_t ptable; /* Packet table identifier */
- herr_t err; /* Function return status */
- hsize_t count; /* Number of records in the table */
+ herr_t err; /* Function return status */
+ hsize_t count; /* Number of records in the table */
- int x; /* Loop variable */
+ int x; /* Loop variable */
/* Buffers to hold data */
- int writeBuffer[5];
- int readBuffer[5];
+ int writeBuffer[5];
+ int readBuffer[5];
- /* Initialize buffers */
- for(x=0; x<5; x++)
- {
- writeBuffer[x]=x;
- readBuffer[x] = -1;
- }
+ /* Initialize buffers */
+ for (x = 0; x < 5; x++) {
+ writeBuffer[x] = x;
+ readBuffer[x] = -1;
+ }
/* Create a file using default properties */
- fid=H5Fcreate("packet_table_FLexample.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
+ fid = H5Fcreate("packet_table_FLexample.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create a fixed-length packet table within the file */
/* This table's "packets" will be simple integers and it will use compression
* level 5. */
- ptable = H5PTcreate_fl(fid, "Packet Test Dataset", H5T_NATIVE_INT, (hsize_t)100, 5);
- if(ptable == H5I_INVALID_HID)
- goto out;
+ ptable = H5PTcreate_fl(fid, "Packet Test Dataset", H5T_NATIVE_INT, (hsize_t)100, 5);
+ if (ptable == H5I_INVALID_HID)
+ goto out;
/* Write one packet to the packet table */
- err = H5PTappend(ptable, (hsize_t)1, &(writeBuffer[0]) );
- if(err < 0)
- goto out;
+ err = H5PTappend(ptable, (hsize_t)1, &(writeBuffer[0]));
+ if (err < 0)
+ goto out;
/* Write several packets to the packet table */
- err = H5PTappend(ptable, (hsize_t)4, &(writeBuffer[1]) );
- if(err < 0)
- goto out;
+ err = H5PTappend(ptable, (hsize_t)4, &(writeBuffer[1]));
+ if (err < 0)
+ goto out;
/* Get the number of packets in the packet table. This should be five. */
- err = H5PTget_num_packets(ptable, &count);
- if(err < 0)
- goto out;
+ err = H5PTget_num_packets(ptable, &count);
+ if (err < 0)
+ goto out;
- printf("Number of packets in packet table after five appends: %d\n", (int)count);
+ printf("Number of packets in packet table after five appends: %d\n", (int)count);
/* Initialize packet table's "current record" */
- err = H5PTcreate_index(ptable);
- if(err < 0)
- goto out;
+ err = H5PTcreate_index(ptable);
+ if (err < 0)
+ goto out;
/* Iterate through packets, read each one back */
- for(x=0; x<5; x++)
- {
- err = H5PTget_next(ptable, (hsize_t)1, &(readBuffer[x]) );
- if(err < 0)
- goto out;
+ for (x = 0; x < 5; x++) {
+ err = H5PTget_next(ptable, (hsize_t)1, &(readBuffer[x]));
+ if (err < 0)
+ goto out;
- printf("Packet %d's value is %d\n", x, readBuffer[x]);
- }
+ printf("Packet %d's value is %d\n", x, readBuffer[x]);
+ }
/* Close the packet table */
- err = H5PTclose(ptable);
- if(err < 0)
- goto out;
+ err = H5PTclose(ptable);
+ if (err < 0)
+ goto out;
/* Close the file */
- H5Fclose(fid);
+ H5Fclose(fid);
- return 0;
+ return 0;
- out: /* An error has occurred. Clean up and exit. */
+out: /* An error has occurred. Clean up and exit. */
H5PTclose(ptable);
H5Fclose(fid);
return -1;
}
-