From 853b4f417b65979b699a27f8273ed23b60cf70bd Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 25 Apr 2016 14:14:51 -0500 Subject: =?UTF-8?q?[svn-r29796]=20Purpose:=20Fix=20warnings=20HDFFV-8615?= =?UTF-8?q?=20Description:=20=20=20=20=20The=20"warning:=20deprecated=20co?= =?UTF-8?q?nversion=20from=20string=20constant=20to=20=C3=A2char*=C3=A2=20?= =?UTF-8?q?=20=20=20=20[-Wwrite-strings]"=20was=20already=20removed=20by?= =?UTF-8?q?=20adding=20const=20to=20char*=20=20=20=20=20parameter=20in=20t?= =?UTF-8?q?he=20FL=5FPacketTable.=20=20This=20change=20is=20to=20remove=20?= =?UTF-8?q?the=20use=20=20=20=20=20of=20literal=20strings=20in=20code=20fo?= =?UTF-8?q?r=20maintainability.=20Platforms=20tested:=20=20=20=20=20Linux/?= =?UTF-8?q?32=202.6=20(jam)=20=20=20=20=20Linux/64=20(platypus)=20=20=20?= =?UTF-8?q?=20=20Darwin=20(osx1010test)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hl/c++/examples/ptExampleFL.cpp | 17 ++++++++++++++--- 1 file 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."); -- cgit v0.12