summaryrefslogtreecommitdiffstats
path: root/hl/c++
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2016-04-25 19:14:51 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2016-04-25 19:14:51 (GMT)
commit853b4f417b65979b699a27f8273ed23b60cf70bd (patch)
tree2d96e0fa6be7264f16d2fc7b783d3c4652a1e634 /hl/c++
parentf50629ed52d3b4597e11734680c5e5791413b118 (diff)
downloadhdf5-853b4f417b65979b699a27f8273ed23b60cf70bd.zip
hdf5-853b4f417b65979b699a27f8273ed23b60cf70bd.tar.gz
hdf5-853b4f417b65979b699a27f8273ed23b60cf70bd.tar.bz2
[svn-r29796] 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. Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
Diffstat (limited to 'hl/c++')
-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.");