From a873d149e535a32cc1125fb744b0344112096d48 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 30 Jul 2019 16:58:24 -0500 Subject: Cleanup when merging to other branches --- c++/test/dsets.cpp | 80 +- c++/test/tarray.cpp | 1 - examples/h5_extend_write.c | 6 +- fortran/src/H5Sf.c | 9 +- fortran/src/H5_f.c | 2 - fortran/src/H5match_types.c | 6 +- hl/test/test_ds.c | 6 +- hl/test/test_dset_append.c | 3 +- java/test/TestH5P.java | 4 +- test/CMakeTests.cmake | 146 +-- test/CMakeVFDTests.cmake | 2 + test/accum.c | 38 +- test/app_ref.c | 6 +- test/big.c | 4 +- test/bittests.c | 174 +-- test/cache_common.c | 107 +- test/cache_logging.c | 15 +- test/cache_tagging.c | 2 +- test/cmpd_dset.c | 10 +- test/dangle.c | 3 +- test/direct_chunk.c | 10 +- test/dsets.c | 955 ++++++++-------- test/dt_arith.c | 1472 +++++++++++++------------ test/dtypes.c | 24 +- test/earray.c | 6 +- test/efc.c | 10 +- test/enc_dec_plist_cross_platform.c | 4 +- test/err_compat.c | 2 +- test/error_test.c | 54 +- test/evict_on_close.c | 48 +- test/external.c | 1 - test/farray.c | 414 ++++--- test/fillval.c | 57 +- test/flush1.c | 2 +- test/flush2.c | 10 +- test/flushrefresh.c | 109 +- test/freespace.c | 26 +- test/istore.c | 2 +- test/lheap.c | 12 +- test/links.c | 1942 +++++++++++++++++---------------- test/mount.c | 38 +- test/objcopy.c | 14 +- test/ohdr.c | 32 +- test/page_buffer.c | 6 +- test/tarray.c | 42 +- test/testexternal_env.sh.in | 3 + test/testfiles/err_compat_1 | 2 +- test/testfiles/err_compat_2 | 2 +- test/testfiles/error_test_2 | 2 +- test/testframe.c | 346 +++--- test/th5o.c | 48 +- test/tid.c | 9 +- test/titerate.c | 9 +- test/tmisc.c | 30 +- test/ttime.c | 6 +- test/tunicode.c | 2 +- test/tvlstr.c | 27 +- test/tvltypes.c | 6 +- test/twriteorder.c | 384 +++---- test/unregister.c | 239 ++-- test/use_disable_mdc_flushes.c | 8 +- test/vds.c | 24 +- test/vfd.c | 117 +- testpar/t_cache.c | 4 +- testpar/t_filters_parallel.c | 5 + testpar/t_pread.c | 7 - tools/lib/h5diff.c | 1 - tools/lib/h5diff_array.c | 19 +- tools/lib/h5tools.c | 6 +- tools/lib/h5tools_str.c | 6 +- tools/lib/h5tools_utils.c | 26 +- tools/lib/h5trav.c | 2 +- tools/src/h5dump/h5dump_xml.c | 4 +- tools/src/h5repack/h5repack.c | 14 +- tools/src/h5repack/h5repack_copy.c | 30 +- tools/src/h5repack/h5repack_filters.c | 10 +- tools/src/h5repack/h5repack_refs.c | 24 +- tools/test/h5diff/h5diffgentest.c | 162 ++- tools/test/misc/h5clear_gentest.c | 2 +- tools/test/misc/talign.c | 8 +- 80 files changed, 3769 insertions(+), 3741 deletions(-) diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index cf4f6e4..14f1bd4 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -58,13 +58,13 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, /*------------------------------------------------------------------------- * Function: test_create * - * Purpose: Attempts to create a dataset. + * Purpose Attempts to create a dataset. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 *------------------------------------------------------------------------- */ @@ -184,15 +184,15 @@ static herr_t test_create( H5File& file) /*------------------------------------------------------------------------- * Function: test_simple_io * - * Purpose: Tests simple I/O. That is, reading and writing a complete + * Purpose Tests simple I/O. That is, reading and writing a complete * multi-dimensional array without data type or data space * conversions, without compression, and stored contiguously. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 *------------------------------------------------------------------------- */ @@ -268,13 +268,13 @@ static herr_t test_simple_io( H5File& file) /*------------------------------------------------------------------------- * Function: test_datasize * - * Purpose: Tests DataSet::getInMemDataSize(). + * Purpose Tests DataSet::getInMemDataSize(). * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * Thursday, March 22, 2012 *------------------------------------------------------------------------- */ @@ -334,13 +334,13 @@ static herr_t test_datasize(FileAccPropList &fapl) /*------------------------------------------------------------------------- * Function: test_tconv * - * Purpose: Test some simple data type conversion stuff. + * Purpose Test some simple data type conversion stuff. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 *------------------------------------------------------------------------- */ @@ -425,13 +425,13 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ /*------------------------------------------------------------------------- * Function: bogus * - * Purpose: A bogus compression method that doesn't do anything. + * Purpose A bogus compression method that doesn't do anything. * - * Return: Success: Data chunk size + * Return Success: Data chunk size * * Failure: 0 * - * Programmer: Robb Matzke + * Programmer Robb Matzke * Tuesday, April 21, 1998 *------------------------------------------------------------------------- */ @@ -447,16 +447,16 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, /*------------------------------------------------------------------------- * Function: test_compression * - * Purpose: Tests dataset compression. If compression is requested when + * Purpose Tests dataset compression. If compression is requested when * it hasn't been compiled into the library (such as when * updating an existing compressed dataset) then data is sent to * the file uncompressed but no errors are returned. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 *------------------------------------------------------------------------- */ @@ -730,13 +730,13 @@ static herr_t test_compression(H5File& file) /*------------------------------------------------------------------------- * Function: test_nbit_methods * - * Purpose: Tests setting nbit compression methods. + * Purpose Tests setting nbit compression methods. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * Friday, April 22, 2016 * *------------------------------------------------------------------------- @@ -847,16 +847,16 @@ static herr_t test_nbit_compression(H5File& file) /*------------------------------------------------------------------------- * Function: test_multiopen * - * Purpose: Tests that a bug no longer exists. If a dataset is opened + * Purpose Tests that a bug no longer exists. If a dataset is opened * twice and one of the handles is used to extend the dataset, * then the other handle should return the new size when * queried. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Saturday, February 17, 2001 *------------------------------------------------------------------------- */ @@ -929,13 +929,13 @@ static herr_t test_multiopen (H5File& file) /*------------------------------------------------------------------------- * Function: test_types * - * Purpose: Test various types - should be moved to dtypes.cpp + * Purpose Test various types - should be moved to dtypes.cpp * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * February 17, 2001 *------------------------------------------------------------------------- */ @@ -1118,9 +1118,9 @@ static herr_t test_types(H5File& file) /*------------------------------------------------------------------------- * Function: test_getObjinfo * - * Purpose: Tests getObjinfo() + * Purpose Tests getObjinfo() * - * Return: Success: 0 + * Return Success: 0 * Failure: -1 * * July, 2018 @@ -1178,10 +1178,10 @@ static herr_t test_getinfo(H5File& file) /*------------------------------------------------------------------------- * Function: test_chunk_cache * - * Purpose: Tests setting rdcc info on a DAPL, and interaction + * Purpose Tests setting rdcc info on a DAPL, and interaction * with the corresponding properties in the file structure. * - * Return: Success: 0 + * Return Success: 0 * Failure: number of errors * * July 2018 @@ -1290,13 +1290,13 @@ static herr_t test_chunk_cache(FileAccPropList fapl) /*------------------------------------------------------------------------- * Function: test_virtual * - * Purpose: Tests fixed, unlimited, and printf selections in the same + * Purpose Tests fixed, unlimited, and printf selections in the same * VDS * - * Return: Success: 0 + * Return Success: 0 * Failure: number of errors * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * Friday, March 10, 2017 * *------------------------------------------------------------------------- @@ -1368,13 +1368,13 @@ static herr_t test_virtual() /*------------------------------------------------------------------------- * Function: test_dset * - * Purpose: Tests the dataset interface (H5D) + * Purpose Tests the dataset interface (H5D) * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 * * Modifications: @@ -1438,11 +1438,11 @@ void test_dset() /*------------------------------------------------------------------------- * Function: cleanup_dsets * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: None + * Return None * - * Programmer: (use C version) + * Programmer (use C version) *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index a341885..fccc556 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -371,7 +371,6 @@ static void test_array_info() s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in hsize_t sdims1[] = {SPACE1_DIM1}; hsize_t tdims1[] = {ARRAY1_DIM1}; - int nmemb; // Number of compound members int ii; // counting variables hsize_t idxi, idxj, idxk; // dimension indicing variables H5T_class_t mclass; // Datatype class for field diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c index f3f6077..4abda30 100644 --- a/examples/h5_extend_write.c +++ b/examples/h5_extend_write.c @@ -163,9 +163,9 @@ main (void) /* * Resulting dataset * - * 1 1 1 3 3 - * 1 1 1 3 3 - * 1 1 1 0 0 + * 1 1 1 3 3 + * 1 1 1 3 3 + * 1 1 1 0 0 * 2 0 0 0 0 * 2 0 0 0 0 * 2 0 0 0 0 diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index 2eae0d9..0bafc58 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -1033,22 +1033,21 @@ h5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_ hsize_t *c_block = NULL; H5S_seloper_t c_op; - herr_t status; int rank; int i; rank = H5Sget_simple_extent_ndims(*space_id); if (rank < 0 ) return ret_value; - c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_start == NULL) goto DONE; - c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_count == NULL) goto DONE; - c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_stride == NULL) goto DONE; - c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_block == NULL) goto DONE; diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 69ba8b3..08b0212 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -632,7 +632,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5s_flags[15] = (int_f)H5S_SEL_POINTS; h5s_flags[16] = (int_f)H5S_SEL_HYPERSLABS; h5s_flags[17] = (int_f)H5S_SEL_ALL; - /* * H5T flags */ @@ -671,7 +670,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5t_flags[32] = (int_f)H5T_ARRAY; h5t_flags[33] = (int_f)H5T_DIR_ASCEND; h5t_flags[34] = (int_f)H5T_DIR_DESCEND; - /* * H5Z flags */ diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 57f7dda..e39e85a 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -143,7 +143,7 @@ void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char int main(void) { int i; - char chrA[32],chrB[32]; + char chrA[64],chrB[64]; int IntKinds[] = H5_FORTRAN_INTEGER_KINDS; int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; @@ -347,8 +347,8 @@ int main(void) for(i=0;i 0) { - sprintf(chrA, "Fortran_REAL_%s", Real_C_TYPES[i]); - sprintf(chrB, "real_%s_f", Real_C_TYPES[i]); + snprintf(chrA, sizeof(chrA), "Fortran_REAL_%s", Real_C_TYPES[i]); + snprintf(chrB, sizeof(chrB), "real_%s_f", Real_C_TYPES[i]); writeToFiles("float",chrA, chrB, RealKinds[i]); } } diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index d7af9e9..6c75423 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -4876,12 +4876,12 @@ static int read_data( const char* fname, for(i=0, nelms=1; i < ndims; i++) { if(fscanf( f, "%s %u", str, &j) && HDferror(f)) { - printf( "fscanf error in file %s\n", data_file ); + HDprintf( "fscanf error in file %s\n", data_file ); HDfclose(f); return -1; } /* end if */ if(fscanf( f, "%d",&n ) < 0 && HDferror(f)) { - printf( "fscanf error in file %s\n", data_file ); + HDprintf( "fscanf error in file %s\n", data_file ); HDfclose(f); return -1; } /* end if */ @@ -4899,7 +4899,7 @@ static int read_data( const char* fname, for(j = 0; j < nelms; j++) { if(fscanf( f, "%f",&val ) < 0 && HDferror(f)) { - printf( "fscanf error in file %s\n", data_file ); + HDprintf( "fscanf error in file %s\n", data_file ); HDfclose(f); return -1; } /* end if */ diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index e050de2..8bb4f84 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -11,11 +11,12 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include #include #include + #include "h5hltest.h" #include "H5DOpublic.h" -#include #if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) # define H5_ZLIB_HEADER "zlib.h" diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 981f34e..b1c29b2 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -209,12 +209,12 @@ public class TestH5P { @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidlow() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, 5, HDF5Constants.H5F_LIBVER_LATEST); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST+1, HDF5Constants.H5F_LIBVER_LATEST); } @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1); } @Test diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index f307950..dd977ce 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -554,6 +554,79 @@ if (TEST_CACHE_IMAGE) ) endif () +#-- Adding test for external_env +add_test ( + NAME H5TEST-external_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + extern_1r.raw + extern_2r.raw + extern_3r.raw + extern_4r.raw + extern_1w.raw + extern_2w.raw + extern_3w.raw + extern_4w.raw + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-external_env-clear-objects PROPERTIES FIXTURES_SETUP clear_external_env) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) +else () + add_test (NAME H5TEST-external_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=external_env.txt" + #-D "TEST_REFERENCE=external_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-external_env PROPERTIES + FIXTURES_REQUIRED clear_external_env + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) + +#-- Adding test for vds_env +add_test ( + NAME H5TEST-vds_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + vds_virt_0.h5 + vds_virt_3.h5 + vds_src_2.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-vds_env-clear-objects PROPERTIES FIXTURES_SETUP clear_vds_env) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) +else () + add_test (NAME H5TEST-vds_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=vds_env.txt" + #-D "TEST_REFERENCE=vds_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-vds_env PROPERTIES + FIXTURES_REQUIRED clear_vds_env + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) + #-- Adding test for flush1/2 add_test (NAME H5TEST-flush-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -762,79 +835,6 @@ set_tests_properties (H5TEST-links_env PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -#-- Adding test for external_env -add_test ( - NAME H5TEST-external_env-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove - extern_env_1r.raw - extern_env_2r.raw - extern_env_3r.raw - extern_env_4r.raw - extern_env_1w.raw - extern_env_2w.raw - extern_env_3w.raw - extern_env_4w.raw - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-external_env-clear-objects PROPERTIES FIXTURES_SETUP clear_external_env) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -else () - add_test (NAME H5TEST-external_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" - -D "TEST_ENV_VALUE:STRING=\${ORIGIN}" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=external_env.txt" - #-D "TEST_REFERENCE=external_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (H5TEST-external_env PROPERTIES - FIXTURES_REQUIRED clear_external_env - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) - -#-- Adding test for vds_env -add_test ( - NAME H5TEST-vds_env-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove - vds_virt_0.h5 - vds_virt_3.h5 - vds_src_2.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-vds_env-clear-objects PROPERTIES FIXTURES_SETUP clear_vds_env) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -else () - add_test (NAME H5TEST-vds_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" - -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=vds_env.txt" - #-D "TEST_REFERENCE=vds_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (H5TEST-vds_env PROPERTIES - FIXTURES_REQUIRED clear_vds_env - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) - if (NOT BUILD_SHARED_LIBS) #-- Adding test for libinfo add_test (NAME H5TEST-testlibinfo diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index b94fc88..cf938f5 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -81,6 +81,8 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD tcheck_version testmeta links_env + external_env + vds_env ) if (NOT CYGWIN) list (REMOVE_ITEM H5_VFD_SKIP_TESTS big cache) diff --git a/test/accum.c b/test/accum.c index 19006b6..4cef35a 100644 --- a/test/accum.c +++ b/test/accum.c @@ -94,7 +94,7 @@ main(void) /* Test Setup */ - puts("Testing the metadata accumulator"); + HDputs("Testing the metadata accumulator"); /* Create a test file */ if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -141,14 +141,14 @@ main(void) if(nerrors) goto error; - puts("All metadata accumulator tests passed."); + HDputs("All metadata accumulator tests passed."); return 0; error: if(api_ctx_pushed) H5CX_pop(); - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); return 1; } /* end main() */ @@ -1951,10 +1951,11 @@ test_swmr_write_big(hbool_t newest_format) if((pid = HDfork()) < 0) { HDperror("fork"); FAIL_STACK_ERROR; - } else if(0 == pid) { /* Child process */ + } + else if(0 == pid) { /* Child process */ /* Run the reader */ status = HDexecv(SWMR_READER, new_argv); - printf("errno from execv = %s\n", strerror(errno)); + HDprintf("errno from execv = %s\n", strerror(errno)); FAIL_STACK_ERROR; } /* end if */ @@ -2030,18 +2031,19 @@ accum_printf(const H5F_t *f) { H5F_meta_accum_t * accum = &f->shared->accum; - printf("\n"); - printf("Current contents of accumulator:\n"); - if (accum->alloc_size == 0) { - printf("=====================================================\n"); - printf(" No accumulator allocated.\n"); - printf("=====================================================\n"); - } else { - printf("=====================================================\n"); - printf(" accumulator allocated size == %zu\n", accum->alloc_size); - printf(" accumulated data size == %zu\n", accum->size); + HDprintf("\n"); + HDprintf("Current contents of accumulator:\n"); + if(accum->alloc_size == 0) { + HDprintf("=====================================================\n"); + HDprintf(" No accumulator allocated.\n"); + HDprintf("=====================================================\n"); + } + else { + HDprintf("=====================================================\n"); + HDprintf(" accumulator allocated size == %zu\n", accum->alloc_size); + HDprintf(" accumulated data size == %zu\n", accum->size); HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc); if(accum->dirty) { HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off)); @@ -2049,8 +2051,8 @@ accum_printf(const H5F_t *f) } /* end if */ HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size)); HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", (haddr_t)(accum->loc + accum->alloc_size)); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); } - printf("\n\n"); + HDprintf("\n\n"); } /* accum_printf() */ diff --git a/test/app_ref.c b/test/app_ref.c index 3ef3fef..a4853fa 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -83,8 +83,8 @@ Abrt_Handler (int H5_ATTR_UNUSED sig) int i, n; for (i=0; i0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find copied region in destination"); + HDputs (" Unabled to find copied region in destination"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found copied bits when we shouldn't have"); + HDputs (" Found copied bits when we shouldn't have"); goto failed; } @@ -199,25 +199,25 @@ test_copy (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first copied bit in destination " + HDprintf (" Unable to find first copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found copied bits and shouldn't have!"); + HDputs (" Found copied bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last copied bit in destination " + HDprintf (" Unable to find last copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order zeros are present and shouldn't be!"); + HDputs (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -228,25 +228,25 @@ test_copy (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last copied bit in destination " + HDprintf (" Unable to find last copied bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found copied bits but shouldn't have (reverse)!"); + HDputs (" Found copied bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of copied data " + HDprintf (" Unable to find beginning of copied data " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading original data but shouldn't have!"); + HDputs (" Found leading original data but shouldn't have!"); goto failed; } @@ -256,14 +256,14 @@ test_copy (void) return 0; failed: - printf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", i, (unsigned long)s_offset, (unsigned long)d_offset, (unsigned long)size); - printf (" s = 0x"); - for (j=sizeof(v1)-1; j>=0; --j) printf ("%02x", v1[j]); - printf ("\n d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" s = 0x"); + for (j=sizeof(v1)-1; j>=0; --j) HDprintf ("%02x", v1[j]); + HDprintf ("\n d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -311,7 +311,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if(n != (ssize_t)offset + shift_dist) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -323,7 +323,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -338,7 +338,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -350,7 +350,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if(n != (ssize_t)(offset + size) - shift_dist - 1) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -373,7 +373,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (n >= 0) { H5_FAILED(); - printf (" Unable to verify all bits are zero in destination(LSB) " + HDprintf (" Unable to verify all bits are zero in destination(LSB) " "(n=%d)\n", (int)n); goto failed; } @@ -382,7 +382,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n >= 0) { H5_FAILED(); - printf (" Unable to verify all bits are zero in destination(MSB) " + HDprintf (" Unable to verify all bits are zero in destination(MSB) " "(n=%d)\n", (int)n); goto failed; } @@ -392,11 +392,11 @@ test_shift (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n", i, (unsigned long)offset, (unsigned long)size, (unsigned long)shift_dist); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -446,13 +446,13 @@ test_increment (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (size!=1 && (size_t)n!=offset+size-1) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } if(size==1 && n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bit in destination " + HDprintf (" Unable to verify all-zero bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -464,13 +464,13 @@ test_increment (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (size!=1 && n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if(size==1 && n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bit in destination " + HDprintf (" Unable to verify all-zero bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -480,10 +480,10 @@ test_increment (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -530,7 +530,7 @@ test_decrement (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -542,7 +542,7 @@ test_decrement (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -552,10 +552,10 @@ test_decrement (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -602,7 +602,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -614,7 +614,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -630,7 +630,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bits in destination " + HDprintf (" Unable to verify all-zero bits in destination " "(n=%d)\n", (int)n); goto failed; } @@ -642,7 +642,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bits in destination " + HDprintf (" Unable to verify all-zero bits in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -652,10 +652,10 @@ test_negate (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -697,12 +697,12 @@ test_set (void) for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break; if (size>0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find set region in buffer"); + HDputs (" Unabled to find set region in buffer"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found set bits when we shouldn't have"); + HDputs (" Found set bits when we shouldn't have"); goto failed; } @@ -711,25 +711,25 @@ test_set (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first set bit in destination " + HDprintf (" Unable to find first set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found set bits and shouldn't have!"); + HDputs (" Found set bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last set bit in destination " + HDprintf (" Unable to find last set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order zeros are present and shouldn't be!"); + HDputs (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -740,25 +740,25 @@ test_set (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last set bit in destination " + HDprintf (" Unable to find last set bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found set bits but shouldn't have (reverse)!"); + HDputs (" Found set bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of set bit region " + HDprintf (" Unable to find beginning of set bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading zeros but shouldn't have!"); + HDputs (" Found leading zeros but shouldn't have!"); goto failed; } @@ -768,11 +768,11 @@ test_set (void) return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -814,12 +814,12 @@ test_clear (void) for (j=0; j<(int)sizeof(v2); j++) if (0xff!=v2[j]) break; if (size>0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find cleared region in buffer"); + HDputs (" Unabled to find cleared region in buffer"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found cleared bits when we shouldn't have"); + HDputs (" Found cleared bits when we shouldn't have"); goto failed; } @@ -828,25 +828,25 @@ test_clear (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 0); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first cleared bit in destination " + HDprintf (" Unable to find first cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found cleared bits and shouldn't have!"); + HDputs (" Found cleared bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 1); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last cleared bit in destination " + HDprintf (" Unable to find last cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order ones are present and shouldn't be!"); + HDputs (" High-order ones are present and shouldn't be!"); goto failed; } @@ -857,25 +857,25 @@ test_clear (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 0); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last cleared bit in destination " + HDprintf (" Unable to find last cleared bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found cleared bits but shouldn't have (reverse)!"); + HDputs (" Found cleared bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 1); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of cleared bit region " + HDprintf (" Unable to find beginning of cleared bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading ones but shouldn't have!"); + HDputs (" Found leading ones but shouldn't have!"); goto failed; } @@ -885,11 +885,11 @@ test_clear (void) return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -928,11 +928,11 @@ main(void) nerrors += test_negate() < 0 ? 1 : 0; if(nerrors) { - printf("***** %u FAILURE%s! *****\n", + HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S"); exit(EXIT_FAILURE); } - printf("All bit tests passed.\n"); + HDprintf("All bit tests passed.\n"); H5close(); diff --git a/test/cache_common.c b/test/cache_common.c index 2cc188e..b078964 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -20,6 +20,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5MFprivate.h" #include "H5MMprivate.h" + #include "cache_common.h" @@ -3276,23 +3277,24 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - HDassert(fid >= 0); - saved_fid = fid; + HDassert(fid >= 0); + saved_fid = fid; if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { pass = FALSE; failure_mssg = "H5Fflush() failed."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } else { + } + else { file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); - if(file_ptr == NULL) { + if(file_ptr == NULL) { pass = FALSE; failure_mssg = "Can't get file_ptr."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } + } } } @@ -3303,36 +3305,36 @@ setup_cache(size_t max_cache_size, if(pass) { /* A bit of fancy footwork here: - * - * The call to H5Fcreate() allocates an instance of H5C_t, - * initializes it, and stores its address in f->shared->cache. - * - * We don't want to use this cache, as it has a bunch of extra - * initialization that may change over time, and in any case - * it will not in general be configured the way we want it. - * - * We used to deal with this problem by storing the file pointer - * in another instance of H5C_t, and then ignoring the original - * version. However, this strategy doesn't work any more, as - * we can't store the file pointer in the instance of H5C_t, - * and we have modified many cache routines to use a file - * pointer to look up the target cache. - * - * Thus we now make note of the address of the instance of - * H5C_t created by the call to H5Fcreate(), set - * file_ptr->shared->cache to NULL, call H5C_create() - * to allocate a new instance of H5C_t for test purposes, - * and store than new instance's address in - * file_ptr->shared->cache. - * - * On shut down, we call H5C_dest on our instance of H5C_t, - * set file_ptr->shared->cache to point to the original - * instance, and then close the file normally. - */ + * + * The call to H5Fcreate() allocates an instance of H5C_t, + * initializes it, and stores its address in f->shared->cache. + * + * We don't want to use this cache, as it has a bunch of extra + * initialization that may change over time, and in any case + * it will not in general be configured the way we want it. + * + * We used to deal with this problem by storing the file pointer + * in another instance of H5C_t, and then ignoring the original + * version. However, this strategy doesn't work any more, as + * we can't store the file pointer in the instance of H5C_t, + * and we have modified many cache routines to use a file + * pointer to look up the target cache. + * + * Thus we now make note of the address of the instance of + * H5C_t created by the call to H5Fcreate(), set + * file_ptr->shared->cache to NULL, call H5C_create() + * to allocate a new instance of H5C_t for test purposes, + * and store than new instance's address in + * file_ptr->shared->cache. + * + * On shut down, we call H5C_dest on our instance of H5C_t, + * set file_ptr->shared->cache to point to the original + * instance, and then close the file normally. + */ HDassert(saved_cache == NULL); - saved_cache = file_ptr->shared->cache; - file_ptr->shared->cache = NULL; + saved_cache = file_ptr->shared->cache; + file_ptr->shared->cache = NULL; cache_ptr = H5C_create(max_cache_size, min_clean_size, @@ -3351,19 +3353,20 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - if(cache_ptr == NULL) { + if(cache_ptr == NULL) { pass = FALSE; failure_mssg = "H5C_create() failed."; if(verbose) HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC); - } else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { + } + else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { pass = FALSE; - failure_mssg = "Bad cache_ptr magic."; + failure_mssg = "Bad cache_ptr magic."; if(verbose) HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC); - } + } } if(show_progress) /* 7 */ @@ -3446,7 +3449,7 @@ takedown_cache(H5F_t * file_ptr, H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } - if ( H5C_prep_for_file_close(file_ptr) < 0 ) { + if ( H5C_prep_for_file_close(file_ptr) < 0 ) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; @@ -3456,23 +3459,23 @@ takedown_cache(H5F_t * file_ptr, H5C_dest(file_ptr); - if ( saved_cache != NULL ) { + if ( saved_cache != NULL ) { - file_ptr->shared->cache = saved_cache; - saved_cache = NULL; - } + file_ptr->shared->cache = saved_cache; + saved_cache = NULL; + } } if ( saved_fapl_id != H5P_DEFAULT ) { H5Pclose(saved_fapl_id); - saved_fapl_id = H5P_DEFAULT; + saved_fapl_id = H5P_DEFAULT; } if ( saved_fcpl_id != H5P_DEFAULT ) { H5Pclose(saved_fcpl_id); - saved_fcpl_id = H5P_DEFAULT; + saved_fcpl_id = H5P_DEFAULT; } if ( saved_fid != -1 ) { @@ -3489,21 +3492,21 @@ takedown_cache(H5F_t * file_ptr, saved_actual_base_addr = HADDR_UNDEF; } - if ( H5Fclose(saved_fid) < 0 ) { + if ( H5Fclose(saved_fid) < 0 ) { pass = FALSE; - failure_mssg = "couldn't close test file."; + failure_mssg = "couldn't close test file."; - } else { + } else { - saved_fid = -1; + saved_fid = -1; } /* Pop API context */ H5CX_pop(); - if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { + if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { @@ -3515,10 +3518,10 @@ takedown_cache(H5F_t * file_ptr, if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "couldn't delete test file."; + failure_mssg = "couldn't delete test file."; - } - } + } + } } return; diff --git a/test/cache_logging.c b/test/cache_logging.c index 1eb9d41..c43609b 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -40,10 +40,10 @@ test_logging_api(void) char *location = NULL; size_t size; - hid_t fid; - hid_t gid; + hid_t fid = -1; + hid_t gid = -1; hbool_t is_currently_logging; - char group_name[8]; + char group_name[12]; char filename[1024]; int i; @@ -111,8 +111,8 @@ test_logging_api(void) /* Perform some manipulations */ for(i = 0; i < N_GROUPS; i++) { - HDmemset(group_name, 0, 8); - HDsnprintf(group_name, 8, "%d", i); + HDmemset(group_name, 0, sizeof(group_name)); + HDsnprintf(group_name, sizeof(group_name), "%d", i); if((gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if(H5Gclose(gid) < 0) @@ -166,10 +166,11 @@ main(void) if(nerrors) { HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return 1; + HDexit(EXIT_FAILURE); } HDprintf("All Metadata Cache Logging tests passed.\n"); - return 0; + + HDexit(EXIT_SUCCESS); } diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 119ba62..df28079 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -394,7 +394,7 @@ error: * Function: get_sbe_tag() * * Purpose: This function retrieves the tag associated with the superblock - * extension (the object header address stored in the superblock) + * extension (the object header address stored in the superblock) * * Return: 0 on Success; 1 on Failure * diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 5d6cfc7..11bc2b7 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -910,7 +910,7 @@ initialize_stype1(unsigned char *buf, size_t num) stype1 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype1 *)buf + i; + s_ptr = (stype1 *)((void *)buf) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) @@ -953,7 +953,7 @@ initialize_stype2(unsigned char *buf, size_t num) stype2 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype2 *)buf + i; + s_ptr = (stype2 *)((void *)buf) + i; s_ptr->a = (int)(i * 8 + 0); s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) @@ -1000,7 +1000,7 @@ initialize_stype3(unsigned char *buf, size_t num) stype3 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype3 *)buf + i; + s_ptr = (stype3 *)((void *)buf) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) @@ -1031,7 +1031,7 @@ initialize_stype4(unsigned char *buf, size_t num) stype4 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype4 *)buf + i; + s_ptr = (stype4 *)((void *)buf) + i; s_ptr->a = (int)(i * 8 + 0); s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) @@ -1808,7 +1808,7 @@ test_pack_ooo(void) unsigned free_order[PACK_NMEMBS]; /* Index of remaining free slots in order */ unsigned num_free; /* Number of free slots in order */ unsigned sub_cmpd_order; /* Order to insert the inner compound */ - char name[6]; /* Member name */ + char name[16]; /* Member name */ unsigned extra_space; /* Whether to add extra space to the end of * the compound */ unsigned i, j; /* Indices */ diff --git a/test/dangle.c b/test/dangle.c index 75e9c84..9f30f10 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -602,7 +602,8 @@ test_dangle_force(void) TEST_ERROR; /* Allocate the array of object IDs */ - objs = (hid_t*)HDmalloc(sizeof(hid_t) * (size_t)count); + if(NULL == (objs = (hid_t *)HDcalloc((size_t)count, sizeof(hid_t)))) + TEST_ERROR; /* Get the list of open IDs */ if(H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0) diff --git a/test/direct_chunk.c b/test/direct_chunk.c index f68fb93..447e827 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -2008,11 +2008,11 @@ error: static int test_single_chunk(unsigned config) { - hid_t fid; /* File ID */ - hid_t fapl; /* File access property list ID */ - hid_t sid; /* Dataspace ID */ - hid_t did; /* Dataset ID */ - hid_t dcpl; /* Dataset creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */ hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */ hsize_t offset[2] = {0,0}; /* Offset for writing */ diff --git a/test/dsets.c b/test/dsets.c index 9562ec9..4302475 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -408,7 +408,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); + HDputs(" Library allowed overwrite of existing dataset."); goto error; } @@ -430,7 +430,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a non-existent dataset."); + HDputs(" Opened a non-existent dataset."); goto error; } @@ -452,7 +452,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); + HDputs(" Opened a dataset with incorrect chunking parameters."); goto error; } @@ -491,10 +491,10 @@ test_create(hid_t file) if(H5Dclose(dataset) < 0) goto error; PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_create() */ @@ -573,8 +573,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -597,8 +597,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != rdata[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -612,10 +612,10 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) } /* end if */ else { SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ - return 0; + return SUCCEED; error: if(space > 0) @@ -630,7 +630,7 @@ error: HDclose(f); if(tconv_buf) HDfree(tconv_buf); - return -1; + return FAIL; } /* end test_simple_io() */ @@ -706,8 +706,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != rdata[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -720,10 +720,10 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) } /* end if */ else { SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ - return 0; + return SUCCEED; error: if(space > 0) @@ -736,7 +736,7 @@ error: if(H5Fclose(file) < 0) TEST_ERROR if(f > 0) HDclose(f); - return -1; + return FAIL; } /* end test_userblock_offset() */ @@ -821,10 +821,10 @@ test_compact_io(hid_t fapl) for(j = 0; j < 8; j++) if(rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); - printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); + HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; } /* end */ @@ -879,10 +879,10 @@ test_compact_io(hid_t fapl) for(j = 0; j < 8; j++) if(rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); - printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); + HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; } /* end */ @@ -917,7 +917,7 @@ test_compact_io(hid_t fapl) if(H5Pclose(plist) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -929,7 +929,7 @@ test_compact_io(hid_t fapl) H5Fclose(verfile); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_compact_io() */ @@ -1020,8 +1020,8 @@ test_max_compact(hid_t fapl) for(u = 0; u < compact_size; u++) if(rbuf[u] != wbuf[u]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %u\n", (unsigned)u); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %u\n", (unsigned)u); goto error; } /* end if */ @@ -1066,7 +1066,7 @@ test_max_compact(hid_t fapl) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: if(wbuf) @@ -1082,7 +1082,7 @@ error: H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_max_compact() */ @@ -1191,7 +1191,7 @@ test_layout_extend(hid_t fapl) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1205,7 +1205,7 @@ error: H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_layout_extend() */ @@ -1240,14 +1240,19 @@ test_conv_buffer(hid_t fid) CmpField *cf = NULL; CmpFieldR *cfrR = NULL; - hid_t dataset = -1; /* dataset ID */ - hid_t space = -1; /* data space ID */ - hid_t ctype1, ctype2; /* data type ID */ - hid_t arr_type1, arr_type2, arr_type3, arr_type4, arr_type5; + hid_t dataset = H5I_INVALID_HID; /* dataset ID */ + hid_t space = H5I_INVALID_HID; /* data space ID */ + hid_t ctype1 = H5I_INVALID_HID, + ctype2 = H5I_INVALID_HID; /* data type ID */ + hid_t arr_type1 = H5I_INVALID_HID, + arr_type2 = H5I_INVALID_HID, + arr_type3 = H5I_INVALID_HID, + arr_type4 = H5I_INVALID_HID, + arr_type5 = H5I_INVALID_HID; hsize_t dimsa[3]; hsize_t dimsb[1]; hsize_t dimsc[1]; - hid_t xfer_list; + hid_t xfer_list = H5I_INVALID_HID; size_t size; TESTING("data type conversion buffer size"); @@ -1315,7 +1320,7 @@ test_conv_buffer(hid_t fid) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Library shouldn't allow conversion buffer too small"); + HDputs(" Library shouldn't allow conversion buffer too small"); goto error; } @@ -1340,11 +1345,24 @@ test_conv_buffer(hid_t fid) HDfree(cf); HDfree(cfrR); - puts(" PASSED"); - return 0; + HDputs(" PASSED"); + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY { + H5Pclose(xfer_list); + H5Sclose(space); + H5Tclose(arr_type1); + H5Tclose(arr_type2); + H5Tclose(arr_type3); + H5Tclose(ctype1); + H5Tclose(ctype2); + H5Tclose(arr_type4); + H5Tclose(arr_type5); + H5Dclose(dataset); + } H5E_END_TRY; + + return FAIL; } /* end test_conv_buffer() */ @@ -1404,7 +1422,7 @@ test_tconv(hid_t file) in[4 * i + 2] != out[4 * i + 1] || in[4 * i + 3] != out[4 * i + 0]) { H5_FAILED(); - puts(" Read with byte order conversion failed."); + HDputs(" Read with byte order conversion failed."); goto error; } } @@ -1414,8 +1432,8 @@ test_tconv(hid_t file) HDfree(out); HDfree(in); - puts(" PASSED"); - return 0; + HDputs(" PASSED"); + return SUCCEED; error: if(out) @@ -1428,7 +1446,7 @@ error: H5Sclose(space); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_tconv() */ /* This message derives from H5Z */ @@ -1760,7 +1778,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Check if all the filters are available */ if(H5Pall_filters_avail(dcpl)!=TRUE) { H5_FAILED(); - printf(" Line %d: Incorrect filter availability\n",__LINE__); + HDprintf(" Line %d: Incorrect filter availability\n",__LINE__); goto error; } /* end if */ @@ -1783,8 +1801,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for(j=0; j<(size_t)size[1]; j++) { if(0!=check[i][j]) { H5_FAILED(); - printf(" Read a non-zero value.\n"); - printf(" At index %lu,%lu\n", + HDprintf(" Read a non-zero value.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } @@ -1849,10 +1867,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for(j=0; j= 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_get_filter_info() */ /*------------------------------------------------------------------------- @@ -2291,7 +2309,7 @@ H5_ATTR_UNUSED * STEP 0: Test null I/O filter by itself. *---------------------------------------------------------- */ - puts("Testing 'null' filter"); + HDputs("Testing 'null' filter"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Zregister (H5Z_BOGUS) < 0) goto error; @@ -2306,7 +2324,7 @@ H5_ATTR_UNUSED * STEP 1: Test Fletcher32 Checksum by itself. *---------------------------------------------------------- */ - puts("Testing Fletcher32 checksum(enabled for read)"); + HDputs("Testing Fletcher32 checksum(enabled for read)"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_filter(dc, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL) < 0) goto error; @@ -2315,21 +2333,21 @@ H5_ATTR_UNUSED if(test_filter_internal(file,DSET_FLETCHER32_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size) < 0) goto error; if(fletcher32_size<=null_size) { H5_FAILED(); - puts(" Size after checksumming is incorrect."); + HDputs(" Size after checksumming is incorrect."); goto error; } /* end if */ /* Disable checksum during read */ - puts("Testing Fletcher32 checksum(disabled for read)"); + HDputs("Testing Fletcher32 checksum(disabled for read)"); if(test_filter_internal(file,DSET_FLETCHER32_NAME_2,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size) < 0) goto error; if(fletcher32_size<=null_size) { H5_FAILED(); - puts(" Size after checksumming is incorrect."); + HDputs(" Size after checksumming is incorrect."); goto error; } /* end if */ /* Try to corrupt data and see if checksum fails */ - puts("Testing Fletcher32 checksum(when data is corrupted)"); + HDputs("Testing Fletcher32 checksum(when data is corrupted)"); data_corrupt[0] = 52; data_corrupt[1] = 33; data_corrupt[2] = 27; @@ -2339,7 +2357,7 @@ H5_ATTR_UNUSED if(test_filter_internal(file,DSET_FLETCHER32_NAME_3,dc,DISABLE_FLETCHER32,DATA_CORRUPTED,&fletcher32_size) < 0) goto error; if(fletcher32_size<=null_size) { H5_FAILED(); - puts(" Size after checksumming is incorrect."); + HDputs(" Size after checksumming is incorrect."); goto error; } /* end if */ @@ -2352,7 +2370,7 @@ H5_ATTR_UNUSED *---------------------------------------------------------- */ #ifdef H5_HAVE_FILTER_DEFLATE - puts("Testing deflate filter"); + HDputs("Testing deflate filter"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_deflate (dc, 6) < 0) goto error; @@ -2363,7 +2381,7 @@ H5_ATTR_UNUSED #else /* H5_HAVE_FILTER_DEFLATE */ TESTING("deflate filter"); SKIPPED(); - puts(" Deflate filter not enabled"); + HDputs(" Deflate filter not enabled"); #endif /* H5_HAVE_FILTER_DEFLATE */ /*---------------------------------------------------------- @@ -2376,7 +2394,7 @@ H5_ATTR_UNUSED if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; - puts(""); + HDputs(""); if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; if(test_filter_internal(file,DSET_SZIP_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&szip_size) < 0) goto error; if(H5Pclose (dc) < 0) goto error; @@ -2388,7 +2406,7 @@ H5_ATTR_UNUSED TESTING("szip filter (without encoder)"); if( h5_szip_can_encode() != 1) { - puts(""); + HDputs(""); if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error; } else { @@ -2398,14 +2416,14 @@ H5_ATTR_UNUSED #else /* H5_HAVE_FILTER_SZIP */ TESTING("szip filter"); SKIPPED(); - puts(" Szip filter not enabled"); + HDputs(" Szip filter not enabled"); #endif /* H5_HAVE_FILTER_SZIP */ /*---------------------------------------------------------- * STEP 4: Test shuffling by itself. *---------------------------------------------------------- */ - puts("Testing shuffle filter"); + HDputs("Testing shuffle filter"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_shuffle (dc) < 0) goto error; @@ -2413,7 +2431,7 @@ H5_ATTR_UNUSED if(test_filter_internal(file,DSET_SHUFFLE_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&shuffle_size) < 0) goto error; if(shuffle_size!=null_size) { H5_FAILED(); - puts(" Shuffled size not the same as uncompressed size."); + HDputs(" Shuffled size not the same as uncompressed size."); goto error; } /* end if */ @@ -2425,7 +2443,7 @@ H5_ATTR_UNUSED *---------------------------------------------------------- */ #ifdef H5_HAVE_FILTER_DEFLATE - puts("Testing shuffle+deflate+checksum filters(checksum first)"); + HDputs("Testing shuffle+deflate+checksum filters(checksum first)"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_fletcher32 (dc) < 0) goto error; @@ -2437,7 +2455,7 @@ H5_ATTR_UNUSED /* Clean up objects used for this test */ if(H5Pclose (dc) < 0) goto error; - puts("Testing shuffle+deflate+checksum filters(checksum last)"); + HDputs("Testing shuffle+deflate+checksum filters(checksum last)"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_shuffle (dc) < 0) goto error; @@ -2451,7 +2469,7 @@ H5_ATTR_UNUSED #else /* H5_HAVE_FILTER_DEFLATE */ TESTING("shuffle+deflate+fletcher32 filters"); SKIPPED(); - puts(" Deflate filter not enabled"); + HDputs(" Deflate filter not enabled"); #endif /* H5_HAVE_FILTER_DEFLATE */ /*---------------------------------------------------------- @@ -2468,7 +2486,7 @@ H5_ATTR_UNUSED /* Make sure encoding is enabled */ if( h5_szip_can_encode() == 1) { - puts(""); + HDputs(""); if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error; } @@ -2479,7 +2497,7 @@ H5_ATTR_UNUSED TESTING("shuffle+szip+checksum filters(checksum first, without encoder)"); if( h5_szip_can_encode() != 1) { - puts(""); + HDputs(""); if(test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error; } else { @@ -2493,7 +2511,7 @@ H5_ATTR_UNUSED /* Make sure encoding is enabled */ if( h5_szip_can_encode() == 1) { - puts(""); + HDputs(""); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_shuffle (dc) < 0) goto error; @@ -2512,12 +2530,12 @@ H5_ATTR_UNUSED #else /* H5_HAVE_FILTER_SZIP */ TESTING("shuffle+szip+fletcher32 filters"); SKIPPED(); - puts(" szip filter not enabled"); + HDputs(" szip filter not enabled"); #endif /* H5_HAVE_FILTER_SZIP */ - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_filters() */ @@ -2526,8 +2544,7 @@ error: * * Purpose: Tests library behavior when filter is missing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -2552,7 +2569,7 @@ test_missing_filter(hid_t file) /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ @@ -2564,31 +2581,31 @@ test_missing_filter(hid_t file) /* (Use private routine, to avoid range checking on filter ID) */ if(H5Z__unregister(H5Z_FILTER_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ /* Create dcpl with deflate filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Pset_deflate(dcpl, 9) < 0) { H5_FAILED(); - printf(" Line %d: Can't set deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't set deflate filter\n",__LINE__); goto error; } /* end if */ @@ -2596,47 +2613,47 @@ test_missing_filter(hid_t file) ret=H5Pall_filters_avail(dcpl); if(ret<0) { H5_FAILED(); - printf(" Line %d: Can't check filter availability\n",__LINE__); + HDprintf(" Line %d: Can't check filter availability\n",__LINE__); goto error; } /* end if */ if(ret!=FALSE) { H5_FAILED(); - printf(" Line %d: Filter shouldn't be available\n",__LINE__); + HDprintf(" Line %d: Filter shouldn't be available\n",__LINE__); goto error; } /* end if */ /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_MISSING_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if(0 == (dset_size = H5Dget_storage_size(dsid))) { H5_FAILED(); - printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ @@ -2644,14 +2661,14 @@ test_missing_filter(hid_t file) /* (i.e. the deflation filter we asked for was silently ignored) */ if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -2661,10 +2678,10 @@ test_missing_filter(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -2673,21 +2690,21 @@ test_missing_filter(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -2697,14 +2714,14 @@ test_missing_filter(hid_t file) /* Open existing file */ if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open existing deflated file\n", __LINE__); + HDprintf(" Line %d: Can't open existing deflated file\n", __LINE__); goto error; } /* end if */ /* Open dataset */ if((dsid = H5Dopen2(fid, "Dataset1", H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n", __LINE__); + HDprintf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ @@ -2714,21 +2731,21 @@ test_missing_filter(hid_t file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Should not be able to read dataset data\n", __LINE__); + HDprintf(" Line %d: Should not be able to read dataset data\n", __LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n", __LINE__); + HDprintf(" Line %d: Can't close dataset\n", __LINE__); goto error; } /* end if */ /* Close existing file */ if(H5Fclose(fid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n", __LINE__); + HDprintf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ @@ -2736,21 +2753,21 @@ test_missing_filter(hid_t file) /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ #ifdef H5_HAVE_FILTER_DEFLATE /* Register deflate filter (use internal function to avoid range checks) */ if(H5Z_register(H5Z_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ @@ -2760,13 +2777,13 @@ test_missing_filter(hid_t file) api_ctx_pushed = FALSE; PASSED(); - return 0; + return SUCCEED; error: if(api_ctx_pushed) H5CX_pop(); - return -1; -} + return FAIL; +} /* end test_missing_filter() */ /*------------------------------------------------------------------------- @@ -2837,8 +2854,8 @@ test_onebyte_shuffle(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(new_data[i][j] != orig_data[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } @@ -2854,10 +2871,10 @@ test_onebyte_shuffle(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_onebyte_shuffle() */ @@ -2883,7 +2900,7 @@ test_nbit_int(hid_t file) double power; size_t i, j; - puts("Testing nbit filter"); + HDputs("Testing nbit filter"); TESTING(" nbit int (setup)"); /* Define dataset datatype (integer), and set precision, offset */ @@ -2953,8 +2970,8 @@ test_nbit_int(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(((unsigned)new_data[i][j] & mask) != ((unsigned)orig_data[i][j] & mask)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -2972,10 +2989,10 @@ test_nbit_int(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_int() */ @@ -3068,8 +3085,8 @@ test_nbit_float(hid_t file) continue; /* skip if value is NaN */ if(!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -3090,10 +3107,10 @@ test_nbit_float(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_float() */ @@ -3200,8 +3217,8 @@ test_nbit_double(hid_t file) continue; /* skip if value is NaN */ if(!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -3222,10 +3239,10 @@ test_nbit_double(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_double() */ @@ -3328,8 +3345,8 @@ test_nbit_array(hid_t file) for(n = 0; n < (size_t)adims[1]; n++) { if(new_data[i][j][m][n]!= orig_data[i][j][m][n]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu,%lu,%lu\n", + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu,%lu,%lu\n", (unsigned long)i, (unsigned long)j, (unsigned long)m, (unsigned long)n); goto error; } @@ -3349,10 +3366,10 @@ test_nbit_array(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_array() */ @@ -3534,8 +3551,8 @@ test_nbit_compound(hid_t file) (orig_data[i][j].f == orig_data[i][j].f && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f))) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -3566,10 +3583,10 @@ test_nbit_compound(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_compound() */ @@ -3865,8 +3882,8 @@ out: (new_data[i][j].a.f == new_data[i][j].a.f && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) || new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -3911,10 +3928,10 @@ out: PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_compound_2() */ @@ -4048,8 +4065,8 @@ test_nbit_compound_3(hid_t file) new_data[i].r != orig_data[i].r) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu\n", (unsigned long)i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu\n", (unsigned long)i); goto error; } @@ -4057,8 +4074,8 @@ test_nbit_compound_3(hid_t file) if(((unsigned int *)orig_data[i].v.p)[k] !=((unsigned int *)new_data[i].v.p)[k]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu\n", (unsigned long)i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu\n", (unsigned long)i); goto error; } @@ -4066,8 +4083,8 @@ test_nbit_compound_3(hid_t file) if(orig_data[i].o[j] != new_data[i].o[j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu\n", (unsigned long)i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu\n", (unsigned long)i); goto error; } } @@ -4091,10 +4108,10 @@ test_nbit_compound_3(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_compound_3() */ @@ -4128,41 +4145,41 @@ test_nbit_int_size(hid_t file) /* Define dataset datatype (integer), and set precision, offset */ if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) { H5_FAILED(); - printf(" line %d: H5Tcopy failed\n",__LINE__); + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); goto error; } /* end if */ precision = 16; /* precision includes sign bit */ if(H5Tset_precision(datatype,precision)<0) { H5_FAILED(); - printf(" line %d: H5Pset_precision failed\n",__LINE__); + HDprintf(" line %d: H5Pset_precision failed\n",__LINE__); goto error; } /* end if */ offset = 8; if(H5Tset_offset(datatype,offset)<0) { H5_FAILED(); - printf(" line %d: H5Tset_offset failed\n",__LINE__); + HDprintf(" line %d: H5Tset_offset failed\n",__LINE__); goto error; } /* end if */ /* Copy to memory datatype */ if((mem_datatype = H5Tcopy(datatype)) < 0) { H5_FAILED(); - printf(" line %d: H5Tcopy failed\n",__LINE__); + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); goto error; } /* end if */ /* Set order of dataset datatype */ if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { H5_FAILED(); - printf(" line %d: H5Pset_order failed\n",__LINE__); + HDprintf(" line %d: H5Pset_order failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_size(datatype, 4)<0) { H5_FAILED(); - printf(" line %d: H5Pset_size failed\n",__LINE__); + HDprintf(" line %d: H5Pset_size failed\n",__LINE__); goto error; } /* end if */ @@ -4181,7 +4198,7 @@ test_nbit_int_size(hid_t file) dims[1] = DSET_DIM2; if((dataspace = H5Screate_simple (2, dims, NULL))<0) { H5_FAILED(); - printf(" line %d: H5Pcreate failed\n",__LINE__); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); goto error; } /* end if */ @@ -4192,13 +4209,13 @@ test_nbit_int_size(hid_t file) chunk_size[1] = DSET_DIM2/10; if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) { H5_FAILED(); - printf(" line %d: H5Pcreate failed\n",__LINE__); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) { H5_FAILED(); - printf(" line %d: H5Pset_chunk failed\n",__LINE__); + HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__); goto error; } /* end if */ @@ -4207,7 +4224,7 @@ test_nbit_int_size(hid_t file) */ if(H5Pset_nbit (dset_create_props)<0) { H5_FAILED(); - printf(" line %d: H5Pset_nbit failed\n",__LINE__); + HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__); goto error; } /* end if */ @@ -4218,7 +4235,7 @@ test_nbit_int_size(hid_t file) dataspace, H5P_DEFAULT, dset_create_props, H5P_DEFAULT))<0) { H5_FAILED(); - printf(" line %d: H5dwrite failed\n",__LINE__); + HDprintf(" line %d: H5dwrite failed\n",__LINE__); goto error; } /* end if */ @@ -4228,7 +4245,7 @@ test_nbit_int_size(hid_t file) if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) { H5_FAILED(); - printf(" Line %d: H5Dwrite failed\n",__LINE__); + HDprintf(" Line %d: H5Dwrite failed\n",__LINE__); goto error; } /* end if */ @@ -4237,7 +4254,7 @@ test_nbit_int_size(hid_t file) */ if((precision = H5Tget_precision(datatype)) == 0) { H5_FAILED(); - printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); + HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); goto error; } /* end if */ @@ -4259,9 +4276,9 @@ test_nbit_int_size(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_int_size() */ @@ -4317,7 +4334,7 @@ test_nbit_flt_size(hid_t file) *-------------------------------------------------------------------*/ if((datatype = H5Tcopy(H5T_IEEE_F32LE)) < 0) { H5_FAILED(); - printf(" line %d: H5Tcopy failed\n",__LINE__); + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); goto error; } /* end if */ @@ -4331,38 +4348,38 @@ test_nbit_flt_size(hid_t file) if(H5Tset_fields(datatype, spos, epos, esize, mpos, msize)<0) { H5_FAILED(); - printf(" line %d: H5Tset_fields failed\n",__LINE__); + HDprintf(" line %d: H5Tset_fields failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_offset(datatype,offset)<0) { H5_FAILED(); - printf(" line %d: H5Tset_offset failed\n",__LINE__); + HDprintf(" line %d: H5Tset_offset failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_precision(datatype,precision)<0) { H5_FAILED(); - printf(" line %d: H5Tset_precision failed\n",__LINE__); + HDprintf(" line %d: H5Tset_precision failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_size(datatype, 4)<0) { H5_FAILED(); - printf(" line %d: H5Pset_size failed\n",__LINE__); + HDprintf(" line %d: H5Pset_size failed\n",__LINE__); goto error; } /* end if */ /* Set order of dataset datatype */ if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { H5_FAILED(); - printf(" line %d: H5Pset_order failed\n",__LINE__); + HDprintf(" line %d: H5Pset_order failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_ebias(datatype, 31)<0) { H5_FAILED(); - printf(" line %d: H5Pset_size failed\n",__LINE__); + HDprintf(" line %d: H5Pset_size failed\n",__LINE__); goto error; } /* end if */ @@ -4379,7 +4396,7 @@ test_nbit_flt_size(hid_t file) dims[1] = DSET_DIM2; if((dataspace = H5Screate_simple (2, dims, NULL))<0) { H5_FAILED(); - printf(" line %d: H5Pcreate failed\n",__LINE__); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); goto error; } /* end if */ @@ -4390,13 +4407,13 @@ test_nbit_flt_size(hid_t file) chunk_size[1] = DSET_DIM2/10; if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) { H5_FAILED(); - printf(" line %d: H5Pcreate failed\n",__LINE__); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) { H5_FAILED(); - printf(" line %d: H5Pset_chunk failed\n",__LINE__); + HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__); goto error; } /* end if */ @@ -4405,7 +4422,7 @@ test_nbit_flt_size(hid_t file) */ if(H5Pset_nbit (dset_create_props)<0) { H5_FAILED(); - printf(" line %d: H5Pset_nbit failed\n",__LINE__); + HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__); goto error; } /* end if */ @@ -4416,7 +4433,7 @@ test_nbit_flt_size(hid_t file) dataspace, H5P_DEFAULT, dset_create_props, H5P_DEFAULT))<0) { H5_FAILED(); - printf(" line %d: H5dwrite failed\n",__LINE__); + HDprintf(" line %d: H5dwrite failed\n",__LINE__); goto error; } /* end if */ @@ -4426,7 +4443,7 @@ test_nbit_flt_size(hid_t file) if(H5Dwrite (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) { H5_FAILED(); - printf(" Line %d: H5Dwrite failed\n",__LINE__); + HDprintf(" Line %d: H5Dwrite failed\n",__LINE__); goto error; } /* end if */ @@ -4435,7 +4452,7 @@ test_nbit_flt_size(hid_t file) */ if((precision = H5Tget_precision(datatype)) == 0) { H5_FAILED(); - printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); + HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); goto error; } /* end if */ @@ -4456,9 +4473,9 @@ test_nbit_flt_size(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_flt_size() */ /*------------------------------------------------------------------------- @@ -4486,7 +4503,7 @@ test_scaleoffset_int(hid_t file) int new_data[2][5]; size_t i, j; - puts("Testing scaleoffset filter"); + HDputs("Testing scaleoffset filter"); TESTING(" scaleoffset int without fill value (setup)"); datatype = H5Tcopy(H5T_NATIVE_INT); @@ -4549,8 +4566,8 @@ test_scaleoffset_int(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(new_data[i][j] != orig_data[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -4567,9 +4584,9 @@ test_scaleoffset_int(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_int() */ @@ -4678,8 +4695,8 @@ test_scaleoffset_int_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(new_data[0][j] != orig_data[0][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -4695,9 +4712,9 @@ test_scaleoffset_int_2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_int_2() */ @@ -4790,8 +4807,8 @@ test_scaleoffset_float(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -4808,9 +4825,9 @@ test_scaleoffset_float(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_float() */ @@ -4921,8 +4938,8 @@ test_scaleoffset_float_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -4937,9 +4954,9 @@ test_scaleoffset_float_2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_float_2() */ @@ -5032,8 +5049,8 @@ test_scaleoffset_double(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -5050,9 +5067,9 @@ test_scaleoffset_double(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_double() */ @@ -5163,8 +5180,8 @@ test_scaleoffset_double_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -5180,9 +5197,9 @@ test_scaleoffset_double_2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_double_2() */ @@ -5230,7 +5247,7 @@ test_multiopen (hid_t file) if(H5Sget_simple_extent_dims(space, tmp_size, NULL) < 0) goto error; if(cur_size[0] != tmp_size[0]) { H5_FAILED(); - printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); + HDprintf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); goto error; } /* end if */ @@ -5240,17 +5257,17 @@ test_multiopen (hid_t file) if(H5Pclose(dcpl) < 0) goto error; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Dclose(dset1); - H5Dclose(dset2); - H5Sclose(space); - H5Pclose(dcpl); + H5Dclose(dset1); + H5Dclose(dset2); + H5Sclose(space); + H5Pclose(dcpl); } H5E_END_TRY; - return -1; -} /* end test_multiopen () */ + return FAIL; +} /* end test_multiopen() */ /*------------------------------------------------------------------------- @@ -5336,7 +5353,7 @@ test_types(hid_t file) /* Cleanup */ if(H5Gclose(grp) < 0) goto error; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5345,7 +5362,7 @@ test_types(hid_t file) H5Sclose(space); H5Dclose(dset); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_types() */ /* This message derives from H5Z */ @@ -5392,30 +5409,30 @@ test_can_apply(hid_t file) /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_CAN_APPLY_TEST) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } /* The filter is mandate. */ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ @@ -5427,7 +5444,7 @@ test_can_apply(hid_t file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5438,7 +5455,7 @@ test_can_apply(hid_t file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5446,42 +5463,42 @@ test_can_apply(hid_t file) /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size=H5Dget_storage_size(dsid))==0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + HDprintf(" Line %d: Error querying dataset size\n",__LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_INT)*dims[0]*dims[1])!=dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -5491,10 +5508,10 @@ test_can_apply(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -5503,30 +5520,30 @@ test_can_apply(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_can_apply() */ /* This message derives from H5Z */ @@ -5575,72 +5592,72 @@ test_can_apply2(hid_t file) /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_CAN_APPLY_TEST2) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } /* The filter is optional. */ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST2, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size=H5Dget_storage_size(dsid))==0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + HDprintf(" Line %d: Error querying dataset size\n",__LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -5650,10 +5667,10 @@ test_can_apply2(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -5662,30 +5679,30 @@ test_can_apply2(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_can_apply2() */ @@ -5732,19 +5749,19 @@ file) /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ @@ -5755,7 +5772,7 @@ file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); + HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; } @@ -5766,7 +5783,7 @@ file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); + HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; } @@ -5774,7 +5791,7 @@ file) szip_pixels_per_block=2; if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) { H5_FAILED(); - printf(" Line %d: Can't set szip filter\n",__LINE__); + HDprintf(" Line %d: Can't set szip filter\n",__LINE__); goto error; } @@ -5786,47 +5803,47 @@ file) } H5E_END_TRY; if(dsid <=0) { H5_FAILED(); - printf(" Line %d: Should have created dataset!\n",__LINE__); + HDprintf(" Line %d: Should have created dataset!\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ /* Create another data space */ if((sid = H5Screate_simple(2, dims2, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ @@ -5834,7 +5851,7 @@ file) szip_pixels_per_block=32; if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) { H5_FAILED(); - printf(" Line %d: Can't set szip filter\n",__LINE__); + HDprintf(" Line %d: Can't set szip filter\n",__LINE__); goto error; } @@ -5845,7 +5862,7 @@ file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5853,14 +5870,14 @@ file) /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -5868,17 +5885,17 @@ file) PASSED(); } else { SKIPPED(); - puts(" Szip encoding is not enabled."); + HDputs(" Szip encoding is not enabled."); } #else /* H5_HAVE_FILTER_SZIP */ SKIPPED(); - puts(" Szip filter is not enabled."); + HDputs(" Szip filter is not enabled."); #endif /* H5_HAVE_FILTER_SZIP */ - return 0; + return SUCCEED; #ifdef H5_HAVE_FILTER_SZIP error: - return -1; + return FAIL; #endif /* H5_HAVE_FILTER_SZIP */ } /* end test_can_apply_szip() */ @@ -5938,57 +5955,57 @@ test_set_local(hid_t fapl) /* Open file */ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n",__LINE__); + HDprintf(" Line %d: Can't open file\n",__LINE__); goto error; } /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_SET_LOCAL_TEST) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'set local' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'set local' filter\n",__LINE__); goto error; } if(H5Pset_filter(dcpl, H5Z_FILTER_SET_LOCAL_TEST, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus2 filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus2 filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ @@ -5996,77 +6013,77 @@ test_set_local(hid_t fapl) /* (Shouldn't get modified by output filter) */ if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME_2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n", __LINE__); + HDprintf(" Line %d: Can't close dataspace\n", __LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n", __LINE__); + HDprintf(" Line %d: Can't close dcpl\n", __LINE__); goto error; } /* end if */ /* Close file (flushes & empties cache) */ if(H5Fclose(file) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n", __LINE__); + HDprintf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ /* Open file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n", __LINE__); + HDprintf(" Line %d: Can't open file\n", __LINE__); goto error; } /* Re-open dataset */ if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n", __LINE__); + HDprintf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size = H5Dget_storage_size(dsid)) == 0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n", __LINE__); + HDprintf(" Line %d: Error querying dataset size\n", __LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n", __LINE__); + HDprintf(" Line %d: Error reading dataset data\n", __LINE__); goto error; } /* end if */ @@ -6076,10 +6093,10 @@ test_set_local(hid_t fapl) for(j=0; j=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); goto error; } /* end if */ @@ -6458,7 +6475,7 @@ test_filter_delete(hid_t file) } H5E_END_TRY; if(ret >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); goto error; } /* end if */ @@ -6490,7 +6507,7 @@ test_filter_delete(hid_t file) #else SKIPPED(); #endif - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6499,7 +6516,7 @@ error: H5Dclose(dsid); H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_filter_delete() */ @@ -6556,7 +6573,7 @@ auxread_fdata(hid_t fid, const char *name) if(nelmts) { buf = (void *)HDmalloc((size_t)(nelmts * msize)); if(buf == NULL) { - printf( "cannot read into memory\n" ); + HDprintf( "cannot read into memory\n" ); goto error; } if(H5Dread(dset_id, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) @@ -6572,7 +6589,7 @@ auxread_fdata(hid_t fid, const char *name) if(buf) HDfree(buf); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6584,7 +6601,7 @@ error: if(buf) HDfree(buf); } H5E_END_TRY; - return -1; + return FAIL; } /* end auxread_fdata() */ @@ -6645,7 +6662,7 @@ test_filters_endianess(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6654,7 +6671,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_filters_endianess() */ @@ -6804,7 +6821,7 @@ test_zero_dims(hid_t file) if(H5Sclose(s2) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6818,7 +6835,7 @@ error: H5Dclose(d2); H5Sclose(s2); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_zero_dims() */ @@ -6955,13 +6972,13 @@ test_missing_chunk(hid_t file) for(u=0; u=5) { if(rdata[u]!=911) { - printf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]); + HDprintf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]); TEST_ERROR; } /* end if */ } /* end if */ else { if(rdata[u]!=wdata[u]) { - printf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]); + HDprintf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]); TEST_ERROR; } /* end if */ } /* end else */ @@ -6973,14 +6990,14 @@ test_missing_chunk(hid_t file) if((i % 10) >= 5 || (j % 10) >= 5) { if(rdata2[i][j] != 911) { - printf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", + HDprintf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", __LINE__,(unsigned)i, (unsigned)j, rdata2[i][j]); TEST_ERROR; } /* end if */ } /* end if */ else { if(rdata2[i][j] != wdata2[i][j]) { - printf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", + HDprintf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", __LINE__,(unsigned)i, (unsigned)j, wdata2[i][j],(unsigned)i, (unsigned)j, rdata2[i][j]); TEST_ERROR; } /* end if */ @@ -6997,7 +7014,7 @@ test_missing_chunk(hid_t file) if(H5Dclose(did2) < 0) TEST_ERROR; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7010,7 +7027,7 @@ error: H5Sclose(s); H5Sclose(sid2); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_missing_chunk() */ @@ -7144,8 +7161,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); - printf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]); TEST_ERROR; } /* end if */ @@ -7251,7 +7268,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -7357,7 +7374,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -7368,7 +7385,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) if(H5Fclose(file) < 0) TEST_ERROR; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7378,7 +7395,7 @@ error: H5Dclose(d); H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_random_chunks_real() */ @@ -7498,7 +7515,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); + HDputs(" Library allowed overwrite of existing dataset."); goto error; } @@ -7519,7 +7536,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a non-existent dataset."); + HDputs(" Opened a non-existent dataset."); goto error; } @@ -7568,7 +7585,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); + HDputs(" Opened a dataset with incorrect chunking parameters."); goto error; } @@ -7620,15 +7637,15 @@ test_deprec(hid_t file) if(H5Zregister(H5Z_DEPREC) < 0) goto error; if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error; - puts(""); + HDputs(""); if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -7732,7 +7749,7 @@ test_huge_chunks(hid_t fapl) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7741,7 +7758,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_huge_chunks() */ @@ -7936,7 +7953,7 @@ test_chunk_cache(hid_t fapl) if (H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7949,7 +7966,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_cache() */ @@ -8120,15 +8137,15 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the first 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) if(rdata1[i] != i) { - printf(" Read different values than written in the 1st chunk.\n"); - printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i); + HDprintf(" Read different values than written in the 1st chunk.\n"); + HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i); TEST_ERROR } /* end if */ for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(rdata1[j] != fvalue) { - printf(" Read different values than written in the 2nd chunk.\n"); - printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue); + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue); TEST_ERROR } /* end if */ @@ -8136,8 +8153,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) if(t_rdata1[i][j] != j) { - printf(" Read different values than written in the 1st chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 1st chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], j); TEST_ERROR } /* end if */ @@ -8145,8 +8162,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++) for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(t_rdata1[i][j] != fvalue) { - printf(" Read different values than written in the 2nd chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], fvalue); TEST_ERROR } /* end if */ @@ -8192,8 +8209,8 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the second 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) if(rdata2[i] != i) { - printf(" Read different values than written in the chunk.\n"); - printf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i); + HDprintf(" Read different values than written in the chunk.\n"); + HDprintf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i); TEST_ERROR } /* end if */ @@ -8201,8 +8218,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) if(t_rdata2[i][j] != j) { - printf(" Read different values than written in the chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", __LINE__, i, j, t_rdata2[i][j], j); TEST_ERROR } /* end if */ @@ -8223,7 +8240,7 @@ test_big_chunks_bypass_cache(hid_t fapl) HDfree(rdata2); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8242,7 +8259,7 @@ error: HDfree(rdata1); if(rdata2) HDfree(rdata2); - return -1; + return FAIL; } /* end test_big_chunks_bypass_cache() */ @@ -8310,10 +8327,10 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Loop over using SWMR access to write */ for(swmr = 0; swmr <= 1; swmr++) { - int compress; /* Whether chunks should be compressed */ + int compress; /* Whether chunks should be compressed */ /* SWMR is now supported with/without latest format: */ - /* (1) write+latest-format (2) SWMR-write+non-latest-format */ + /* (1) write+latest-format (2) SWMR-write+non-latest-format */ /* Skip this iteration if SWMR I/O is not supported for the VFD specified * by the environment variable. @@ -8325,10 +8342,10 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Loop over compressing chunks */ for(compress = 0; compress <= 1; compress++) #else - /* Loop over without compression */ + /* Loop over without compression */ for(compress = 0; compress <= 0; compress++) #endif /* H5_HAVE_FILTER_DEFLATE */ - { + { H5D_alloc_time_t alloc_time; /* Storage allocation time */ /* Loop over storage allocation time */ @@ -8578,7 +8595,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) if(H5Pclose(my_fapl) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8589,7 +8606,7 @@ error: H5Fclose(fid); H5Pclose(my_fapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_fast() */ @@ -8702,7 +8719,7 @@ test_reopen_chunk_fast(hid_t fapl) } /* end for */ PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8712,7 +8729,7 @@ error: H5Sclose(scalar_sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_reopen_chunk_fast() */ @@ -8811,7 +8828,7 @@ test_chunk_fast_bug1(hid_t fapl) if(H5Sclose(sid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8820,7 +8837,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_fast_bug1() */ /* This message derives from H5Z */ @@ -8931,7 +8948,7 @@ test_chunk_expand(hid_t fapl) if(sizeof(size_t) <= 4 && low != H5F_LIBVER_LATEST) { SKIPPED(); - puts(" Current machine can't test for error w/old file format"); + HDputs(" Current machine can't test for error w/old file format"); } /* end if */ else { /* Register "expansion" filter */ @@ -9266,7 +9283,7 @@ test_chunk_expand(hid_t fapl) PASSED(); } /* end else */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -9279,7 +9296,7 @@ error: H5Sclose(scalar_sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_expand() */ @@ -9594,7 +9611,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9622,7 +9639,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9648,7 +9665,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS_BIG; i++) if(rbuf_big[i] != wbuf_big[i]) { - printf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", __LINE__,(unsigned)i,wbuf_big[i],(unsigned)i,rbuf_big[i]); TEST_ERROR; } /* end if */ @@ -9684,7 +9701,7 @@ test_fixed_array(hid_t fapl) HDfree(rbuf_big); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -9698,7 +9715,7 @@ error: HDfree(wbuf_big); if(rbuf_big) HDfree(rbuf_big); - return -1; + return FAIL; } /* end test_fixed_array() */ @@ -9887,7 +9904,7 @@ test_single_chunk(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < (DSET_DIM1 * DSET_DIM2); i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9906,7 +9923,7 @@ test_single_chunk(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++) if(t_rbuf[i] != t_wbuf[i]) { - printf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", __LINE__,(unsigned)i,t_wbuf[i],(unsigned)i,t_rbuf[i]); TEST_ERROR; } /* end if */ @@ -9942,7 +9959,7 @@ test_single_chunk(hid_t fapl) HDfree(t_rbuf); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -9962,7 +9979,7 @@ error: HDfree(t_wbuf); if(t_rbuf) HDfree(t_rbuf); - return -1; + return FAIL; } /* end test_single_chunk() */ @@ -10028,14 +10045,14 @@ test_idx_compatible(void) } PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_idx_compatible() */ /*------------------------------------------------------------------------- @@ -10166,7 +10183,7 @@ test_unfiltered_edge_chunks(hid_t fapl) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10175,7 +10192,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_unfiltered_edge_chunks() */ @@ -10280,7 +10297,7 @@ test_large_chunk_shrink(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10290,7 +10307,7 @@ error: H5Sclose(scalar_sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_large_chunk_shrink() */ @@ -10374,7 +10391,7 @@ test_zero_dim_dset(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10383,7 +10400,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_zero_dim_dset() */ @@ -10424,8 +10441,8 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) if(!H5FD_supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; - } /* end if */ + return SUCCEED; + } /* Check if we are using the latest version of the format */ if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) @@ -10437,7 +10454,8 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Create file with write+latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - } else { + } + else { /* Create file with SWMR-write+non-latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -10622,7 +10640,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10632,7 +10650,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* test_swmr_non_latest() */ @@ -10673,8 +10691,8 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) if(!H5FD_supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; - } /* end if */ + return SUCCEED; + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10740,7 +10758,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10752,7 +10770,7 @@ error: H5Sclose(sid); H5Sclose(msid); } H5E_END_TRY; - return -1; + return FAIL; } /* test_earray_hdr_fd() */ @@ -10793,8 +10811,8 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) if(!H5FD_supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; - } /* end if */ + return SUCCEED; + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10860,7 +10878,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10872,7 +10890,7 @@ error: H5Sclose(sid); H5Sclose(msid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_farray_hdr_fd() */ @@ -10913,8 +10931,8 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) if(!H5FD_supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; - } /* end if */ + return SUCCEED; + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10980,7 +10998,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10992,7 +11010,7 @@ error: H5Sclose(sid); H5Sclose(msid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_bt2_hdr_fd() */ @@ -11376,7 +11394,7 @@ test_storage_size(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11386,7 +11404,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_storage_size() */ @@ -11467,7 +11485,7 @@ test_power2up(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11477,7 +11495,7 @@ error: H5Pclose(dcpl); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_power2up() */ @@ -11507,7 +11525,7 @@ typedef struct scatter_info_t { for(k=0; k<(int)(sizeof(ARR[0][0])/sizeof(ARR[0][0][0])); k++) \ if(ARR[i][j][k] != EXP[i][j][k]) { \ H5_FAILED(); AT(); \ - printf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \ + HDprintf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \ goto error; \ } @@ -11789,13 +11807,13 @@ test_scatter(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_scatter() */ @@ -11857,7 +11875,7 @@ gather_cb(const void *dst_buf, size_t dst_buf_bytes_used, error: return FAIL; -} +} /* end gather_cb() */ static herr_t test_gather(void) @@ -12151,13 +12169,13 @@ test_gather(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_gather() */ @@ -12220,7 +12238,7 @@ scatter_error_cb_unalign(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out* *src_buf_bytes_used = *(size_t *)_src_buf_bytes_used; return SUCCEED; -} /* end scatter_error_cb_unalign() */ +} /* endscatter_error_cb_unalign() */ static herr_t test_scatter_error(void) @@ -12354,13 +12372,13 @@ test_scatter_error(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_scatter_error() */ @@ -12493,13 +12511,13 @@ test_gather_error(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_gather_error() */ /*------------------------------------------------------------------------- @@ -12598,7 +12616,6 @@ static herr_t dls_01_main( void ); static herr_t dls_01_setup_file( hid_t fid ) { - int status = 0; hid_t sid = 0, did = 0, tid = 0, dcpl = 0; int ndims = 1; @@ -12636,18 +12653,15 @@ dls_01_setup_file( hid_t fid ) status = H5Sclose( sid ); if ( status != 0 ) TEST_ERROR - return 0; + return SUCCEED; error: - - return -1; - + return FAIL; } /* end dls_01_setup_file() */ static herr_t dls_01_write_data( hid_t fid, char* buffer ) { - int status = 0; hid_t did = 0, tid = 0; hsize_t extent[1] = {4}; @@ -12673,18 +12687,15 @@ dls_01_write_data( hid_t fid, char* buffer ) status = H5Dclose( did ); if ( status != 0 ) TEST_ERROR - return 0; + return SUCCEED; error: - - return -1; - + return FAIL; } /* end dls_01_write_data() */ static herr_t dls_01_read_stuff( hid_t fid ) { - int status = 0; hid_t did = 0; H5O_info_t info; @@ -12698,18 +12709,15 @@ dls_01_read_stuff( hid_t fid ) status = H5Dclose( did ); if ( status != 0 ) TEST_ERROR - return 0; + return SUCCEED; error: - - return -1; - + return FAIL; } /* end dls_01_read_stuff() */ static herr_t dls_01_main( void ) { - char filename[512]; int status = 0; hid_t fapl = 0, fid = 0; @@ -12766,14 +12774,11 @@ dls_01_main( void ) PASSED(); - return 0; + return SUCCEED; error: - if ( buffer ) HDfree(buffer); - - return -1; - + return FAIL; } /* end dls_01_main() */ /*------------------------------------------------------------------------- @@ -12882,7 +12887,7 @@ test_compact_open_close_dirty(hid_t fapl) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -12891,7 +12896,7 @@ error: H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_compact_open_close_dirty() */ @@ -13119,25 +13124,25 @@ test_object_header_minimization_dcpl(hid_t fapl_id) ret = H5Pget_dset_no_attrs_hint(-1, &minimize); } H5E_END_TRY; if (ret == SUCCEED) - TEST_ERROR + TEST_ERROR /* Invalid DCPL ID should fail */ H5E_BEGIN_TRY { ret = H5Pset_dset_no_attrs_hint(-1, FALSE); } H5E_END_TRY; if (ret == SUCCEED) - TEST_ERROR + TEST_ERROR /* Invalid DCPL ID should fail */ H5E_BEGIN_TRY { ret = H5Pset_dset_no_attrs_hint(-1, TRUE); } H5E_END_TRY; if (ret == SUCCEED) - TEST_ERROR + TEST_ERROR /* Invalid DCPL ID should fail */ H5E_BEGIN_TRY { ret = H5Pget_dset_no_attrs_hint(dcpl_id, NULL); } H5E_END_TRY; if (ret == SUCCEED) - TEST_ERROR + TEST_ERROR /* NULL out pointer should fail */ /************/ /* TEARDOWN */ @@ -13249,20 +13254,20 @@ main(void) my_fapl = fapl2; if(paged) { my_fcpl = fcpl2; - puts("\nTesting with new file format and paged aggregation"); + HDputs("\nTesting with new file format and paged aggregation"); } else { my_fcpl = fcpl; - puts("\nTesting with new file format and non-paged aggregation"); + HDputs("\nTesting with new file format and non-paged aggregation"); } } /* end if */ else { my_fapl = fapl; if(paged) { my_fcpl = fcpl2; - puts("Testing with old file format and paged aggregation:"); + HDputs("Testing with old file format and paged aggregation:"); } else { my_fcpl = fcpl; - puts("Testing with old file format and non-paged aggregation:"); + HDputs("Testing with old file format and non-paged aggregation:"); } } /* end else */ @@ -13273,7 +13278,7 @@ main(void) if (TRUE == minimized_ohdr) { if (0 > H5Fset_dset_no_attrs_hint(file, TRUE)) goto error; - puts("(minimized dataset object headers with file setting)"); + HDputs("(minimized dataset object headers with file setting)"); } /* Cause the library to emit initial messages */ @@ -13380,7 +13385,7 @@ main(void) if(nerrors) goto error; - printf("All dataset tests passed.\n"); + HDprintf("All dataset tests passed.\n"); #ifdef H5_HAVE_FILTER_SZIP if (GetTestCleanup()) HDremove(NOENCODER_COPY_FILENAME); @@ -13391,7 +13396,7 @@ main(void) error: nerrors = MAX(1, nerrors); - printf("***** %d DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end main() */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 2729ba1..7e1adf5 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -21,7 +21,7 @@ #include "h5test.h" /* Number of elements in each random test */ -#define NTESTELEM 10000 +#define NTESTELEM 10000 /* Epsilon for floating-point comparisons */ #define FP_EPSILON 0.000001F @@ -30,7 +30,7 @@ * Offset from alinged memory returned by malloc(). This can be used to test * that type conversions handle non-aligned buffers correctly. */ -#define ALIGNMENT 1 +#define ALIGNMENT 1 /* * Define if you want to test alignment code on a machine that doesn't @@ -41,7 +41,7 @@ /* Alignment test stuff */ #ifdef TEST_ALIGNMENT -#define H5T_FRIEND /*suppress error about including H5Tpkg */ +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #endif #define SET_ALIGNMENT(TYPE,VAL) \ @@ -58,7 +58,7 @@ const char *FILENAME[] = { * endian. If local variable `endian' is H5T_ORDER_BE then the result will * be I, otherwise the result will be Z-(I+1). */ -#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1)) +#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1)) typedef enum dtype_t { INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT, @@ -100,8 +100,8 @@ static int skip_overflow_tests_g = 0; static int without_hardware_g = 0; /* Allocates memory aligned on a certain boundary. */ -#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT)) -#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT) +#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT)) +#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT) /* Initialize source buffer of integer for integer->integer and integer->floating-point conversion test. * This algorithm is mainly to avoid any casting and comparison between source and destination types @@ -394,13 +394,13 @@ static int my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, size_t esize); /*------------------------------------------------------------------------- - * Function: fpe_handler + * Function: fpe_handler * - * Purpose: Exit with 255 + * Purpose: Exit with 255 * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 6, 1998 * * Modifications: @@ -419,16 +419,16 @@ fpe_handler(int H5_ATTR_UNUSED signo) HDexit(255); } - + /*------------------------------------------------------------------------- - * Function: reset_hdf5 + * Function: reset_hdf5 * - * Purpose: Reset the hdf5 library. This causes statistics to be printed - * and counters to be reset. + * Purpose: Reset the hdf5 library. This causes statistics to be printed + * and counters to be reset. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 16, 1998 * * Modifications: @@ -461,19 +461,19 @@ reset_hdf5(void) } - + /*------------------------------------------------------------------------- - * Function: except_func + * Function: except_func * - * Purpose: Gets called for all data type conversion exceptions. + * Purpose: Gets called for all data type conversion exceptions. * - * Return: H5T_CONV_ABORT: -1 + * Return: H5T_CONV_ABORT: -1 * * H5T_CONV_UNHANDLED 0 * * H5T_CONV_HANDLED 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * April 19, 2004 * * Modifications: @@ -482,7 +482,7 @@ reset_hdf5(void) */ static H5T_conv_ret_t except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf, - void *dst_buf, void *user_data) + void *dst_buf, void *user_data) { H5T_conv_ret_t ret = H5T_CONV_HANDLED; @@ -509,19 +509,19 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 return ret; } - + /*------------------------------------------------------------------------- - * Function: some_dummy_func + * Function: some_dummy_func * - * Purpose: A dummy function to help check for overflow. + * Purpose: A dummy function to help check for overflow. * - * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT - * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW - * CHECKING. + * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT + * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW + * CHECKING. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, July 21, 1998 * *------------------------------------------------------------------------- @@ -529,21 +529,21 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 void some_dummy_func(float x) { - char s[128]; + char s[128]; HDsnprintf(s, sizeof(s), "%g", (double)x); } - + /*------------------------------------------------------------------------- - * Function: generates_sigfpe + * Function: generates_sigfpe * - * Purpose: Determines if SIGFPE is generated from overflows. We must be - * able to fork() and waitpid() in order for this test to work - * properly. Sets skip_overflow_tests_g to non-zero if they - * would generate SIGBUS, zero otherwise. + * Purpose: Determines if SIGFPE is generated from overflows. We must be + * able to fork() and waitpid() in order for this test to work + * properly. Sets skip_overflow_tests_g to non-zero if they + * would generate SIGBUS, zero otherwise. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, July 21, 1998 * * Modifications: @@ -554,38 +554,38 @@ static void generates_sigfpe(void) { #if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) - pid_t pid; - int status; - size_t i, j; - double d; + pid_t pid; + int status; + size_t i, j; + double d; unsigned char *dp = (unsigned char*)&d; - float f; + float f; HDfflush(stdout); HDfflush(stderr); if ((pid=fork()) < 0) { - HDperror("fork"); - HDexit(EXIT_FAILURE); + HDperror("fork"); + HDexit(EXIT_FAILURE); } else if (0==pid) { - for (i=0; i<2000; i++) { - for(j = 0; j < sizeof(double); j++) + for (i=0; i<2000; i++) { + for(j = 0; j < sizeof(double); j++) dp[j] = (unsigned char)HDrand(); - f = (float)d; - some_dummy_func((float)f); - } - HDexit(EXIT_SUCCESS); + f = (float)d; + some_dummy_func((float)f); + } + HDexit(EXIT_SUCCESS); } while (pid!=waitpid(pid, &status, 0)) /*void*/; if (WIFEXITED(status) && 0==WEXITSTATUS(status)) { - HDputs("Floating-point overflow cases will be tested."); - skip_overflow_tests_g = FALSE; + HDputs("Floating-point overflow cases will be tested."); + skip_overflow_tests_g = FALSE; } else if (WIFSIGNALED(status) && SIGFPE==WTERMSIG(status)) { - HDputs("Floating-point overflow cases cannot be safely tested."); - skip_overflow_tests_g = TRUE; - /* delete the core dump file that SIGFPE may have created */ - HDunlink("core"); + HDputs("Floating-point overflow cases cannot be safely tested."); + skip_overflow_tests_g = TRUE; + /* delete the core dump file that SIGFPE may have created */ + HDunlink("core"); } #else HDputs("Cannot determine if floating-point overflows generate a SIGFPE;"); @@ -595,7 +595,7 @@ generates_sigfpe(void) #endif } - + /*------------------------------------------------------------------------- * Function: test_hard_query * @@ -621,25 +621,25 @@ test_hard_query(void) /* Verify the conversion from int to float is a hard conversion. */ if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) { H5_FAILED(); - printf("Can't query conversion function\n"); + HDprintf("Can't query conversion function\n"); goto error; } /* Unregister the hard conversion from int to float. Verify the conversion * is a soft conversion. */ - H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float); + H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != FALSE) { H5_FAILED(); - printf("Can't query conversion function\n"); + HDprintf("Can't query conversion function\n"); goto error; } /* Register the hard conversion from int to float. Verify the conversion * is a hard conversion. */ - H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float); + H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) { H5_FAILED(); - printf("Can't query conversion function\n"); + HDprintf("Can't query conversion function\n"); goto error; } @@ -660,16 +660,16 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: expt_handle + * Function: expt_handle * - * Purpose: Gets called from test_particular_fp_integer() for data type + * Purpose: Gets called from test_particular_fp_integer() for data type * conversion exceptions. * - * Return: H5T_CONV_HANDLED 1 + * Return: H5T_CONV_HANDLED 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Sept 7, 2005 * * Modifications: @@ -678,7 +678,7 @@ error: */ static H5T_conv_ret_t expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf, - void *dst_buf, void *user_data) + void *dst_buf, void *user_data) { signed char fill_value1 = 7; int fill_value2 = 13; @@ -694,7 +694,7 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 return H5T_CONV_HANDLED; } - + /*------------------------------------------------------------------------- * Function: test_particular_fp_integer * @@ -714,12 +714,6 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 * Return: Success: 0 * * Failure: number of errors - * - * Programmer: Raymond Lu - * Sept 7, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_particular_fp_integer(void) @@ -735,7 +729,7 @@ static int test_particular_fp_integer(void) float src_f = (float)INT_MAX; int dst_i; int fill_value = 13; - int endian; /*endianess */ + int endian; /*endianess */ unsigned int fails_this_test = 0; size_t j; @@ -743,7 +737,7 @@ static int test_particular_fp_integer(void) if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) { H5_FAILED(); - printf("Can't create data transfer property list\n"); + HDprintf("Can't create data transfer property list\n"); goto error; } @@ -754,25 +748,25 @@ static int test_particular_fp_integer(void) buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); saved_buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); - memcpy(buf1, &src_d, src_size1); - memcpy(saved_buf1, &src_d, src_size1); + HDmemcpy(buf1, &src_d, src_size1); + HDmemcpy(saved_buf1, &src_d, src_size1); /* Register exception handling function and signal the destination is "signed char". */ flag = 1; if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) { H5_FAILED(); - printf("Can't register conversion callback\n"); + HDprintf("Can't register conversion callback\n"); goto error; } /* Do conversion */ if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } - memcpy(&dst_c, buf1, dst_size1); + HDmemcpy(&dst_c, buf1, dst_size1); /* Print errors */ if(dst_c != SCHAR_MAX) { @@ -782,20 +776,20 @@ static int test_particular_fp_integer(void) if(0 == fails_this_test++) H5_FAILED(); - printf(" test double to signed char:\n"); - printf(" src = "); + HDprintf(" test double to signed char:\n"); + HDprintf(" src = "); for (j=0; j derived floating-point conversions"); - printf("%-70s", str); - HDfflush(stdout); + HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions"); + HDprintf("%-70s", str); + HDfflush(stdout); H5_FAILED(); } - printf(" test %u elmt %u: \n", 1, (unsigned)i); + HDprintf(" test %u elmt %u: \n", 1, (unsigned)i); - printf(" src = "); + HDprintf(" src = "); for (j=0; j=max_fails) { HDputs(" maximum failures reached, aborting test..."); @@ -1127,43 +1121,43 @@ test_derived_flt(void) *--------------------------------------------------------------------------*/ if(H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) { H5_FAILED(); - printf("Can't set fields\n"); + HDprintf("Can't set fields\n"); goto error; } if(H5Tset_offset(tid2, (size_t)0) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tset_precision(tid2, (size_t)24) < 0) { H5_FAILED(); - printf("Can't set precision 2\n"); + HDprintf("Can't set precision 2\n"); goto error; } if(H5Tset_size(tid2, (size_t)3) < 0) { H5_FAILED(); - printf("Can't set size\n"); + HDprintf("Can't set size\n"); goto error; } if(H5Tset_ebias(tid2, (size_t)63) < 0) { H5_FAILED(); - printf("Can't set size\n"); + HDprintf("Can't set size\n"); goto error; } if(H5Tset_pad(tid2, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) { H5_FAILED(); - printf("Can't set padding\n"); + HDprintf("Can't set padding\n"); goto error; } if(H5Tcommit2(file, "new float type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't set inpad\n"); + HDprintf("Can't set inpad\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } @@ -1171,33 +1165,33 @@ test_derived_flt(void) FAIL_PUTS_ERROR("Can't open datatype") if(H5Tget_fields(tid2, &spos, &epos, &esize, &mpos, &msize) < 0) { H5_FAILED(); - printf("Can't get fields\n"); + HDprintf("Can't get fields\n"); goto error; } if(spos != 23 || epos != 16 || esize != 7 || mpos != 0 || msize != 16) { H5_FAILED(); - printf("Wrong field values\n"); + HDprintf("Wrong field values\n"); goto error; } if(H5Tget_precision(tid2) != 24) { H5_FAILED(); - printf("Can't get precision or wrong precision\n"); + HDprintf("Can't get precision or wrong precision\n"); goto error; } if(H5Tget_offset(tid2)!=0) { H5_FAILED(); - printf("Can't get offset or wrong offset\n"); + HDprintf("Can't get offset or wrong offset\n"); goto error; } if((size = H5Tget_size(tid2))!=3) { H5_FAILED(); - printf("Can't get size or wrong size\n"); + HDprintf("Can't get size or wrong size\n"); goto error; } if(H5Tget_ebias(tid2)!=63) { H5_FAILED(); - printf("Can't get exponent bias or wrong bias\n"); + HDprintf("Can't get exponent bias or wrong bias\n"); goto error; } @@ -1221,13 +1215,13 @@ test_derived_flt(void) * the precision and exponent power. */ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } /* Convert data from the 1st back to the 2nd derived floating-point type. */ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } @@ -1249,22 +1243,22 @@ test_derived_flt(void) /* Print errors */ if (0==fails_this_test++) { - HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions"); - printf("%-70s", str); - HDfflush(stdout); + HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions"); + HDprintf("%-70s", str); + HDfflush(stdout); H5_FAILED(); } - printf(" test %u elmt %u: \n", 1, (unsigned)i); + HDprintf(" test %u elmt %u: \n", 1, (unsigned)i); - printf(" src = "); + HDprintf(" src = "); for (j=0; j=max_fails) { HDputs(" maximum failures reached, aborting test..."); @@ -1277,25 +1271,25 @@ test_derived_flt(void) if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Pclose(dxpl_id) < 0) { H5_FAILED(); - printf("Can't close property list\n"); + HDprintf("Can't close property list\n"); goto error; } if(H5Fclose(file) < 0) { H5_FAILED(); - printf("Can't close file\n"); + HDprintf("Can't close file\n"); goto error; } /* end if */ @@ -1304,7 +1298,7 @@ test_derived_flt(void) /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); - reset_hdf5(); /*print statistics*/ + reset_hdf5(); /*print statistics*/ return 0; @@ -1328,7 +1322,7 @@ test_derived_flt(void) return MAX((int)fails_this_test, 1); } - + /*------------------------------------------------------------------------- * Function: test_derived_integer * @@ -1353,11 +1347,11 @@ test_derived_integer(void) char filename[1024]; size_t src_size, dst_size; unsigned char *buf=NULL, *saved_buf=NULL; - int endian; /*endianess */ + int endian; /*endianess */ size_t nelmts = NTESTELEM; unsigned int fails_this_test = 0; - const size_t max_fails=40; /*max number of failures*/ - char str[256]; /*message string */ + const size_t max_fails=40; /*max number of failures*/ + char str[256]; /*message string */ unsigned int i, j; TESTING("user-define and query functions of integer types"); @@ -1366,25 +1360,25 @@ test_derived_integer(void) h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf("Can't create file\n"); + HDprintf("Can't create file\n"); goto error; } if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) { H5_FAILED(); - printf("Can't create data transfer property list\n"); + HDprintf("Can't create data transfer property list\n"); goto error; } if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) { H5_FAILED(); - printf("Can't copy data type\n"); + HDprintf("Can't copy data type\n"); goto error; } if((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) { H5_FAILED(); - printf("Can't copy data type\n"); + HDprintf("Can't copy data type\n"); goto error; } @@ -1402,37 +1396,37 @@ test_derived_integer(void) *--------------------------------------------------------------------------*/ if(H5Tset_offset(tid1, (size_t)0) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tset_size(tid1, (size_t)3) < 0) { H5_FAILED(); - printf("Can't set size\n"); + HDprintf("Can't set size\n"); goto error; } if(H5Tset_precision(tid1, (size_t)24) < 0) { H5_FAILED(); - printf("Can't set precision\n"); + HDprintf("Can't set precision\n"); goto error; } if(H5Tset_order(tid1, H5T_ORDER_BE) < 0) { H5_FAILED(); - printf("Can't set order\n"); + HDprintf("Can't set order\n"); goto error; } if(H5Tcommit2(file, "new integer type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit data type\n"); + HDprintf("Can't commit data type\n"); goto error; } if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } @@ -1440,22 +1434,22 @@ test_derived_integer(void) FAIL_PUTS_ERROR("Can't open datatype") if(H5Tget_precision(tid1) != 24) { H5_FAILED(); - printf("Can't get precision or wrong precision\n"); + HDprintf("Can't get precision or wrong precision\n"); goto error; } if(H5Tget_offset(tid1) != 0) { H5_FAILED(); - printf("Can't get offset or wrong offset\n"); + HDprintf("Can't get offset or wrong offset\n"); goto error; } if(H5Tget_size(tid1) != 3) { H5_FAILED(); - printf("Can't get size or wrong size\n"); + HDprintf("Can't get size or wrong size\n"); goto error; } if(H5Tget_order(tid1)!=H5T_ORDER_BE) { H5_FAILED(); - printf("Can't get order or wrong order\n"); + HDprintf("Can't get order or wrong order\n"); goto error; } @@ -1469,31 +1463,31 @@ test_derived_integer(void) *--------------------------------------------------------------------------*/ if(H5Tset_precision(tid2, (size_t)48) < 0) { H5_FAILED(); - printf("Can't set precision\n"); + HDprintf("Can't set precision\n"); goto error; } if(H5Tset_offset(tid2, (size_t)10) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tset_sign(tid2, H5T_SGN_2) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tcommit2(file, "new integer type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit data type\n"); + HDprintf("Can't commit data type\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } @@ -1501,22 +1495,22 @@ test_derived_integer(void) FAIL_PUTS_ERROR("Can't open datatype") if(H5Tget_precision(tid2) != 48) { H5_FAILED(); - printf("Can't get precision or wrong precision\n"); + HDprintf("Can't get precision or wrong precision\n"); goto error; } if(H5Tget_offset(tid2) != 10) { H5_FAILED(); - printf("Can't get offset or wrong offset\n"); + HDprintf("Can't get offset or wrong offset\n"); goto error; } if(H5Tget_size(tid2) != 8) { H5_FAILED(); - printf("Can't get size or wrong size\n"); + HDprintf("Can't get size or wrong size\n"); goto error; } if(H5Tget_sign(tid2)!=H5T_SGN_2) { H5_FAILED(); - printf("Can't get sign or wrong sign\n"); + HDprintf("Can't get sign or wrong sign\n"); goto error; } @@ -1540,13 +1534,13 @@ test_derived_integer(void) * the 1st type's precision. */ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } /* Convert data from the 2nd back to the 1st derived integer type. */ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } @@ -1560,22 +1554,22 @@ test_derived_integer(void) /* Print errors */ if (0==fails_this_test++) { - HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions"); - printf("%-70s", str); - HDfflush(stdout); + HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions"); + HDprintf("%-70s", str); + HDfflush(stdout); H5_FAILED(); } - printf(" test %u elmt %u: \n", 1, (unsigned)i); + HDprintf(" test %u elmt %u: \n", 1, (unsigned)i); - printf(" src = "); + HDprintf(" src = "); for (j=0; j=max_fails) { HDputs(" maximum failures reached, aborting test..."); @@ -1585,25 +1579,25 @@ test_derived_integer(void) if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Pclose(dxpl_id) < 0) { H5_FAILED(); - printf("Can't close property list\n"); + HDprintf("Can't close property list\n"); goto error; } if(H5Fclose(file) < 0) { H5_FAILED(); - printf("Can't close file\n"); + HDprintf("Can't close file\n"); goto error; } /* end if */ @@ -1615,7 +1609,7 @@ test_derived_integer(void) /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); - reset_hdf5(); /*print statistics*/ + reset_hdf5(); /*print statistics*/ return 0; @@ -1638,24 +1632,24 @@ test_derived_integer(void) return MAX((int)fails_this_test, 1); } - + /*------------------------------------------------------------------------- - * Function: test_conv_int_1 + * Function: test_conv_int_1 * - * Purpose: Test conversion of integer values from SRC to DST. - * These types should be any combination of: + * Purpose: Test conversion of integer values from SRC to DST. + * These types should be any combination of: * - * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR - * H5T_NATIVE_SHORT H5T_NATIVE_USHORT - * H5T_NATIVE_INT H5T_NATIVE_UINT - * H5T_NATIVE_LONG H5T_NATIVE_ULONG - * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG + * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR + * H5T_NATIVE_SHORT H5T_NATIVE_USHORT + * H5T_NATIVE_INT H5T_NATIVE_UINT + * H5T_NATIVE_LONG H5T_NATIVE_ULONG + * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 16, 1998 * * Modifications: @@ -1665,121 +1659,121 @@ test_derived_integer(void) static int test_conv_int_1(const char *name, hid_t src, hid_t dst) { - size_t nelmts=0; /*num values per test */ - const size_t max_fails=8; /*max number of failures*/ - size_t fails_all_tests=0; /*number of failures */ - size_t fails_this_test; /*fails for this test */ - char str[256]; /*hello string */ - dtype_t src_type, dst_type; /*data types */ - const char *src_type_name=NULL; /*source type name */ - const char *dst_type_name=NULL; /*destination type name */ - int endian; /*machine endianess */ - size_t src_size, dst_size; /*type sizes */ - unsigned char *buf=NULL; /*buffer for conversion */ - unsigned char *saved=NULL; /*original values */ - size_t j, k; /*counters */ - unsigned char *hw=NULL; /*hardware conv result */ - unsigned char src_bits[32]; /*src value in LE order */ - unsigned char dst_bits[32]; /*dest value in LE order*/ - size_t src_nbits; /*source length in bits */ - size_t dst_nbits; /*dst length in bits */ + size_t nelmts=0; /*num values per test */ + const size_t max_fails=8; /*max number of failures*/ + size_t fails_all_tests=0; /*number of failures */ + size_t fails_this_test; /*fails for this test */ + char str[256]; /*hello string */ + dtype_t src_type, dst_type; /*data types */ + const char *src_type_name=NULL; /*source type name */ + const char *dst_type_name=NULL; /*destination type name */ + int endian; /*machine endianess */ + size_t src_size, dst_size; /*type sizes */ + unsigned char *buf=NULL; /*buffer for conversion */ + unsigned char *saved=NULL; /*original values */ + size_t j, k; /*counters */ + unsigned char *hw=NULL; /*hardware conv result */ + unsigned char src_bits[32]; /*src value in LE order */ + unsigned char dst_bits[32]; /*dest value in LE order*/ + size_t src_nbits; /*source length in bits */ + size_t dst_nbits; /*dst length in bits */ H5T_sign_t src_sign; /*source sign type */ H5T_sign_t dst_sign; /*dst sign type */ - void *aligned=NULL; /*aligned temp buffer */ - signed char hw_char; - unsigned char hw_uchar; - short hw_short; - unsigned short hw_ushort; - int hw_int; - unsigned hw_uint; - long hw_long; - unsigned long hw_ulong; - long long hw_llong; - unsigned long long hw_ullong; + void *aligned=NULL; /*aligned temp buffer */ + signed char hw_char; + unsigned char hw_uchar; + short hw_short; + unsigned short hw_ushort; + int hw_int; + unsigned hw_uint; + long hw_long; + unsigned long hw_ulong; + long long hw_llong; + unsigned long long hw_ullong; /* What are the names of the source and destination types */ if (H5Tequal(src, H5T_NATIVE_SCHAR)) { - src_type_name = "signed char"; - src_type = INT_SCHAR; + src_type_name = "signed char"; + src_type = INT_SCHAR; } else if (H5Tequal(src, H5T_NATIVE_UCHAR)) { - src_type_name = "unsigned char"; - src_type = INT_UCHAR; + src_type_name = "unsigned char"; + src_type = INT_UCHAR; } else if (H5Tequal(src, H5T_NATIVE_SHORT)) { - src_type_name = "short"; - src_type = INT_SHORT; + src_type_name = "short"; + src_type = INT_SHORT; } else if (H5Tequal(src, H5T_NATIVE_USHORT)) { - src_type_name = "unsigned short"; - src_type = INT_USHORT; + src_type_name = "unsigned short"; + src_type = INT_USHORT; } else if (H5Tequal(src, H5T_NATIVE_INT)) { - src_type_name = "int"; - src_type = INT_INT; + src_type_name = "int"; + src_type = INT_INT; } else if (H5Tequal(src, H5T_NATIVE_UINT)) { - src_type_name = "unsigned int"; - src_type = INT_UINT; + src_type_name = "unsigned int"; + src_type = INT_UINT; } else if (H5Tequal(src, H5T_NATIVE_LONG)) { - src_type_name = "long"; - src_type = INT_LONG; + src_type_name = "long"; + src_type = INT_LONG; } else if (H5Tequal(src, H5T_NATIVE_ULONG)) { - src_type_name = "unsigned long"; - src_type = INT_ULONG; + src_type_name = "unsigned long"; + src_type = INT_ULONG; } else if (H5Tequal(src, H5T_NATIVE_LLONG)) { - src_type_name = "long long"; - src_type = INT_LLONG; + src_type_name = "long long"; + src_type = INT_LLONG; } else if (H5Tequal(src, H5T_NATIVE_ULLONG)) { - src_type_name = "unsigned long long"; - src_type = INT_ULLONG; + src_type_name = "unsigned long long"; + src_type = INT_ULLONG; } else { - src_type_name = "UNKNOWN"; - src_type = OTHER; + src_type_name = "UNKNOWN"; + src_type = OTHER; } if (H5Tequal(dst, H5T_NATIVE_SCHAR)) { - dst_type_name = "signed char"; - dst_type = INT_SCHAR; + dst_type_name = "signed char"; + dst_type = INT_SCHAR; } else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) { - dst_type_name = "unsigned char"; - dst_type = INT_UCHAR; + dst_type_name = "unsigned char"; + dst_type = INT_UCHAR; } else if (H5Tequal(dst, H5T_NATIVE_SHORT)) { - dst_type_name = "short"; - dst_type = INT_SHORT; + dst_type_name = "short"; + dst_type = INT_SHORT; } else if (H5Tequal(dst, H5T_NATIVE_USHORT)) { - dst_type_name = "unsigned short"; - dst_type = INT_USHORT; + dst_type_name = "unsigned short"; + dst_type = INT_USHORT; } else if (H5Tequal(dst, H5T_NATIVE_INT)) { - dst_type_name = "int"; - dst_type = INT_INT; + dst_type_name = "int"; + dst_type = INT_INT; } else if (H5Tequal(dst, H5T_NATIVE_UINT)) { - dst_type_name = "unsigned int"; - dst_type = INT_UINT; + dst_type_name = "unsigned int"; + dst_type = INT_UINT; } else if (H5Tequal(dst, H5T_NATIVE_LONG)) { - dst_type_name = "long"; - dst_type = INT_LONG; + dst_type_name = "long"; + dst_type = INT_LONG; } else if (H5Tequal(dst, H5T_NATIVE_ULONG)) { - dst_type_name = "unsigned long"; - dst_type = INT_ULONG; + dst_type_name = "unsigned long"; + dst_type = INT_ULONG; } else if (H5Tequal(dst, H5T_NATIVE_LLONG)) { - dst_type_name = "long long"; - dst_type = INT_LLONG; + dst_type_name = "long long"; + dst_type = INT_LLONG; } else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) { - dst_type_name = "unsigned long long"; - dst_type = INT_ULLONG; + dst_type_name = "unsigned long long"; + dst_type = INT_ULLONG; } else { - dst_type_name = "UNKNOWN"; - dst_type = OTHER; + dst_type_name = "UNKNOWN"; + dst_type = OTHER; } /* Sanity checks */ if (OTHER==src_type || OTHER==dst_type) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; } else { HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test=0; } @@ -2462,44 +2456,44 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) /* Print errors */ if (0==fails_this_test++) H5_FAILED(); - printf(" elmt %u\n", (unsigned)j); + HDprintf(" elmt %u\n", (unsigned)j); - printf(" src = "); + HDprintf(" src = "); for (k=0; k0) { - while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/; - if (WIFEXITED(status) && 255==WEXITSTATUS(status)) { - return 0; /*child exit after catching SIGFPE*/ - } else if (WIFEXITED(status)) { - return WEXITSTATUS(status); - } else if (WIFSIGNALED(status)) { - HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status)); - HDputs(str); - return 1; /*child exit after catching non-SIGFPE signal */ - } else { - HDputs(" Child didn't exit normally."); - return 1; - } + while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/; + if (WIFEXITED(status) && 255==WEXITSTATUS(status)) { + return 0; /*child exit after catching SIGFPE*/ + } else if (WIFEXITED(status)) { + return WEXITSTATUS(status); + } else if (WIFSIGNALED(status)) { + HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status)); + HDputs(str); + return 1; /*child exit after catching non-SIGFPE signal */ + } else { + HDputs(" Child didn't exit normally."); + return 1; + } } #endif @@ -2916,35 +2910,35 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) /* What are the names of the source and destination types */ if (H5Tequal(src, H5T_NATIVE_FLOAT)) { - src_type_name = "float"; - src_type = FLT_FLOAT; + src_type_name = "float"; + src_type = FLT_FLOAT; } else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) { - src_type_name = "double"; - src_type = FLT_DOUBLE; + src_type_name = "double"; + src_type = FLT_DOUBLE; #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) { - src_type_name = "long double"; - src_type = FLT_LDOUBLE; + src_type_name = "long double"; + src_type = FLT_LDOUBLE; #endif } else { - src_type_name = "UNKNOWN"; - src_type = OTHER; + src_type_name = "UNKNOWN"; + src_type = OTHER; } if (H5Tequal(dst, H5T_NATIVE_FLOAT)) { - dst_type_name = "float"; - dst_type = FLT_FLOAT; + dst_type_name = "float"; + dst_type = FLT_FLOAT; } else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) { - dst_type_name = "double"; - dst_type = FLT_DOUBLE; + dst_type_name = "double"; + dst_type = FLT_DOUBLE; #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) { - dst_type_name = "long double"; - dst_type = FLT_LDOUBLE; + dst_type_name = "long double"; + dst_type = FLT_LDOUBLE; #endif } else { - dst_type_name = "UNKNOWN"; - dst_type = OTHER; + dst_type_name = "UNKNOWN"; + dst_type = OTHER; } /* Sanity checks */ @@ -2952,22 +2946,22 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible."); if (OTHER==src_type || OTHER==dst_type) { if(!strcmp(name, "noop")) - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); else if(run_test==TEST_SPECIAL) - HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", + name, src_type_name, dst_type_name); else if(run_test==TEST_NORMAL) - HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", + name, src_type_name, dst_type_name); else if(run_test==TEST_DENORM) - HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", + name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; } else { if(!strcmp(name, "noop")) HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", @@ -2982,7 +2976,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test = 0; } @@ -3199,18 +3193,18 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) * the SGI compiler assigns the dst's maximal value. */ { - double check_mant[2]; - int check_expo[2]; + double check_mant[2]; + int check_expo[2]; if (FLT_FLOAT==dst_type) { float x; HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) - continue; /* all underflowed, no error */ + continue; /* all underflowed, no error */ if (overflow && my_isinf(dendian, buf+j*sizeof(float), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) - continue; /* all overflowed, no error */ + continue; /* all overflowed, no error */ check_mant[0] = HDfrexpf(x, check_expo+0); check_mant[1] = HDfrexpf(hw_f, check_expo+1); } else if (FLT_DOUBLE==dst_type) { @@ -3218,10 +3212,10 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) - continue; /* all underflowed, no error */ + continue; /* all underflowed, no error */ if (overflow && my_isinf(dendian, buf+j*sizeof(double), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) - continue; /* all overflowed, no error */ + continue; /* all overflowed, no error */ check_mant[0] = HDfrexp(x, check_expo+0); check_mant[1] = HDfrexp(hw_d, check_expo+1); #if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE) @@ -3264,20 +3258,20 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) H5_WARNING(); } } - printf(" elmt %u\n", (unsigned)j); + HDprintf(" elmt %u\n", (unsigned)j); - printf(" src ="); + HDprintf(" src ="); for (k=0; k %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; } if ((INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type || @@ -3566,12 +3560,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) && FLT_LDOUBLE!=dst_type #endif )) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" 1. Not an integer-float conversion."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" 1. Not an integer-float conversion."); + goto error; } if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type @@ -3583,12 +3577,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) && INT_USHORT!=dst_type && INT_INT!=dst_type && INT_UINT!=dst_type && INT_LONG!=dst_type && INT_ULONG!=dst_type && INT_LLONG!=dst_type && INT_ULLONG!=dst_type)) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" 2. Not a float-integer conversion."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" 2. Not a float-integer conversion."); + goto error; } if (INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type || @@ -3597,7 +3591,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) INT_ULLONG==src_type) { HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test=0; } else { @@ -3610,7 +3604,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) else HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test=0; } @@ -4347,44 +4341,44 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) H5_WARNING(); } } - printf(" elmt %u: \n", (unsigned)j); + HDprintf(" elmt %u: \n", (unsigned)j); - printf(" src = "); + HDprintf(" src = "); for (k=0; k %s conversions", name, "long double", "float"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); @@ -4915,11 +4909,11 @@ run_fp_tests(const char *name) nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); #else { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", "float or double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); @@ -4934,15 +4928,15 @@ done: return nerrors; } - + /*------------------------------------------------------------------------- - * Function: run_int_fp_conv + * Function: run_int_fp_conv * - * Purpose: Runs all integer-float tests. + * Purpose: Runs all integer-float tests. * - * Return: Number of errors + * Return: Number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Monday, November 10, 2003 * * Modifications: @@ -4952,7 +4946,7 @@ done: static int run_int_fp_conv(const char *name) { - int nerrors = 0; + int nerrors = 0; nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_FLOAT); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_DOUBLE); @@ -5001,11 +4995,11 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); #else { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "(unsigned) long", "long double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the special algorithm of hardware conversion."); @@ -5020,11 +5014,11 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE); #else /* H5_LLONG_TO_LDOUBLE_CORRECT */ { - char str[256]; /*hello string */ + char str[256]; /*hello string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long long", "long double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); HDputs(" Test skipped due to compiler error in handling conversion."); } @@ -5033,11 +5027,11 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE); #else /* H5_LLONG_TO_LDOUBLE_CORRECT */ { - char str[256]; /*hello string */ + char str[256]; /*hello string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "unsigned long long", "long double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); HDputs(" Test skipped due to compiler not handling conversion."); } @@ -5048,15 +5042,15 @@ run_int_fp_conv(const char *name) return nerrors; } - + /*------------------------------------------------------------------------- - * Function: run_fp_int_conv + * Function: run_fp_int_conv * - * Purpose: Runs all float-integer tests. + * Purpose: Runs all float-integer tests. * - * Return: Number of errors + * Return: Number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Monday, November 10, 2003 * * Modifications: @@ -5066,7 +5060,7 @@ run_int_fp_conv(const char *name) static int run_fp_int_conv(const char *name) { - int nerrors = 0; + int nerrors = 0; int test_values; for(test_values = TEST_NORMAL; test_values <= TEST_SPECIAL; test_values++) { @@ -5111,7 +5105,7 @@ run_fp_int_conv(const char *name) #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE if(test_values != TEST_SPECIAL) { - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); @@ -5119,18 +5113,18 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); } else { #ifndef H5_DISABLE_SOME_LDOUBLE_CONV - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); #else - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", "signed and unsigned char, short, int, long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); @@ -5152,11 +5146,11 @@ run_fp_int_conv(const char *name) } #else { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "(unsigned) long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the special algorithm of hardware conversion."); @@ -5172,11 +5166,11 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG); #else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "long long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to hardware conversion error."); @@ -5189,11 +5183,11 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG); #else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "unsigned long long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to hardware conversion error."); @@ -5209,7 +5203,7 @@ run_fp_int_conv(const char *name) return nerrors; } - + /*------------------------------------------------------------------------- * Function: main * @@ -5233,7 +5227,7 @@ run_fp_int_conv(const char *name) int main(void) { - unsigned long nerrors = 0; + unsigned long nerrors = 0; /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -5241,7 +5235,7 @@ main(void) reset_hdf5(); if (ALIGNMENT) - printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); + HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); /* Do the tests */ @@ -5310,11 +5304,11 @@ main(void) h5_restore_err(); if (nerrors) { - printf("***** %lu FAILURE%s! *****\n", + HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } - printf("All data type tests passed.\n"); + HDprintf("All data type tests passed.\n"); return 0; } diff --git a/test/dtypes.c b/test/dtypes.c index 3253d6c..e14ec5c 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -716,7 +716,7 @@ test_compound_2(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = i*8+1; s_ptr->c[0] = i*8+2; @@ -754,8 +754,8 @@ test_compound_2(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || @@ -847,7 +847,7 @@ test_compound_3(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = i*8+1; s_ptr->c[0] = i*8+2; @@ -884,8 +884,8 @@ test_compound_3(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] || @@ -978,7 +978,7 @@ test_compound_4(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = (i*8+1) & 0x7fff; s_ptr->c[0] = i*8+2; @@ -1017,8 +1017,8 @@ test_compound_4(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || @@ -1215,7 +1215,7 @@ test_compound_6(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->b = (i*8+1) & 0x7fff; s_ptr->d = (i*8+6) & 0x7fff; } @@ -1244,8 +1244,8 @@ test_compound_6(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) { H5_FAILED(); diff --git a/test/earray.c b/test/earray.c index d72b3f5..be899b6 100644 --- a/test/earray.c +++ b/test/earray.c @@ -529,10 +529,10 @@ verify_cparam(const H5EA_t *ea, const H5EA_create_t *cparam) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* verify_cparam() */ @@ -2398,7 +2398,7 @@ error: H5E_BEGIN_TRY { if(ea) H5EA_close(ea); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; diff --git a/test/efc.c b/test/efc.c index 5a946bb..98d4948 100644 --- a/test/efc.c +++ b/test/efc.c @@ -2900,7 +2900,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Test Setup */ - puts("Testing the external file cache"); + HDputs("Testing the external file cache"); /* Create property lists */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); @@ -2937,14 +2937,14 @@ main(void) if(nerrors) goto error; - puts("All external file cache tests passed."); + HDputs("All external file cache tests passed."); h5_clean_files(FILENAME, fapl_id); - return 0; + return EXIT_SUCCESS; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl_id); @@ -2952,6 +2952,6 @@ error: if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } /* end main() */ diff --git a/test/enc_dec_plist_cross_platform.c b/test/enc_dec_plist_cross_platform.c index 1fbb41b..15c7391 100644 --- a/test/enc_dec_plist_cross_platform.c +++ b/test/enc_dec_plist_cross_platform.c @@ -28,7 +28,7 @@ int main(void) { if(VERBOSE_MED) - printf("Encode/Decode property list endianess\n"); + HDprintf("Encode/Decode property list endianess\n"); /******* ENCODE/DECODE DCPLS *****/ TESTING("Default DCPL Encoding/Decoding"); @@ -227,7 +227,7 @@ test_plists(const char *filename_prefix) return 1; error: - printf("***** Plist Encode/Decode tests FAILED! *****\n"); + HDprintf("***** Plist Encode/Decode tests FAILED! *****\n"); return -1; } diff --git a/test/err_compat.c b/test/err_compat.c index eee150b..4860a3c 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -469,7 +469,7 @@ main(void) char filename[1024]; const char *FUNC_main="main"; - fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There're supposed to be some error messages\n"); + fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); diff --git a/test/error_test.c b/test/error_test.c index 5356fa7..580234a 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * October 14, 2001 * - * Purpose: Tests the error API routines. + * Purpose: Tests the error API routines. */ #include "h5test.h" #include "H5srcdir.h" @@ -23,7 +23,7 @@ #ifdef H5_USE_16_API int main(void) { - HDfprintf(stderr, "Test skipped because backward compatbility with v1.6 is configured in\n"); + HDfprintf(stderr, "Test skipped because backward compatibility with v1.6 is configured in\n"); return 0; } #else /* H5_USE_16_API */ @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; hid_t ERR_CLS; hid_t ERR_CLS2; @@ -80,7 +80,7 @@ hid_t ERR_MIN_GETNUM; static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data); - + /*------------------------------------------------------------------------- * Function: test_error * @@ -94,10 +94,10 @@ static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, static herr_t test_error(hid_t file) { - hid_t dataset = -1; + hid_t dataset = -1; hid_t space = -1; hid_t estack_id = -1; - hsize_t dims[2]; + hsize_t dims[2]; const char *FUNC_test_error = "test_error"; H5E_auto2_t old_func; void *old_data = NULL; @@ -169,7 +169,7 @@ test_error(hid_t file) return -1; } /* end test_error() */ - + /*------------------------------------------------------------------------- * Function: init_error * @@ -245,7 +245,7 @@ error: return -1; } /* end init_error() */ - + /*------------------------------------------------------------------------- * Function: error_stack * @@ -287,7 +287,7 @@ error: return -1; } /* end error_stack() */ - + /*------------------------------------------------------------------------- * Function: long_desc_cb * @@ -309,7 +309,7 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie return -1; } /* end long_desc_cb() */ - + /*------------------------------------------------------------------------- * Function: test_long_desc * @@ -375,7 +375,7 @@ error: return -1; } /* end test_long_desc() */ - + /*------------------------------------------------------------------------- * Function: dump_error * @@ -405,7 +405,7 @@ error: return -1; } /* end dump_error() */ - + /*------------------------------------------------------------------------- * Function: custom_print_cb * @@ -436,8 +436,8 @@ custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data) TEST_ERROR; HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", - indent, "", n, err_desc->file_name, - err_desc->func_name, err_desc->line); + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); HDfprintf(stream, "%*sclass: %s\n", indent * 2, "", cls); HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min); @@ -448,7 +448,7 @@ error: return -1; } /* end custom_print_cb() */ - + /*------------------------------------------------------------------------- * Function: test_create * @@ -531,11 +531,11 @@ test_copy(void) err_num = H5Eget_num(H5E_DEFAULT); if (err_num != 1) TEST_ERROR - + /* Copy error stack, which clears the original */ if ((estack_id = H5Eget_current_stack()) < 0) TEST_ERROR - + /* Check the number of errors on stack copy */ err_num = H5Eget_num(estack_id); if (err_num != 1) @@ -555,7 +555,7 @@ test_copy(void) if (err_num != 1) TEST_ERROR - /* Try to close error stack copy. Should fail because + /* Try to close error stack copy. Should fail because * the current H5Eset_current_stack closes the stack to be set. */ H5E_BEGIN_TRY { @@ -570,7 +570,7 @@ error: return -1; } /* end test_copy() */ - + /*------------------------------------------------------------------------- * Function: close_error * @@ -606,17 +606,17 @@ error: return -1; } /* end close_error() */ - + /*------------------------------------------------------------------------- * Function: test_filter_error * * Purpose: Make sure the error message prints out the filter name - * when the existent file is opened but the filter isn't - * registered. The existent file was created with - * gen_filters.c. + * when the existent file is opened but the filter isn't + * registered. The existent file was created with + * gen_filters.c. * * Return: Success: 0 - * Failure: -1 + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -654,7 +654,7 @@ error: return -1; } /* end test_filter_error() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -736,7 +736,7 @@ main(void) if (close_error() < 0) TEST_ERROR; - /* Test error message during data reading when filter isn't registered + /* Test error message during data reading when filter isn't registered * Use default FAPL to avoid some VFD drivers by the check-vfd test because * the test file was pre-generated. */ diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 6536837..9d23f2f 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Dana Robinson - * Spring 2016 - * - * Purpose: Tests the basic operation of the evict-on-close cache +/* Purpose: Tests the basic operation of the evict-on-close cache * behavior. Tests that ensure the tagging is handled correctly * are located in cache.c. */ @@ -91,9 +87,6 @@ static herr_t check_group_layout(hid_t fid, const char *group_name); * * Return: TRUE/FALSE * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hbool_t @@ -114,8 +107,8 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) return TRUE; else entry_ptr = entry_ptr->ht_next; - } /* end while */ - } /* end for */ + } + } return FALSE; } /* end verify_tag_not_in_cache() */ @@ -129,9 +122,6 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) * Return: Success: The file ID of the created file * Failure: -1 * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hid_t @@ -207,7 +197,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -303,7 +293,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -593,9 +583,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -710,9 +697,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -815,9 +799,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -873,7 +854,7 @@ check_evict_on_close_api(void) /* ensure an invalid plist fails */ H5E_BEGIN_TRY { - status = H5Pget_evict_on_close((hid_t)-1, &evict_on_close); + status = H5Pget_evict_on_close(H5I_INVALID_HID, &evict_on_close); } H5E_END_TRY; if(status >= 0) FAIL_PUTS_ERROR("H5Pget_evict_on_close() accepted invalid hid_t."); @@ -897,9 +878,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -979,7 +957,7 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: @@ -992,7 +970,7 @@ error: H5Pclose(fapl_id); } H5E_END_TRY; - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* end main() */ @@ -1007,9 +985,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2017 - * *------------------------------------------------------------------------- */ static herr_t @@ -1052,9 +1027,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -1076,14 +1048,14 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); HDprintf("Note that EoC is not supported under parallel so most tests are skipped.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: HDprintf("***** %u evict-on-close test%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* main() - parallel */ diff --git a/test/external.c b/test/external.c index 7e9ecf9..8a4ca86 100644 --- a/test/external.c +++ b/test/external.c @@ -1402,4 +1402,3 @@ error: printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); return EXIT_FAILURE; } /* end main() */ - diff --git a/test/farray.c b/test/farray.c index 383cb32..e1bc5bc 100644 --- a/test/farray.c +++ b/test/farray.c @@ -25,9 +25,9 @@ #include "H5FApkg.h" /* Fixed Arrays */ /* Other private headers that this test requires */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" /* IDs */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Local macros */ @@ -113,121 +113,116 @@ h5_stat_size_t empty_size_g; /*------------------------------------------------------------------------- - * Function: init_cparam + * Function: init_cparam * - * Purpose: Initialize array creation parameter structure + * Purpose: Initialize array creation parameter structure * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t init_cparam(H5FA_create_t *cparam, farray_test_param_t *tparam) { /* Wipe out background */ HDmemset(cparam, 0, sizeof(*cparam)); - cparam->cls = H5FA_CLS_TEST; - cparam->raw_elmt_size = ELMT_SIZE; - cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; - cparam->nelmts = tparam->nelmts; + cparam->cls = H5FA_CLS_TEST; + cparam->raw_elmt_size = ELMT_SIZE; + cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; + cparam->nelmts = tparam->nelmts; - return(0); + return SUCCEED; } /* init_cparam() */ /*------------------------------------------------------------------------- - * Function: create_file + * Function: create_file * - * Purpose: Create file and retrieve pointer to internal file object - * - * Return: Success: 0 - * Failure: -1 + * Purpose: Create file and retrieve pointer to internal file object * + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ -static int -create_file(hid_t fapl, hid_t *file, H5F_t **f) +static herr_t +create_file(hid_t fapl_id, hid_t *fid, H5F_t **f) { /* Create the file to work on */ - if((*file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if ((*fid = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) - FAIL_STACK_ERROR + if (NULL == (*f = (H5F_t *)H5I_object(*fid))) + FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) - FAIL_STACK_ERROR + if (H5AC_ignore_tags(*f) < 0) + FAIL_STACK_ERROR; /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_file() */ /*------------------------------------------------------------------------- - * Function: check_stats + * Function: check_stats * - * Purpose: Verify stats for a fixed array + * Purpose: Verify stats for a fixed array * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t check_stats(const H5FA_t *fa, const farray_state_t *state) { H5FA_stat_t farray_stats; /* Statistics about the array */ /* Get statistics for fixed array and verify they are correct */ - if(H5FA_get_stats(fa, &farray_stats) < 0) + if (H5FA_get_stats(fa, &farray_stats) < 0) FAIL_STACK_ERROR /* Compare information */ - if(farray_stats.hdr_size != state->hdr_size) { + if (farray_stats.hdr_size != state->hdr_size) { HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n", farray_stats.hdr_size, state->hdr_size); TEST_ERROR - } /* end if */ + } - if(farray_stats.dblk_size != state->dblk_size) { + if (farray_stats.dblk_size != state->dblk_size) { HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n", farray_stats.dblk_size, state->dblk_size); TEST_ERROR - } /* end if */ + } - if(farray_stats.nelmts != state->nelmts) { + if (farray_stats.nelmts != state->nelmts) { HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n", farray_stats.nelmts, state->nelmts); TEST_ERROR - } /* end if */ + } - /* All tests passed */ - return(0); + /* Success */ + return SUCCEED; error: - return(-1); + return FAIL; } /* check_stats() */ /*------------------------------------------------------------------------- - * Function: set_fa_state - * - * Purpose: Set the state of the Fixed Array + * Function: set_fa_state * - * Return: does not fail + * Purpose: Set the state of the Fixed Array * - * Programmer: Vailin Choi; 5th August, 2009 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) { size_t dblk_page_nelmts; /* # of elements per page */ @@ -241,190 +236,190 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) state->nelmts = cparam->nelmts; dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; - if(state->nelmts > dblk_page_nelmts) { - size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); - size_t dblk_page_init_size = (npages + 7) / 8; - hsize_t checksum_size = npages * 4; + if (state->nelmts > dblk_page_nelmts) { + size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); + size_t dblk_page_init_size = (npages + 7) / 8; + hsize_t checksum_size = npages * 4; - state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + + state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + state->nelmts * cparam->raw_elmt_size; - } else - state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; + } + else + state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; - return(0); + return SUCCEED; } /* end set_fa_state() */ /*------------------------------------------------------------------------- - * Function: reopen_file + * Function: reopen_file * - * Purpose: Perform common "re-open" operations on file & array for testing + * Purpose: Perform common "re-open" operations on file & array for testing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static int -reopen_file(hid_t *file, H5F_t **f, hid_t fapl, +reopen_file(hid_t *fid, H5F_t **f, hid_t fapl_id, H5FA_t **fa, haddr_t fa_addr, const farray_test_param_t *tparam) { /* Check for closing & re-opening the array */ /* (actually will close & re-open the file as well) */ - if(tparam->reopen_array) { + if (tparam->reopen_array) { + /* Close array, if given */ - if(fa && *fa) { - if(H5FA_close(*fa) < 0) + if (fa && *fa) { + if (H5FA_close(*fa) < 0) FAIL_STACK_ERROR *fa = NULL; - } /* end if */ + } /* Close file */ - if(*file) { - if(H5Fclose(*file) < 0) + if (*fid) { + if (H5Fclose(*fid) < 0) FAIL_STACK_ERROR - *file = (-1); + *fid = H5I_INVALID_HID; *f = NULL; - } /* end if */ + } /* Re-open the file */ - if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if ((*fid = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) - FAIL_STACK_ERROR + if (NULL == (*f = (H5F_t *)H5I_object(*fid))) + FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) + if (H5AC_ignore_tags(*f) < 0) FAIL_STACK_ERROR /* Re-open array, if given */ - if(fa) - if(NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) + if (fa) + if (NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) FAIL_STACK_ERROR - } /* end if */ + } /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* reopen_file() */ /*------------------------------------------------------------------------- - * Function: create_array + * Function: create_array * - * Purpose: Create a fixed array and perform initial checks + * Purpose: Create a fixed array and perform initial checks * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t create_array(H5F_t *f, const H5FA_create_t *cparam, H5FA_t **fa, haddr_t *fa_addr) { farray_state_t state; /* State of extensible array */ /* Create array */ - if(NULL == (*fa = H5FA_create(f, cparam, NULL))) + if (NULL == (*fa = H5FA_create(f, cparam, NULL))) FAIL_STACK_ERROR /* Check status of array */ - if(H5FA_get_addr(*fa, fa_addr) < 0) + if (H5FA_get_addr(*fa, fa_addr) < 0) FAIL_STACK_ERROR - if(!H5F_addr_defined(*fa_addr)) + if (!H5F_addr_defined(*fa_addr)) TEST_ERROR + + /* Check array stats */ HDmemset(&state, 0, sizeof(state)); - state.hdr_size = FA_HDR_SIZE; - state.nelmts = cparam->nelmts; - if(check_stats(*fa, &state)) + state.hdr_size = FA_HDR_SIZE; + state.nelmts = cparam->nelmts; + if (check_stats(*fa, &state)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_array() */ /*------------------------------------------------------------------------- - * Function: verify_cparam + * Function: verify_cparam * - * Purpose: Verify creation parameters are correct + * Purpose: Verify creation parameters are correct * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t verify_cparam(const H5FA_t *fa, const H5FA_create_t *cparam) { H5FA_create_t test_cparam; /* Creation parameters for array */ /* Retrieve creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5FA_create_t)); - if(H5FA_get_cparam_test(fa, &test_cparam) < 0) + if (H5FA_get_cparam_test(fa, &test_cparam) < 0) FAIL_STACK_ERROR /* Verify creation parameters */ - if(H5FA_cmp_cparam_test(cparam, &test_cparam)) + if (H5FA_cmp_cparam_test(cparam, &test_cparam)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* verify_cparam() */ /*------------------------------------------------------------------------- - * Function: finish + * Function: finish * - * Purpose: Close array, delete array, close file and verify that file + * Purpose: Close array, delete array, close file and verify that file * is empty size * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int -finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) +static herr_t +finish(hid_t fid, hid_t fapl_id, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) { h5_stat_size_t file_size; /* File size, after deleting array */ /* Close the fixed array */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR /* Delete array */ - if(H5FA_delete(f, fa_addr, NULL) < 0) + if (H5FA_delete(f, fa_addr, NULL) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size = h5_get_file_size(filename_g, fapl)) < 0) + if ((file_size = h5_get_file_size(filename_g, fapl_id)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size != empty_size_g) + if (file_size != empty_size_g) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* finish() */ @@ -627,66 +622,64 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if (create_file(fapl_id, &fid, &f) < 0) TEST_ERROR - /* - * Display testing message - */ + /* Display testing message */ TESTING("open fixed array twice"); /* Create array */ - if(create_array(f, cparam, &fa, &fa_addr) < 0) + if (create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2) < 0) + if (H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if (reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ - if((file2 = H5Freopen(file)) < 0) + if ((fid2 = H5Freopen(fid)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) - FAIL_STACK_ERROR + if (NULL == (f2 = (H5F_t *)H5I_object(fid2))) + FAIL_STACK_ERROR; /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR /* Close the first extensible array wrapper */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -694,11 +687,11 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if (finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -708,12 +701,12 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) error: H5E_BEGIN_TRY { - if(fa) + if (fa) H5FA_close(fa); - if(fa2) + if (fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); + H5Fclose(fid); + H5Fclose(fid2); } H5E_END_TRY; return 1; @@ -736,44 +729,42 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - hid_t file0 = -1; /* File ID */ - hid_t file00 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ - - /* - * Display testing message - */ + char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid0 = H5I_INVALID_HID; /* File ID */ + hid_t fid00 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + + /* Display testing message */ TESTING("open fixed array twice, through different file handles"); /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if (create_file(fapl_id, &fid, &f) < 0) TEST_ERROR /* Create array */ - if(create_array(f, cparam, &fa, &fa_addr) < 0) + if (create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2) < 0) + if (H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; @@ -781,15 +772,15 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (So that there is something holding the file open when the extensible * array is closed) */ - if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if ((fid0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if (reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Close the first fixed array wrapper */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -797,44 +788,43 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR - file = -1; + fid = H5I_INVALID_HID; /* Open a different file */ /* (This re-allocates the 'top' file pointer and assigns it a different * 'shared' file pointer, making the file pointer in the fixed array's * header stale) */ - h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp)); - if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[1], fapl_id, filename_tmp, sizeof(filename_tmp)); + if ((fid00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR - /* Re-open the file with the fixed array */ - if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if ((fid2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) - FAIL_STACK_ERROR + if (NULL == (f2 = (H5F_t *)H5I_object(fid2))) + FAIL_STACK_ERROR; /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the extra file handles */ - if(H5Fclose(file0) < 0) + if (H5Fclose(fid0) < 0) FAIL_STACK_ERROR - if(H5Fclose(file00) < 0) + if (H5Fclose(fid00) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if (finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -844,14 +834,14 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa error: H5E_BEGIN_TRY { - if(fa) + if (fa) H5FA_close(fa); - if(fa2) + if (fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); - H5Fclose(file0); - H5Fclose(file00); + H5Fclose(fid); + H5Fclose(fid2); + H5Fclose(fid0); + H5Fclose(fid00); } H5E_END_TRY; return 1; @@ -966,7 +956,7 @@ error: H5FA_close(fa); if(fa2) H5FA_close(fa2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; @@ -1666,7 +1656,7 @@ main(void) fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); if(ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); @@ -1706,12 +1696,12 @@ main(void) switch(curr_test) { /* "Normal" testing parameters */ case FARRAY_TEST_NORMAL: - puts("Testing with NORMAL PARAMETERS"); + HDputs("Testing with NORMAL PARAMETERS"); break; /* "Re-open array" testing parameters */ case FARRAY_TEST_REOPEN: - puts("Testing with reopen array flag set"); + HDputs("Testing with reopen array flag set"); tparam.reopen_array = FARRAY_TEST_REOPEN; break; @@ -1738,25 +1728,25 @@ main(void) switch(curr_iter) { /* "Forward" testing parameters */ case FARRAY_ITER_FW: - puts("Testing with forward iteration"); + HDputs("Testing with forward iteration"); tparam.fiter = &fa_iter_fw; break; /* "Reverse" testing parameters */ case FARRAY_ITER_RV: - puts("Testing with reverse iteration"); + HDputs("Testing with reverse iteration"); tparam.fiter = &fa_iter_rv; break; /* "Random" testing parameters */ case FARRAY_ITER_RND: - puts("Testing with random iteration"); + HDputs("Testing with random iteration"); tparam.fiter = &fa_iter_rnd; break; /* "Cyclic" testing parameters */ case FARRAY_ITER_CYC: - puts("Testing with cyclic iteration"); + HDputs("Testing with cyclic iteration"); tparam.fiter = &fa_iter_cyc; break; @@ -1772,22 +1762,26 @@ main(void) nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)tparam.nelmts, "setting all the array elements"); } /* end for */ - /* Check skipping elements */ + /* Check skipping elements */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)1, TRUE, "skipping to first element"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, ((hsize_t)1 << cparam.max_dblk_page_nelmts_bits), TRUE, "skipping to first element in data block page"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), TRUE, "skipping to last element"); - /* Create Fixed Array of MAX_NELMTS elements */ - /* - * MAX_NELMTS succeeds on jam and smirom. - * The value was adjusted for linew due to the following: - Linew failed with "H5FD_sec2_truncate(): unable to extend file properly" - Linew failed with "H5FD_sec2_truncate(): File too large" - */ + /* Create Fixed Array */ + /* MAX_NELMTS succeeds on some platforms buy may fail on others: + * + * "H5FD_sec2_truncate(): unable to extend file properly" + * + * and + * + * "H5FD_sec2_truncate(): File too large" + * + * have both been seen. + */ tparam.nelmts = MAX_NELMTS/17; - init_cparam(&cparam, &tparam); + init_cparam(&cparam, &tparam); - /* Set the last element in the Fixed Array */ + /* Set the last element in the Fixed Array */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), FALSE, "skipping to last element"); } /* end for */ @@ -1800,22 +1794,22 @@ main(void) if(nerrors) goto error; - puts("All fixed array tests passed."); + HDputs("All fixed array tests passed."); /* Clean up file used */ h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { - H5Pclose(fapl); + H5Pclose(fapl); } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); - return 1; + HDexit(EXIT_FAILURE); } /* end main() */ diff --git a/test/fillval.c b/test/fillval.c index 8c8e902..5b95de9 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -762,15 +762,17 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, comp_datatype *buf_c=NULL; H5D_space_status_t allocation; - if(datatype==H5T_INTEGER) + if(datatype == H5T_INTEGER) { fillval = *(int*)_fillval; - else if(datatype==H5T_COMPOUND) { - fill_c.a=((comp_datatype*)_fillval)->a; + } + else if(datatype == H5T_COMPOUND) { + fill_c.a=((comp_datatype*)_fillval)->a; fill_c.x=((comp_datatype*)_fillval)->x; fill_c.y=((comp_datatype*)_fillval)->y; fill_c.z=((comp_datatype*)_fillval)->z; - } else { - puts("Invalid type for test"); + } + else { + HDputs("Invalid type for test"); goto error; } @@ -806,7 +808,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; } /* case for compound datatype */ - } else if(datatype==H5T_COMPOUND) { + } + else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0) goto error; if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) || @@ -828,10 +831,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* Select all odd data locations in the file dataset */ for (i=0, nelmts=1; i<5; i++) { - hs_size[i] = cur_size[i]/2; - hs_offset[i] = 0; - hs_stride[i] = 2; - nelmts *= hs_size[i]; + hs_size[i] = cur_size[i]/2; + hs_offset[i] = 0; + hs_stride[i] = 2; + nelmts *= hs_size[i]; } if((mspace=H5Screate_simple(5, hs_size, hs_size)) < 0) goto error; if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, @@ -1089,17 +1092,23 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) } h5_fixname(base_name, fapl, filename, sizeof filename); - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5D_CHUNKED==layout) { - if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; - } else if(H5D_COMPACT==layout) { - if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if(H5D_CHUNKED == layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) + goto error; + } + else if(H5D_COMPACT == layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) + goto error; } - if((ctype_id=create_compound_type()) < 0) goto error; + if((ctype_id = create_compound_type()) < 0) + goto error; /* I. Test H5D_ALLOC_TIME_LATE space allocation cases */ if(H5D_COMPACT != layout) { @@ -2359,8 +2368,6 @@ test_partalloc(hid_t fapl, const char *base_name) * Programmer: Robb Matzke * Thursday, October 1, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -2380,8 +2387,8 @@ main(int argc, char *argv[]) else if(!strcmp(argv[argno], "compact")) test_compact =1; else { - fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); - exit(EXIT_FAILURE); + HDfprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); + HDexit(EXIT_FAILURE); } } /* end for */ } /* end if */ @@ -2444,15 +2451,15 @@ main(int argc, char *argv[]) if(nerrors) goto error; - puts("All fill value tests passed."); + HDputs("All fill value tests passed."); if(h5_cleanup(FILENAME, fapl)) HDremove(FILE_NAME_RAW); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("***** FILL VALUE TESTS FAILED *****"); - return 1; + HDputs("***** FILL VALUE TESTS FAILED *****"); + HDexit(EXIT_FAILURE); } diff --git a/test/flush1.c b/test/flush1.c index bdbd731..d7d578b 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -73,7 +73,7 @@ create_file(const char *filename, hid_t fapl_id, hbool_t swmr) hid_t fid = -1; /* file ID */ hid_t top_gid = -1; /* containing group ID */ hid_t gid = -1; /* subgroup ID */ - char group_name[16]; /* group name */ + char group_name[32]; /* group name */ unsigned flags; /* file open flags */ int i; /* iterator */ diff --git a/test/flush2.c b/test/flush2.c index 9fdf6c1..519f1b2 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -15,10 +15,10 @@ * Programmer: Robb Matzke * Friday, October 23, 1998 * - * Purpose: This is the second half of a two-part test that makes sure - * that a file can be read after an application crashes as long - * as the file was flushed first. This half tries to read the - * file created by the first half. + * Purpose: This is the second half of a two-part test that makes sure + * that a file can be read after an application crashes as long + * as the file was flushed first. This half tries to read the + * file created by the first half. */ #include "h5test.h" @@ -135,7 +135,7 @@ file_ok(const char *filename, hid_t fapl_id, hbool_t check_second_dset) hid_t fid = -1; /* file ID */ hid_t top_gid = -1; /* containing group ID */ hid_t gid = -1; /* subgroup ID */ - char group_name[16]; /* group name */ + char group_name[32]; /* group name */ int i; /* iterator */ /* open file */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 4196d85..c933349 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -130,7 +130,7 @@ herr_t end_verification(void); * it will time out waiting for a signal from the test script * which will never come. * - * Return: 0 on Success, 1 on Failure + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Mike McGreevy * July 1, 2010 @@ -166,23 +166,26 @@ int main(int argc, const char *argv[]) if(end_verification() < 0) TEST_ERROR; if(end_verification() < 0) TEST_ERROR; } /* end else */ - } else if(argc == 3) { + } + else if(argc == 3) { /* Two arguments supplied. Pass them to flush verification routine. */ if(flush_verification(argv[1], argv[2]) != 0) PROCESS_ERROR; - } else if(argc == 2) { + } + else if(argc == 2) { /* One argument supplied. Pass it to refresh verification routine. */ if(refresh_verification(argv[1]) != 0) PROCESS_ERROR; - } else { + } + else { /* Illegal number of arguments supplied. Error. */ HDfprintf(stderr, "Error. %d is an Invalid number of arguments to main().\n", argc); PROCESS_ERROR } /* end if */ - return SUCCEED; + return EXIT_SUCCESS; error: /* Return */ - return FAIL; + return EXIT_FAILURE; } /* main */ @@ -695,7 +698,6 @@ herr_t test_refresh(void) /* ================= */ /* Refresh Datatypes */ /* ================= */ - TESTING("to ensure that H5Trefresh correctly refreshes single datatypes"); /* Verify First Committed Datatype can be refreshed with H5Trefresh */ @@ -715,7 +717,6 @@ herr_t test_refresh(void) if(H5Oflush(tid2) < 0) TEST_ERROR; if(end_refresh_verification_process() != 0) TEST_ERROR; - PASSED(); /* =============== */ @@ -995,7 +996,7 @@ herr_t refresh_verification(const char * obj_pathname) check to ensure we didn't erroneously flush the attribute before starting the verification. */ if(flushed_oinfo.num_attrs != 0) - PROCESS_ERROR; + PROCESS_ERROR; /* Send Signal to MAIN PROCESS indicating that it can go ahead and modify the object. */ @@ -1027,55 +1028,57 @@ herr_t refresh_verification(const char * obj_pathname) * test cases is easy). */ do { - if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { - if(H5Drefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { - if(H5Grefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { - if(H5Trefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || + if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { + if(H5Drefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { + if(H5Grefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { + if(H5Trefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || (HDstrcmp(obj_pathname, T3) == 0)) { - if(H5Orefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else { - HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); - PROCESS_ERROR; - } /* end else */ - - /* Get object info. This should now accurately reflect the refreshed object on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; - - /* Confirm following (first 4) attributes are the same: */ - /* Confirm following (last 4) attributes are different */ - if( (flushed_oinfo.addr == refreshed_oinfo.addr) && - (flushed_oinfo.type == refreshed_oinfo.type) && - (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && - (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && - (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && - (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && - (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && - (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { - ok = TRUE; - break; - } - if(tries == sleep_tries) - HDsleep(1); + if(H5Orefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else { + HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); + PROCESS_ERROR; + } /* end else */ + + /* Get object info. This should now accurately reflect the refreshed object on disk. */ + if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) + PROCESS_ERROR; + + /* Confirm following (first 4) attributes are the same: */ + /* Confirm following (last 4) attributes are different */ + if( (flushed_oinfo.addr == refreshed_oinfo.addr) && + (flushed_oinfo.type == refreshed_oinfo.type) && + (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && + (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && + (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && + (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && + (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && + (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { + ok = TRUE; + break; + } + + if(tries == sleep_tries) + HDsleep(1); } while(--tries); - + if(!ok) { - printf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, - (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); - printf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, - (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); - PROCESS_ERROR; + HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, + (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); + HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, + (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); + PROCESS_ERROR; } - + /* Close objects */ if(H5Oclose(oid) < 0) PROCESS_ERROR; if(H5Fclose(fid) < 0) PROCESS_ERROR; diff --git a/test/freespace.c b/test/freespace.c index 33a6f89..c0fbb76 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -24,7 +24,7 @@ #define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" -#include "H5CXprivate.h" /* API Contexts */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" #include "H5VMprivate.h" @@ -496,7 +496,7 @@ test_fs_create(hid_t fapl) if(!H5F_addr_defined(fs_addr)) TEST_ERROR - if (frsp->nclasses != nclasses) + if(frsp->nclasses != nclasses) TEST_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -879,7 +879,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -1248,7 +1248,7 @@ test_fs_sect_find(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -1857,14 +1857,14 @@ test_fs_sect_shrink(hid_t fapl) * Re-add section A that allow shrinking and its section class type defines "can_shrink" */ if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); can_shrink = FALSE; if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* should have nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1875,18 +1875,18 @@ test_fs_sect_shrink(hid_t fapl) /* section A should not be there in free-space */ if((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if (node_found) TEST_ERROR /* Close the free space manager */ if(H5FS_close(f, frsp) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ if(H5FS_delete(f, fs_addr) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; /* Close the file */ @@ -2082,7 +2082,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2357,7 +2357,7 @@ test_fs_sect_change_class(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2736,7 +2736,7 @@ test_fs_sect_extend(hid_t fapl) PASSED() - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2838,7 +2838,7 @@ test_fs_sect_iterate(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR diff --git a/test/istore.c b/test/istore.c index b5bac2c..1d57a2a 100644 --- a/test/istore.c +++ b/test/istore.c @@ -216,7 +216,7 @@ test_create(hid_t f, const char *prefix) /* Create chunked dataset of this dimensionality */ HDsnprintf(name, sizeof name, "%s_%02u", prefix, u); - if ((dataset=new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) + if((dataset = new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) return FAIL; /* Close dataset created */ diff --git a/test/lheap.c b/test/lheap.c index 4f09b6e..d309fb0 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -41,9 +41,7 @@ const char *FILENAME[] = { * heap, close the file, open the file, read data out of the * local heap, close the file. * - * Return: Success: zero - * - * Failure: non-zero + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Tuesday, November 24, 1998 @@ -95,7 +93,7 @@ main(void) H5Eprint2(H5E_DEFAULT, stdout); goto error; } - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -147,7 +145,7 @@ main(void) if(j > 4) buf[j] = '\0'; - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -211,7 +209,7 @@ main(void) HDputs("All local heap tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; error: HDputs("*** TESTS FAILED ***"); @@ -221,6 +219,6 @@ main(void) if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } diff --git a/test/links.c b/test/links.c index 8d49069..371c2c5 100644 --- a/test/links.c +++ b/test/links.c @@ -15,28 +15,28 @@ * Programmer: Robb Matzke * Friday, April 10, 1998 * - * Purpose: Tests hard, soft (symbolic) & external links. + * Purpose: Tests hard, soft (symbolic) & external links. */ /* * This file needs to access private information from the H5FD package. * This file also needs to access the file driver testing code. */ -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ #define H5FD_TESTING /* * This file needs to access private information from the H5G package. * This file also needs to access the group testing code. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" #include "H5srcdir.h" #include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ @@ -62,55 +62,55 @@ const char *FILENAME[] = { "links6", /* 9 */ "links7", /* 10 */ "links8", /* 11 */ - "extlinks0", /* 12: main files */ - TMPDIR "extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - TMPDIR "extlinks1", /* 15: */ - "extlinks2", /* 16: */ - TMPDIR "extlinks2", /* 17: */ - "extlinks3", /* 18: */ - TMPDIR "extlinks3", /* 19: */ - "extlinks4", /* 20: */ - TMPDIR "extlinks4", /* 21: */ - "extlinks5", /* 22: */ - TMPDIR "extlinks6", /* 23: */ - "extlinks7", /* 24: */ - TMPDIR "extlinks7", /* 25: */ - TMPDIR "extlinks8", /* 26: */ - "extlinks9", /* 27: */ - TMPDIR "extlinks9", /* 28: */ - "extlinks10", /* 29: */ /* TESTS for windows */ + "extlinks0", /* 12: main files */ + TMPDIR "extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + TMPDIR "extlinks1", /* 15: */ + "extlinks2", /* 16: */ + TMPDIR "extlinks2", /* 17: */ + "extlinks3", /* 18: */ + TMPDIR "extlinks3", /* 19: */ + "extlinks4", /* 20: */ + TMPDIR "extlinks4", /* 21: */ + "extlinks5", /* 22: */ + TMPDIR "extlinks6", /* 23: */ + "extlinks7", /* 24: */ + TMPDIR "extlinks7", /* 25: */ + TMPDIR "extlinks8", /* 26: */ + "extlinks9", /* 27: */ + TMPDIR "extlinks9", /* 28: */ + "extlinks10", /* 29: */ /* TESTS for windows */ TMPDIR "extlinks10",/* 30: */ TMPDIR "extlinks11",/* 31: */ TMPDIR "extlinks12",/* 32: */ - "extlinks13", /* 33: */ + "extlinks13", /* 33: */ TMPDIR "extlinks13",/* 34: */ TMPDIR "extlinks14",/* 35: */ TMPDIR "extlinks15",/* 36: */ - "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ - "extlinks21A", /* 45: Files for symlink() tests*/ + "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ + "extlinks21A", /* 45: Files for symlink() tests*/ TMPDIR2 "extlinks21B",/* 46: */ TMPDIR2 "extlinks21C",/* 47: */ - "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ + "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ TMPDIR "extlinks21D",/* 49: */ TMPDIR "extlinks21E",/* 50: */ - "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ NULL }; -#define FAMILY_SIZE 1024 +#define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 -#define NUM40 40 +#define NUM40 40 /* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ -#define EXTSTOP 12 +#define EXTSTOP 12 #define LINK_BUF_SIZE 1024 #define NAME_BUF_SIZE 1024 @@ -318,7 +318,7 @@ typedef struct { static hid_t dcpl_g; /* for [un]minimized dataset object headers */ - + /*------------------------------------------------------------------------- * Function: fix_ext_filename * @@ -340,17 +340,17 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) HDstrcat(path_name, file_name); } - + /*------------------------------------------------------------------------- - * Function: mklinks + * Function: mklinks * - * Purpose: Build a file with assorted links. + * Purpose: Build a file with assorted links. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -360,9 +360,9 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) static int mklinks(hid_t fapl, hbool_t new_format) { - hid_t file, scalar, grp, d1; - hsize_t size[1] = {1}; - char filename[NAME_BUF_SIZE]; + hid_t file, scalar, grp, d1; + hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link creation (w/new group format)") @@ -405,7 +405,7 @@ mklinks(hid_t fapl, hbool_t new_format) return -1; } - + /*------------------------------------------------------------------------- * Function: new_links * @@ -425,11 +425,11 @@ mklinks(hid_t fapl, hbool_t new_format) static int new_links(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); - hid_t scalar=(-1); - hid_t dset1=(-1), dset2=(-1); - char filename[NAME_BUF_SIZE]; + hid_t file_a, file_b=(-1); + hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); + hid_t scalar=(-1); + hid_t dset1=(-1), dset2=(-1); + char filename[NAME_BUF_SIZE]; hsize_t size[1] = {1}; if(new_format) @@ -492,31 +492,31 @@ new_links(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Sclose(scalar); - H5Dclose(dset1); - H5Dclose(dset2); - H5Gclose(grp1_a); - H5Gclose(grp2_a); - H5Gclose(grp1_b); - H5Gclose(grp2_b); - H5Fclose(file_a); - H5Fclose(file_b); + H5Sclose(scalar); + H5Dclose(dset1); + H5Dclose(dset2); + H5Gclose(grp1_a); + H5Gclose(grp2_a); + H5Gclose(grp1_b); + H5Gclose(grp2_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return -1; } - + /*------------------------------------------------------------------------- - * Function: cklinks + * Function: cklinks * - * Purpose: Open the file created in the first step and check that the - * links look correct. + * Purpose: Open the file created in the first step and check that the + * links look correct. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -526,12 +526,12 @@ new_links(hid_t fapl, hbool_t new_format) static int cklinks(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; - char linkval[LINK_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - herr_t status; + hid_t file; + H5O_info_t oinfo1, oinfo2; + H5L_info_t linfo2; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; if(new_format) TESTING("link queries (w/new group format)") @@ -546,15 +546,15 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR @@ -565,91 +565,91 @@ cklinks(hid_t fapl, hbool_t new_format) status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ H5E_BEGIN_TRY { status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ /* Symbolic link */ if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Soft link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(linkval, "/d1")) { - H5_FAILED(); - HDputs(" Soft link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "foobar")) { - H5_FAILED(); - HDputs(" Dangling link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - printf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "/grp1/recursive")) { - H5_FAILED(); - HDputs(" Recursive link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR } /* end if */ /* Non-existent link */ @@ -665,7 +665,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: ck_new_links * @@ -684,9 +684,9 @@ error: static int ck_new_links(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; - char filename[NAME_BUF_SIZE]; + hid_t file; + H5O_info_t oi_dset, oi_hard1, oi_hard2; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("new link queries (w/new group format)") @@ -699,23 +699,23 @@ ck_new_links(hid_t fapl, hbool_t new_format) /* Get hard link info */ if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { - H5_FAILED(); - printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* Cleanup */ @@ -728,7 +728,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: long_links * @@ -748,12 +748,12 @@ error: static int long_links(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Datatype ID */ char *objname = NULL; /* Name of object [Long] */ size_t u; /* Local index variable */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("long names for objects & links (w/new group format)") @@ -796,15 +796,15 @@ long_links(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; HDfree(objname); return -1; } - + /*------------------------------------------------------------------------- * Function: toomany * @@ -824,10 +824,10 @@ long_links(hid_t fapl, hbool_t new_format) static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("too many links (w/new group format)") @@ -917,9 +917,9 @@ toomany(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); } H5E_END_TRY; if(gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - TEST_ERROR + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + TEST_ERROR } /* end if */ /* Open object through lesser soft link */ @@ -944,14 +944,14 @@ toomany(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end toomany() */ - + /*------------------------------------------------------------------------- * Function: test_lcpl * @@ -1111,7 +1111,7 @@ error: return 1; } /* end test_lcpl() */ - + /*------------------------------------------------------------------------- * Function: test_move * @@ -1131,9 +1131,9 @@ error: static int test_move(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lmove (w/new group format)") @@ -1155,9 +1155,9 @@ test_move(hid_t fapl, hbool_t new_format) /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -1188,11 +1188,11 @@ test_move(hid_t fapl, hbool_t new_format) /* Move a group across groups in the same file while renaming it. */ if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if( H5Gclose(moved_grp) < 0) TEST_ERROR @@ -1201,38 +1201,38 @@ test_move(hid_t fapl, hbool_t new_format) moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); } H5E_END_TRY; if(moved_grp >= 0) { - H5_FAILED(); - HDputs(" Group still in original location?"); - TEST_ERROR + H5_FAILED(); + HDputs(" Group still in original location?"); + TEST_ERROR } /* end if */ /* Use H5Lmove to rename a group without moving it. */ if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group. */ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lmove to move a group without renaming it. */ if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group . */ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Move the group while giving long paths. */ if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR @@ -1261,17 +1261,17 @@ test_move(hid_t fapl, hbool_t new_format) error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: test_copy * @@ -1291,9 +1291,9 @@ test_move(hid_t fapl, hbool_t new_format) static int test_copy(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lcopy (w/new group format)") @@ -1315,9 +1315,9 @@ test_copy(hid_t fapl, hbool_t new_format) /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -1348,75 +1348,75 @@ test_copy(hid_t fapl, hbool_t new_format) /* Move a group across groups in the same file while renaming it. */ if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to create a group in the same location with a different name. */ if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group. */ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to copy to a different location with the same name. */ if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group . */ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in the previous location */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Copy the group while giving long paths. */ if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in all previous original locations */ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR @@ -1432,17 +1432,17 @@ test_copy(hid_t fapl, hbool_t new_format) error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: test_move_preserves * @@ -1608,16 +1608,16 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose(fcpl_id); - H5Pclose(lcpl_id); - H5Pclose(lcpl2_id); + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_move_preserves() */ - + /*------------------------------------------------------------------------- * Function: test_deprec * @@ -1640,7 +1640,7 @@ test_deprec(hid_t fapl, hbool_t new_format) hid_t file_id = -1; hid_t group1_id = -1; hid_t group2_id = -1; - H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; + H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; H5G_obj_t obj_type; /* Object type */ hsize_t num_objs; /* Number of objects in a group */ char filename[1024]; @@ -1768,7 +1768,7 @@ error: } /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: external_link_root * @@ -1788,14 +1788,14 @@ error: static int external_link_root(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t linfo; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t linfo; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - const char *file; /* File from external link */ - const char *path; /* Path from external link */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + const char *file; /* File from external link */ + const char *path; /* Path from external link */ if(new_format) TESTING("external link to root (w/new group format)") @@ -1824,21 +1824,21 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Create external link to object in first file */ @@ -1848,21 +1848,21 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Close and re-open file to ensure that data is written to disk */ @@ -1945,14 +1945,14 @@ external_link_root(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_root() */ - + /*------------------------------------------------------------------------- * Function: external_link_path * @@ -1973,11 +1973,11 @@ external_link_root(hid_t fapl, hbool_t new_format) static int external_link_path(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external link to object on path (w/new group format)") @@ -2053,14 +2053,14 @@ external_link_path(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_path() */ - + /*------------------------------------------------------------------------- * Function: external_link_mult * @@ -2081,13 +2081,13 @@ external_link_path(hid_t fapl, hbool_t new_format) static int external_link_mult(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1), fid2 = (-1); /* File IDs */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1), fid2 = (-1); /* File IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links across multiple files (w/new group format)") @@ -2217,14 +2217,14 @@ external_link_mult(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_mult() */ - + /*------------------------------------------------------------------------- * Function: external_link_self * @@ -2244,13 +2244,13 @@ external_link_mult(hid_t fapl, hbool_t new_format) static int external_link_self(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lcpl_id = (-1); /* Link Creation Property List ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t lcpl_id = (-1); /* Link Creation Property List ID */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - char filename3[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + char filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external link to self (w/new group format)") @@ -2365,15 +2365,15 @@ external_link_self(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(lcpl_id); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(lcpl_id); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_self() */ - + /*------------------------------------------------------------------------- * Function: external_link_pingpong * @@ -2401,11 +2401,11 @@ external_link_self(hid_t fapl, hbool_t new_format) static int external_link_pingpong(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links back and forth (w/new group format)") @@ -2488,14 +2488,14 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_pingpong() */ - + /*------------------------------------------------------------------------- * Function: external_link_toomany * @@ -2536,11 +2536,11 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) static int external_link_toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("too many external links (w/new group format)") @@ -2603,9 +2603,9 @@ external_link_toomany(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "link1", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); - goto error; + H5_FAILED(); + HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); + goto error; } /* Open object through external link */ @@ -2632,14 +2632,14 @@ external_link_toomany(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_toomany() */ - + /*------------------------------------------------------------------------- * Function: external_link_dangling * @@ -2660,12 +2660,12 @@ external_link_toomany(hid_t fapl, hbool_t new_format) static int external_link_dangling(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t rid = (-1); /* Root Group ID */ hid_t status = (-1); /* Status */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("dangling external links (w/new group format)") @@ -2704,9 +2704,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through dangling object external link */ @@ -2714,9 +2714,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Try to get name of object by index through dangling file external link */ @@ -2740,22 +2740,22 @@ external_link_dangling(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_dangling() */ - + /*------------------------------------------------------------------------- * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set - * by H5Pset_elink_prefix() + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" + * Should be able to access the target file in tmp directory via the prefix set + * by H5Pset_elink_prefix() * * * Return: Success: 0 @@ -2771,12 +2771,12 @@ external_link_dangling(hid_t fapl, hbool_t new_format) static int external_link_prefix(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t gapl_id = (-1); - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + hid_t gapl_id = (-1); + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via H5Pset_elink_prefix()(w/new group format)") @@ -2790,7 +2790,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* create tmp directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + TEST_ERROR /* set up name for target file: "tmp/extlinks2" */ h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); @@ -2821,9 +2821,9 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -2835,20 +2835,20 @@ external_link_prefix(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_prefix() */ - + /*------------------------------------------------------------------------- * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" - * Should be able to access the target file via the main file's absolute path + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" + * 3. target file: "tmp/extlinks3" + * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 * Failure: -1 @@ -2863,13 +2863,13 @@ external_link_prefix(hid_t fapl, hbool_t new_format) static int external_link_abs_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's absolute path (w/new group format)") @@ -2887,7 +2887,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Window: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -2915,9 +2915,9 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from absolute path set for main file */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -2929,20 +2929,20 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_abs_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_rel_mainpath: test 4 * - * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" - * Should be able to access the target file via the main file's CWD+relative path + * Purpose: 1. target link: "extlinks4" + * 2. main file: "tmp/extlinks0" + * 3. target file: "tmp/extlinks4" + * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 * Failure: -1 @@ -2957,11 +2957,11 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) static int external_link_rel_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + relative path(w/new group format)") @@ -3001,9 +3001,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the main file's relative pathname */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3015,19 +3015,19 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_rel_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 2. target file: "extlinks5" - * Should be able to access the target file in the current working directory + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 2. target file: "extlinks5" + * Should be able to access the target file in the current working directory * * * Return: Success: 0 @@ -3043,11 +3043,11 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) static int external_link_cwd(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; @@ -3065,7 +3065,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3093,9 +3093,9 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the current working directory */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3107,21 +3107,21 @@ external_link_cwd(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_cwd() */ - + /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:":/CWD/tmp/extlinks6" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" - * Should be able to access the target file's absolute path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks6" + * Should be able to access the target file's absolute path * * Return: Success: 0 * Failure: -1 @@ -3136,12 +3136,12 @@ external_link_cwd(hid_t fapl, hbool_t new_format) static int external_link_abstar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; if(new_format) @@ -3159,7 +3159,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* * set up name for external linked target file: * Linux: "/CWD/tmp/extlinks6" - * Windows: ":/CWD/tmp/extlinks6" + * Windows: ":/CWD/tmp/extlinks6" */ fix_ext_filename(tmpname, cwdpath, FILENAME[23]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3189,9 +3189,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* should be able to find the target file with abolute path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3203,8 +3203,8 @@ external_link_abstar(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_abstar() */ @@ -3213,9 +3213,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format) * Function: external_link_abstar_cur: test 7 * * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: ":/CWD/tmp/extlinks7" - * 2. main file: "extlinks0" - * 3. target file: "extlinks7" - * Should be able to access the target file via the main file's CWD. + * 2. main file: "extlinks0" + * 3. target file: "extlinks7" + * Should be able to access the target file via the main file's CWD. * * Return: Success: 0 * Failure: -1 @@ -3230,13 +3230,13 @@ external_link_abstar(hid_t fapl, hbool_t new_format) static int external_link_abstar_cur(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD (w/new group format)") @@ -3256,7 +3256,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* * set up name for external linked target file: * Linux: "/CWD/tmp/extlinks7" - * Windows: ":/CWD/tmp/extlinks7" + * Windows: ":/CWD/tmp/extlinks7" */ fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3283,9 +3283,9 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* should be able to find the target file from main file's current working directory */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory."); + goto error; } /* closing for main file */ @@ -3297,20 +3297,20 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_abstar_cur() */ - + /*------------------------------------------------------------------------- * Function: external_link_reltar: test 8 * * Purpose: 1. target link: Linux:"tmp/extlinks8" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" - * Should be able to access the target file via the main file's CWD+ target's relative path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks8" + * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 * Failure: -1 @@ -3325,10 +3325,10 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) static int external_link_reltar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + target's relative path(w/new group format)") @@ -3363,9 +3363,9 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* end if */ /* closing for main file */ @@ -3377,22 +3377,22 @@ external_link_reltar(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_reltar() */ - + /*------------------------------------------------------------------------- * Function: external_link_chdir: test 9 * * Purpose: - * 1. target link: "extlinks9" - * 2. main file: "extlinks0" - * 3. target file" "tmp/extlinks9" - * 3. chdir "tmp" - * Should be able to access the target file in current working directory + * 1. target link: "extlinks9" + * 2. main file: "extlinks0" + * 3. target file" "tmp/extlinks9" + * 3. chdir "tmp" + * Should be able to access the target file in current working directory * * Return: Success: 0 * Failure: -1 @@ -3407,11 +3407,11 @@ external_link_reltar(hid_t fapl, hbool_t new_format) static int external_link_chdir(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via chdir and found in current working directory (w/new group format)") @@ -3460,9 +3460,9 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * main file's current working directory + pathname of external linked targetfile */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3474,28 +3474,28 @@ external_link_chdir(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_chdir() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl1: test 10 * * Purpose: To verify that the external linked target file with physical layout - * different from the parent can be successfully opened. - * - * 1. target link: "extlinks16" - * 2. target file: "extlinks16" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file A to be a "family" file: extlinks16A - * 4. Create target file B to be a "multi" file: extlinks16B - * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A - * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B - * 6. Should succeed in opening the target object: ext_extA - * 6. Should succeed in opening the target object: ext_extB + * different from the parent can be successfully opened. + * + * 1. target link: "extlinks16" + * 2. target file: "extlinks16" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file A to be a "family" file: extlinks16A + * 4. Create target file B to be a "multi" file: extlinks16B + * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A + * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B + * 6. Should succeed in opening the target object: ext_extA + * 6. Should succeed in opening the target object: ext_extB * * Return: Success: 0 * Failure: -1 @@ -3510,22 +3510,22 @@ external_link_chdir(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl1(hid_t fapl, hbool_t new_format) { - hid_t fid=(-1); - hid_t fidA=(-1), fidB=(-1); - hid_t gidA=(-1), gidB=(-1); - hid_t oidA=(-1), oidB=(-1); - char filename1[NAME_BUF_SIZE], - filename2A[NAME_BUF_SIZE], - filename2B[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid=(-1); + hid_t fidA=(-1), fidB=(-1); + hid_t gidA=(-1), gidB=(-1); + hid_t oidA=(-1), oidB=(-1); + char filename1[NAME_BUF_SIZE], + filename2A[NAME_BUF_SIZE], + filename2B[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; - hid_t fam_fapl=-1, multi_fapl=-1; - hid_t lapl_idA=-1, lapl_idB=-1; - H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; + hid_t fam_fapl=-1, multi_fapl=-1; + hid_t lapl_idA=-1, lapl_idB=-1; + H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; char sv[H5FD_MEM_NTYPES][64]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; if(new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)") @@ -3533,11 +3533,11 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts") if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + TEST_ERROR /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3560,8 +3560,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(sv, 0, sizeof sv); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_map[mt] = H5FD_MEM_SUPER; - memb_fapl[mt] = H5P_DEFAULT; + memb_map[mt] = H5FD_MEM_SUPER; + memb_fapl[mt] = H5P_DEFAULT; } /* end for */ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; @@ -3569,27 +3569,27 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsnprintf(sv[H5FD_MEM_SUPER], sizeof(sv[H5FD_MEM_SUPER]), "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsnprintf(sv[H5FD_MEM_BTREE], sizeof(sv[H5FD_MEM_BTREE]), "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsnprintf(sv[H5FD_MEM_DRAW], sizeof(sv[H5FD_MEM_DRAW]), "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsnprintf(sv[H5FD_MEM_GHEAP], sizeof(sv[H5FD_MEM_GHEAP]), "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); + HDsnprintf(sv[H5FD_MEM_LHEAP], sizeof(sv[H5FD_MEM_LHEAP]), "%%s-%c.h5", 'l'); memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX/3)*2; - sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); + HDsnprintf(sv[H5FD_MEM_OHDR], sizeof(sv[H5FD_MEM_OHDR]), "%%s-%c.h5", 'o'); memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX/6)*5; @@ -3621,10 +3621,10 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* Create external link to target file A:/A */ if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Create external link to target file B:/B */ if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Set file access property list for link access to use the family driver */ if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR @@ -3635,9 +3635,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object A in the current working directory */ if (oidA < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening family target file A in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening family target file A in current working directory"); + goto error; } /* Set file access property list for link access to use the multi driver */ @@ -3649,9 +3649,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object B in the current working directory */ if (oidB < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening multi target file B in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening multi target file B in current working directory"); + goto error; } /* closing */ @@ -3668,38 +3668,38 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose (lapl_idA); - H5Pclose (lapl_idB); - H5Pclose (fam_fapl); - H5Pclose (multi_fapl); - H5Gclose (gidA); - H5Gclose (gidB); - H5Oclose (oidA); - H5Oclose (oidB); - H5Fclose (fid); + H5Pclose (lapl_idA); + H5Pclose (lapl_idB); + H5Pclose (fam_fapl); + H5Pclose (multi_fapl); + H5Gclose (gidA); + H5Gclose (gidB); + H5Oclose (oidA); + H5Oclose (oidB); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl1() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl2: test 11 * * Purpose: To verify that processing done to the external linked target object is - * correctly handled when the parent and target files have the same - * physical layout but different access methods. - * - * 1. target link: "extlinks17" - * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file to be a "core" file:/A/Dataset - * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset - * 6. Set the file access property list of the link access to use "core" file without - * backing store - * 6. Should succeed in opening the target dataset: ext_link - * 7. Write data to the target dataset - * 8. On closing, the file size of target should be the same as before since - * it is opened without backing store. + * correctly handled when the parent and target files have the same + * physical layout but different access methods. + * + * 1. target link: "extlinks17" + * 2. target file: "extlinks17" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file to be a "core" file:/A/Dataset + * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset + * 6. Set the file access property list of the link access to use "core" file without + * backing store + * 6. Should succeed in opening the target dataset: ext_link + * 7. Write data to the target dataset + * 8. On closing, the file size of target should be the same as before since + * it is opened without backing store. * * Return: Success: 0 * Failure: -1 @@ -3714,17 +3714,17 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; hsize_t dims[2]; - int points[NUM40][NUM40]; - h5_stat_size_t filesize, new_filesize; - int i, j, n; + int points[NUM40][NUM40]; + h5_stat_size_t filesize, new_filesize; + int i, j, n; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") @@ -3736,7 +3736,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3760,12 +3760,16 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create dataset creation property list */ - if((dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g)) < 0) TEST_ERROR; + if (dcpl_g == H5P_DEFAULT) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + else + dcpl = H5Pcopy(dcpl_g); + if (0 > dcpl) TEST_ERROR; if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR /* closing for target file */ if(H5Pclose(dcpl) < 0) TEST_ERROR @@ -3825,39 +3829,39 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); - H5Pclose(core_fapl); - H5Pclose(dapl_id); - H5Dclose(did); - H5Gclose(gid); - H5Fclose(fid); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); + H5Pclose(core_fapl); + H5Pclose(dapl_id); + H5Dclose(did); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl2() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl3: test 12 * * Purpose: To verify that the file access property list for link access is - * set and closed correctly. - * - * 1. Create fapl for core driver - * 2. Create fapl for stdio driver - * 3. Set link access's fapl to use stdio driver - * 4. Verify that link access's fapl is the stdio driver - * 5. Reset the link access' fapl to use core driver - * 6. H5Pcopy() the link access - * 7. Get the fapl property value of the original link access - * 8. Close the original link access - * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl - * 10. Verify that the copied link access's fapl is the core driver - * 11. Get the fapl property value of the copied link access - * 12. H5Premove() the fapl property from the copied link access - * 13. H5Pclose() fapl set in the copied link access should fail since the - * removal in #12 should also close its fapl + * set and closed correctly. + * + * 1. Create fapl for core driver + * 2. Create fapl for stdio driver + * 3. Set link access's fapl to use stdio driver + * 4. Verify that link access's fapl is the stdio driver + * 5. Reset the link access' fapl to use core driver + * 6. H5Pcopy() the link access + * 7. Get the fapl property value of the original link access + * 8. Close the original link access + * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl + * 10. Verify that the copied link access's fapl is the core driver + * 11. Get the fapl property value of the copied link access + * 12. H5Premove() the fapl property from the copied link access + * 13. H5Pclose() fapl set in the copied link access should fail since the + * removal in #12 should also close its fapl * * Return: Success: 0 * Failure: -1 @@ -3873,7 +3877,7 @@ static int external_set_elink_fapl3(hbool_t new_format) { hid_t core_fapl = -1, stdio_fapl = -1; - hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; + hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; if(new_format) TESTING("H5Pset/get_fapl() (w/new group format)") @@ -3941,7 +3945,7 @@ external_set_elink_fapl3(hbool_t new_format) return -1; } /* end external_set_elink_fapl3() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_acc_flags * @@ -4162,7 +4166,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo return -1; } /* end external_set_elink_acc_flags() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_cb * @@ -4238,7 +4242,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) op_data.target_file = filename2; /* Core file driver has issues when used as the member file driver for a family file */ /* Family file driver cannot be used with family or multi drivers for member files */ - /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) + /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) would report FALSE, causing problems */ base_driver = H5Pget_driver(fapl); op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI @@ -4329,7 +4333,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) return -1; } /* end external_set_elink_cb() */ - + /*------------------------------------------------------------------------- * Function: external_reset_register * @@ -4390,14 +4394,14 @@ external_reset_register(void) return -1; } /* end external_reset_register() */ - + #ifdef H5_HAVE_WINDOW_PATH /*------------------------------------------------------------------------- * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" + * 1. target link: "/CWD/tmp/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks10" * Should be able to find the target file via main file's current drive/rel path @@ -4415,13 +4419,13 @@ external_reset_register(void) static int external_link_win1(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's current drive/rel path(windows)(w/new group format)") @@ -4465,9 +4469,9 @@ external_link_win1(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's CWD*/ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4479,21 +4483,21 @@ external_link_win1(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win1() */ - + /*------------------------------------------------------------------------- * Function: external_link_win2 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks11" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" - * Should be able to access the target file directly (rel drive/abs path) + * 1. target link: "/CWD/tmp/extlinks11" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks11" + * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 * Failure: -1 @@ -4508,13 +4512,13 @@ external_link_win1(hid_t fapl, hbool_t new_format) static int external_link_win2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's rel drive/abs path directly(windows)(w/new group format)") @@ -4559,9 +4563,9 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4573,21 +4577,21 @@ external_link_win2(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win2() */ - + /*------------------------------------------------------------------------- * Function: external_link_win3 * * Purpose: - * 1. target link: ":tmp/extlinks12" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" - * Should be able to access the target file directly (abs drive/rel path) + * 1. target link: ":tmp/extlinks12" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks12" + * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 * Failure: -1 @@ -4602,13 +4606,13 @@ external_link_win2(hid_t fapl, hbool_t new_format) static int external_link_win3(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)") @@ -4652,9 +4656,9 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4666,20 +4670,20 @@ external_link_win3(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win3() */ - + /*------------------------------------------------------------------------- * Function: external_link_win4 * * Purpose: - * 1. target link: ":extlinks13" - * 2. main file: ":tmp/extlinks0" - * 3. target file: tmp/extlinks13 - * Should be able to access the target file via main file's abs drive/rel path + * 1. target link: ":extlinks13" + * 2. main file: ":tmp/extlinks0" + * 3. target file: tmp/extlinks13 + * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4694,13 +4698,13 @@ external_link_win3(hid_t fapl, hbool_t new_format) static int external_link_win4(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)") @@ -4741,9 +4745,9 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's absolute drive/relative path */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4755,21 +4759,21 @@ external_link_win4(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win4() */ - + /*------------------------------------------------------------------------- * Function: external_link_win5 * * Purpose: - * 1. target link: ":tmp/extlinks14" - * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" - * Should be able to access the target file via main file's relative drive/absolute path + * 1. target link: ":tmp/extlinks14" + * 2. main file: "/CWD/extlinks0" + * 3. target file: "tmp/extlinks14" + * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 * Failure: -1 @@ -4784,13 +4788,13 @@ external_link_win4(hid_t fapl, hbool_t new_format) static int external_link_win5(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; if(new_format) @@ -4841,9 +4845,9 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's rel drive/abs path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4855,21 +4859,21 @@ external_link_win5(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win5() */ - + /*------------------------------------------------------------------------- * Function: external_link_win6 * * Purpose: - * 1. target link: ":tmp/extlinks15" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" - * Should be able to access the target file via target's current drive/rel path + * 1. target link: ":tmp/extlinks15" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks15" + * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4884,13 +4888,13 @@ external_link_win5(hid_t fapl, hbool_t new_format) static int external_link_win6(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's current drive/rel path (windows)(w/new group format)") @@ -4938,9 +4942,9 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* should be able to find the target file via target file's rel path in current drive */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4952,13 +4956,13 @@ external_link_win6(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win6() */ - + /*------------------------------------------------------------------------- * Function: external_link_win7 * @@ -5045,7 +5049,7 @@ external_link_win7(hid_t fapl, hbool_t new_format) return -1; } /* end external_link_win7() */ - + /*------------------------------------------------------------------------- * Function: external_link_win8 * @@ -5137,7 +5141,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) return -1; } /* end external_link_win8() */ - + /*------------------------------------------------------------------------- * Function: external_link_win9 * @@ -5226,7 +5230,7 @@ external_link_win9(hid_t fapl, hbool_t new_format) #endif /* H5_HAVE_WINDOW_PATH */ - + /*------------------------------------------------------------------------- * Function: external_link_recursive * @@ -5245,9 +5249,9 @@ external_link_win9(hid_t fapl, hbool_t new_format) static int external_link_recursive(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("recursive external links (w/new group format)") @@ -5275,9 +5279,9 @@ external_link_recursive(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for recursive external links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for recursive external links."); + goto error; } /* Close first file */ @@ -5289,13 +5293,13 @@ external_link_recursive(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_recursive() */ - + /*------------------------------------------------------------------------- * Function: external_link_query * @@ -5315,14 +5319,14 @@ external_link_recursive(hid_t fapl, hbool_t new_format) static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ const char *file_name; /* Name of the file the external link points to */ const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ + H5O_info_t oi; /* Object information */ H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) @@ -5345,9 +5349,9 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Close file */ @@ -5371,9 +5375,9 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Get information for external link. It should be two strings right after each other */ @@ -5389,9 +5393,9 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Query information about object that external link points to */ if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been a group"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; } /* Close first file */ @@ -5419,13 +5423,13 @@ external_link_query(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_query() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_compact * @@ -5442,10 +5446,10 @@ error: static int external_link_unlink_compact(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("unlinking external link in compact group (w/new group format)") @@ -5504,14 +5508,14 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_compact() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_dense * @@ -5528,13 +5532,13 @@ error: static int external_link_unlink_dense(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ @@ -5650,14 +5654,14 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_dense() */ - + /*------------------------------------------------------------------------- * Function: external_link_move * @@ -5674,11 +5678,11 @@ error: static int external_link_move(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("move external link (w/new group format)") @@ -5841,14 +5845,14 @@ external_link_move(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_move() */ - + /*------------------------------------------------------------------------- * Function: external_link_ride * @@ -5866,13 +5870,13 @@ error: static int external_link_ride(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ @@ -6027,14 +6031,14 @@ external_link_ride(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { H5Pclose(gcpl); - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_ride() */ - + /*------------------------------------------------------------------------- * Function: external_link_closing * @@ -6056,11 +6060,11 @@ external_link_closing(hid_t fapl, hbool_t new_format) hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); hid_t lcpl_id=(-1); hsize_t dims[2]; - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ - buf[NAME_BUF_SIZE]; /* misc. buffer */ + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ H5L_info_t li; H5O_info_t oi; hobj_ref_t obj_ref; @@ -6267,7 +6271,7 @@ error: return -1; } /* external_link_closing() */ - + /*------------------------------------------------------------------------- * Function: ext_link_endian * @@ -6286,8 +6290,8 @@ error: static int external_link_endian(hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t lapl_id = (-1); /* Prop List ID */ const char *pathbuf = H5_get_srcdir(); /* Path to the files */ const char *namebuf; @@ -6335,14 +6339,14 @@ external_link_endian(hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } - + /*------------------------------------------------------------------------- * Function: external_link_strong * @@ -6364,7 +6368,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) hid_t fid1 = (-1), fid2 = (-1); /* File ID */ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; if(new_format) @@ -6427,7 +6431,7 @@ error: return -1; } /* end external_link_strong() */ - + /*------------------------------------------------------------------------- * Function: external_symlink * @@ -6448,17 +6452,17 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #ifdef H5_HAVE_SYMLINK hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2a[NAME_BUF_SIZE], + filename2b[NAME_BUF_SIZE], + filename3a[NAME_BUF_SIZE], + filename3b[NAME_BUF_SIZE], + filename4a[NAME_BUF_SIZE], + filename4b[NAME_BUF_SIZE], + filename5a[NAME_BUF_SIZE], + filename5b[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ @@ -6616,8 +6620,8 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) PASSED(); } /* end if */ else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); } /* end else */ return 0; @@ -6643,7 +6647,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #endif /* H5_HAVE_SYMLINK */ } /* end external_symlink() */ - + /*------------------------------------------------------------------------- * Function: external_copy_invalid_object * @@ -6716,7 +6720,7 @@ error: return -1; } /* end external_copy_invalid_object */ - + /*------------------------------------------------------------------------- * Function: external_dont_fail_to_source * @@ -6780,7 +6784,7 @@ error: return -1; } /* end external_dont_fail_to_source */ - + /*------------------------------------------------------------------------- * Function: external_file_cache * @@ -7173,7 +7177,7 @@ error: return -1; } /* end external_file_cache */ - + /*------------------------------------------------------------------------- * Function: external_open_twice * @@ -7409,7 +7413,7 @@ error: return -1; } /* end external_open_twice() */ - + /*------------------------------------------------------------------------- * Function: external_link_with_committed_datatype * @@ -7432,24 +7436,24 @@ error: static int external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) { - hid_t fid1 = -1, fid2 = -1; /* File IDs */ - hid_t gid1 = -1, gid2 = -1; /* Group IDs */ - hid_t tid = -1; /* Datatype ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t sid2 = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t atid = -1; /* Attribute's datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t dtid = -1; /* Dataset's datatype ID */ - hid_t dcpl = -1; /* Dataset creation property list */ - int wdata = 99; /* Attribute data written */ - int wbuf[60]; /* Data buffer for writing */ - int rbuf[60]; /* Data buffer for reading */ - int i; /* Local index variable */ - char filename1[NAME_BUF_SIZE]; /* File name for main file */ - char filename2[NAME_BUF_SIZE]; /* File name for target file */ - hsize_t dims[2] = {5, 12}; /* Dimension sizes */ - hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ + hid_t fid1 = -1, fid2 = -1; /* File IDs */ + hid_t gid1 = -1, gid2 = -1; /* Group IDs */ + hid_t tid = -1; /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t sid2 = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t atid = -1; /* Attribute's datatype ID */ + hid_t did = -1; /* Dataset ID */ + hid_t dtid = -1; /* Dataset's datatype ID */ + hid_t dcpl = -1; /* Dataset creation property list */ + int wdata = 99; /* Attribute data written */ + int wbuf[60]; /* Data buffer for writing */ + int rbuf[60]; /* Data buffer for reading */ + int i; /* Local index variable */ + char filename1[NAME_BUF_SIZE]; /* File name for main file */ + char filename2[NAME_BUF_SIZE]; /* File name for target file */ + hsize_t dims[2] = {5, 12}; /* Dimension sizes */ + hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ if(new_format) TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)") @@ -7534,8 +7538,8 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) /* Initialize data buffers */ for(i = 0; i < 60; i++) { - wbuf[i] = i; - rbuf[i] = 0; + wbuf[i] = i; + rbuf[i] = 0; } /* Create a dataset with the committed datatype in the group */ @@ -7681,13 +7685,13 @@ error: H5Aclose(atid); H5Aclose(dtid); - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY return -1; } /* end external_link_with_committed_datatype() */ - + /*------------------------------------------------------------------------- * Function: ud_hard_links * @@ -7875,12 +7879,12 @@ const H5L_class_t UD_hard_class[1] = {{ static int ud_hard_links(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; TESTING("user-defined hard link (w/new group format)") @@ -7952,9 +7956,9 @@ ud_hard_links(hid_t fapl) /* UD hard links have no query function, thus return a "link length" of 0 */ if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* end if */ /* Unlink the group pointed to by the UD link. It shouldn't be @@ -7985,14 +7989,14 @@ ud_hard_links(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end ud_hard_links() */ - + /*------------------------------------------------------------------------- * Function: UD_rereg_traverse * @@ -8042,11 +8046,11 @@ const H5L_class_t UD_rereg_class[1] = {{ static int ud_link_reregister(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ TESTING("registering a new class for existing UD links (w/new group format)") @@ -8171,14 +8175,14 @@ ud_link_reregister(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end ud_link_reregister() */ - + /*------------------------------------------------------------------------- * Function: ud_callbacks * @@ -8315,12 +8319,12 @@ const H5L_class_t UD_cb_class[1] = {{ static int ud_callbacks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t lcpl = (-1); /* Link Creation PL */ H5L_info_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; if(new_format) @@ -8367,9 +8371,9 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != 16) TEST_ERROR if (UD_CB_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* Fill the query buffer */ @@ -8428,14 +8432,14 @@ ud_callbacks(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose (lcpl); - H5Gclose (gid); - H5Fclose (fid); + H5Pclose (lcpl); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end ud_callbacks() */ - + /*------------------------------------------------------------------------- * Function: lapl_udata * @@ -8487,12 +8491,12 @@ const H5L_class_t UD_plist_class[1] = {{ static int lapl_udata(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t plist_id = (-1); /* Property List ID */ - char group_a_name[NAME_BUF_SIZE]; - char group_b_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + char group_a_name[NAME_BUF_SIZE]; + char group_b_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("user data passed through lapl (w/new group format)") @@ -8567,15 +8571,15 @@ lapl_udata(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose (plist_id); - H5Gclose (gid); - H5Gclose (gid2); - H5Fclose (fid); + H5Pclose (plist_id); + H5Gclose (gid); + H5Gclose (gid2); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end lapl_udata() */ - + /*------------------------------------------------------------------------- * Function: ud_link_errors * @@ -8785,10 +8789,10 @@ const H5L_class_t UD_error4_class[1] = {{ static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; H5L_info_t li; /* Link information */ @@ -8827,6 +8831,12 @@ ud_link_errors(hid_t fapl, hbool_t new_format) TEST_ERROR } H5E_END_TRY + /* Try to create a link with H5Lcreate_ud that has a NULL udata pointer, but a non-zero udata_size value */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR + } H5E_END_TRY; + /* Create a user-defined link to the group. */ strcpy(group_name, "/group"); if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -8896,13 +8906,13 @@ ud_link_errors(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end ud_link_errors() */ - + /*------------------------------------------------------------------------- * Function: lapl_nlinks * @@ -8923,15 +8933,15 @@ error: static int lapl_nlinks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist = (-1); /* lapl ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t plist = (-1); /* lapl ID */ hid_t tid = (-1), sid = (-1), did = (-1); /* Other IDs */ hid_t gapl = (-1), dapl = (-1), tapl = (-1); /* Other property lists */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; size_t nlinks; /* nlinks for H5Pset_nlinks */ - hsize_t dims[2]; + hsize_t dims[2]; if(new_format) TESTING("adjusting nlinks with LAPL (w/new group format)") @@ -9017,9 +9027,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) gid = H5Oopen(fid, "soft5", plist); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through lesser soft link */ @@ -9125,21 +9135,21 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose(gapl); - H5Pclose(dapl); - H5Pclose(tapl); - H5Dclose(did); - H5Sclose(sid); - H5Tclose(tid); - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(plist); - H5Fclose(fid); + H5Pclose(gapl); + H5Pclose(dapl); + H5Pclose(tapl); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(plist); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end lapl_nlinks() */ - + /*------------------------------------------------------------------------- * Function: linkinfo * @@ -9156,12 +9166,12 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t tid = (-1); /* Type ID */ hid_t sid = (-1), did = -(1); /* Dataspace and dataset IDs */ H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") @@ -9218,15 +9228,15 @@ linkinfo(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Tclose (tid); - H5Dclose (did); - H5Gclose (gid); - H5Fclose (fid); + H5Tclose (tid); + H5Dclose (did); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end linkinfo() */ - + /*------------------------------------------------------------------------- * Function: check_all_closed * @@ -9281,7 +9291,7 @@ error: } /* end check_all_closed() */ - + /*------------------------------------------------------------------------- * Function: build_visit_file * @@ -9381,7 +9391,7 @@ error: return -1; } /* end build_visit_file() */ - + /*------------------------------------------------------------------------- * Function: visit_link_cb * @@ -9411,7 +9421,7 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t return(H5_ITER_CONT); } /* end visit_link_cb() */ - + /*------------------------------------------------------------------------- * Function: link_visit * @@ -9481,7 +9491,7 @@ error: return -1; } /* end link_visit() */ - + /*------------------------------------------------------------------------- * Function: link_visit_by_name * @@ -9559,7 +9569,7 @@ error: return -1; } /* end link_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_cb * @@ -9589,7 +9599,7 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t * return(H5_ITER_CONT); } /* end visit_obj_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit * @@ -9659,7 +9669,7 @@ error: return -1; } /* end obj_visit() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_by_name * @@ -9738,7 +9748,7 @@ error: return -1; } /* end obj_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_stop_cb * @@ -9763,7 +9773,7 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name return(H5_ITER_STOP); } /* end visit_obj_stop_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_stop * @@ -9822,7 +9832,7 @@ error: return -1; } /* end obj_visit_stop() */ - + /*------------------------------------------------------------------------- * Function: link_filters * @@ -9914,7 +9924,7 @@ link_filters(hid_t fapl, hbool_t new_format) int nfilters = 0; H5Z_class2_t filter_class; char name_out[24]; - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; htri_t tri_ret; herr_t status; @@ -10202,7 +10212,7 @@ error: return -1; } /* end link_filters() */ - + /*------------------------------------------------------------------------- * Function: obj_exists * @@ -10490,7 +10500,7 @@ error: return -1; } /* end obj_exists() */ - + /*------------------------------------------------------------------------- * Function: corder_create_empty * @@ -10507,10 +10517,10 @@ error: static int corder_create_empty(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - unsigned crt_order_flags; /* Status of creation order info for GCPL */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + unsigned crt_order_flags; /* Status of creation order info for GCPL */ herr_t ret; /* Generic return value */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10532,9 +10542,9 @@ corder_create_empty(hid_t fapl) ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); } H5E_END_TRY; if(ret > 0) { - H5_FAILED(); - HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); + TEST_ERROR } /* end if */ /* Set creation order tracking & indexing on group */ @@ -10597,7 +10607,7 @@ error: return -1; } /* end corder_create_empty() */ - + /*------------------------------------------------------------------------- * Function: corder_create_compact * @@ -10615,12 +10625,12 @@ error: static int corder_create_compact(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10715,7 +10725,7 @@ error: return -1; } /* end corder_create_compact() */ - + /*------------------------------------------------------------------------- * Function: corder_create_dense * @@ -10733,12 +10743,12 @@ error: static int corder_create_dense(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -10848,7 +10858,7 @@ error: return -1; } /* end corder_create_dense() */ - + /*------------------------------------------------------------------------- * Function: corder_transition * @@ -10866,12 +10876,12 @@ error: static int corder_transition(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ h5_stat_size_t empty_size; /* Size of empty file */ @@ -11077,7 +11087,7 @@ error: return -1; } /* end corder_transition() */ - + /*------------------------------------------------------------------------- * Function: corder_delete * @@ -11096,9 +11106,9 @@ error: static int corder_delete(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ hsize_t name_count; /* # of records in name index */ @@ -11118,7 +11128,7 @@ corder_delete(hid_t fapl) /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Creating file with latest format will enable paged aggregation with persistent fs */ + /* Creating file with latest format will enable paged aggregation with persistent fs */ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Close file */ @@ -11206,14 +11216,14 @@ error: return -1; } /* end corder_delete() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_check * * Purpose: Support routine for link_info_by_idx, to verify the link * info is correct for a link * - * Note: This routine assumes that the links have been inserted in the + * Note: This routine assumes that the links have been inserted in the * group in alphabetical order. * * Return: Success: 0 @@ -11365,7 +11375,7 @@ error: return(-1); } /* end link_info_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx * @@ -11383,9 +11393,9 @@ error: static int link_info_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned hard_link; /* Create hard or soft link? */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11449,7 +11459,7 @@ link_info_by_idx(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11491,7 +11501,7 @@ link_info_by_idx(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11550,7 +11560,7 @@ error: return -1; } /* end link_info_by_idx() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_old * @@ -11568,8 +11578,8 @@ error: static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ unsigned hard_link; /* Create hard or soft link? */ H5L_info_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -11717,7 +11727,7 @@ error: return -1; } /* end link_info_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: delete_by_idx * @@ -11735,9 +11745,9 @@ error: static int delete_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -11820,7 +11830,7 @@ delete_by_idx(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11875,7 +11885,7 @@ delete_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11942,7 +11952,7 @@ delete_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -12043,7 +12053,7 @@ error: return -1; } /* end delete_by_idx() */ - + /*------------------------------------------------------------------------- * Function: delete_by_idx_old * @@ -12061,8 +12071,8 @@ error: static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ H5L_info_t linfo; /* Link info struct */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12268,7 +12278,7 @@ error: return -1; } /* end delete_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_cb * @@ -12345,7 +12355,7 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, } /* end link_iterate_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_cb * @@ -12367,7 +12377,7 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_fail_cb * @@ -12389,7 +12399,7 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l return(H5_ITER_ERROR); } /* end link_iterate_fail_cb() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_check * @@ -12550,7 +12560,7 @@ error: return(-1); } /* end link_iterate_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate * @@ -12568,9 +12578,9 @@ error: static int link_iterate(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -12662,7 +12672,7 @@ link_iterate(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -12688,7 +12698,7 @@ link_iterate(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -12746,7 +12756,7 @@ error: return -1; } /* end link_iterate() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_cb * @@ -12817,7 +12827,7 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf } /* end link_iterate_old_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_old_cb * @@ -12839,7 +12849,7 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_old_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_check * @@ -13014,7 +13024,7 @@ error: return(-1); } /* end link_iterate_old_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old * @@ -13031,8 +13041,8 @@ error: static int link_iterate_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13075,7 +13085,7 @@ link_iterate_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13135,7 +13145,7 @@ error: return -1; } /* end link_iterate_old() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_check * @@ -13234,7 +13244,7 @@ error: return(-1); } /* end open_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx * @@ -13252,11 +13262,11 @@ error: static int open_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -13265,7 +13275,7 @@ open_by_idx(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t *objno = NULL; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13356,7 +13366,7 @@ open_by_idx(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13391,7 +13401,7 @@ open_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13464,7 +13474,7 @@ error: return -1; } /* end open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_old * @@ -13482,15 +13492,15 @@ error: static int open_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13533,7 +13543,7 @@ open_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13599,7 +13609,7 @@ error: return -1; } /* end open_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: object_info_check * @@ -13670,7 +13680,7 @@ error: return(-1); } /* end object_info_check() */ - + /*------------------------------------------------------------------------- * Function: object_info * @@ -13688,10 +13698,10 @@ error: static int object_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ @@ -13701,7 +13711,7 @@ object_info(hid_t fapl) H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t *objno = NULL; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13791,7 +13801,7 @@ object_info(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ hid_t attr_id; /* Attribute ID */ /* Make name for link */ @@ -13839,7 +13849,7 @@ object_info(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ hid_t attr_id; /* Attribute ID */ /* Make name for link */ @@ -13921,7 +13931,7 @@ error: return -1; } /* end object_info() */ - + /*------------------------------------------------------------------------- * Function: object_info_old * @@ -13938,15 +13948,15 @@ error: static int object_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13988,7 +13998,7 @@ object_info_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ hid_t attr_id; /* Attribute ID */ /* Make name for link */ @@ -14067,7 +14077,7 @@ error: return -1; } /* end object_info_old() */ - + /*------------------------------------------------------------------------- * Function: group_info * @@ -14085,10 +14095,10 @@ error: static int group_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -14098,7 +14108,7 @@ group_info(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14180,7 +14190,7 @@ group_info(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -14321,7 +14331,7 @@ group_info(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2, group_id3; /* Group IDs */ + hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -14489,7 +14499,7 @@ error: return -1; } /* end group_info() */ - + /*------------------------------------------------------------------------- * Function: group_info_old * @@ -14507,15 +14517,15 @@ error: static int group_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5G_info_t grp_info; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14551,7 +14561,7 @@ group_info_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -14719,7 +14729,7 @@ error: return -1; } /* end group_info_old() */ - + /*------------------------------------------------------------------------- * Function: timestamps * @@ -14737,11 +14747,11 @@ error: static int timestamps(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t group_id2 = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t gcpl_id2 = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t group_id2 = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t gcpl_id2 = (-1); /* Group creation property list ID */ H5O_info_t oinfo, oinfo2; /* Object info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -14882,17 +14892,17 @@ error: return -1; } /* end timestamps() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test links + * Purpose: Test links * - * Return: Success: exit(EXIT_SUCCESS) + * Return: Success: exit(EXIT_SUCCESS) * - * Failure: exit(EXIT_FAILURE) + * Failure: exit(EXIT_FAILURE) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * *------------------------------------------------------------------------- @@ -14900,10 +14910,10 @@ error: int main(void) { - hid_t fapl, fapl2; /* File access property lists */ - int nerrors = 0; + hid_t fapl, fapl2; /* File access property lists */ + int nerrors = 0; unsigned new_format; /* Whether to use the new format or not */ - unsigned minimize_dset_oh; /* Whether to minimize dataset object headers */ + unsigned minimize_dset_oh; unsigned efc; /* Whether to use the external file cache */ const char *env_h5_drvr; /* File Driver value from environment */ @@ -15031,8 +15041,8 @@ main(void) nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; - } /* for with/without external file cache (efc) */ + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + } /* with/without external file cache */ /* These tests assume that external links are a form of UD links, * so assume that everything that passed for external links @@ -15060,10 +15070,11 @@ main(void) /* Keep this test last, it's testing files that are used above */ /* do not do this for files used by external link tests */ nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; - } /* for new/old format */ + } /* new/old format */ /* New group revision feature tests */ nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; + /* XXX: when creation order indexing is fully working, go back and add checks * to these tests to make certain that the creation order values are * correct. @@ -15089,7 +15100,8 @@ main(void) nerrors += group_info_old(fapl) < 0 ? 1 : 0; if (minimize_dset_oh) { - if (H5Pclose(dcpl_g) < 0) TEST_ERROR; + if (H5Pclose(dcpl_g) < 0) + TEST_ERROR; dcpl_g = -1; } } /* [un]minimized dataset object headers */ diff --git a/test/mount.c b/test/mount.c index c6230ee..b7d2858 100644 --- a/test/mount.c +++ b/test/mount.c @@ -192,7 +192,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting a file on itself should have failed."); + HDputs(" Mounting a file on itself should have failed."); TEST_ERROR } /* end if */ @@ -208,7 +208,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting two files at one mount point should have failed."); + HDputs(" Mounting two files at one mount point should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -227,7 +227,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting same file opened twice at one mount point should have failed."); + HDputs(" Mounting same file opened twice at one mount point should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -240,7 +240,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Creating a cycle with mount points should have failed."); + HDputs(" Creating a cycle with mount points should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -423,7 +423,7 @@ test_hide(hid_t fapl) } H5E_END_TRY; if(grp >= 0) { H5_FAILED(); - puts(" Name is still accessible under mount point."); + HDputs(" Name is still accessible under mount point."); TEST_ERROR } /* end if */ @@ -434,7 +434,7 @@ test_hide(hid_t fapl) if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); - puts(" Hard link failed for hidden object."); + HDputs(" Hard link failed for hidden object."); TEST_ERROR } /* end if */ @@ -503,7 +503,7 @@ test_assoc(hid_t fapl) if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); - puts(" Association failed."); + HDputs(" Association failed."); TEST_ERROR } /* end if */ @@ -628,7 +628,7 @@ test_move(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Moving an object across files should't have been possible"); + HDputs(" Moving an object across files should't have been possible"); TEST_ERROR } /* end if */ @@ -834,7 +834,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Incorrect traversal from mount point!"); + HDputs(" Incorrect traversal from mount point!"); TEST_ERROR } /* end if */ @@ -851,7 +851,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Traversal through mount point should not have worked!"); + HDputs(" Traversal through mount point should not have worked!"); TEST_ERROR } /* end if */ H5E_BEGIN_TRY { @@ -859,7 +859,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Traversal through mount point should not have worked!"); + HDputs(" Traversal through mount point should not have worked!"); TEST_ERROR } /* end if */ @@ -873,7 +873,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); + HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__); TEST_ERROR } /* end if */ H5E_BEGIN_TRY { @@ -881,7 +881,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); + HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -1005,7 +1005,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Interfile hard link should not have been allowed!"); + HDputs(" Interfile hard link should not have been allowed!"); TEST_ERROR } /* end if */ @@ -1015,7 +1015,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Interfile renaming should not have been allowed!"); + HDputs(" Interfile renaming should not have been allowed!"); TEST_ERROR } /* end if */ @@ -1033,7 +1033,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(dset >= 0) { H5_FAILED(); - puts(" Dataset and shared type must be in the same file!"); + HDputs(" Dataset and shared type must be in the same file!"); TEST_ERROR } /* end if */ @@ -1172,7 +1172,7 @@ test_close(hid_t fapl) if(H5Fclose(file1) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { H5_FAILED(); - puts(" File1 contents are not accessible!"); + HDputs(" File1 contents are not accessible!"); TEST_ERROR } /* end if */ if(H5Fclose(file2) < 0) FAIL_STACK_ERROR @@ -4379,13 +4379,13 @@ main(void) if (nerrors) goto error; - puts("All mount tests passed."); + HDputs("All mount tests passed."); h5_cleanup(FILENAME, fapl); return 0; error: - puts("***** MOUNT ERRORS *****"); + HDputs("***** MOUNT ERRORS *****"); return 1; } diff --git a/test/objcopy.c b/test/objcopy.c index 09dd459..b4854d0 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -986,15 +986,15 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, * for each */ for(elmt=0; elmtlen - != ((const hvl_t *)memb2)->len) + if(((const hvl_t *)((const void *)memb1))->len + != ((const hvl_t *)((const void *)memb2))->len) TEST_ERROR /* Check vlen data */ if(!compare_data(parent1, parent2, pid, base_id, - ((const hvl_t *)memb1)->len, - ((const hvl_t *)memb1)->p, - ((const hvl_t *)memb2)->p, obj_owner)) + ((const hvl_t *)((const void *)memb1))->len, + ((const hvl_t *)((const void *)memb1))->p, + ((const hvl_t *)((const void *)memb2))->p, obj_owner)) TEST_ERROR /* Update member pointers */ @@ -5875,7 +5875,7 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2) char *v; } s1; s1 rbuf; /* Buffer for data read */ - s1 rbuf2; /* Buffer for data read */ + s1 rbuf2; /* Buffer for data read */ /* Open the attributes attached to the objects */ if((aid = H5Aopen_by_idx(loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -13390,7 +13390,7 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl hid_t fid1 = -1, fid2 = -1; /* File IDs */ hid_t gid = -1; /* Group ID */ int i; - char grp_name[8]; + char grp_name[16]; char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; diff --git a/test/ohdr.c b/test/ohdr.c index 73ae8ac..c959e35 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -21,14 +21,14 @@ * This file needs to access private datatypes from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /* suppress error about including H5Opkg */ #define H5O_TESTING #include "H5Opkg.h" /* * This file needs to access private datatypes from the H5G package. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /* suppress error about including H5Gpkg */ #include "H5Gpkg.h" #include "H5CXprivate.h" /* API Contexts */ @@ -1189,17 +1189,17 @@ error: static herr_t test_ohdr_swmr(hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t fapl = -1; /* File access property list */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t plist = -1; /* Dataset creation property list */ - size_t compact_size = 1024; /* The size of compact dataset */ - int *wbuf = NULL; /* Buffer for writing */ - hsize_t dims[1]; /* Dimension sizes */ - size_t u; /* Iterator */ - int n; /* Data variable */ - H5O_info_t obj_info; /* Information for the object */ + hid_t fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t plist = -1; /* Dataset creation property list */ + size_t compact_size = 1024; /* The size of compact dataset */ + int *wbuf = NULL; /* Buffer for writing */ + hsize_t dims[1]; /* Dimension sizes */ + size_t u; /* Iterator */ + int n; /* Data variable */ + H5O_info_t obj_info; /* Information for the object */ if(new_format) { TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format"); @@ -1636,13 +1636,9 @@ error: * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * - * Modification: - * - Added loop of combinations of low/high library format bounds - * (BMR, Feb 2018) - * *------------------------------------------------------------------------- */ int diff --git a/test/page_buffer.c b/test/page_buffer.c index 3c61ab0..39d6340 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -36,7 +36,7 @@ #include "H5PBprivate.h" -#define FILENAME_LEN 1024 +#define FILENAME_LEN 1024 #define NUM_DSETS 5 #define NX 100 #define NY 50 @@ -97,7 +97,7 @@ create_file(char *filename, hid_t fcpl, hid_t fapl) int i; int num_elements; int j; - char dset_name[10]; + char dset_name[32]; if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; @@ -234,7 +234,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, int i; int j; int num_elements; - char dset_name[10]; + char dset_name[32]; H5F_t *f = NULL; if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) diff --git a/test/tarray.c b/test/tarray.c index 99f7bf8..eb71ad6 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -26,8 +26,8 @@ #define TESTFILE "tarrold.h5" /* 1-D array datatype */ -#define ARRAY1_RANK 1 -#define ARRAY1_DIM1 4 +#define ARRAY1_RANK 1 +#define ARRAY1_DIM1 4 /* 3-D array datatype */ #define ARRAY2_RANK 3 @@ -65,7 +65,7 @@ typedef struct void *test_array_alloc_custom(size_t size, void *info); void test_array_free_custom(void *mem, void *info); - + /*------------------------------------------------------------------------- * Function: test_array_atomic_1d * @@ -189,7 +189,7 @@ test_array_atomic_1d(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_atomic_1d() */ - + /*------------------------------------------------------------------------- * Function: test_array_funcs * @@ -252,7 +252,7 @@ test_array_funcs(void) CHECK(ret, FAIL, "H5Tclose"); } /* end test_array_funcs() */ - + /*------------------------------------------------------------------------- * Function: test_array_atomic_3d * @@ -381,7 +381,7 @@ test_array_atomic_3d(void) } /* end test_array_atomic_3d() */ - + /*------------------------------------------------------------------------- * Function: test_array_array_atomic * @@ -540,7 +540,7 @@ test_array_array_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_array_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_atomic * @@ -747,7 +747,7 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_compound_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_array * @@ -1006,7 +1006,7 @@ test_array_compound_array(void) ** allocated. ** ****************************************************************/ - + /*------------------------------------------------------------------------- * Function: test_array_alloc_custom * @@ -1045,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info) return ret_value; } /* end test_array_alloc_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_free_custom * @@ -1074,14 +1074,14 @@ test_array_free_custom(void *_mem, void *info) if(_mem != NULL) { mem = ((unsigned char *)_mem) - extra; - *mem_used -= *(size_t *)mem; + *mem_used -= *(size_t *)((void *)mem); HDfree(mem); } /* end if */ return; } /* end test_array_free_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_atomic * @@ -1296,7 +1296,7 @@ test_array_vlen_atomic(void) } /* end test_array_vlen_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_array * @@ -1341,7 +1341,7 @@ test_array_vlen_array(void) for(k=0; k<(i+j+1); k++) for(l=0; l * Tuesday, January 6, 2004 * - * Purpose: Provides support functions for the testing framework. + * Purpose: Provides support functions for the testing framework. * */ @@ -28,24 +28,25 @@ #define MAXTESTDESC 64 typedef struct TestStruct { - int NumErrors; - char Description[MAXTESTDESC]; - int SkipFlag; - char Name[MAXTESTNAME]; - void (*Call)(void); - void (*Cleanup)(void); - const void *Parameters; + int NumErrors; + char Description[MAXTESTDESC]; + int SkipFlag; + char Name[MAXTESTNAME]; + void (*Call)(void); + void (*Cleanup)(void); + const void *Parameters; } TestStruct; /* * Variables used by testing framework. */ +static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */ static int num_errs = 0; /* Total number of errors during testing */ int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */ -static int Summary = 0; /* Show test summary. Default is no. */ -static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ -static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ +static int Summary = 0; /* Show test summary. Default is no. */ +static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ +static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ static TestStruct *Test = NULL; /* Array of tests */ static unsigned TestAlloc = 0; /* Size of the Test array */ static unsigned Index = 0; @@ -54,7 +55,7 @@ static const char *TestProgName = NULL; static void (*TestPrivateUsage)(void) = NULL; static int (*TestPrivateParser)(int ac, char *av[]) = NULL; - + /* * Setup a test function and add it to the list of tests. * It must have no parameters and returns void. @@ -74,12 +75,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con /* Sanity checking */ if (HDstrlen(TheDescr) >= MAXTESTDESC) { printf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", - TheDescr, MAXTESTDESC); + TheDescr, MAXTESTDESC); exit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheName) >= MAXTESTNAME) { printf("Test name too long, increase MAXTESTNAME(%d).\n", - MAXTESTNAME); + MAXTESTNAME); exit(EXIT_FAILURE); } /* end if */ @@ -102,12 +103,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con /* Set up test function */ HDstrcpy(Test[Index].Description, TheDescr); if(*TheName != '-') { - HDstrcpy(Test[Index].Name, TheName); - Test[Index].SkipFlag = 0; + HDstrcpy(Test[Index].Name, TheName); + Test[Index].SkipFlag = 0; } - else { /* skip test by default */ - HDstrcpy(Test[Index].Name, TheName+1); - Test[Index].SkipFlag = 1; + else { /* skip test by default */ + HDstrcpy(Test[Index].Name, TheName+1); + Test[Index].SkipFlag = 1; } Test[Index].Call = TheCall; Test[Index].Cleanup = Cleanup; @@ -118,7 +119,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con Index++; } - + /* * Initialize testing framework * @@ -130,8 +131,8 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con * private options. Default to NULL which means none is provided. * * Modifications: - * Albert Cheng 2004/08/17 - * Added the ProgName, private_usage and private_parser arguments. + * Albert Cheng 2004/08/17 + * Added the ProgName, private_usage and private_parser arguments. */ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[])) { @@ -140,62 +141,63 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p * half the functions this test calls are private, so automatic error * reporting wouldn't do much good since it's triggered at the API layer. */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + if (enable_error_stack == 0) + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* * Record the program name and private routines if provided. */ TestProgName = ProgName; - if (NULL != private_usage) - TestPrivateUsage = private_usage; - if (NULL != private_parser) - TestPrivateParser = private_parser; + if(NULL != private_usage) + TestPrivateUsage = private_usage; + if(NULL != private_parser) + TestPrivateParser = private_parser; } - + /* * Print test usage. - * First print the common test options, then the extra options if provided. + * First print the common test options, then the extra options if provided. * * Modification: - * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature. + * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature. */ void TestUsage(void) { - unsigned i; - - print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", - TestProgName, (TestPrivateUsage ? "" : "")); - print_func(" [-[e]x[clude] name]+ \n"); - print_func(" [-o[nly] name]+ \n"); - print_func(" [-b[egin] name] \n"); - print_func(" [-s[ummary]] \n"); - print_func(" [-c[leanoff]] \n"); - print_func(" [-h[elp]] \n"); - print_func("\n\n"); - print_func("verbose controls the amount of information displayed\n"); - print_func("exclude to exclude tests by name\n"); - print_func("only to name tests which should be run\n"); - print_func("begin start at the name of the test givin\n"); - print_func("summary prints a summary of test results at the end\n"); - print_func("cleanoff does not delete *.hdf files after execution of tests\n"); - print_func("help print out this information\n"); - if (TestPrivateUsage){ - print_func("\nExtra options\n"); - TestPrivateUsage(); - } - print_func("\n\n"); - print_func("This program currently tests the following: \n\n"); - print_func("%16s %s\n", "Name", "Description"); - print_func("%16s %s\n", "----", "-----------"); - - for (i = 0; i < Index; i++) - print_func("%16s %s\n", Test[i].Name, Test[i].Description); - - print_func("\n\n"); + unsigned i; + + print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", + TestProgName, (TestPrivateUsage ? "" : "")); + print_func(" [-[e]x[clude] name]+ \n"); + print_func(" [-o[nly] name]+ \n"); + print_func(" [-b[egin] name] \n"); + print_func(" [-s[ummary]] \n"); + print_func(" [-c[leanoff]] \n"); + print_func(" [-h[elp]] \n"); + print_func("\n\n"); + print_func("verbose controls the amount of information displayed\n"); + print_func("exclude to exclude tests by name\n"); + print_func("only to name tests which should be run\n"); + print_func("begin start at the name of the test givin\n"); + print_func("summary prints a summary of test results at the end\n"); + print_func("cleanoff does not delete *.hdf files after execution of tests\n"); + print_func("help print out this information\n"); + if (TestPrivateUsage){ + print_func("\nExtra options\n"); + TestPrivateUsage(); + } + print_func("\n\n"); + print_func("This program currently tests the following: \n\n"); + print_func("%16s %s\n", "Name", "Description"); + print_func("%16s %s\n", "----", "-----------"); + + for (i = 0; i < Index; i++) + print_func("%16s %s\n", Test[i].Name, Test[i].Description); + + print_func("\n\n"); } - + /* * Print test info. */ @@ -209,7 +211,7 @@ void TestInfo(const char *ProgName) print_func("Linked with hdf5 version %u.%u release %u\n", major, minor, release); } - + /* * Parse command line information. * argc, argv: the usual command line argument count and strings @@ -218,7 +220,7 @@ void TestInfo(const char *ProgName) * exit EXIT_FAILURE if error is encountered. * * Modification: - * 2004/08/18 Albert Cheng. Add extra_parse feature. + * 2004/08/18 Albert Cheng. Add extra_parse feature. */ void TestParseCmdLine(int argc, char *argv[]) { @@ -226,80 +228,82 @@ void TestParseCmdLine(int argc, char *argv[]) int ret_code; while (argv++, --argc > 0){ - if ((HDstrcmp(*argv, "-verbose") == 0) || - (HDstrcmp(*argv, "-v") == 0)) { - if (argc > 0){ - --argc; ++argv; - ParseTestVerbosity(*argv); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-exclude") == 0) || - (HDstrcmp(*argv, "-x") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, SKIPTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-begin") == 0) || - (HDstrcmp(*argv, "-b") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, BEGINTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-only") == 0) || - (HDstrcmp(*argv, "-o") == 0))) { - if(argc > 0) { - unsigned Loop; - - --argc; ++argv; - - /* Skip all tests, then activate only one. */ + if ((HDstrcmp(*argv, "-verbose") == 0) || + (HDstrcmp(*argv, "-v") == 0)) { + if (argc > 0){ + --argc; ++argv; + ParseTestVerbosity(*argv); + }else{ + TestUsage(); + exit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-exclude") == 0) || + (HDstrcmp(*argv, "-x") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, SKIPTEST); + }else{ + TestUsage(); + exit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-begin") == 0) || + (HDstrcmp(*argv, "-b") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, BEGINTEST); + }else{ + TestUsage(); + exit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-only") == 0) || + (HDstrcmp(*argv, "-o") == 0))) { + if(argc > 0) { + unsigned Loop; + + --argc; ++argv; + + /* Skip all tests, then activate only one. */ if(!skipped_all) { for(Loop = 0; Loop < Index; Loop++) Test[Loop].SkipFlag = 1; skipped_all = TRUE; } /* end if */ - SetTest(*argv, ONLYTEST); - } /* end if */ + SetTest(*argv, ONLYTEST); + } /* end if */ else { - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) - Summary = 1; - else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { - TestUsage(); - exit(EXIT_SUCCESS); + TestUsage(); + exit(EXIT_FAILURE); } - else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) - SetTestNoCleanup(); - else { - /* non-standard option. Break out. */ - break; - } + } + else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) + Summary = 1; + else if (HDstrcmp(*argv, "-enable-error-stack") == 0) + enable_error_stack = 1; + else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { + TestUsage(); + exit(EXIT_SUCCESS); + } + else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) + SetTestNoCleanup(); + else { + /* non-standard option. Break out. */ + break; + } } /* Call extra parsing function if provided. */ if (NULL != TestPrivateParser){ - ret_code=TestPrivateParser(argc+1, argv-1); - if (ret_code != 0) - exit(EXIT_FAILURE); + ret_code=TestPrivateParser(argc+1, argv-1); + if (ret_code != 0) + exit(EXIT_FAILURE); } } - + /* * Perform Tests. */ @@ -314,10 +318,10 @@ void PerformTests(void) MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name)); MESSAGE(5, ("===============================================\n")); Test[Loop].NumErrors = num_errs; - Test_parameters = Test[Loop].Parameters; - ALARM_ON; + Test_parameters = Test[Loop].Parameters; + ALARM_ON; Test[Loop].Call(); - ALARM_OFF; + ALARM_OFF; Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors; MESSAGE(5, ("===============================================\n")); MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors)); @@ -332,7 +336,7 @@ void PerformTests(void) print_func("All tests were successful. \n\n"); } - + /* * Display test summary. */ @@ -354,7 +358,7 @@ void TestSummary(void) print_func("\n\n"); } - + /* * Cleanup files from testing */ @@ -370,7 +374,7 @@ void TestCleanup(void) Test[Loop].Cleanup(); } - + /* * Shutdown the test infrastructure */ @@ -380,7 +384,7 @@ void TestShutdown(void) HDfree(Test); } - + /* * Retrieve the verbosity level for the testing framework */ @@ -504,16 +508,16 @@ int SetTestNoCleanup(void) void ParseTestVerbosity(char *argv) { if (*argv == 'l') - SetTestVerbosity(VERBO_LO); + SetTestVerbosity(VERBO_LO); else if (*argv == 'm') - SetTestVerbosity(VERBO_MED); + SetTestVerbosity(VERBO_MED); else if (*argv == 'h') - SetTestVerbosity(VERBO_HI); + SetTestVerbosity(VERBO_HI); else - SetTestVerbosity(atoi(argv)); + SetTestVerbosity(atoi(argv)); } - + /* * Retrieve the number of testing errors for the testing framework */ @@ -522,7 +526,7 @@ H5_ATTR_PURE int GetTestNumErrs(void) return(num_errs); } - + /* * Increment the number of testing errors */ @@ -531,7 +535,7 @@ void IncTestNumErrs(void) num_errs++; } - + /* * Retrieve the current Test Parameters pointer. */ @@ -540,7 +544,7 @@ H5_ATTR_PURE const void *GetTestParameters(void) return(Test_parameters); } - + /* * This routine is designed to provide equivalent functionality to 'printf' * and also increment the error count for the testing framework. @@ -563,7 +567,7 @@ TestErrPrintf(const char *format, ...) return ret_value; } - + /* * Set (control) which test will be tested. * SKIPTEST: skip this test @@ -576,41 +580,41 @@ void SetTest(const char *testname, int action) unsigned Loop; switch (action){ - case SKIPTEST: - for (Loop = 0; Loop < Index; Loop++) - if (HDstrcmp(testname, Test[Loop].Name) == 0){ - Test[Loop].SkipFlag = 1; - break; - } - break; - case BEGINTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; - else{ - /* Found it. Set it to run. Done. */ - Test[Loop].SkipFlag = 0; - break; - } - } - break; - case ONLYTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) == 0) { - /* Found it. Set it to run. Break to skip the rest. */ - Test[Loop].SkipFlag = 0; - break; - } - } - break; - default: - /* error */ - printf("*** ERROR: Unknown action (%d) for SetTest\n", action); - break; + case SKIPTEST: + for (Loop = 0; Loop < Index; Loop++) + if (HDstrcmp(testname, Test[Loop].Name) == 0){ + Test[Loop].SkipFlag = 1; + break; + } + break; + case BEGINTEST: + for (Loop = 0; Loop < Index; Loop++) { + if (HDstrcmp(testname, Test[Loop].Name) != 0) + Test[Loop].SkipFlag = 1; + else{ + /* Found it. Set it to run. Done. */ + Test[Loop].SkipFlag = 0; + break; + } + } + break; + case ONLYTEST: + for (Loop = 0; Loop < Index; Loop++) { + if (HDstrcmp(testname, Test[Loop].Name) == 0) { + /* Found it. Set it to run. Break to skip the rest. */ + Test[Loop].SkipFlag = 0; + break; + } + } + break; + default: + /* error */ + printf("*** ERROR: Unknown action (%d) for SetTest\n", action); + break; } } - + /* * Enable alarm on test execution, configurable by environment variable */ diff --git a/test/th5o.c b/test/th5o.c index 2949c4e..3ecd08b 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -13,7 +13,7 @@ /*********************************************************** * -* Test program: th5o +* Test program: th5o * * Test public H5O functions for accessing * @@ -30,7 +30,7 @@ #define TEST6_DIM1 100 #define TEST6_DIM2 100 - + /**************************************************************** ** ** test_h5o_open(): Test H5Oopen function. @@ -140,7 +140,7 @@ test_h5o_open(void) } /* test_h5o_open() */ - + /**************************************************************** ** ** test_h5o_close(): Test H5Oclose function. @@ -230,7 +230,7 @@ test_h5o_close(void) CHECK(ret, FAIL, "H5Fclose"); } - + /**************************************************************** ** ** test_h5o_open_by_addr(): Test H5Oopen_by_addr function. @@ -367,7 +367,7 @@ test_h5o_open_by_addr(void) VERIFY(dtype, FAIL, "H5Oopen_by_addr"); } /* test_h5o_open_by_addr() */ - + /**************************************************************** ** ** test_h5o_refcount(): Test H5O refcounting functions. @@ -378,7 +378,7 @@ test_h5o_refcount(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info_t oinfo; /* Object info struct */ hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ @@ -562,7 +562,7 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Fclose"); } /* test_h5o_refcount() */ - + /**************************************************************** ** ** test_h5o_plist(): Test object creation properties @@ -756,7 +756,7 @@ test_h5o_plist(void) CHECK(ret, FAIL, "H5Pclose"); } /* test_h5o_plist() */ - + /**************************************************************** ** ** test_h5o_link(): Test creating link to object @@ -910,7 +910,7 @@ test_h5o_link(void) HDfree(rdata); } /* end test_h5o_link() */ - + /**************************************************************** ** ** test_h5o_comment(): Test H5Oset(get)_comment functions. @@ -1083,7 +1083,7 @@ test_h5o_comment(void) } /* test_h5o_comment() */ - + /**************************************************************** ** ** test_h5o_comment_by_name(): Test H5Oset(get)_comment_by_name functions. @@ -1242,7 +1242,7 @@ test_h5o_comment_by_name(void) } /* test_h5o_comment_by_name() */ - + /**************************************************************** ** ** test_h5o_getinfo_same_file(): Test that querying the object info for @@ -1254,7 +1254,7 @@ test_h5o_getinfo_same_file(void) { hid_t fid1, fid2; /* HDF5 File ID */ hid_t gid1, gid2; /* Group IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info_t oinfo1, oinfo2; /* Object info structs */ herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ @@ -1382,7 +1382,7 @@ visit_obj_cb(hid_t group_id, const char *name, const H5O_info_t *oinfo1, return(H5_ITER_CONT); } /* end visit_obj_cb() */ - + /**************************************************************** ** ** test_h5o_getinfo_visit(): @@ -1479,7 +1479,7 @@ test_h5o_getinfo_visit(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /**************************************************************** ** ** test_h5o(): Main H5O (generic object) testing routine. @@ -1491,21 +1491,21 @@ test_h5o(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Objects\n")); - test_h5o_open(); /* Test generic open function */ - test_h5o_open_by_addr(); /* Test opening objects by address */ - test_h5o_close(); /* Test generic close function */ - test_h5o_refcount(); /* Test incrementing and decrementing reference count */ - test_h5o_plist(); /* Test object creation properties */ - test_h5o_link(); /* Test object link routine */ - test_h5o_comment(); /* Test routines for comment */ - test_h5o_comment_by_name(); /* Test routines for comment by name */ + test_h5o_open(); /* Test generic open function */ + test_h5o_open_by_addr(); /* Test opening objects by address */ + test_h5o_close(); /* Test generic close function */ + test_h5o_refcount(); /* Test incrementing and decrementing reference count */ + test_h5o_plist(); /* Test object creation properties */ + test_h5o_link(); /* Test object link routine */ + test_h5o_comment(); /* Test routines for comment */ + test_h5o_comment_by_name(); /* Test routines for comment by name */ test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_h5o_getinfo_visit(); /* Test object info for H5Oget_info/2 and H5Ovisit */ + test_h5o_getinfo_visit(); /* Test object info for H5Oget_info/2 and H5Ovisit */ #endif } /* test_h5o() */ - + /*------------------------------------------------------------------------- * Function: cleanup_h5o * diff --git a/test/tid.c b/test/tid.c index 8a27c3b..3587566 100644 --- a/test/tid.c +++ b/test/tid.c @@ -251,7 +251,10 @@ static int id_predefined_test(void ) testObj = HDmalloc(sizeof(int)); - /* Try to perform illegal functions on various predefined types */ + /* + * Attempt to perform public functions on various library types + */ + H5E_BEGIN_TRY testID = H5Iregister(H5I_FILE, testObj); H5E_END_TRY @@ -317,7 +320,7 @@ static int id_predefined_test(void ) H5Tclose(typeID); /* testObj was never registered as an atom, so it will not be - * automatically freed. */ + * automatically freed. */ HDfree(testObj); return 0; @@ -476,7 +479,7 @@ static int test_id_type_list(void) goto out; /* Sanity check */ - if(startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) + if((int)startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) { /* Error condition, throw an error */ CHECK(1, 1, "H5Iregister_type"); diff --git a/test/titerate.c b/test/titerate.c index 093e8b5..696784d 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -116,7 +116,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ return(count2 > 10 ? 1 : 0); default: - printf("invalid iteration command"); + HDprintf("invalid iteration command"); return(-1); } /* end switch */ } /* end liter_cb() */ @@ -163,7 +163,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(filespace, FAIL, "H5Screate"); for(i=0; i< NDATASETS; i++) { - sprintf(name,"Dataset %d",i); + HDsprintf(name,"Dataset %d",i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -737,7 +737,7 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(filespace, FAIL, "H5Screate"); for(i = 0; i < NDATASETS; i++) { - sprintf(name, "Dataset %d", i); + HDsprintf(name, "Dataset %d", i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -953,6 +953,7 @@ find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data) searched_err->found = true; status = H5_ITER_STOP; } + return status; } /* end find_err_msg_cb() */ @@ -1077,6 +1078,6 @@ test_iterate(void) void cleanup_iterate(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/tmisc.c b/test/tmisc.c index 22e1aad..47c0606 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2713,9 +2713,6 @@ test_misc15(void) fapl = H5Fget_access_plist(file); CHECK(fapl, FAIL, "H5Fget_access_plist"); - ret = H5Pclose(fapl); - CHECK(ret, FAIL, "H5Pclose"); - ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -2723,6 +2720,9 @@ test_misc15(void) ret = H5Fis_hdf5(MISC15_FILE); CHECK(ret, FAIL, "H5Fis_hdf5"); + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + file = H5Fopen(MISC15_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); @@ -4721,6 +4721,7 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25a() */ + /**************************************************************** ** ** test_misc25b(): Exercise null object header message merge bug @@ -4756,7 +4757,7 @@ test_misc25b(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25b() */ - + /**************************************************************** ** ** test_misc25c(): Exercise another null object header message merge bug. @@ -4890,7 +4891,7 @@ test_misc25c(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25c() */ - + /**************************************************************** ** ** test_misc26(): Regression test: ensure that copying filter @@ -4976,7 +4977,7 @@ test_misc26(void) CHECK_I(ret, "H5Pclose"); } - + /**************************************************************** ** ** test_misc27(): Ensure that objects with incorrect # of object @@ -5021,7 +5022,7 @@ test_misc27(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc27() */ - + /**************************************************************** ** ** test_misc28(): Ensure that the dataset chunk cache will hold @@ -5198,7 +5199,7 @@ test_misc28(void) CHECK_I(ret, "H5Pclose"); } /* end test_misc28() */ - + /**************************************************************** ** ** test_misc29(): Ensure that speculative metadata reads don't @@ -5247,7 +5248,7 @@ test_misc30_get_info(hid_t loc_id) return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } - + /**************************************************************** ** ** test_misc30(): Exercise local heap code that loads prefix @@ -5312,7 +5313,7 @@ test_misc30(void) VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ - + /**************************************************************** ** ** test_misc31(): Test reentering library through deprecated @@ -5410,7 +5411,7 @@ test_misc31(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end test_misc31() */ - + /**************************************************************** * * test_misc32(): Simple test of filter memory allocation @@ -5584,7 +5585,7 @@ test_misc34(void) } /* end test_misc34() */ - + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5637,7 +5638,7 @@ test_misc(void) } /* test_misc() */ - + /*------------------------------------------------------------------------- * Function: cleanup_misc * @@ -5647,9 +5648,6 @@ test_misc(void) * * Programmer: Albert Cheng * July 2, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ void diff --git a/test/ttime.c b/test/ttime.c index 48c9ba8..5b3436d 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -178,13 +178,13 @@ test_time_io(void) tid = H5Dget_type(dsid); CHECK(tid, FAIL, "H5Dget_type"); if( H5Tget_class (tid) == H5T_TIME) - fprintf(stderr,"datatype class is H5T_TIME\n"); + HDfprintf(stderr,"datatype class is H5T_TIME\n"); status = H5Tclose (tid); CHECK(status, FAIL, "H5Tclose"); status = H5Dread (dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timethen); CHECK(status, FAIL, "H5Dread"); -fprintf(stderr,"time written was: %s\n", HDctime(&timethen)); +HDfprintf(stderr,"time written was: %s\n", HDctime(&timethen)); status = H5Dclose(dsid); CHECK(status, FAIL, "H5Dclose"); @@ -231,6 +231,6 @@ test_time(void) void cleanup_time(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/tunicode.c b/test/tunicode.c index e0e1f24..5a60036 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -163,7 +163,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string, each with a * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ - strncpy(buf, new_string, big_len); + HDstrncpy(buf, new_string, big_len); HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); diff --git a/test/tvlstr.c b/test/tvlstr.c index 2c552eb..5f715ce 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -32,7 +32,7 @@ #define SPACE1_DIM1 4 #define NUMP 4 -#define VLSTR_TYPE "vl_string_type" +#define VLSTR_TYPE "vl_string_type" /* Definitions for the VL re-writing test */ #define REWRITE_NDATASETS 32 @@ -94,7 +94,7 @@ void test_vlstr_free_custom(void *_mem, void *info) if(_mem!=NULL) { mem=((unsigned char *)_mem)-extra; - *mem_used-=*(size_t *)mem; + *mem_used-=*(size_t *)((void *)mem); HDfree(mem); } /* end if */ } @@ -183,7 +183,7 @@ test_vlstrings_basic(void) /* Count the actual number of bytes used by the strings */ for(i=0,str_used=0; istring, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -1406,7 +1406,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; jstring, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ diff --git a/test/twriteorder.c b/test/twriteorder.c index 4c86636..60ee384 100644 --- a/test/twriteorder.c +++ b/test/twriteorder.c @@ -25,7 +25,6 @@ * get the same data the write has written. * * Created: Albert Cheng, 2013/8/28. -* Modified: *************************************************************/ /*********************************************************** @@ -69,18 +68,18 @@ #ifdef H5_HAVE_FORK #define DATAFILE "twriteorder.dat" -/* #define READERS_MAX 10 */ /* max number of readers */ -#define BLOCKSIZE_DFT 1024 /* 1KB */ -#define PARTITION_DFT 2048 /* 2KB */ -#define NLINKEDBLOCKS_DFT 512 /* default 512 */ -#define SIZE_BLKADDR 4 /* expected sizeof blkaddr */ -#define Hgoto_error(val) {ret_value=val; goto done;} +/* #define READERS_MAX 10 */ /* max number of readers */ +#define BLOCKSIZE_DFT 1024 /* 1KB */ +#define PARTITION_DFT 2048 /* 2KB */ +#define NLINKEDBLOCKS_DFT 512 /* default 512 */ +#define SIZE_BLKADDR 4 /* expected sizeof blkaddr */ +#define Hgoto_error(val) {ret_value=val; goto done;} /* type declarations */ typedef enum part_t { - UC_READWRITE =0, /* both writer and reader */ - UC_WRITER, /* writer only */ - UC_READER /* reader only */ + UC_READWRITE = 0, /* both writer and reader */ + UC_WRITER, /* writer only */ + UC_READER /* reader only */ } part_t; /* prototypes */ @@ -92,9 +91,9 @@ int setup_parameters(int argc, char * const argv[]); int parse_option(int argc, char * const argv[]); /* Global Variable definitions */ -const char *progname_g="twriteorder"; /* program name */ -int write_fd_g; -int blocksize_g, part_size_g, nlinkedblock_g; +const char *progname_g="twriteorder"; /* program name */ +int write_fd_g; +int blocksize_g, part_size_g, nlinkedblock_g; part_t launch_g; /* Function definitions */ @@ -103,15 +102,15 @@ part_t launch_g; void usage(const char *prog) { - fprintf(stderr, "usage: %s [OPTIONS]\n", prog); - fprintf(stderr, " OPTIONS\n"); - fprintf(stderr, " -h Print a usage message and exit\n"); - fprintf(stderr, " -l w|r launch writer or reader only. [default: launch both]\n"); - fprintf(stderr, " -b N Block size [default: %d]\n", BLOCKSIZE_DFT); - fprintf(stderr, " -p N Partition size [default: %d]\n", PARTITION_DFT); - fprintf(stderr, " -n N Number of linked blocks [default: %d]\n", NLINKEDBLOCKS_DFT); - fprintf(stderr, " where N is an integer value\n"); - fprintf(stderr, "\n"); + HDfprintf(stderr, "usage: %s [OPTIONS]\n", prog); + HDfprintf(stderr, " OPTIONS\n"); + HDfprintf(stderr, " -h Print a usage message and exit\n"); + HDfprintf(stderr, " -l w|r launch writer or reader only. [default: launch both]\n"); + HDfprintf(stderr, " -b N Block size [default: %d]\n", BLOCKSIZE_DFT); + HDfprintf(stderr, " -p N Partition size [default: %d]\n", PARTITION_DFT); + HDfprintf(stderr, " -n N Number of linked blocks [default: %d]\n", NLINKEDBLOCKS_DFT); + HDfprintf(stderr, " where N is an integer value\n"); + HDfprintf(stderr, "\n"); } /* Setup test parameters by parsing command line options. @@ -127,73 +126,73 @@ parse_option(int argc, char * const argv[]) /* suppress getopt from printing error */ opterr = 0; - while (1){ - c = getopt (argc, argv, cmd_options); - if (-1 == c) - break; - switch (c) { - case 'h': - usage(progname_g); - exit(0); - break; - case 'b': /* number of planes to write/read */ - if ((blocksize_g = atoi(optarg)) <= 0){ - fprintf(stderr, "bad blocksize %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'n': /* number of planes to write/read */ - if ((nlinkedblock_g = atoi(optarg)) < 2){ - fprintf(stderr, "bad number of linked blocks %s, must be greater than 1.\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'p': /* number of planes to write/read */ - if ((part_size_g = atoi(optarg)) <= 0){ - fprintf(stderr, "bad partition size %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'l': /* launch reader or writer only */ - switch (*optarg) { - case 'r': /* reader only */ - launch_g = UC_READER; - break; - case 'w': /* writer only */ - launch_g = UC_WRITER; - break; - default: - fprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg); - usage(progname_g); - Hgoto_error(-1); - break; - } - printf("launch = %d\n", launch_g); - break; - case '?': - fprintf(stderr, "getopt returned '%c'.\n", c); - usage(progname_g); - Hgoto_error(-1); - default: - fprintf(stderr, "getopt returned unexpected value.\n"); - fprintf(stderr, "Unexpected value is %d\n", c); - Hgoto_error(-1); - } - } + while (1) { + c = getopt (argc, argv, cmd_options); + if (-1 == c) + break; + + switch (c) { + case 'h': + usage(progname_g); + HDexit(0); + break; + case 'b': /* number of planes to write/read */ + if ((blocksize_g = atoi(optarg)) <= 0) { + HDfprintf(stderr, "bad blocksize %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'n': /* number of planes to write/read */ + if ((nlinkedblock_g = atoi(optarg)) < 2) { + HDfprintf(stderr, "bad number of linked blocks %s, must be greater than 1.\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'p': /* number of planes to write/read */ + if ((part_size_g = atoi(optarg)) <= 0) { + HDfprintf(stderr, "bad partition size %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'l': /* launch reader or writer only */ + switch (*optarg) { + case 'r': /* reader only */ + launch_g = UC_READER; + break; + case 'w': /* writer only */ + launch_g = UC_WRITER; + break; + default: + HDfprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg); + usage(progname_g); + Hgoto_error(-1); + break; + } /* end inner switch */ + HDprintf("launch = %d\n", launch_g); + break; + case '?': + HDfprintf(stderr, "getopt returned '%c'.\n", c); + usage(progname_g); + Hgoto_error(-1); + default: + HDfprintf(stderr, "getopt returned unexpected value.\n"); + HDfprintf(stderr, "Unexpected value is %d\n", c); + Hgoto_error(-1); + } /* end outer switch */ + } /* end while */ /* verify partition size must be >= blocksize */ if (part_size_g < blocksize_g ){ - fprintf(stderr, "Blocksize %d should not be bigger than partition size %d\n", - blocksize_g, part_size_g); - Hgoto_error(-1); + HDfprintf(stderr, "Blocksize %d should not be bigger than partition size %d\n", blocksize_g, part_size_g); + Hgoto_error(-1); } done: /* All done. */ - return(ret_value); + return ret_value; } /* Setup parameters for the test case. @@ -209,15 +208,16 @@ int setup_parameters(int argc, char * const argv[]) /* parse options */ if (parse_option(argc, argv) < 0){ - return(-1); + return -1; } /* show parameters and return */ - printf("blocksize = %ld\n", (long)blocksize_g); - printf("part_size = %ld\n", (long)part_size_g); - printf("nlinkedblock = %ld\n", (long)nlinkedblock_g); - printf("launch = %d\n", launch_g); - return(0); + HDprintf("blocksize = %ld\n", (long)blocksize_g); + HDprintf("part_size = %ld\n", (long)part_size_g); + HDprintf("nlinkedblock = %ld\n", (long)nlinkedblock_g); + HDprintf("launch = %d\n", launch_g); + + return 0; } /* Create the test file with initial "empty" file, that is, @@ -227,19 +227,19 @@ int setup_parameters(int argc, char * const argv[]) */ int create_wo_file(void) { - int blkaddr=0; /* blkaddress of next linked block */ - int ret_code; + int blkaddr = 0; /* blkaddress of next linked block */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* Create the data file */ if ((write_fd_g = HDopen(DATAFILE, O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) { HDprintf("WRITER: error from open\n"); return -1; } - blkaddr=0; + blkaddr = 0; /* write it to partition 0 */ - if ((ret_code=HDwrite(write_fd_g, &blkaddr, (size_t)SIZE_BLKADDR)) != SIZE_BLKADDR){ - printf("blkaddr write failed\n"); - return -1; + if ((bytes_wrote = HDwrite(write_fd_g, &blkaddr, (size_t)SIZE_BLKADDR)) != SIZE_BLKADDR){ + HDprintf("blkaddr write failed\n"); + return -1; } /* File initialized, return success */ @@ -252,38 +252,45 @@ int write_wo_file(void) int blkaddr_old=0; int i; char buffer[BLOCKSIZE_DFT]; - int ret_code; + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* write block 1, 2, ... */ - for (i=1; i=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } /* Close the group */ - if(H5Gclose(gid) < 0) goto error; + if(H5Gclose(gid) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (gcpl) < 0) goto error; + if(H5Pclose (gcpl_id) < 0) + goto error; - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; + /********************* + * PART 2 - DATASETS * + *********************/ - if(H5Pset_filter(dc, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) goto error; + /* Use DUMMY filter for creating datasets */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0) + goto error; + if(H5Pset_filter(dcpl_id, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) + goto error; - /* Initialize the dataset */ + /* Initialize the data for writing */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) - points[i][j] = n++; + data[i][j] = n++; - /* Create the data space */ + /* Create the dataspace */ dims[0] = DSET_DIM1; dims[1] = DSET_DIM2; - if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) + goto error; /* Create a dataset in the first file */ - if((dataset = H5Dcreate2(file1, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid1, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Unregister the filter before closing the dataset. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset */ + if(H5Dclose(did) < 0) + goto error; /* Create a dataset in the second file */ - if((dataset = H5Dcreate2(file2, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid2, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset in the second file */ + if(H5Dclose(did) < 0) + goto error; /* Unregister the filter after closing all objects but before closing files. - * It should flush all files. */ - if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) goto error; + * It should flush all files. + */ + if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (dc) < 0) goto error; - if(H5Fclose(file1) < 0) goto error; - if(H5Fclose(file2) < 0) goto error; + if(H5Pclose(dcpl_id) < 0) + goto error; + if(H5Fclose(fid1) < 0) + goto error; + if(H5Fclose(fid2) < 0) + goto error; PASSED(); - return 0; + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY { + H5Fclose(fid1); + H5Fclose(fid2); + H5Pclose(dcpl_id); + H5Pclose(gcpl_id); + H5Gclose(gid); + H5Gclose(gid_loop); + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; + + return FAIL; } /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests unregistering filter with H5Zunregister + * Function: main * - * Return: Success: exit(EXIT_SUCCESS) + * Purpose: Tests unregistering filter with H5Zunregister * - * Failure: exit(EXIT_FAILURE) - * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl; - int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; + int nerrors = 0; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Testing setup */ h5_reset(); - fapl = h5_fileaccess(); + fapl_id = h5_fileaccess(); /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; /* Test unregistering filter in its own file */ - nerrors += (test_unregister_filters(fapl) < 0 ? 1 : 0); + nerrors += (test_unregister_filters(fapl_id) < 0 ? 1 : 0); - if(nerrors) + h5_cleanup(FILENAME, fapl_id); + + if (nerrors) goto error; - printf("All filter unregistration tests passed.\n"); + HDprintf("All filter unregistration tests passed.\n"); /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: nerrors = MAX(1, nerrors); - printf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", + HDprintf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); if(api_ctx_pushed) H5CX_pop(); - return 1; -} + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c index 340f578..67e2226 100644 --- a/test/use_disable_mdc_flushes.c +++ b/test/use_disable_mdc_flushes.c @@ -108,28 +108,28 @@ parse_option(int argc, char * const argv[]) filename_g = optarg; break; case 'n': /* number of planes to write/read */ - if ((nplanes_g = atoi(optarg)) <= 0){ + if ((nplanes_g = HDatoi(optarg)) <= 0){ fprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 's': /* use swmr file open mode */ - if ((use_swmr_g = atoi(optarg)) < 0){ + if ((use_swmr_g = HDatoi(optarg)) < 0){ fprintf(stderr, "swmr value should be 0(no) or 1(yes)\n"); usage(progname_g); Hgoto_error(-1); }; break; case 'y': /* Number of planes per chunk */ - if ((chunkplanes_g = atoi(optarg)) <= 0){ + if ((chunkplanes_g = HDatoi(optarg)) <= 0){ fprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 'z': /* size of chunk=(z,z) */ - if ((chunksize_g = atoi(optarg)) <= 0){ + if ((chunksize_g = HDatoi(optarg)) <= 0){ fprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); diff --git a/test/vds.c b/test/vds.c index fd5a431..459ca6b 100644 --- a/test/vds.c +++ b/test/vds.c @@ -378,7 +378,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR if(config == TEST_API_REOPEN_FILE) { if(oinfo.meta_size.obj.heap_size != exp_meta_size) { - printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); + HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR } } @@ -1215,11 +1215,14 @@ test_vds_prefix_first(unsigned config, hid_t fapl) /* Create source file if requested */ if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); + if(NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if(HDchdir(TMPDIR) < 0) + TEST_ERROR if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - HDchdir(buffer); + if(HDchdir(buffer) < 0) + TEST_ERROR } else { srcfile[0] = vfile; @@ -1296,11 +1299,14 @@ test_vds_prefix_first(unsigned config, hid_t fapl) /* Reopen srcdset and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); + if(NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if(HDchdir(TMPDIR) < 0) + TEST_ERROR if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - HDchdir(buffer); + if(HDchdir(buffer) < 0) + TEST_ERROR } if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR @@ -11451,14 +11457,14 @@ main(void) if(nerrors) goto error; - printf("All virtual dataset tests passed.\n"); + HDprintf("All virtual dataset tests passed.\n"); h5_cleanup(FILENAME, fapl); return EXIT_SUCCESS; error: nerrors = MAX(1, nerrors); - printf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end main() */ diff --git a/test/vfd.c b/test/vfd.c index dfc5047..8e46850 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -66,7 +66,7 @@ const char *FILENAME[] = { #define COMPAT_BASENAME "family_v16_" #define MULTI_COMPAT_BASENAME "multi_file_v16" - + /*------------------------------------------------------------------------- * Function: test_sec2 * @@ -178,7 +178,7 @@ error: return -1; } /* end test_sec2() */ - + /*------------------------------------------------------------------------- * Function: test_core * @@ -412,8 +412,8 @@ test_core(void) for(j = 0; j < CORE_DSET_DIM2; j++) if(*pr++ != *pw++) { H5_FAILED(); - printf(" Read different values than written in data set.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -480,8 +480,8 @@ test_core(void) for(j = 0; j < CORE_DSET_DIM2; j++) if(*pw++ != *pr++) { H5_FAILED(); - printf(" Read different values than written in data set.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -534,7 +534,7 @@ error: return -1; } /* end test_core() */ - + /*------------------------------------------------------------------------- * Function: test_direct * @@ -597,7 +597,7 @@ test_direct(void) if(file<0) { H5Pclose (fapl); SKIPPED(); - printf(" Probably the file system doesn't support Direct I/O\n"); + HDprintf(" Probably the file system doesn't support Direct I/O\n"); return 0; } @@ -674,8 +674,8 @@ test_direct(void) for(j = 0; j < DSET1_DIM2; j++) if(*p1++ != *p2++) { H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set 1.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -706,8 +706,8 @@ test_direct(void) for(i = 0; i < DSET2_DIM; i++) if(wdata2[i] != rdata2[i]) { H5_FAILED(); - printf(" Read different values than written in data set 2.\n"); - printf(" At index %d\n", i); + HDprintf(" Read different values than written in data set 2.\n"); + HDprintf(" At index %d\n", i); TEST_ERROR; } /* end if */ @@ -754,7 +754,7 @@ error: #endif /*H5_HAVE_DIRECT*/ } - + /*------------------------------------------------------------------------- * Function: test_family_opens * @@ -769,6 +769,14 @@ error: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'first_name' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static herr_t test_family_opens(char *fname, hid_t fa_pl) { @@ -825,8 +833,9 @@ test_family_opens(char *fname, hid_t fa_pl) error: return -1; } /* end test_family_opens() */ +#pragma GCC diagnostic pop + - /*------------------------------------------------------------------------- * Function: test_family * @@ -1008,7 +1017,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: test_family_compat * @@ -1027,6 +1036,14 @@ error: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'newname_individual', etc. in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static herr_t test_family_compat(void) { @@ -1110,26 +1127,34 @@ error: return -1; } /* end test_family_compat() */ +#pragma GCC diagnostic pop + - /*------------------------------------------------------------------------- * Function: test_multi_opens * * Purpose: Private function for test_multi() to tests wrong ways of * reopening multi file. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Thursday, May 19, 2005 * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'sf_name' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static herr_t test_multi_opens(char *fname) { - hid_t file=-1; + hid_t fid = H5I_INVALID_HID; char super_name[1024]; /*name string "%%s-s.h5"*/ char sf_name[1024]; /*name string "multi_file-s.h5"*/ @@ -1138,20 +1163,20 @@ test_multi_opens(char *fname) HDsnprintf(sf_name, sizeof(sf_name), super_name, fname); H5E_BEGIN_TRY { - file = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; - return(file >= 0 ? -1 : 0); -} + return(fid >= 0 ? FAIL : SUCCEED); +} /* end test_multi_opens() */ +#pragma GCC diagnostic pop + - /*------------------------------------------------------------------------- * Function: test_multi * * Purpose: Tests the file handle interface for MUTLI driver * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 @@ -1201,19 +1226,19 @@ test_multi(void) memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/4; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3; @@ -1365,7 +1390,7 @@ test_multi(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1374,11 +1399,12 @@ error: H5Pclose(fapl); H5Pclose(fapl2); H5Fclose(file); + H5Aclose(attr); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_multi() */ + - /*------------------------------------------------------------------------- * Function: test_multi_compat * @@ -1432,12 +1458,12 @@ test_multi_compat(void) memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; @@ -1447,17 +1473,19 @@ test_multi_compat(void) h5_fixname(FILENAME[9], fapl, newname, sizeof newname); /* Make copy for the data file in the build directory, to protect the - * original file in the source directory */ - sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); - sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); + * original file in the source directory + */ + HDsprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); + HDsprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); h5_make_local_copy(filename_s, newname_s); - sprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); - sprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); + HDsprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); + HDsprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); h5_make_local_copy(filename_r, newname_r); /* Reopen the file for read only. Verify 1.8 library can open file - * created with 1.6 library. */ + * created with 1.6 library. + */ if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; @@ -1550,7 +1578,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: test_log * @@ -1661,7 +1689,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: test_stdio * @@ -1766,7 +1794,7 @@ error: } - + /*------------------------------------------------------------------------- * Function: test_windows * @@ -1888,7 +1916,6 @@ error: } /* end test_windows() */ - /*------------------------------------------------------------------------- * Function: main * diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 29c6f4a..3004f9f 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1228,7 +1228,7 @@ setup_derived_types(void) nerrors++; success = FALSE; if ( verbose ) { - HDfprintf(stdout, "%d:%s: MPI_Get_Address() call failed.\n", + HDfprintf(stdout, "%d:%s: MPI_Get_address() call failed.\n", world_mpi_rank, FUNC); } @@ -1250,7 +1250,7 @@ setup_derived_types(void) nerrors++; success = FALSE; if ( verbose ) { - HDfprintf(stdout, "%d:%s: MPI_Type_struct() call failed.\n", + HDfprintf(stdout, "%d:%s: MPI_Type_create_struct() call failed.\n", world_mpi_rank, FUNC); } } diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index 1f26e0d..db5bd13 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -3683,6 +3683,8 @@ test_read_filtered_dataset_point_selection(void) if (read_buf) HDfree(read_buf); if (correct_buf) HDfree(correct_buf); + HDfree(coords); + VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded"); VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded"); @@ -5791,6 +5793,9 @@ test_write_parallel_read_serial(void) VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); VRFY((H5Fclose(file_id) >= 0), "File close succeeded"); + + HDfree(correct_buf); + HDfree(read_buf); } return; diff --git a/testpar/t_pread.c b/testpar/t_pread.c index ac33b88..74feeb6 100644 --- a/testpar/t_pread.c +++ b/testpar/t_pread.c @@ -1079,18 +1079,11 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group_id) * with the opening and validation of the data contained * therein. * - * WARNING: This test uses fork() and execve(), and - * therefore will not run on Windows. - * * Return: Success: 0 - * * Failure: 1 * * Programmer: Richard Warren * 10/1/17 - * - * Modifications: - * *------------------------------------------------------------------------- */ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 594bf51..3ee5393 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1344,7 +1344,6 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } #endif /* H5_HAVE_PARALLEL */ -out: opts->err_stat = opts->err_stat | ret_value; /* free table */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 9d5f062..2a45913 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -516,14 +516,14 @@ static hsize_t diff_datum( if (H5Tis_variable_str(m_type)) { h5difftrace("diff_datum H5T_STRING variable\n"); /* Get pointer to first string */ - s1 = *(char**) mem1; + s1 = *(char **)((void *)mem1); if (s1) size1 = HDstrlen(s1); else size1 = 0; /* Get pointer to second string */ - s2 = *(char**) mem2; + s2 = *(char **)((void *)mem2); if (s2) size2 = HDstrlen(s2); else @@ -783,12 +783,11 @@ static hsize_t diff_datum( } /* check object type */ - if (ret_value >= 0) - if (obj1_type != obj2_type) { - parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); - opts->not_cmp = 1; - HGOTO_DONE (opts->err_stat); - } + if (obj1_type != obj2_type) { + parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); + opts->not_cmp = 1; + HGOTO_DONE (opts->err_stat); + } if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) { opts->err_stat = 1; @@ -829,10 +828,10 @@ static hsize_t diff_datum( size = H5Tget_size(memb_type); /* get the number of sequence elements */ - nelmts = ((hvl_t *) mem1)->len; + nelmts = ((hvl_t *)((void *)mem1))->len; for (j = 0; j < nelmts; j++) - nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index, + nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, index, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members); H5Tclose(memb_type); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index d93f7b0..f103647 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1283,7 +1283,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t mem = ((unsigned char*)_mem) + block_index * size; if (H5Tis_variable_str(tid)) { - s = *(char**) mem; + s = *(char **)((void *)mem); if (s != NULL) size = HDstrlen(s); else @@ -1375,10 +1375,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; /* Get the number of sequence elements */ - nelmts = ((hvl_t *) mem)->len; + nelmts = ((hvl_t *)((void *)mem))->len; /* dump the array element */ - if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { + if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *)((void *)mem))->p)), nelmts) < 0) { H5Tclose(memb); H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") } diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 3e8f1fe..17e3f18 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -787,7 +787,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if(H5Tis_variable_str(type)) { /* cp_vp is the pointer into the struct where a `char*' is stored. So we have * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ - s = *(char**) cp_vp; + s = *(char **)((void *)cp_vp); if(s != NULL) size = HDstrlen(s); } else { @@ -1240,7 +1240,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, "%s", OPT(info->vlen_pre, "(")); /* Get the number of sequence elements */ - nelmts = ((hvl_t *) cp_vp)->len; + nelmts = ((hvl_t *)((void *)cp_vp))->len; for(i = 0; i < nelmts; i++) { if(i) h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK)); @@ -1264,7 +1264,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai ctx->indent_level++; /* Dump the array element */ - h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *) cp_vp)->p)) + i * size, ctx); + h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *)((void *)cp_vp))->p)) + i * size, ctx); ctx->indent_level--; } /* end for */ diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index e7e017f..d97b5c9 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -97,7 +97,7 @@ parallel_print(const char* format, ...) HDva_end(ap); } - + /*------------------------------------------------------------------------- * Function: error_msg * @@ -122,7 +122,7 @@ error_msg(const char *fmt, ...) HDva_end(ap); } - + /*------------------------------------------------------------------------- * Function: warn_msg * @@ -161,7 +161,7 @@ help_ref_msg(FILE *output) HDfprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n",h5tools_getprogname()); } - + /*------------------------------------------------------------------------- * Function: get_option * @@ -344,7 +344,7 @@ indentation(unsigned x) } } - + /*------------------------------------------------------------------------- * Function: print_version * @@ -362,7 +362,7 @@ print_version(const char *progname) ((const char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); } - + /*------------------------------------------------------------------------- * Function: init_table * @@ -384,7 +384,7 @@ init_table(table_t **tbl) *tbl = table; } - + /*------------------------------------------------------------------------- * Function: free_table * @@ -408,7 +408,7 @@ free_table(table_t *table) } #ifdef H5DUMP_DEBUG - + /*------------------------------------------------------------------------- * Function: dump_table * @@ -429,7 +429,7 @@ dump_table(char* tablename, table_t *table) table->objs[u].displayed, table->objs[u].recorded); } - + /*------------------------------------------------------------------------- * Function: dump_tables * @@ -447,7 +447,7 @@ dump_tables(find_objs_t *info) } #endif /* H5DUMP_DEBUG */ - + /*------------------------------------------------------------------------- * Function: search_obj * @@ -470,7 +470,7 @@ search_obj(table_t *table, haddr_t objno) return NULL; } - + /*------------------------------------------------------------------------- * Function: find_objs_cb * @@ -546,7 +546,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen return ret_value; } - + /*------------------------------------------------------------------------- * Function: init_objs * @@ -591,7 +591,7 @@ done: return ret_value; } - + /*------------------------------------------------------------------------- * Function: add_obj * @@ -622,7 +622,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record) table->objs[u].displayed = 0; } - + #ifndef H5_HAVE_TMPFILE /*------------------------------------------------------------------------- * Function: tmpfile diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 917d5f5..5519437 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -184,7 +184,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, if(udata->is_absolute) { size_t base_len = HDstrlen(udata->base_grp_name); size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1; - size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1; + size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */ if(NULL == (new_name = (char*)HDmalloc(new_name_len))) return(H5_ITER_ERROR); diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index ec76511..2fa9fd0 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -2881,7 +2881,7 @@ xml_print_refs(hid_t did, int source) goto error; } - refbuf = (hobj_ref_t *) buf; + refbuf = (hobj_ref_t *)((void *)buf); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -3057,7 +3057,7 @@ xml_print_strs(hid_t did, int source) for (i = 0; i < (hsize_t)ssiz; i++) { if (is_vlstr) { - onestring = *(char **) bp; + onestring = *(char **)((void *)bp); if (onestring) str_size = HDstrlen(onestring); } diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index a63e56f..e96dea5 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -713,7 +713,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { hid_t did = -1; hid_t sid = -1; unsigned int i; - unsigned int uf; + int ifil; trav_table_t *travt = NULL; /* nothing to do */ @@ -747,7 +747,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { */ if (options->verbose) - printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs); + printf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs); for (i = 0; i < options->op_tbl->nelems; i++) { char* name = options->op_tbl->objs[i].path; @@ -761,17 +761,17 @@ static int check_objects(const char* fname, pack_opt_t *options) { if (options->verbose) printf("...Found\n"); - for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) { - if (options->op_tbl->objs[i].filter[uf].filtn < 0) + for (ifil = 0; ifil < options->op_tbl->objs[i].nfilters; ifil++) { + if (options->op_tbl->objs[i].filter[ifil].filtn < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); /* check for extra filter conditions */ - switch (options->op_tbl->objs[i].filter[uf].filtn) { + switch (options->op_tbl->objs[i].filter[ifil].filtn) { /* chunk size must be smaller than pixels per block */ case H5Z_FILTER_SZIP: { int j; hsize_t csize = 1; - unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0]; + unsigned ppb = options->op_tbl->objs[i].filter[ifil].cd_values[0]; hsize_t dims[H5S_MAX_RANK]; int rank; @@ -807,7 +807,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { default: break; } - } /* for uf */ + } /* for ifil */ } /* for i */ done: diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 0567269..8122d6d 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -33,20 +33,6 @@ /* size of buffer/# of bytes to xfer at a time when copying userblock */ #define USERBLOCK_XFER_SIZE 512 -/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */ -#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \ - H5E_BEGIN_TRY { \ - if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \ - hid_t _err_num = 0; \ - char _msg[80]; \ - H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \ - H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \ - error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \ - HGOTO_DONE(_fail) \ - } \ - } H5E_END_TRY; \ -} - /*------------------------------------------------------------------------- * local functions *------------------------------------------------------------------------- @@ -61,15 +47,7 @@ static int copy_user_block(const char *infile, const char *outfile, #if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid); #endif -static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata); -/* get the major number from the error stack. */ -static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) { - if (err_desc) - *((hid_t *) udata) = err_desc->maj_num; - - return 0; -} /*------------------------------------------------------------------------- * Function: copy_objects @@ -634,7 +612,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, unsigned crt_order_flags; /* group creation order flag */ unsigned i; unsigned u; - unsigned uf; + int ifil; int is_ref = 0; htri_t is_named; hbool_t limit_maxdims; @@ -740,8 +718,8 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (options->op_tbl->objs) { for (u = 0; u < options->op_tbl->nelems; u++) { if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) - for (uf = 0; uf < options->op_tbl->objs[uf].nfilters; uf++) { - if (options->op_tbl->objs[u].filter[uf].filtn > 0) + for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) { + if (options->op_tbl->objs[u].filter[ifil].filtn > 0) req_filter = 1; } } @@ -1350,7 +1328,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) if (!pr) printf(FORMAT_OBJ, "dset", objname); else { - char str[255], temp[28]; + char str[512], temp[512]; HDstrcpy(str, "dset "); HDstrcat(str, strfilter); diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 3d9472a..7e32def 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -42,7 +42,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ H5D_layout_t layout; int rank; /* rank of dataset */ hsize_t chsize[64]; /* chunk size in elements */ - unsigned int i; + int i; + unsigned u; /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) @@ -65,8 +66,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); objout->chunk.rank = rank; - for (i = 0; i < rank; i++) - objout->chunk.chunk_lengths[i] = chsize[i]; + for (u = 0; u < (unsigned)rank; u++) + objout->chunk.chunk_lengths[u] = chsize[u]; } done: @@ -85,8 +86,7 @@ static int aux_find_obj(const char* name, /* object name from traverse list */ pack_info_t *obj /*OUT*/) /* info about object to filter */ { char *pdest = NULL; - char *pname = NULL; - int result; + const char *pname = NULL; unsigned int i; for (i = 0; i < options->op_tbl->nelems; i++) { diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index a275443..f5846ba 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -22,7 +22,7 @@ */ static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt); -static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, +static int copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout); static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out, trav_table_t *travt); @@ -81,7 +81,7 @@ int do_copy_refobjs(hid_t fidin, if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); - if(copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0) + if(copy_refs_attr(grp_in, grp_out, travt, fidout) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); if(H5Gclose(grp_out) < 0) @@ -316,7 +316,7 @@ int do_copy_refobjs(hid_t fidin, * copy referenced objects in attributes *------------------------------------------------------------------------- */ - if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0) + if(copy_refs_attr(dset_in, dset_out, travt, fidout) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); /*------------------------------------------------------------------------- @@ -426,7 +426,6 @@ done: static int copy_refs_attr(hid_t loc_in, hid_t loc_out, - pack_opt_t *options, trav_table_t *travt, hid_t fidout) /* for saving references */ { @@ -450,7 +449,6 @@ static int copy_refs_attr(hid_t loc_in, is_ref_comp = 0; void *refbuf = NULL; void *buf = NULL; - const char *refname = NULL; unsigned *ref_comp_index = NULL; size_t *ref_comp_size = NULL; int ref_comp_field_n = 0; @@ -604,12 +602,9 @@ static int copy_refs_attr(hid_t loc_in, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ - for(i = 0; i < (unsigned)nelmts; i++) { - if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0) + for(i = 0; i < (unsigned)nelmts; i++) + if(update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt) < 0) continue; - if(options->verbose) - printf("object <%s> reference created to <%s>\n", name, refname); - } /* i */ } /* H5T_STD_REF_OBJ */ /* handle region references */ else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) { @@ -632,12 +627,9 @@ static int copy_refs_attr(hid_t loc_in, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ - for(i = 0; i < (unsigned)nelmts; i++) { - if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0) + for(i = 0; i < (unsigned)nelmts; i++) + if(update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt) < 0) continue; - if(options->verbose) - printf("object <%s> region reference created to <%s>\n", name, refname); - } } /* H5T_STD_REF_DSETREG */ else if (is_ref_vlen) { /* handle VLEN of references */ @@ -700,7 +692,7 @@ static int copy_refs_attr(hid_t loc_in, size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]); hobj_ref_t ref_out; - if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt) < 0) /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ continue; HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); } /* if */ diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index ac3bbee..4f92cae 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -108,6 +108,10 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define SPACE1_DIM1 0 #define SPACE1_DIM2 0 +/* Error macros */ +#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define PROGRAM_ERROR {AT(); goto error;} + /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group, @@ -176,7 +180,7 @@ static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int ma static void gen_datareg(hid_t fid, int make_diffs); /* utilities */ static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); -static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); +static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); static int gen_dataset_idx(const char *file, int format); /*------------------------------------------------------------------------- @@ -284,7 +288,7 @@ int main(void) /* string dataset and attribute. HDFFV-10028 */ test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2); - return 0; + return EXIT_SUCCESS; } /*------------------------------------------------------------------------- @@ -4906,9 +4910,9 @@ out: * types. * h5diff should show non-comparable output from these common objects. *-------------------------------------------------------------------------*/ -static void test_objs_nocomparables(const char *fname1, const char *fname2) +static void +test_objs_nocomparables(const char *fname1, const char *fname2) { - herr_t status = SUCCEED; hid_t fid1 = -1; hid_t fid2 = -1; hid_t topgid1 = -1; @@ -4925,110 +4929,90 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) * Open file(s) to add objects *------------------------------------------------------------------------*/ /* file1 */ - fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); - status = FAIL; - goto out; - } + if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* file2 */ - fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname2); - status = FAIL; - goto out; - } + if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file1 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); - goto out; - } + if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0) + PROGRAM_ERROR /* group */ - gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid1 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); - goto out; - } + if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file2 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* group */ - gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid2 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); - goto out; - } + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); - goto out; - } + if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0) + PROGRAM_ERROR -out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if (fid1) + if(H5Fclose(fid1) < 0) + PROGRAM_ERROR + if(H5Fclose(fid2) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid1) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid2) < 0) + PROGRAM_ERROR + if(H5Gclose(gid1) < 0) + PROGRAM_ERROR + if(H5Gclose(gid2) < 0) + PROGRAM_ERROR + if(H5Tclose(tid1) < 0) + PROGRAM_ERROR + if(H5Tclose(tid2) < 0) + PROGRAM_ERROR + + return; + +error: + H5E_BEGIN_TRY { H5Fclose(fid1); - if (fid2) H5Fclose(fid2); - if (topgid1) H5Gclose(topgid1); - if (topgid2) H5Gclose(topgid2); - if (gid1) H5Gclose(gid1); - if (gid2) H5Gclose(gid2); - if (tid1) H5Tclose(tid1); - if (tid2) H5Tclose(tid2); + } H5E_END_TRY; + return; } static hid_t mkstr(int size, H5T_str_t pad) @@ -8083,36 +8067,40 @@ out: * *------------------------------------------------------------------------- */ -static -int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) +static herr_t +write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { hid_t did = -1; hid_t sid = -1; /* create a space */ - if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) - goto out; + if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + PROGRAM_ERROR /* create the dataset */ - if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* write */ - if (buf) { - if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - } + if(buf) + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + PROGRAM_ERROR /* close */ - H5Dclose(did); - H5Sclose(sid); + if(H5Dclose(did) < 0) + PROGRAM_ERROR + if(H5Sclose(sid) < 0) + PROGRAM_ERROR return SUCCEED; -out: +error: + + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; - H5Dclose(did); - H5Sclose(sid); return FAIL; -} +} /* end write_dset() */ diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 88c8ea5..7f80c23 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -172,7 +172,7 @@ gen_enhance_files(hbool_t user) int data[NUM_ELMTS]; /* Buffer for data */ int fd = -1; /* The file descriptor ID */ int64_t eoa; /* The EOA value */ - int32_t chksum; /* The chksum value */ + uint32_t chksum; /* The chksum value */ int i = 0 , j = 0, u = 0; /* Local index variable */ /* Get a copy of the default file creation property */ diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index ce866b4..08ebfc7 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -130,7 +130,7 @@ int main(void) set = H5Dopen2(fil, setname, H5P_DEFAULT); H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); H5Dclose(set); out: @@ -151,7 +151,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); mname = H5Tget_member_name(fix, 1); printf("Data comparison:\n" "%14s (%2d) %6f = %f\n" @@ -162,7 +162,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 2)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2))); mname = H5Tget_member_name(fix, 2); printf("%14s (%2d) %6f = %f\n" " %6f = %6f\n", @@ -172,7 +172,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); printf("\n" "Short circuit\n" " %6f = %f\n" -- cgit v0.12