summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2016-04-25 19:18:50 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2016-04-25 19:18:50 (GMT)
commit9d743f078ef17105c8490e4cd21dce65bbb6af75 (patch)
tree6e2388b93b082fa5aadde6fd448fad90bf5abb84
parent823241347e6024c996e1e1a2a2fbd10b3b76a78c (diff)
downloadhdf5-9d743f078ef17105c8490e4cd21dce65bbb6af75.zip
hdf5-9d743f078ef17105c8490e4cd21dce65bbb6af75.tar.gz
hdf5-9d743f078ef17105c8490e4cd21dce65bbb6af75.tar.bz2
[svn-r29797] Purpose: Fix warnings HDFFV-8615
Description: The "warning: deprecated conversion from string constant to âchar*â [-Wwrite-strings]" was already removed by adding const to char* parameter in the FL_PacketTable. This change is to remove the use of literal strings in code for maintainability. Merged from trunk r29786. Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
-rw-r--r--hl/c++/examples/ptExampleFL.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/hl/c++/examples/ptExampleFL.cpp b/hl/c++/examples/ptExampleFL.cpp
index 3ce2217..27cbd92 100644
--- a/hl/c++/examples/ptExampleFL.cpp
+++ b/hl/c++/examples/ptExampleFL.cpp
@@ -24,10 +24,14 @@
*-------------------------------------------------------------------------
*/
+const char* FILE_NAME("PTcppexampleFL.h5");
+const char* PT_NAME("/examplePacketTable");
+
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 */
@@ -43,12 +47,19 @@ int main(void)
}
/* Create a new HDF5 file */
- fileID = H5Fcreate("PTcppexampleFL.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fileID = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if(fileID <0)
fprintf(stderr, "Couldn't create file.\n");
- /* Create a fixed-length packet table with compression level 5. */
- FL_PacketTable ptable(fileID, "/examplePacketTable", H5T_NATIVE_INT, 100, 5);
+ /* 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)
+ 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())
fprintf(stderr, "Unable to create packet table.");