diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
commit | 727b687ae6c80c9854cb53814fa1c12f27c2994c (patch) | |
tree | fabe359aaddbe3b4d1e2bb58ceb3b94311d66a1c /c++ | |
parent | 25486d50895fa4a30809d289b9aff4de583a9b84 (diff) | |
download | hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.zip hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.gz hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.bz2 |
[svn-r20146] Description:
Bring r19714:20145 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.6 (amazon) in debug mode
Mac OS X/32 10.6.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'c++')
-rw-r--r-- | c++/CMakeLists.txt | 2 | ||||
-rw-r--r-- | c++/Makefile.in | 3 | ||||
-rw-r--r-- | c++/examples/CMakeLists.txt | 7 | ||||
-rw-r--r-- | c++/examples/Makefile.in | 3 | ||||
-rw-r--r-- | c++/src/H5Exception.cpp | 6 | ||||
-rw-r--r-- | c++/src/H5Exception.h | 2 | ||||
-rw-r--r-- | c++/src/Makefile.in | 5 | ||||
-rw-r--r-- | c++/test/CMakeLists.txt | 3 | ||||
-rw-r--r-- | c++/test/Makefile.in | 3 | ||||
-rw-r--r-- | c++/test/tcompound.cpp | 34 | ||||
-rw-r--r-- | c++/test/tfilter.cpp | 87 | ||||
-rw-r--r-- | c++/test/tlinks.cpp | 1 | ||||
-rw-r--r-- | c++/test/trefer.cpp | 3 | ||||
-rw-r--r-- | c++/test/ttypes.cpp | 8 | ||||
-rw-r--r-- | c++/test/tvlstr.cpp | 28 |
15 files changed, 126 insertions, 69 deletions
diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index 7571e54..26c9521 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -6,6 +6,8 @@ PROJECT (HDF5_CPP) #----------------------------------------------------------------------------- IF (BUILD_SHARED_LIBS) SET (CPP_BUILT_AS_DYNAMIC_LIB 1) +ELSE (BUILD_SHARED_LIBS) + SET (CPP_BUILT_AS_STATIC_LIB 1) ENDIF (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- diff --git a/c++/Makefile.in b/c++/Makefile.in index 728a487..23b5ef0 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -153,6 +153,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -214,6 +215,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -270,6 +272,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index a650db5..7bb6bb5 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -22,10 +22,11 @@ SET (examples FOREACH (example ${examples}) ADD_EXECUTABLE (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - H5_NAMING (cpp_ex_${example}) - TARGET_WIN_PROPERTIES (cpp_ex_${example}) + H5_NAMING (cpp_ex_${example} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) - ADD_TEST (NAME cpp_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>) + IF (BUILD_TESTING) + ADD_TEST (NAME cpp_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>) + ENDIF (BUILD_TESTING) ENDFOREACH (example ${examples}) diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index 6f56fde..4efc6ef 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -120,6 +120,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -181,6 +182,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -237,6 +239,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 556bf21..8513372 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -22,7 +22,7 @@ namespace H5 { #endif -const H5std_string Exception::DEFAULT_MSG("No detailed information provided"); +const char Exception::DEFAULT_MSG[] = "No detailed information provided"; //-------------------------------------------------------------------------- // Function: Exception default constructor @@ -252,7 +252,7 @@ void Exception::walkErrorStack( H5E_direction_t direction, H5E_walk2_t func, voi // Function: Exception::getDetailMsg ///\brief Returns the detailed message set at the time the exception /// is thrown. -///\return Text message - \c std::string +///\return Text message - \c H5std_string // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getDetailMsg() const @@ -275,7 +275,7 @@ const char* Exception::getCDetailMsg() const //-------------------------------------------------------------------------- // Function: Exception::getFuncName ///\brief Returns the name of the function, where the exception is thrown. -///\return Text message - \c std::string +///\return Text message - \c H5std_string // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getFuncName() const diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index c17ff5b..b4af2ba 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -84,7 +84,7 @@ class H5_DLLCPP Exception { protected: // Default value for detail_message - static const H5std_string DEFAULT_MSG; + static const char DEFAULT_MSG[]; }; class H5_DLLCPP FileIException : public Exception { diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 28f6f00..4e4f669 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -175,6 +175,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -236,6 +237,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -292,6 +294,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -402,7 +405,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 69 +LT_VERS_REVISION = 70 LT_VERS_AGE = 0 # Include src directory diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 569e609..197ed84 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -36,8 +36,7 @@ INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR} ) ADD_EXECUTABLE (cpp_testhdf5 ${CPP_TEST_SRCS} ) -H5_NAMING (cpp_testhdf5) -TARGET_WIN_PROPERTIES (cpp_testhdf5) +H5_NAMING (cpp_testhdf5 ${LIB_TYPE}) TARGET_LINK_LIBRARIES (cpp_testhdf5 ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET} diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 5a3f52c..68418d9 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -142,6 +142,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -203,6 +204,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -259,6 +261,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index fb8bd17..fbb1219 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -115,7 +115,8 @@ static void test_compound_2() const int nelmts = NTESTELEM; const hsize_t four = 4; int i; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + unsigned char *buf = NULL, *orig = NULL, *bkg = NULL; + ArrayType *array_dt = NULL; // Output message about test being performed SUBTEST("Compound Element Reordering"); @@ -138,7 +139,7 @@ static void test_compound_2() memcpy(buf, orig, nelmts*sizeof(src_typ_t)); // Build hdf5 datatypes - ArrayType* array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); // Create an empty compound datatype CompType st(sizeof(src_typ_t)); @@ -148,6 +149,7 @@ static void test_compound_2() st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); array_dt->close(); + delete array_dt; array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); @@ -202,6 +204,9 @@ static void test_compound_2() cerr << "test_compound_2 in catch" << endl; issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } + + if(array_dt) + delete array_dt; } // test_compound_2() @@ -235,7 +240,8 @@ static void test_compound_3() int i; const int nelmts = NTESTELEM; const hsize_t four = 4; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + unsigned char *buf = NULL, *orig = NULL, *bkg = NULL; + ArrayType* array_dt = NULL; // Output message about test being performed SUBTEST("Compound Datatype Subset Conversions"); @@ -258,7 +264,7 @@ static void test_compound_3() memcpy(buf, orig, nelmts*sizeof(src_typ_t)); /* Build hdf5 datatypes */ - ArrayType* array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); // Create an empty compound datatype CompType st(sizeof(src_typ_t)); @@ -268,6 +274,7 @@ static void test_compound_3() st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); array_dt->close(); + delete array_dt; array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); @@ -319,6 +326,9 @@ static void test_compound_3() cerr << "test_compound_3 in catch" << endl; issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } + + if(array_dt) + delete array_dt; } // test_compound_3() @@ -357,7 +367,8 @@ static void test_compound_4() int i; const int nelmts = NTESTELEM; const hsize_t four = 4; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + unsigned char *buf = NULL, *orig = NULL, *bkg = NULL; + ArrayType* array_dt = NULL; // Output message about test being performed SUBTEST("Compound Element Shrinking & Reordering"); @@ -380,7 +391,7 @@ static void test_compound_4() memcpy(buf, orig, nelmts*sizeof(src_typ_t)); /* Build hdf5 datatypes */ - ArrayType* array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); + array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); // Create an empty compound datatype CompType st(sizeof(src_typ_t)); @@ -390,6 +401,7 @@ static void test_compound_4() st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT); st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT); array_dt->close(); + delete array_dt; array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four); @@ -446,6 +458,9 @@ static void test_compound_4() cerr << "test_compound_4 in catch" << endl; issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } + + if(array_dt) + delete array_dt; } // test_compound_4() @@ -486,16 +501,18 @@ static void test_compound_5() dst_typ_t *dst; void *buf = calloc(2, sizeof(dst_typ_t)); void *bkg = calloc(2, sizeof(dst_typ_t)); + ArrayType* array_dt = NULL; // Output message about test being performed SUBTEST("Optimized Struct Converter"); try { /* Build datatypes */ - ArrayType* array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims); + array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims); CompType short_array(4*sizeof(short)); short_array.insertMember("_", 0, *array_dt); array_dt->close(); + delete array_dt; CompType int_array(4*sizeof(int)); array_dt = new ArrayType(PredType::NATIVE_INT, 1, dims); @@ -545,6 +562,9 @@ static void test_compound_5() cerr << "test_compound_5 in catch" << endl; issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } + + if(array_dt) + delete array_dt; } // test_compound_5() diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index e59707a..0dbdf00 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -174,58 +174,61 @@ void test_szip_filter(H5File& file1) SUBTEST("szip filter (with encoder)"); if ( h5_szip_can_encode() == 1) { - char* tconv_buf = new char [1000]; - try { - const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; - - // Create the data space - DataSpace space1(2, size, NULL); + char* tconv_buf = new char [1000]; - // Create a small conversion buffer to test strip mining (?) - DSetMemXferPropList xfer; - xfer.setBuffer (1000, tconv_buf, NULL); + try { + const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; - // Prepare dataset create property list - DSetCreatPropList dsplist; - dsplist.setChunk(2, chunk_size); + // Create the data space + DataSpace space1(2, size, NULL); - // Set up for szip compression - dsplist.setSzip(szip_options_mask, szip_pixels_per_block); + // Create a small conversion buffer to test strip mining (?) + DSetMemXferPropList xfer; + xfer.setBuffer (1000, tconv_buf, NULL); - // Create a dataset with szip compression - DataSpace space2 (2, size, NULL); - DataSet dataset(file1.createDataSet (DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist)); + // Prepare dataset create property list + DSetCreatPropList dsplist; + dsplist.setChunk(2, chunk_size); - hsize_t i, j, n; - for (i=n=0; i<size[0]; i++) - { - for (j=0; j<size[1]; j++) - { - points[i][j] = (int)n++; - } - } + // Set up for szip compression + dsplist.setSzip(szip_options_mask, szip_pixels_per_block); - // Write to the dataset then read back the values - dataset.write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - dataset.read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + // Create a dataset with szip compression + DataSpace space2 (2, size, NULL); + DataSet dataset(file1.createDataSet (DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist)); - // Check that the values read are the same as the values written - for (i = 0; i < size[0]; i++) - for (j = 0; j < size[1]; j++) + hsize_t i, j, n; + for (i=n=0; i<size[0]; i++) { - int status = check_values (i, j, points[i][j], check[i][j]); - if (status == -1) - throw Exception("test_szip_filter", "Failed in testing szip method"); + for (j=0; j<size[1]; j++) + { + points[i][j] = (int)n++; + } } - dsplist.close(); - PASSED(); - } // end of try - // catch all other exceptions - catch (Exception E) - { - issue_fail_msg("test_szip_filter()", __LINE__, __FILE__, E.getCDetailMsg()); - } + // Write to the dataset then read back the values + dataset.write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + + // Check that the values read are the same as the values written + for (i = 0; i < size[0]; i++) + for (j = 0; j < size[1]; j++) + { + int status = check_values (i, j, points[i][j], check[i][j]); + if (status == -1) + throw Exception("test_szip_filter", "Failed in testing szip method"); + } + dsplist.close(); + PASSED(); + } // end of try + + // catch all other exceptions + catch (Exception E) + { + issue_fail_msg("test_szip_filter()", __LINE__, __FILE__, E.getCDetailMsg()); + } + + delete tconv_buf; } // if szip presents else { SKIPPED(); diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 53a1c8c..e4e691a 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -403,7 +403,6 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format) { hsize_t size[1] = {1}; char filename[NAME_BUF_SIZE]; - char* tconv_buf = new char [1000]; // Use the file access template id to create a file access prop. list. FileAccPropList fapl(fapl_id); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index aeb202a..7f63d33 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -326,6 +326,9 @@ static void test_reference_obj(void) catch (Exception E) { issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCDetailMsg()); } + + if(file1) + delete file1; } // test_reference_obj() /**************************************************************** diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index ef00c08..b1baa29 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -387,6 +387,7 @@ static void test_named () static hsize_t ds_size[2] = {10, 20}; hsize_t i; unsigned attr_data[10][20]; + DataType *ds_type = NULL; SUBTEST("Named datatypes"); try { @@ -462,12 +463,13 @@ now. // Create a dataset that uses the named type, then get the dataset's // datatype and make sure it's a named type. DataSet dset = file.createDataSet("dset1", another_type, space); - DataType *ds_type = new DataType(dset.getDataType()); + ds_type = new DataType(dset.getDataType()); iscommitted = ds_type->committed(); if (!iscommitted) throw InvalidActionException("IntType::committed()", "1 Dataset type should be named type!"); dset.close(); ds_type->close(); + delete ds_type; // Reopen the dataset and its type, then make sure the type is // a named type. @@ -483,6 +485,7 @@ now. dset = file.createDataSet("dset2", *ds_type, space); ds_type->close(); dset.close(); + delete ds_type; // Reopen the second dataset and make sure the type is shared dset = file.openDataSet("dset2"); @@ -509,6 +512,9 @@ now. catch (Exception E) { issue_fail_msg("test_named", __LINE__, __FILE__, E.getCDetailMsg()); } + + if(ds_type) + delete ds_type; } // test_named diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 91036f9..73e54e0 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -129,7 +129,6 @@ void test_vlstr_free_custom(void *_mem, void *info) *------------------------------------------------------------------------- */ // String for testing datasets -static char *dynstring_ds_write=NULL; static char stastring_ds_write[1]={'A'}; // Info for a string dataset @@ -138,6 +137,9 @@ const H5std_string DSET1_DATA("String Dataset"); static void test_vlstring_dataset() { + char *dynstring_ds_write = NULL; + char *string_ds_check = NULL; + // Output message about test being performed SUBTEST("VL String on Datasets"); @@ -161,12 +163,12 @@ static void test_vlstring_dataset() dset1.write(DSET1_DATA, vlst); // Read and verify the dataset string as a string of chars. - char *string_ds_check; dset1.read(&string_ds_check, vlst); if(HDstrcmp(string_ds_check, DSET1_DATA.c_str())!=0) TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n",__LINE__, DSET1_DATA.c_str(), string_ds_check); HDfree(string_ds_check); // note: no need for std::string test + string_ds_check = NULL; // Read and verify the dataset string as an std::string. H5std_string read_str; @@ -191,6 +193,7 @@ static void test_vlstring_dataset() if(HDstrcmp(string_ds_check,dynstring_ds_write)!=0) TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",dynstring_ds_write,string_ds_check); HDfree(string_ds_check); + string_ds_check = NULL; dset1.close(); // Open dataset DSET1_NAME again. @@ -207,6 +210,11 @@ static void test_vlstring_dataset() catch (Exception E) { issue_fail_msg("test_vlstring_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); } + + if(dynstring_ds_write) + HDfree(dynstring_ds_write); + if(string_ds_check) + HDfree(string_ds_check); } // test_vlstring_dataset() /*------------------------------------------------------------------------- @@ -231,10 +239,10 @@ static void test_vlstring_array_dataset() // Output message about test being performed SUBTEST("VL String Array on Datasets"); - H5File* file1; + H5File* file1 = NULL; try { // Create file. - file1 = new H5File (FILENAME, H5F_ACC_RDWR); + file1 = new H5File(FILENAME, H5F_ACC_RDWR); // Create dataspace for datasets. hsize_t dims1[] = {SPACE1_DIM1}; @@ -278,8 +286,7 @@ static void test_vlstring_array_dataset() HDmemset(wdata2, 'A', 65533); dataset2.write(&wdata2, vlst); - char *rdata2 = (char*)HDcalloc(65534, sizeof(char)); - HDmemset(rdata2, 0, 65533); + char *rdata2; dataset2.read(&rdata2, vlst); if (HDstrcmp(wdata2, rdata2)!=0) TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, wdata2, rdata2); @@ -302,8 +309,10 @@ static void test_vlstring_array_dataset() catch (Exception E) { issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); - delete file1; } + + if(file1) + delete file1; } // end test_vlstring_array_dataset() /*------------------------------------------------------------------------- @@ -482,6 +491,7 @@ static void test_vlstring_type() // Close datatype and file. vlst.close(); file1->close(); + delete file1; // Open file. file1 = new H5File(FILENAME, H5F_ACC_RDWR); @@ -506,8 +516,10 @@ static void test_vlstring_type() catch (Exception E) { issue_fail_msg("test_vlstring_type()", __LINE__, __FILE__, E.getCDetailMsg()); - delete file1; } + + if(file1) + delete file1; } // end test_vlstring_type() /*------------------------------------------------------------------------- |