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 /hl/c++/examples | |
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 'hl/c++/examples')
-rw-r--r-- | hl/c++/examples/ptExampleFL.cpp | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/hl/c++/examples/ptExampleFL.cpp b/hl/c++/examples/ptExampleFL.cpp index 26cbf09..d0b62da 100644 --- a/hl/c++/examples/ptExampleFL.cpp +++ b/hl/c++/examples/ptExampleFL.cpp @@ -22,56 +22,55 @@ *------------------------------------------------------------------------- */ -const char* FILE_NAME("PTcppexampleFL.h5"); -const char* PT_NAME("/examplePacketTable"); +const char *FILE_NAME("PTcppexampleFL.h5"); +const char *PT_NAME("/examplePacketTable"); -int main(void) +int +main(void) { - herr_t err; /* Return value from function calls */ - hid_t fileID; /* HDF5 identifier for file */ - hid_t plistID; /* HDF5 identifier for property list to use compression */ - hsize_t count; /* Number of records in table */ - int x; /* Temporary counter variable */ + herr_t err; /* Return value from function calls */ + hid_t fileID; /* HDF5 identifier for file */ + hid_t plistID; /* HDF5 identifier for property list to use compression */ + hsize_t count; /* Number of records in table */ + int x; /* Temporary counter variable */ /* Buffers to hold data */ int readBuffer[5]; int writeBuffer[5]; /* Initialize buffers */ - for(x=0; x<5; x++) - { - writeBuffer[x]=x; - readBuffer[x] = -1; + for (x = 0; x < 5; x++) { + writeBuffer[x] = x; + readBuffer[x] = -1; } /* Create a new HDF5 file */ fileID = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if(fileID <0) + if (fileID < 0) fprintf(stderr, "Couldn't create file.\n"); /* Prepare property list to set compression, randomly use deflate with compression level 5. */ plistID = H5Pcreate(H5P_DATASET_CREATE); - err = H5Pset_deflate(plistID, 5); - if(err < 0) + err = H5Pset_deflate(plistID, 5); + if (err < 0) fprintf(stderr, "Error setting compression level."); /* Create a fixed-length packet table. */ FL_PacketTable ptable(fileID, plistID, PT_NAME, H5T_NATIVE_INT, 100); - if(! ptable.IsValid()) + if (!ptable.IsValid()) fprintf(stderr, "Unable to create packet table."); /* Append five packets to the packet table, one at a time */ - for(x=0; x<5; x++) - { - err = ptable.AppendPacket( &(writeBuffer[x]) ); - if(err<0) + for (x = 0; x < 5; x++) { + err = ptable.AppendPacket(&(writeBuffer[x])); + if (err < 0) fprintf(stderr, "Error adding record."); } /* Get the number of packets in the packet table. This should be five. */ count = ptable.GetPacketCount(err); - if(err < 0) + if (err < 0) fprintf(stderr, "Error getting packet count."); printf("Number of packets in packet table after five appends: %d\n", count); @@ -80,10 +79,9 @@ int main(void) ptable.ResetIndex(); /* Iterate through packets, read each one back */ - for(x=0; x<5; x++) - { - err = ptable.GetNextPacket( &(readBuffer[x]) ); - if(err < 0) + for (x = 0; x < 5; x++) { + err = ptable.GetNextPacket(&(readBuffer[x])); + if (err < 0) fprintf(stderr, "Error reading record."); printf("Packet %d's value is %d.\n", x, readBuffer[x]); @@ -93,9 +91,8 @@ int main(void) /* out of scope. */ err = H5Fclose(fileID); - if( err < 0 ) + if (err < 0) fprintf(stderr, "Failed to close file.\n"); return 0; } - |