From 637a8f7562c32f1b76b6ff67926baa2b816a3355 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 15 Nov 2017 17:14:35 -0600 Subject: Correct linkage of filters and other libs --- CMakeFilters.cmake | 16 ++++++++-------- src/CMakeLists.txt | 4 ++-- test/CMakeLists.txt | 4 ++-- test/dsets.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 804b16b..71dabb1 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -45,8 +45,8 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) if (NOT ZLIB_FOUND) find_package (ZLIB) # Legacy find if (ZLIB_FOUND) - set (LINK_LIBS ${LINK_LIBS} ${ZLIB_LIBRARIES}) - set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${ZLIB_LIBRARIES}) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) + set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES}) endif () endif () endif () @@ -78,9 +78,9 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DEFLATE") endif () if (BUILD_SHARED_LIBS) - set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${ZLIB_SHARED_LIBRARY}) + set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_SHARED_LIBRARY}) endif () - set (LINK_LIBS ${LINK_LIBS} ${ZLIB_STATIC_LIBRARY}) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY}) INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS}) message (STATUS "Filter ZLIB is ON") endif () @@ -96,8 +96,8 @@ if (HDF5_ENABLE_SZIP_SUPPORT) if (NOT SZIP_FOUND) find_package (SZIP) # Legacy find if (SZIP_FOUND) - set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES}) - set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${SZIP_LIBRARIES}) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) + set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_LIBRARIES}) endif () endif () endif () @@ -119,9 +119,9 @@ if (HDF5_ENABLE_SZIP_SUPPORT) endif () endif () if (BUILD_SHARED_LIBS) - set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${SZIP_SHARED_LIBRARY}) + set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_SHARED_LIBRARY}) endif () - set (LINK_LIBS ${LINK_LIBS} ${SZIP_STATIC_LIBRARY}) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) message (STATUS "Filter SZIP is ON") if (H5_HAVE_FILTER_SZIP) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 91b8e0c..b163b8a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -883,7 +883,7 @@ set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS}) +target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) target_link_libraries (${HDF5_LIB_TARGET} PUBLIC dl) endif () @@ -927,7 +927,7 @@ if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS}) + target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC dl) endif () diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0a2afbf..fca864b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,7 +37,7 @@ endif () if (MINGW) target_link_libraries (${HDF5_TEST_LIB_TARGET} "wsock32.lib") endif () -target_link_libraries (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_link_libraries (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_LIBS}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC) set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test @@ -53,7 +53,7 @@ if (BUILD_SHARED_LIBS) if (MINGW) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "wsock32.lib") endif () - target_link_libraries (${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_LIBS}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test diff --git a/test/dsets.c b/test/dsets.c index 4088304..0fff2d1 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -2087,7 +2087,7 @@ test_get_filter_info(void) #ifdef H5_HAVE_FILTER_SZIP if(H5Zget_filter_info(H5Z_FILTER_SZIP, &flags) < 0) TEST_ERROR - if(SZ_encoder_enabled()) { + if(H5Z_SZIP->encoder_present) { if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) TEST_ERROR -- cgit v0.12 From fea722ec678772a9debcbd56221d1326b11f7ca8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 16 Nov 2017 09:04:50 -0600 Subject: Add note for plugins --- release_docs/RELEASE.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index f8ad620..9e3c3a9 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -157,6 +157,25 @@ Bug Fixes since HDF5-1.10.1 release Library ------- + - filter plugin handling in H5PL.c and H5Z.c + + It was discovered that the dynamic loading process used by + filter plugins had issues with memory allocation and library + dependencies. + + CMake build process changed to use LINK INTERFACE keywords, which + allowed HDF5 C library to make dependent libraries private. The + filter plugin libraries no longer require dependent libraries + (such as szip or zlib) to be available. + (ADB - 2017/11/16, HDFFV-10328) + + The H5Z_class2_t structure returned by the filter plugins are + now dynamically allocated in H5Zregister function. Access to + the functions in the filter library now always use the dynamic + library API. + + (ADB - 2017/11/16, HDFFV-10329) + - H5Zfilter_avail in H5Z.c The public function checked for plugins, while the private -- cgit v0.12 From 8e193705c5700d32866d6e7c71ef17743015a84e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 16 Nov 2017 09:28:58 -0600 Subject: Fix some of the whitespace --- test/tattr.c | 254 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 127 insertions(+), 127 deletions(-) diff --git a/test/tattr.c b/test/tattr.c index d7152ed..3786d0d 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -163,21 +163,21 @@ static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo, static void test_attr_basic_write(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t group; /* Group ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t attr, attr2; /* Attribute ID */ - hsize_t attr_size; /* storage size for attribute */ - ssize_t attr_name_size; /* size of attribute name */ - char *attr_name=NULL; /* name of attribute */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR1_DIM1}; - hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; - int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */ - int i; - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hid_t attr, attr2; /* Attribute ID */ + hsize_t attr_size; /* storage size for attribute */ + ssize_t attr_name_size; /* size of attribute name */ + char *attr_name=NULL; /* name of attribute */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; + int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */ + int i; + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Scalar Attribute Writing Functions\n")); @@ -402,15 +402,15 @@ test_attr_basic_write(hid_t fapl) static void test_attr_basic_read(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t group; /* Group ID */ - hid_t attr; /* Attribute ID */ - H5O_info_t oinfo; /* Object info */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t attr; /* Attribute ID */ + H5O_info_t oinfo; /* Object info */ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ - int i, j; /* Local index variables */ - herr_t ret; /* Generic return value */ + int i, j; /* Local index variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -500,7 +500,7 @@ test_attr_flush(hid_t fapl) set; /* Dataset ID */ double wdata=3.14159F; /* Data to write */ double rdata; /* Data read in */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Attribute Flushing\n")); @@ -563,12 +563,12 @@ test_attr_plist(hid_t fapl) hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t sid1,sid2; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t plist; /* Property list ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR1_DIM1}; - H5T_cset_t cset; /* Character set for attributes */ - herr_t ret; /* Generic return value */ + hid_t attr; /* Attribute ID */ + hid_t plist; /* Property list ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + H5T_cset_t cset; /* Character set for attributes */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Attribute Property Lists\n")); @@ -675,14 +675,14 @@ static void test_attr_compound_write(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t tid1; /* Attribute datatype ID */ - hid_t sid1,sid2; /* Dataspace ID */ + hid_t dataset; /* Dataset ID */ + hid_t tid1; /* Attribute datatype ID */ + hid_t sid1,sid2; /* Dataspace ID */ hid_t attr; /* Attribute ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2}; + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2}; hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Multiple Attribute Functions\n")); @@ -762,11 +762,11 @@ test_attr_compound_write(hid_t fapl) static void test_attr_compound_read(hid_t fapl) { - hid_t fid1; /* HDF5 File ID */ + hid_t fid1; /* HDF5 File ID */ hid_t dataset; /* Dataset ID */ hid_t space; /* Attribute dataspace */ hid_t type; /* Attribute datatype */ - hid_t attr; /* Attribute ID */ + hid_t attr; /* Attribute ID */ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ int rank; /* Attribute rank */ hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */ @@ -781,7 +781,7 @@ test_attr_compound_read(hid_t fapl) ssize_t name_len; /* Length of attribute name */ H5O_info_t oinfo; /* Object info */ int i, j; /* Local index variables */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -830,7 +830,7 @@ test_attr_compound_read(hid_t fapl) HDstrcmp(fieldname, ATTR4_FIELDNAME3))) TestErrPrintf("invalid field name for field #%d: %s\n", i, fieldname); H5free_memory(fieldname); - } /* end for */ + } /* end for */ offset = H5Tget_member_offset(type, 0); VERIFY(offset, attr4_field1_off, "H5Tget_member_offset"); offset = H5Tget_member_offset(type, 1); @@ -878,7 +878,7 @@ test_attr_compound_read(hid_t fapl) printf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i); printf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d); TestErrPrintf("%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n", __LINE__, i, j, attr_data4[i][j].c, i, j, read_data4[i][j].c); - } /* end if */ + } /* end if */ /* Verify Name */ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); @@ -913,12 +913,12 @@ static void test_attr_scalar_write(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ hid_t attr; /* Attribute ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -979,13 +979,13 @@ static void test_attr_scalar_read(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ H5S_class_t stype; /* Dataspace class */ - float rdata = 0.0F; /* Buffer for reading 1st attribute */ + float rdata = 0.0F; /* Buffer for reading 1st attribute */ H5O_info_t oinfo; /* Object info */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Scalar Attribute Reading Functions\n")); @@ -1013,8 +1013,8 @@ test_attr_scalar_read(hid_t fapl) /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!H5_FLT_ABS_EQUAL(rdata, attr_data5)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", - "H5Aread", (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__); + printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + "H5Aread", (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__); /* Get the attribute's dataspace */ sid = H5Aget_space(attr); @@ -1051,15 +1051,15 @@ static void test_attr_mult_write(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ hid_t attr; /* Attribute ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR1_DIM1}; - hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; - hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3}; + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; + hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3}; hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Multiple Attribute Functions\n")); @@ -1170,11 +1170,11 @@ test_attr_mult_write(hid_t fapl) static void test_attr_mult_read(hid_t fapl) { - hid_t fid1; /* HDF5 File ID */ + hid_t fid1; /* HDF5 File ID */ hid_t dataset; /* Dataset ID */ hid_t space; /* Attribute dataspace */ hid_t type; /* Attribute datatype */ - hid_t attr; /* Attribute ID */ + hid_t attr; /* Attribute ID */ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ char temp_name[ATTR_NAME_LEN]; /* Buffer for mangling attribute names */ int rank; /* Attribute rank */ @@ -1185,10 +1185,10 @@ test_attr_mult_read(hid_t fapl) int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */ - ssize_t name_len; /* Length of attribute name */ + ssize_t name_len; /* Length of attribute name */ H5O_info_t oinfo; /* Object info */ int i, j, k; /* Local index values */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -1432,12 +1432,12 @@ attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR static void test_attr_iterate(hid_t fapl) { - hid_t file; /* HDF5 File ID */ + hid_t file; /* HDF5 File ID */ hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ + hid_t sid; /* Dataspace ID */ int count; /* operator data for the iterator */ H5O_info_t oinfo; /* Object info */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -1504,13 +1504,13 @@ test_attr_iterate(hid_t fapl) static void test_attr_delete(hid_t fapl) { - hid_t fid1; /* HDF5 File ID */ + hid_t fid1; /* HDF5 File ID */ hid_t dataset; /* Dataset ID */ hid_t attr; /* Attribute ID */ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ ssize_t name_len; /* Length of attribute name */ H5O_info_t oinfo; /* Object info */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Attribute Functions\n")); @@ -1635,7 +1635,7 @@ test_attr_dtype_shared(hid_t fapl) H5O_info_t oinfo; /* Object's information */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Shared Datatypes with Attributes\n")); @@ -1802,17 +1802,17 @@ test_attr_dtype_shared(hid_t fapl) static void test_attr_duplicate_ids(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t gid1, gid2; /* Group ID */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t gid1, gid2; /* Group ID */ hid_t sid1,sid2; /* Dataspace ID */ - hid_t attr, attr2; /* Attribute ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR1_DIM1}; - int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */ - int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */ - int i; - herr_t ret; /* Generic return value */ + hid_t attr, attr2; /* Attribute ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */ + int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */ + int i; + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing operations with two ID handles\n")); @@ -1830,7 +1830,7 @@ test_attr_duplicate_ids(hid_t fapl) /* Create a dataset */ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Create dataspace for attribute */ @@ -2047,12 +2047,12 @@ test_attr_duplicate_ids(hid_t fapl) static int test_attr_dense_verify(hid_t loc_id, unsigned max_attr) { - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - hid_t attr; /* Attribute ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + hid_t attr; /* Attribute ID */ unsigned value; /* Attribute value */ unsigned u; /* Local index variable */ int old_nerrs; /* Number of errors when entering this check */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Retrieve the current # of reported errors */ old_nerrs = GetTestNumErrs(); @@ -2117,19 +2117,19 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) static void test_attr_dense_create(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ hid_t attr; /* Attribute ID */ hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned max_compact; /* Maximum # of attributes to store compactly */ unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_dense; /* Are attributes stored densely? */ unsigned u; /* Local index variable */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dense Attribute Storage Creation\n")); @@ -2248,19 +2248,19 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) static void test_attr_dense_open(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ hid_t attr; /* Attribute ID */ hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned max_compact; /* Maximum # of attributes to store compactly */ unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_dense; /* Are attributes stored densely? */ unsigned u; /* Local index variable */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Opening Attributes in Dense Storage\n")); @@ -2387,20 +2387,20 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) static void test_attr_dense_delete(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned max_compact; /* Maximum # of attributes to store compactly */ unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_dense; /* Are attributes stored densely? */ unsigned u; /* Local index variable */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ H5O_info_t oinfo; /* Object info */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Attributes in Dense Storage\n")); @@ -2565,21 +2565,21 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) static void test_attr_dense_rename(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */ unsigned max_compact; /* Maximum # of attributes to store compactly */ unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_dense; /* Are attributes stored densely? */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ H5O_info_t oinfo; /* Object info */ unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Renaming Attributes in Dense Storage\n")); @@ -2724,21 +2724,21 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) static void test_attr_dense_unlink(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ hid_t attr; /* Attribute ID */ hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned max_compact; /* Maximum # of attributes to store compactly */ unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_dense; /* Are attributes stored densely? */ size_t mesg_count; /* # of shared messages */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ H5O_info_t oinfo; /* Object info */ unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Unlinking Object with Attributes in Dense Storage\n")); @@ -2856,17 +2856,17 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) { hid_t fid; /* HDF5 File ID */ hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ + hid_t sid; /* Dataspace ID */ hid_t attr; /* Attribute ID */ hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned max_compact, rmax_compact; /* Maximum # of attributes to store compactly */ unsigned min_dense, rmin_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_dense; /* Are attributes stored densely? */ unsigned u; /* Local index variable */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Phase Change Limits For Attributes in Dense Storage\n")); @@ -3019,13 +3019,13 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) static void test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ hid_t gid1, gid2; /* Group ID */ - hid_t sid, sid2; /* Dataspace ID */ + hid_t sid, sid2; /* Dataspace ID */ hid_t attr, attr2, add_attr; /* Attribute ID */ hid_t dcpl; /* Dataset creation property list ID */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ hsize_t dims[] = {ATTR1_DIM1}; int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading attribute */ int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */ @@ -3033,9 +3033,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) unsigned read_scalar; /* variable for reading attribute*/ unsigned max_compact; /* Maximum # of attributes to store compactly */ unsigned min_dense; /* Minimum # of attributes to store "densely" */ - htri_t is_dense; /* Are attributes stored densely? */ + htri_t is_dense; /* Are attributes stored densely? */ unsigned u, i; /* Local index variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing operations with two IDs for Dense Storage\n")); -- cgit v0.12 From 9f1cd84c158a2a951a0f7680a0b08f09ac64515e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 16 Nov 2017 11:45:36 -0600 Subject: HDFFV-10328 merge allocation changes from 1.8 --- src/H5PLint.c | 21 +- src/H5PLplugin_cache.c | 26 +- src/H5Z.c | 715 ++++++++++++++++++++++++++----------------------- 3 files changed, 422 insertions(+), 340 deletions(-) diff --git a/src/H5PLint.c b/src/H5PLint.c index c887f86..e969cbf 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -342,19 +342,38 @@ H5PL__open(const char *path, H5PL_type_t type, int id, hbool_t *success, const v /* Check if the filter IDs match */ if (info->id == id) { + H5Z_class2_t *plugin_copy = NULL; /* Store the plugin in the cache */ if (H5PL__add_plugin(type, id, handle)) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache") + /* allocate local copy of plugin info */ + if (NULL == (plugin_copy = (H5Z_class2_t *)H5MM_calloc(sizeof(H5Z_class2_t)))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for plugin info") + /* Set the plugin info to return */ + *plugin_info = (const void *)info; + + plugin_copy->version = info->version; + plugin_copy->id = info->id; + plugin_copy->encoder_present = info->encoder_present; + plugin_copy->decoder_present = info->decoder_present; + plugin_copy->can_apply = info->can_apply; + plugin_copy->set_local = info->set_local; + plugin_copy->filter = info->filter; + /* copy the user's string into the property */ + if(NULL == (plugin_copy->name = (char *)H5MM_xstrdup(info->name))) + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "can't allocate memory for plugin info name") + /* Set output parameters */ *success = TRUE; - *plugin_info = (const void *)info; } } done: if (!success && handle) + if (*plugin_info) { + *plugin_info = (H5Z_class2_t *)H5MM_xfree(*plugin_info); if (H5PL__close(handle) < 0) HDONE_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c index d826ba0..ec14159 100644 --- a/src/H5PLplugin_cache.c +++ b/src/H5PLplugin_cache.c @@ -280,18 +280,34 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f H5PL_get_plugin_info_t get_plugin_info_function; const H5Z_class2_t *filter_info; + H5Z_class2_t *plugin_copy = NULL; /* Get the "get plugin info" function from the plugin. */ if (NULL == (get_plugin_info_function = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_cache_g[u]).handle, "H5PLget_plugin_info"))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") /* Call the "get plugin info" function */ if (NULL == (filter_info = (const H5Z_class2_t *)(*get_plugin_info_function)())) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info") + + if (NULL == (plugin_copy = (H5Z_class2_t *)H5MM_calloc(sizeof(H5Z_class2_t)))) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for plugin info") + /* Set the plugin info to return */ + *plugin_info = plugin_copy; + + plugin_copy->version = filter_info->version; + plugin_copy->id = filter_info->id; + plugin_copy->encoder_present = filter_info->encoder_present; + plugin_copy->decoder_present = filter_info->decoder_present; + plugin_copy->can_apply = filter_info->can_apply; + plugin_copy->set_local = filter_info->set_local; + plugin_copy->filter = filter_info->filter; + /* copy the user's string into the property */ + if(NULL == (plugin_copy->name = (char *)H5MM_xstrdup(filter_info->name))) + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "can't allocate memory for plugin info name") /* Set output parameters */ *found = TRUE; - *plugin_info = filter_info; /* No need to continue processing */ break; @@ -301,6 +317,10 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f } /* end for */ done: + /* unallocate local copy of plugin info on failure */ + if (FAIL == ret_value && *plugin_info) { + *plugin_info = (H5Z_class2_t *)H5MM_xfree(*plugin_info); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5PL__find_plugin_in_cache() */ #pragma GCC diagnostic pop diff --git a/src/H5Z.c b/src/H5Z.c index 1d023b5..e7574cd 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -34,15 +34,15 @@ #ifdef H5Z_DEBUG typedef struct H5Z_stats_t { struct { - hsize_t total; /*total number of bytes processed */ - hsize_t errors; /*bytes of total attributable to errors */ - H5_timer_t timer; /*execution time including errors */ - } stats[2]; /*0=output, 1=input */ + hsize_t total; /* total number of bytes processed */ + hsize_t errors; /* bytes of total attributable to errors */ + H5_timer_t timer; /* execution time including errors */ + } stats[2]; /* 0=output, 1=input */ } H5Z_stats_t; #endif /* H5Z_DEBUG */ typedef struct H5Z_object_t { - H5Z_filter_t filter_id; /* ID of the filter we're looking for */ + H5Z_filter_t filter_id; /* ID of the filter we're looking for */ htri_t found; /* Whether we find an object using the filter */ } H5Z_object_t; @@ -86,23 +86,23 @@ H5Z__init_package(void) FUNC_ENTER_PACKAGE /* Internal filters */ - if(H5Z_register(H5Z_SHUFFLE) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter") - if(H5Z_register(H5Z_FLETCHER32) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter") - if(H5Z_register(H5Z_NBIT) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter") - if(H5Z_register(H5Z_SCALEOFFSET) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter") + if (H5Z_register (H5Z_SHUFFLE) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter") + if (H5Z_register (H5Z_FLETCHER32) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter") + if (H5Z_register (H5Z_NBIT) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter") + if (H5Z_register (H5Z_SCALEOFFSET) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter") /* External filters */ #ifdef H5_HAVE_FILTER_DEFLATE - if(H5Z_register(H5Z_DEFLATE) < 0) + if (H5Z_register (H5Z_DEFLATE) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter") #endif /* H5_HAVE_FILTER_DEFLATE */ #ifdef H5_HAVE_FILTER_SZIP H5Z_SZIP->encoder_present = SZ_encoder_enabled(); - if(H5Z_register(H5Z_SZIP) < 0) + if (H5Z_register (H5Z_SZIP) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter") #endif /* H5_HAVE_FILTER_SZIP */ @@ -123,6 +123,7 @@ int H5Z_term_package(void) { int n = 0; + size_t i; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -130,7 +131,6 @@ H5Z_term_package(void) #ifdef H5Z_DEBUG char comment[16], bandwidth[32]; int dir, nprint = 0; - size_t i; if(H5DEBUG(Z)) { for(i = 0; i < H5Z_table_used_g; i++) { @@ -179,6 +179,12 @@ H5Z_term_package(void) } /* end for */ } /* end if */ #endif /* H5Z_DEBUG */ + for (i = 0; i < H5Z_table_used_g; i++) { + H5Z_class2_t *cls = (H5Z_class2_t *)(H5Z_table_g+i); + /* deallocate plugin info name */ + if (cls->name) + cls->name = (char *)H5MM_xfree(cls->name); + } /* Free the table of filters */ if(H5Z_table_g) { H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g); @@ -211,8 +217,8 @@ herr_t H5Zregister(const void *cls) { const H5Z_class2_t *cls_real = (const H5Z_class2_t *) cls; /* "Real" class pointer */ - H5Z_class2_t cls_new; /* Translated class struct */ - herr_t ret_value=SUCCEED; /* Return value */ + H5Z_class2_t cls_new; /* Translated class struct */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", cls); @@ -231,7 +237,7 @@ H5Zregister(const void *cls) * at least 256, there should be no overlap and the version of the struct * can be determined by the value of the first field. */ - if(cls_real->version != H5Z_CLASS_T_VERS) { + if (cls_real->version != H5Z_CLASS_T_VERS) { #ifndef H5_NO_DEPRECATED_SYMBOLS /* Assume it is an old "H5Z_class1_t" instead */ const H5Z_class1_t *cls_old = (const H5Z_class1_t *) cls; @@ -251,19 +257,19 @@ H5Zregister(const void *cls) #else /* H5_NO_DEPRECATED_SYMBOLS */ /* Deprecated symbols not allowed, throw an error */ - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5Z_class_t version number"); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5Z_class_t version number"); #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ - if (cls_real->id<0 || cls_real->id>H5Z_FILTER_MAX) + if (cls_real->id < 0 || cls_real->id > H5Z_FILTER_MAX) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") - if (cls_real->idid < H5Z_FILTER_RESERVED) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters") - if (cls_real->filter==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified") + if (cls_real->filter == NULL) + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified") /* Do it */ - if (H5Z_register (cls_real)<0) + if (H5Z_register (cls_real) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") done: @@ -277,39 +283,40 @@ done: * Purpose: Same as the public version except this one allows filters * to be set for predefined method numbers id >= 0 && cls->id <= H5Z_FILTER_MAX); + HDassert (cls); + HDassert (cls->id >= 0 && cls->id <= H5Z_FILTER_MAX); /* Is the filter already registered? */ - for(i = 0; i < H5Z_table_used_g; i++) - if(H5Z_table_g[i].id == cls->id) + for (i = 0; i < H5Z_table_used_g; i++) + if (H5Z_table_g[i].id == cls->id) break; /* Filter not already registered */ - if(i >= H5Z_table_used_g) { - if(H5Z_table_used_g >= H5Z_table_alloc_g) { - size_t n = MAX(H5Z_MAX_NFILTERS, 2*H5Z_table_alloc_g); + if (i >= H5Z_table_used_g) { + if (H5Z_table_used_g >= H5Z_table_alloc_g) { + size_t n = MAX(H5Z_MAX_NFILTERS, 2 * H5Z_table_alloc_g); H5Z_class2_t *table = (H5Z_class2_t *)H5MM_realloc(H5Z_table_g, n * sizeof(H5Z_class2_t)); #ifdef H5Z_DEBUG H5Z_stats_t *stat_table = (H5Z_stats_t *)H5MM_realloc(H5Z_stat_table_g, n * sizeof(H5Z_stats_t)); #endif /* H5Z_DEBUG */ - if(!table) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table") + if (!table) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table") H5Z_table_g = table; #ifdef H5Z_DEBUG - if(!stat_table) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter statistics table") + if (!stat_table) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter statistics table") H5Z_stat_table_g = stat_table; #endif /* H5Z_DEBUG */ H5Z_table_alloc_g = n; @@ -317,15 +324,21 @@ H5Z_register (const H5Z_class2_t *cls) /* Initialize */ i = H5Z_table_used_g++; - HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); + HDmemcpy (H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); + H5Z_table_g[i].name = (char *)H5MM_xstrdup(cls->name); #ifdef H5Z_DEBUG - HDmemset(H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t)); + HDmemset (H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t)); #endif /* H5Z_DEBUG */ } /* end if */ /* Filter already registered */ else { + H5Z_class2_t *old_cls = (H5Z_class2_t *)(H5Z_table_g+i); + /* deallocate plugin info name */ + if (old_cls->name) + old_cls->name = (char *)H5MM_xfree(old_cls->name); /* Replace old contents */ - HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); + HDmemcpy (old_cls, cls, sizeof(H5Z_class2_t)); + old_cls->name = (char *)H5MM_xstrdup(cls->name); } /* end else */ done: @@ -338,25 +351,26 @@ done: * * Purpose: This function unregisters a filter. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t H5Zunregister(H5Z_filter_t id) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "Zf", id); /* Check args */ - if(id < 0 || id > H5Z_FILTER_MAX) + if (id < 0 || id > H5Z_FILTER_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") - if(id < H5Z_FILTER_RESERVED) + if (id < H5Z_FILTER_RESERVED) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters") /* Do it */ - if(H5Z_unregister(id) < 0) + if (H5Z_unregister(id) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter") done: @@ -370,27 +384,29 @@ done: * Purpose: Same as the public version except this one allows filters * to be unset for predefined method numbers =0 && filter_id<=H5Z_FILTER_MAX); /* Is the filter already registered? */ - for (filter_index=0; filter_index=H5Z_table_used_g) + if (filter_index >= H5Z_table_used_g) HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered") /* Initialize the structure object for iteration */ @@ -398,28 +414,32 @@ H5Z_unregister(H5Z_filter_t filter_id) object.found = FALSE; /* Iterate through all opened datasets, returns a failure if any of them uses the filter */ - if(H5I_iterate(H5I_DATASET, H5Z__check_unregister_dset_cb, &object, FALSE) < 0) + if (H5I_iterate(H5I_DATASET, H5Z__check_unregister_dset_cb, &object, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed") - if(object.found) + if (object.found) HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "can't unregister filter because a dataset is still using it") /* Iterate through all opened groups, returns a failure if any of them uses the filter */ - if(H5I_iterate(H5I_GROUP, H5Z__check_unregister_group_cb, &object, FALSE) < 0) + if (H5I_iterate(H5I_GROUP, H5Z__check_unregister_group_cb, &object, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed") - if(object.found) + if (object.found) HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "can't unregister filter because a group is still using it") /* Iterate through all opened files and flush them */ - if(H5I_iterate(H5I_FILE, H5Z__flush_file_cb, NULL, FALSE) < 0) + if (H5I_iterate(H5I_FILE, H5Z__flush_file_cb, NULL, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed") + /* deallocate plugin info name */ + old_cls = (H5Z_class2_t *)(H5Z_table_g+filter_index); + if (old_cls->name) + old_cls->name = (char *)H5MM_xfree(old_cls->name); /* Remove filter from table */ /* Don't worry about shrinking table size (for now) */ - HDmemmove(&H5Z_table_g[filter_index],&H5Z_table_g[filter_index+1],sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-filter_index)); + HDmemmove (&H5Z_table_g[filter_index], &H5Z_table_g[filter_index+1], sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-filter_index)); #ifdef H5Z_DEBUG - HDmemmove(&H5Z_stat_table_g[filter_index],&H5Z_stat_table_g[filter_index+1],sizeof(H5Z_stats_t)*((H5Z_table_used_g-1)-filter_index)); + HDmemmove (&H5Z_stat_table_g[filter_index], &H5Z_stat_table_g[filter_index+1], sizeof(H5Z_stats_t)*((H5Z_table_used_g-1)-filter_index)); #endif /* H5Z_DEBUG */ H5Z_table_used_g--; @@ -431,10 +451,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Z__check_unregister * - * Purpose: Check if an object uses the filter to be unregistered. + * Purpose: Check if an object uses the filter to be unregistered. * - * Return: TRUE if the object uses the filter. - * FALSE if not, NEGATIVE on error. + * Return: TRUE if the object uses the filter. + * FALSE if not, NEGATIVE on error. *------------------------------------------------------------------------- */ static htri_t @@ -446,12 +466,12 @@ H5Z__check_unregister(hid_t ocpl_id, H5Z_filter_t filter_id) FUNC_ENTER_STATIC /* Get the plist structure of object creation */ - if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_PLINE, H5E_BADATOM, FAIL, "can't find object for ID") + if (NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) + HGOTO_ERROR (H5E_PLINE, H5E_BADATOM, FAIL, "can't find object for ID") /* Check if the object creation property list uses the filter */ - if((ret_value = H5P_filter_in_pline(plist, filter_id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") + if ((ret_value = H5P_filter_in_pline(plist, filter_id)) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") done: FUNC_LEAVE_NOAPI(ret_value) @@ -483,25 +503,25 @@ H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void HDassert(obj_ptr); /* Get the group creation property */ - if((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list") + if ((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list") /* Check if the filter is in the group creation property list */ - if((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") + if ((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and * let H5Z_unregister return failure. */ - if(filter_in_pline) { + if (filter_in_pline) { object->found = TRUE; ret_value = TRUE; } /* end if */ done: - if(ocpl_id > 0) - if(H5I_dec_app_ref(ocpl_id) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") + if (ocpl_id > 0) + if (H5I_dec_app_ref(ocpl_id) < 0) + HDONE_ERROR (H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__check_unregister_group_cb() */ @@ -510,13 +530,13 @@ done: /*------------------------------------------------------------------------- * Function: H5Z__check_unregister_dset_cb * - * Purpose: The callback function for H5Z_unregister. It iterates - * through all opened objects. If the object is a dataset - * or a group and it uses the filter to be unregistered, the - * function returns TRUE. + * Purpose: The callback function for H5Z_unregister. It iterates + * through all opened objects. If the object is a dataset + * or a group and it uses the filter to be unregistered, the + * function returns TRUE. * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. + * Return: TRUE if the object uses the filter. + * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -529,28 +549,28 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * FUNC_ENTER_STATIC - HDassert(obj_ptr); + HDassert (obj_ptr); /* Get the dataset creation property */ - if((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get dataset creation property list") + if ((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't get dataset creation property list") /* Check if the filter is in the dataset creation property list */ - if((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") + if ((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and * let H5Z_unregister return failure. */ - if(filter_in_pline) { + if (filter_in_pline) { object->found = TRUE; ret_value = TRUE; } /* end if */ done: - if(ocpl_id > 0) - if(H5I_dec_app_ref(ocpl_id) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") + if (ocpl_id > 0) + if (H5I_dec_app_ref(ocpl_id) < 0) + HDONE_ERROR (H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__check_unregister_dset_cb() */ @@ -569,17 +589,17 @@ done: static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_UNUSED *key) { - int ret_value = FALSE; /* Return value */ + int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC - HDassert(obj_ptr); + HDassert (obj_ptr); /* Call the flush routine for mounted file hierarchies. Do a global flush * if the file is opened for write */ - if(H5F_ACC_RDWR & H5F_INTENT((H5F_t *)obj_ptr)) { - if(H5F_flush_mounts((H5F_t *)obj_ptr, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy") + if (H5F_ACC_RDWR & H5F_INTENT((H5F_t *)obj_ptr)) { + if (H5F_flush_mounts((H5F_t *)obj_ptr, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy") } /* end if */ done: @@ -598,17 +618,17 @@ done: htri_t H5Zfilter_avail(H5Z_filter_t id) { - htri_t ret_value=FALSE; /* Return value */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "Zf", id); /* Check args */ - if(id<0 || id>H5Z_FILTER_MAX) + if (id < 0 || id > H5Z_FILTER_MAX) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") - if((ret_value = H5Z_filter_avail(id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "unable to check the availability of the filter") + if ((ret_value = H5Z_filter_avail(id)) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "unable to check the availability of the filter") done: FUNC_LEAVE_API(ret_value) @@ -626,21 +646,25 @@ done: htri_t H5Z_filter_avail(H5Z_filter_t id) { - size_t i; /* Local index variable */ - const H5Z_class2_t *filter_info; - htri_t ret_value = FALSE; /* Return value */ + size_t i; /* Local index variable */ + H5Z_class2_t *filter_info; + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Is the filter already registered? */ - for(i = 0; i < H5Z_table_used_g; i++) - if(H5Z_table_g[i].id == id) - HGOTO_DONE(TRUE) - - if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)id))) { - if(H5Z_register(filter_info) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter") - HGOTO_DONE(TRUE) + for (i = 0; i < H5Z_table_used_g; i++) + if (H5Z_table_g[i].id == id) + HGOTO_DONE (TRUE) + + if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)id))) { + herr_t status = H5Z_register(filter_info); + if (filter_info->name) + filter_info->name = (char *)H5MM_xfree(filter_info->name); + filter_info = (H5Z_class2_t *)H5MM_xfree(filter_info); + if (status < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter") + HGOTO_DONE (TRUE) } done: FUNC_LEAVE_NOAPI(ret_value) @@ -666,59 +690,59 @@ H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, { H5Z_class2_t *fclass; /* Individual filter information */ size_t u; /* Local index variable */ - htri_t ret_value = TRUE; /* Return value */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT HDassert(pline->nused > 0); /* Iterate over filters */ - for(u = 0; u < pline->nused; u++) { + for (u = 0; u < pline->nused; u++) { /* Get filter information */ - if(NULL == (fclass = H5Z_find(pline->filter[u].id))) { + if (NULL == (fclass = H5Z_find(pline->filter[u].id))) { /* Ignore errors from optional filters */ - if(pline->filter[u].flags & H5Z_FLAG_OPTIONAL) - H5E_clear_stack(NULL); + if (pline->filter[u].flags & H5Z_FLAG_OPTIONAL) + H5E_clear_stack (NULL); else - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located") + HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located") } /* end if */ else { /* Make correct callback */ - switch(prelude_type) { + switch (prelude_type) { case H5Z_PRELUDE_CAN_APPLY: /* Check if filter is configured to be able to encode */ - if(!fclass->encoder_present) - HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled."); + if (!fclass->encoder_present) + HGOTO_ERROR (H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled."); /* Check if there is a "can apply" callback */ - if(fclass->can_apply) { + if (fclass->can_apply) { /* Make callback to filter's "can apply" function */ htri_t status = (fclass->can_apply)(dcpl_id, type_id, space_id); /* Indicate error during filter callback */ - if(status < 0) + if (status < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback") /* Indicate filter can't apply to this combination of parameters. * If the filter is NOT optional, returns failure. */ - if(status == FALSE && !(pline->filter[u].flags & H5Z_FLAG_OPTIONAL)) + if (status == FALSE && !(pline->filter[u].flags & H5Z_FLAG_OPTIONAL)) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate") } /* end if */ break; case H5Z_PRELUDE_SET_LOCAL: /* Check if there is a "set local" callback */ - if(fclass->set_local) { + if (fclass->set_local) { /* Make callback to filter's "set local" function */ - if((fclass->set_local)(dcpl_id, type_id, space_id) < 0) + if ((fclass->set_local)(dcpl_id, type_id, space_id) < 0) /* Indicate error during filter callback */ - HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback") + HGOTO_ERROR (H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback") } /* end if */ break; default: - HDassert("invalid prelude type" && 0); + HDassert ("invalid prelude type" && 0); } /* end switch */ } /* end else */ } /* end for */ @@ -745,62 +769,62 @@ done: static herr_t H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type) { - hid_t space_id = -1; /* ID for dataspace describing chunk */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t space_id = -1; /* ID for dataspace describing chunk */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); - HDassert(H5I_DATATYPE == H5I_get_type(type_id)); + HDassert (H5I_GENPROP_LST == H5I_get_type(dcpl_id)); + HDassert (H5I_DATATYPE == H5I_get_type(type_id)); /* Check if the property list is non-default */ - if(dcpl_id != H5P_DATASET_CREATE_DEFAULT) { - H5P_genplist_t *dc_plist; /* Dataset creation property list object */ - H5O_layout_t dcpl_layout; /* Dataset's layout information */ + if (dcpl_id != H5P_DATASET_CREATE_DEFAULT) { + H5P_genplist_t *dc_plist; /* Dataset creation property list object */ + H5O_layout_t dcpl_layout; /* Dataset's layout information */ /* Get dataset creation property list object */ - if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") /* Peek at the layout information */ - if(H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") + if (H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ - if(H5D_CHUNKED == dcpl_layout.type) { + if (H5D_CHUNKED == dcpl_layout.type) { H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */ /* Get I/O pipeline information */ - if(H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") /* Check if the chunks have filters */ - if(dcpl_pline.nused > 0) { + if (dcpl_pline.nused > 0) { hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */ - H5S_t *space; /* Dataspace describing chunk */ - size_t u; /* Local index variable */ + H5S_t *space; /* Dataspace describing chunk */ + size_t u; /* Local index variable */ - /* Create a data space for a chunk & set the extent */ - for(u = 0; u < dcpl_layout.u.chunk.ndims; u++) + /* Create a dataspace for a chunk & set the extent */ + for (u = 0; u < dcpl_layout.u.chunk.ndims; u++) chunk_dims[u] = dcpl_layout.u.chunk.dim[u]; - if(NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + if (NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL))) + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") /* Get ID for dataspace to pass to filter routines */ - if((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) { - (void)H5S_close(space); - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) { + (void)H5S_close (space); + HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* end if */ /* Make the callbacks */ - if(H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + if (H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") } /* end if */ } /* end if */ } /* end if */ done: - if(space_id > 0 && H5I_dec_ref(space_id) < 0) + if (space_id > 0 && H5I_dec_ref(space_id) < 0) HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") FUNC_LEAVE_NOAPI(ret_value) @@ -814,7 +838,8 @@ done: * property list can be applied to a particular combination of * datatype and dataspace for a dataset. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success + * Negative on failure * * Notes: The chunk dimensions are used to create a dataspace, instead * of passing in the dataset's dataspace, since the chunk @@ -829,8 +854,8 @@ H5Z_can_apply(hid_t dcpl_id, hid_t type_id) FUNC_ENTER_NOAPI(FAIL) /* Make "can apply" callbacks for filters in pipeline */ - if(H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + if (H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") done: FUNC_LEAVE_NOAPI(ret_value) @@ -844,7 +869,8 @@ done: * settings for filters on a new dataset, based on the datatype * and dataspace of that dataset (chunk). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success + * Negative on failure * * Notes: The chunk dimensions are used to create a dataspace, instead * of passing in the dataset's dataspace, since the chunk @@ -859,8 +885,8 @@ H5Z_set_local(hid_t dcpl_id, hid_t type_id) FUNC_ENTER_NOAPI(FAIL) /* Make "set local" callbacks for filters in pipeline */ - if(H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") + if (H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") done: FUNC_LEAVE_NOAPI(ret_value) @@ -874,7 +900,8 @@ done: * applied to an opaque byte stream (currently only a group). * The pipeline is assumed to have at least one filter. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -884,11 +911,11 @@ H5Z_can_apply_direct(const H5O_pline_t *pline) FUNC_ENTER_NOAPI(FAIL) - HDassert(pline->nused > 0); + HDassert (pline->nused > 0); /* Make "can apply" callbacks for filters in pipeline */ - if(H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + if (H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") done: FUNC_LEAVE_NOAPI(ret_value) @@ -902,7 +929,8 @@ done: * new opaque object. The pipeline is assumed to have at * least one filter. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success + * Negative on failure * * Notes: This callback will almost certainly not do anything * useful, other than to make certain that the filter will @@ -916,11 +944,11 @@ H5Z_set_local_direct(const H5O_pline_t *pline) FUNC_ENTER_NOAPI(FAIL) - HDassert(pline->nused > 0); + HDassert (pline->nused > 0); /* Make "set local" callbacks for filters in pipeline */ - if(H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") + if (H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") done: FUNC_LEAVE_NOAPI(ret_value) @@ -930,58 +958,59 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_modify * - * Purpose: Modify filter parameters for specified pipeline. + * Purpose: Modify filter parameters for specified pipeline. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) { - size_t idx; /* Index of filter in pipeline */ - herr_t ret_value = SUCCEED; /* Return value */ + size_t idx; /* Index of filter in pipeline */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); - HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); - HDassert(0 == cd_nelmts || cd_values); + HDassert (pline); + HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert (0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); + HDassert (0 == cd_nelmts || cd_values); /* Locate the filter in the pipeline */ - for(idx = 0; idx < pline->nused; idx++) - if(pline->filter[idx].id == filter) + for (idx = 0; idx < pline->nused; idx++) + if (pline->filter[idx].id == filter) break; /* Check if the filter was not already in the pipeline */ - if(idx > pline->nused) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") + if (idx > pline->nused) + HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") /* Change parameters for filter */ pline->filter[idx].flags = flags; pline->filter[idx].cd_nelmts = cd_nelmts; /* Free any existing parameters */ - if(pline->filter[idx].cd_values != NULL && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) + if (pline->filter[idx].cd_values != NULL && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) H5MM_xfree(pline->filter[idx].cd_values); /* Set parameters */ - if(cd_nelmts > 0) { - size_t i; /* Local index variable */ + if (cd_nelmts > 0) { + size_t i; /* Local index variable */ /* Allocate memory or point at internal buffer */ - if(cd_nelmts > H5Z_COMMON_CD_VALUES) { + if (cd_nelmts > H5Z_COMMON_CD_VALUES) { pline->filter[idx].cd_values = (unsigned *)H5MM_malloc(cd_nelmts * sizeof(unsigned)); - if(NULL == pline->filter[idx].cd_values) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter parameters") + if (NULL == pline->filter[idx].cd_values) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter parameters") } /* end if */ else pline->filter[idx].cd_values = pline->filter[idx]._cd_values; /* Copy client data values */ - for(i = 0; i < cd_nelmts; i++) - pline->filter[idx].cd_values[i] = cd_values[i]; + for (i = 0; i < cd_nelmts; i++) + pline->filter[idx].cd_values[i] = cd_values[i]; } /* end if */ else pline->filter[idx].cd_values = NULL; @@ -996,36 +1025,37 @@ done: * * Purpose: Append another filter to the specified pipeline. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) { - size_t idx; - herr_t ret_value = SUCCEED; /* Return value */ + size_t idx; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); - HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); - HDassert(0 == cd_nelmts || cd_values); + HDassert (pline); + HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert (0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); + HDassert (0 == cd_nelmts || cd_values); /* * Check filter limit. We do it here for early warnings although we may * decide to relax this restriction in the future. */ - if(pline->nused >= H5Z_MAX_NFILTERS) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline") + if (pline->nused >= H5Z_MAX_NFILTERS) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline") /* Check for freshly allocated filter pipeline */ - if(pline->version == 0) + if (pline->version == 0) pline->version = H5O_PLINE_VERSION_1; /* Allocate additional space in the pipeline if it's full */ - if(pline->nused >= pline->nalloc) { + if (pline->nused >= pline->nalloc) { H5O_pline_t x; size_t n; @@ -1036,14 +1066,14 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, * filter struct is reallocated. Set these pointers to ~NULL * so that we can reset them after reallocating the filters array. */ - for(n = 0; n < pline->nalloc; ++n) - if(pline->filter[n].cd_values == pline->filter[n]._cd_values) + for (n = 0; n < pline->nalloc; ++n) + if (pline->filter[n].cd_values == pline->filter[n]._cd_values) pline->filter[n].cd_values = (unsigned *)((void *) ~((size_t)NULL)); x.nalloc = MAX(H5Z_MAX_NFILTERS, 2 * pline->nalloc); x.filter = (H5Z_filter_info_t *)H5MM_realloc(pline->filter, x.nalloc * sizeof(x.filter[0])); - if(NULL == x.filter) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline") + if (NULL == x.filter) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline") /* Fix pointers in previous filters that need to point to their own * internal data. @@ -1061,22 +1091,22 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, idx = pline->nused; pline->filter[idx].id = filter; pline->filter[idx].flags = flags; - pline->filter[idx].name = NULL; /* we'll pick it up later*/ + pline->filter[idx].name = NULL; /*we'll pick it up later*/ pline->filter[idx].cd_nelmts = cd_nelmts; - if(cd_nelmts > 0) { - size_t i; /* Local index variable */ + if (cd_nelmts > 0) { + size_t i; /* Local index variable */ /* Allocate memory or point at internal buffer */ - if(cd_nelmts > H5Z_COMMON_CD_VALUES) { + if (cd_nelmts > H5Z_COMMON_CD_VALUES) { pline->filter[idx].cd_values = (unsigned *)H5MM_malloc(cd_nelmts * sizeof(unsigned)); - if(NULL == pline->filter[idx].cd_values) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter") + if (NULL == pline->filter[idx].cd_values) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter") } /* end if */ else pline->filter[idx].cd_values = pline->filter[idx]._cd_values; /* Copy client data values */ - for(i = 0; i < cd_nelmts; i++) + for (i = 0; i < cd_nelmts; i++) pline->filter[idx].cd_values[i] = cd_values[i]; } /* end if */ else @@ -1095,8 +1125,8 @@ done: * Purpose: Given a filter ID return the offset in the global array * that holds all the registered filters. * - * Return: Success: Non-negative index of entry in global filter table. - * Failure: Negative + * Return: Success: Non-negative index of entry in global filter table. + * Failure: Negative *------------------------------------------------------------------------- */ static int @@ -1107,9 +1137,9 @@ H5Z_find_idx(H5Z_filter_t id) FUNC_ENTER_NOAPI_NOINIT_NOERR - for (i=0; ifilter[].flags). The filters are processed in - * definition order unless the H5Z_FLAG_REVERSE is set. The - * FILTER_MASK is a bit-mask to indicate which filters to skip - * and on exit will indicate which filters failed. Each - * filter has an index number in the pipeline and that index - * number is the filter's bit in the FILTER_MASK. NBYTES is the - * number of bytes of data to filter and on exit should be the - * number of resulting bytes while BUF_SIZE holds the total - * allocated size of the buffer, which is pointed to BUF. - * - * If the buffer must grow during processing of the pipeline - * then the pipeline function should free the original buffer - * and return a fresh buffer, adjusting BUF_SIZE accordingly. - * - * Return: Non-negative on success/Negative on failure + * Purpose: Process data through the filter pipeline. The FLAGS argument + * is the filter invocation flags (definition flags come from + * the PLINE->filter[].flags). The filters are processed in + * definition order unless the H5Z_FLAG_REVERSE is set. The + * FILTER_MASK is a bit-mask to indicate which filters to skip + * and on exit will indicate which filters failed. Each + * filter has an index number in the pipeline and that index + * number is the filter's bit in the FILTER_MASK. NBYTES is the + * number of bytes of data to filter and on exit should be the + * number of resulting bytes while BUF_SIZE holds the total + * allocated size of the buffer, which is pointed to BUF. + * + * If the buffer must grow during processing of the pipeline + * then the pipeline function should free the original buffer + * and return a fresh buffer, adjusting BUF_SIZE accordingly. + * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1174,51 +1205,55 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, H5Z_cb_t cb_struct, size_t *nbytes/*in,out*/, size_t *buf_size/*in,out*/, void **buf/*in,out*/) { - size_t i, idx, new_nbytes; - int fclass_idx; /* Index of filter class in global table */ - H5Z_class2_t *fclass = NULL; /* Filter class pointer */ + size_t i, idx, new_nbytes; + int fclass_idx; /* Index of filter class in global table */ + H5Z_class2_t *fclass=NULL; /* Filter class pointer */ #ifdef H5Z_DEBUG - H5Z_stats_t *fstats = NULL; /* Filter stats pointer */ + H5Z_stats_t *fstats=NULL; /* Filter stats pointer */ H5_timer_t timer; #endif - unsigned failed = 0; - unsigned tmp_flags; - herr_t ret_value = SUCCEED; /* Return value */ + unsigned failed = 0; + unsigned tmp_flags; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_INVMASK))); - HDassert(filter_mask); - HDassert(nbytes && *nbytes > 0); - HDassert(buf_size && *buf_size > 0); - HDassert(buf && *buf); - HDassert(!pline || pline->nused < H5Z_MAX_NFILTERS); + HDassert (0 == (flags & ~((unsigned)H5Z_FLAG_INVMASK))); + HDassert (filter_mask); + HDassert (nbytes && *nbytes>0); + HDassert (buf_size && *buf_size>0); + HDassert (buf && *buf); + HDassert (!pline || pline->nusednused; i > 0; --i) { - idx = i - 1; + idx = i-1; if (*filter_mask & ((unsigned)1 << idx)) { failed |= (unsigned)1 << idx; - continue;/*filter excluded*/ + continue; /* filter excluded */ } /* If the filter isn't registered and the application doesn't - * indicate no plugin through HDF5_PRELOAD_PLUG (using the symbol "::"), - * try to load it dynamically and register it. Otherwise, return failure - */ - if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { + * indicate no plugin through HDF5_PRELOAD_PLUG (using the symbol "::"), + * try to load it dynamically and register it. Otherwise, return failure + */ + if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { hbool_t issue_error = FALSE; - const H5Z_class2_t *filter_info; + H5Z_class2_t *filter_info; /* Try loading the filter */ - if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { + if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { /* Register the filter we loaded */ - if(H5Z_register(filter_info) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") + herr_t status = H5Z_register(filter_info); + if (filter_info->name) + filter_info->name = (char *)H5MM_xfree(filter_info->name); + filter_info = (H5Z_class2_t *)H5MM_xfree(filter_info); + if (status < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ - if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) + if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) issue_error = TRUE; } /* end if */ else @@ -1227,8 +1262,8 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, /* Check for error */ if(issue_error) { /* Print out the filter name to give more info. But the name is optional for - * the filter */ - if(pline->filter[idx].name) + * the filter */ + if (pline->filter[idx].name) HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter '%s' is not registered", pline->filter[idx].name) else HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter (name unavailable) is not registered") @@ -1238,26 +1273,26 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, fclass = &H5Z_table_g[fclass_idx]; #ifdef H5Z_DEBUG fstats = &H5Z_stat_table_g[fclass_idx]; - H5_timer_begin(&timer); + H5_timer_begin (&timer); #endif - tmp_flags = flags|(pline->filter[idx].flags); + tmp_flags = flags | (pline->filter[idx].flags); tmp_flags |= (edc_read== H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0; new_nbytes = (fclass->filter)(tmp_flags, pline->filter[idx].cd_nelmts, - pline->filter[idx].cd_values, *nbytes, buf_size, buf); + pline->filter[idx].cd_values, *nbytes, buf_size, buf); #ifdef H5Z_DEBUG - H5_timer_end(&(fstats->stats[1].timer), &timer); + H5_timer_end (&(fstats->stats[1].timer), &timer); fstats->stats[1].total += MAX(*nbytes, new_nbytes); if (0 == new_nbytes) fstats->stats[1].errors += *nbytes; #endif - if(0==new_nbytes) { - if((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data))) || !cb_struct.func) - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read") + if (0 == new_nbytes) { + if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func (pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data))) || !cb_struct.func) + HGOTO_ERROR (H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read") *nbytes = *buf_size; failed |= (unsigned)1 << idx; - H5E_clear_stack(NULL); + H5E_clear_stack (NULL); } else { *nbytes = new_nbytes; @@ -1276,35 +1311,34 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered") failed |= (unsigned)1 << idx; - H5E_clear_stack(NULL); + H5E_clear_stack (NULL); continue; /*filter excluded*/ } fclass = &H5Z_table_g[fclass_idx]; #ifdef H5Z_DEBUG fstats = &H5Z_stat_table_g[fclass_idx]; - H5_timer_begin(&timer); + H5_timer_begin (&timer); #endif - new_nbytes = (fclass->filter)(flags|(pline->filter[idx].flags), pline->filter[idx].cd_nelmts, - pline->filter[idx].cd_values, *nbytes, buf_size, buf); + new_nbytes = (fclass->filter)(flags | (pline->filter[idx].flags), pline->filter[idx].cd_nelmts, + pline->filter[idx].cd_values, *nbytes, buf_size, buf); #ifdef H5Z_DEBUG - H5_timer_end(&(fstats->stats[0].timer), &timer); + H5_timer_end (&(fstats->stats[0].timer), &timer); fstats->stats[0].total += MAX(*nbytes, new_nbytes); if (0 == new_nbytes) fstats->stats[0].errors += *nbytes; #endif - if(0 == new_nbytes) { + if (0 == new_nbytes) { if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) { - if((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data))) || !cb_struct.func) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure") + if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func (pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data))) || !cb_struct.func) + HGOTO_ERROR (H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure") *nbytes = *buf_size; } failed |= (unsigned)1 << idx; - H5E_clear_stack(NULL); + H5E_clear_stack (NULL); } - else { + else *nbytes = new_nbytes; - } } } @@ -1320,7 +1354,8 @@ done: * * Purpose: Get pointer to filter info for pipeline * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ H5Z_filter_info_t * @@ -1331,17 +1366,17 @@ H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) FUNC_ENTER_NOAPI(NULL) - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert (pline); + HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); /* Locate the filter in the pipeline */ - for(idx = 0; idx < pline->nused; idx++) - if(pline->filter[idx].id == filter) + for (idx = 0; idx < pline->nused; idx++) + if (pline->filter[idx].id == filter) break; /* Check if the filter was not already in the pipeline */ - if(idx >= pline->nused) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline") + if (idx >= pline->nused) + HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline") /* Set return value */ ret_value = &pline->filter[idx]; @@ -1365,21 +1400,21 @@ done: htri_t H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter) { - size_t idx; /* Index of filter in pipeline */ - htri_t ret_value = TRUE; /* Return value */ + size_t idx; /* Index of filter in pipeline */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert (pline); + HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); /* Locate the filter in the pipeline */ - for(idx = 0; idx < pline->nused; idx++) - if(pline->filter[idx].id == filter) + for (idx = 0; idx < pline->nused; idx++) + if (pline->filter[idx].id == filter) break; /* Check if the filter was not already in the pipeline */ - if(idx >= pline->nused) + if (idx >= pline->nused) ret_value = FALSE; done: @@ -1394,30 +1429,31 @@ done: * Purpose: Verify that all the filters in a pipeline are currently * available (i.e. registered) * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure + * Return: Non-negative (TRUE/FALSE) on success + * Negative on failure *------------------------------------------------------------------------- */ htri_t H5Z_all_filters_avail(const H5O_pline_t *pline) { - size_t i,j; /* Local index variable */ - htri_t ret_value=TRUE; /* Return value */ + size_t i, j; /* Local index variable */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(pline); + HDassert (pline); /* Iterate through all the filters in pipeline */ - for(i = 0; i < pline->nused; i++) { + for (i = 0; i < pline->nused; i++) { /* Look for each filter in the list of registered filters */ - for(j = 0; j < H5Z_table_used_g; j++) - if(H5Z_table_g[j].id == pline->filter[i].id) + for (j = 0; j < H5Z_table_used_g; j++) + if (H5Z_table_g[j].id == pline->filter[i].id) break; /* Check if we didn't find the filter */ - if(j == H5Z_table_used_g) - HGOTO_DONE(FALSE) + if (j == H5Z_table_used_g) + HGOTO_DONE (FALSE) } /* end for */ done: @@ -1432,7 +1468,8 @@ done: * Purpose: Delete filter FILTER from pipeline PLINE; * deletes all filters if FILTER is H5Z_FILTER_NONE * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1443,52 +1480,52 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); + HDassert (pline); + HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX); /* if the pipeline has no filters, just return */ - if(pline->nused == 0) - HGOTO_DONE(SUCCEED) + if (pline->nused == 0) + HGOTO_DONE (SUCCEED) /* Delete all filters */ - if(H5Z_FILTER_ALL == filter) { - if(H5O_msg_reset(H5O_PLINE_ID, pline) < 0) + if (H5Z_FILTER_ALL == filter) { + if (H5O_msg_reset(H5O_PLINE_ID, pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info") } /* end if */ /* Delete filter */ else { - size_t idx; /* Index of filter in pipeline */ - hbool_t found = FALSE; /* Indicate filter was found in pipeline */ + size_t idx; /* Index of filter in pipeline */ + hbool_t found = FALSE; /* Indicate filter was found in pipeline */ /* Locate the filter in the pipeline */ - for(idx = 0; idx < pline->nused; idx++) - if(pline->filter[idx].id == filter) { + for (idx = 0; idx < pline->nused; idx++) + if (pline->filter[idx].id == filter) { found = TRUE; break; } /* end if */ /* filter was not found in the pipeline */ - if(!found) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") + if (!found) + HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") /* Free information for deleted filter */ - if(pline->filter[idx].name && pline->filter[idx].name != pline->filter[idx]._name) - HDassert((HDstrlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN); - if(pline->filter[idx].name != pline->filter[idx]._name) + if (pline->filter[idx].name && pline->filter[idx].name != pline->filter[idx]._name) + HDassert ((HDstrlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN); + if (pline->filter[idx].name != pline->filter[idx]._name) pline->filter[idx].name = (char *)H5MM_xfree(pline->filter[idx].name); - if(pline->filter[idx].cd_values && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) - HDassert(pline->filter[idx].cd_nelmts > H5Z_COMMON_CD_VALUES); - if(pline->filter[idx].cd_values != pline->filter[idx]._cd_values) + if (pline->filter[idx].cd_values && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) + HDassert (pline->filter[idx].cd_nelmts > H5Z_COMMON_CD_VALUES); + if (pline->filter[idx].cd_values != pline->filter[idx]._cd_values) pline->filter[idx].cd_values = (unsigned *)H5MM_xfree(pline->filter[idx].cd_values); /* Remove filter from pipeline array */ - if((idx + 1) < pline->nused) { + if ((idx + 1) < pline->nused) { /* Copy filters down & fix up any client data value arrays using internal storage */ - for(; (idx + 1) < pline->nused; idx++) { + for (; (idx + 1) < pline->nused; idx++) { pline->filter[idx] = pline->filter[idx + 1]; - if(pline->filter[idx].name && (HDstrlen(pline->filter[idx].name) + 1) <= H5Z_COMMON_NAME_LEN) + if (pline->filter[idx].name && (HDstrlen(pline->filter[idx].name) + 1) <= H5Z_COMMON_NAME_LEN) pline->filter[idx].name = pline->filter[idx]._name; - if(pline->filter[idx].cd_nelmts <= H5Z_COMMON_CD_VALUES) + if (pline->filter[idx].cd_nelmts <= H5Z_COMMON_CD_VALUES) pline->filter[idx].cd_values = pline->filter[idx]._cd_values; } /* end for */ } /* end if */ @@ -1497,7 +1534,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) pline->nused--; /* Reset information for previous last filter in pipeline */ - HDmemset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); + HDmemset (&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); } /* end else */ done: @@ -1510,6 +1547,9 @@ done: * * Purpose: Gets information about a pipeline data filter and stores it * in filter_config_flags. + * + * Return: zero on success + * negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1521,8 +1561,8 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) H5TRACE2("e", "Zf*Iu", filter, filter_config_flags); /* Get the filter info */ - if(H5Z_get_filter_info(filter, filter_config_flags) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") + if (H5Z_get_filter_info(filter, filter_config_flags) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") done: FUNC_LEAVE_API(ret_value) @@ -1534,6 +1574,9 @@ done: * * Purpose: Gets information about a pipeline data filter and stores it * in filter_config_flags. + * + * Return: zero on success + * negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1545,16 +1588,16 @@ H5Z_get_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) FUNC_ENTER_NOAPI(FAIL) /* Look up the filter class info */ - if(NULL == (fclass = H5Z_find(filter))) - HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "Filter not defined") + if (NULL == (fclass = H5Z_find(filter))) + HGOTO_ERROR (H5E_PLINE, H5E_BADVALUE, FAIL, "Filter not defined") /* Set the filter config flags for the application */ - if(filter_config_flags != NULL) { + if (filter_config_flags != NULL) { *filter_config_flags = 0; - if(fclass->encoder_present) + if (fclass->encoder_present) *filter_config_flags |= H5Z_FILTER_CONFIG_ENCODE_ENABLED; - if(fclass->decoder_present) + if (fclass->decoder_present) *filter_config_flags |= H5Z_FILTER_CONFIG_DECODE_ENABLED; } /* end if */ -- cgit v0.12 From dfaeaa35cd6b765581d1f0d86076d549135b9500 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 16 Nov 2017 15:00:13 -0600 Subject: Fix typo --- src/H5PLint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5PLint.c b/src/H5PLint.c index e969cbf..33dda96 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -372,7 +372,7 @@ H5PL__open(const char *path, H5PL_type_t type, int id, hbool_t *success, const v done: if (!success && handle) - if (*plugin_info) { + if (*plugin_info) *plugin_info = (H5Z_class2_t *)H5MM_xfree(*plugin_info); if (H5PL__close(handle) < 0) HDONE_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") -- cgit v0.12 From 9599e55176104ab55576ee921be4475e860da5fa Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 17 Nov 2017 13:59:57 -0600 Subject: HDFFV-10328 - remove allocation changes --- src/H5PLint.c | 21 +-------------------- src/H5PLplugin_cache.c | 22 +--------------------- src/H5Z.c | 33 ++++----------------------------- 3 files changed, 6 insertions(+), 70 deletions(-) diff --git a/src/H5PLint.c b/src/H5PLint.c index 33dda96..c887f86 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -342,38 +342,19 @@ H5PL__open(const char *path, H5PL_type_t type, int id, hbool_t *success, const v /* Check if the filter IDs match */ if (info->id == id) { - H5Z_class2_t *plugin_copy = NULL; /* Store the plugin in the cache */ if (H5PL__add_plugin(type, id, handle)) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache") - /* allocate local copy of plugin info */ - if (NULL == (plugin_copy = (H5Z_class2_t *)H5MM_calloc(sizeof(H5Z_class2_t)))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for plugin info") - /* Set the plugin info to return */ - *plugin_info = (const void *)info; - - plugin_copy->version = info->version; - plugin_copy->id = info->id; - plugin_copy->encoder_present = info->encoder_present; - plugin_copy->decoder_present = info->decoder_present; - plugin_copy->can_apply = info->can_apply; - plugin_copy->set_local = info->set_local; - plugin_copy->filter = info->filter; - /* copy the user's string into the property */ - if(NULL == (plugin_copy->name = (char *)H5MM_xstrdup(info->name))) - HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "can't allocate memory for plugin info name") - /* Set output parameters */ *success = TRUE; + *plugin_info = (const void *)info; } } done: if (!success && handle) - if (*plugin_info) - *plugin_info = (H5Z_class2_t *)H5MM_xfree(*plugin_info); if (H5PL__close(handle) < 0) HDONE_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c index ec14159..e483e01 100644 --- a/src/H5PLplugin_cache.c +++ b/src/H5PLplugin_cache.c @@ -280,7 +280,6 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f H5PL_get_plugin_info_t get_plugin_info_function; const H5Z_class2_t *filter_info; - H5Z_class2_t *plugin_copy = NULL; /* Get the "get plugin info" function from the plugin. */ if (NULL == (get_plugin_info_function = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_cache_g[u]).handle, "H5PLget_plugin_info"))) @@ -290,24 +289,9 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f if (NULL == (filter_info = (const H5Z_class2_t *)(*get_plugin_info_function)())) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info") - if (NULL == (plugin_copy = (H5Z_class2_t *)H5MM_calloc(sizeof(H5Z_class2_t)))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for plugin info") - /* Set the plugin info to return */ - *plugin_info = plugin_copy; - - plugin_copy->version = filter_info->version; - plugin_copy->id = filter_info->id; - plugin_copy->encoder_present = filter_info->encoder_present; - plugin_copy->decoder_present = filter_info->decoder_present; - plugin_copy->can_apply = filter_info->can_apply; - plugin_copy->set_local = filter_info->set_local; - plugin_copy->filter = filter_info->filter; - /* copy the user's string into the property */ - if(NULL == (plugin_copy->name = (char *)H5MM_xstrdup(filter_info->name))) - HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "can't allocate memory for plugin info name") - /* Set output parameters */ *found = TRUE; + *plugin_info = filter_info; /* No need to continue processing */ break; @@ -317,10 +301,6 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f } /* end for */ done: - /* unallocate local copy of plugin info on failure */ - if (FAIL == ret_value && *plugin_info) { - *plugin_info = (H5Z_class2_t *)H5MM_xfree(*plugin_info); - } FUNC_LEAVE_NOAPI(ret_value) } /* end H5PL__find_plugin_in_cache() */ #pragma GCC diagnostic pop diff --git a/src/H5Z.c b/src/H5Z.c index e7574cd..1f1a905 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -123,7 +123,6 @@ int H5Z_term_package(void) { int n = 0; - size_t i; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -131,6 +130,7 @@ H5Z_term_package(void) #ifdef H5Z_DEBUG char comment[16], bandwidth[32]; int dir, nprint = 0; + size_t i; if(H5DEBUG(Z)) { for(i = 0; i < H5Z_table_used_g; i++) { @@ -179,12 +179,6 @@ H5Z_term_package(void) } /* end for */ } /* end if */ #endif /* H5Z_DEBUG */ - for (i = 0; i < H5Z_table_used_g; i++) { - H5Z_class2_t *cls = (H5Z_class2_t *)(H5Z_table_g+i); - /* deallocate plugin info name */ - if (cls->name) - cls->name = (char *)H5MM_xfree(cls->name); - } /* Free the table of filters */ if(H5Z_table_g) { H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g); @@ -325,20 +319,14 @@ H5Z_register (const H5Z_class2_t *cls) /* Initialize */ i = H5Z_table_used_g++; HDmemcpy (H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); - H5Z_table_g[i].name = (char *)H5MM_xstrdup(cls->name); #ifdef H5Z_DEBUG HDmemset (H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t)); #endif /* H5Z_DEBUG */ } /* end if */ /* Filter already registered */ else { - H5Z_class2_t *old_cls = (H5Z_class2_t *)(H5Z_table_g+i); - /* deallocate plugin info name */ - if (old_cls->name) - old_cls->name = (char *)H5MM_xfree(old_cls->name); /* Replace old contents */ - HDmemcpy (old_cls, cls, sizeof(H5Z_class2_t)); - old_cls->name = (char *)H5MM_xstrdup(cls->name); + HDmemcpy (H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); } /* end else */ done: @@ -394,7 +382,6 @@ H5Z_unregister(H5Z_filter_t filter_id) size_t filter_index; /* Local index variable for filter */ H5Z_object_t object; herr_t ret_value = SUCCEED; /* Return value */ - H5Z_class2_t *old_cls = NULL; FUNC_ENTER_NOAPI(FAIL) @@ -431,10 +418,6 @@ H5Z_unregister(H5Z_filter_t filter_id) if (H5I_iterate(H5I_FILE, H5Z__flush_file_cb, NULL, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed") - /* deallocate plugin info name */ - old_cls = (H5Z_class2_t *)(H5Z_table_g+filter_index); - if (old_cls->name) - old_cls->name = (char *)H5MM_xfree(old_cls->name); /* Remove filter from table */ /* Don't worry about shrinking table size (for now) */ HDmemmove (&H5Z_table_g[filter_index], &H5Z_table_g[filter_index+1], sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-filter_index)); @@ -658,11 +641,7 @@ H5Z_filter_avail(H5Z_filter_t id) HGOTO_DONE (TRUE) if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)id))) { - herr_t status = H5Z_register(filter_info); - if (filter_info->name) - filter_info->name = (char *)H5MM_xfree(filter_info->name); - filter_info = (H5Z_class2_t *)H5MM_xfree(filter_info); - if (status < 0) + if (H5Z_register (filter_info) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter") HGOTO_DONE (TRUE) } @@ -1245,11 +1224,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, /* Try loading the filter */ if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { /* Register the filter we loaded */ - herr_t status = H5Z_register(filter_info); - if (filter_info->name) - filter_info->name = (char *)H5MM_xfree(filter_info->name); - filter_info = (H5Z_class2_t *)H5MM_xfree(filter_info); - if (status < 0) + if (H5Z_register(filter_info < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ -- cgit v0.12 From bd28c0b42d43edc53f1bfd12ecb2ab397e92cbab Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 17 Nov 2017 14:02:07 -0600 Subject: HDFFV-10328 remove allocation note --- release_docs/RELEASE.txt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 9e3c3a9..a1b59b1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -160,8 +160,7 @@ Bug Fixes since HDF5-1.10.1 release - filter plugin handling in H5PL.c and H5Z.c It was discovered that the dynamic loading process used by - filter plugins had issues with memory allocation and library - dependencies. + filter plugins had issues with library dependencies. CMake build process changed to use LINK INTERFACE keywords, which allowed HDF5 C library to make dependent libraries private. The @@ -169,13 +168,6 @@ Bug Fixes since HDF5-1.10.1 release (such as szip or zlib) to be available. (ADB - 2017/11/16, HDFFV-10328) - The H5Z_class2_t structure returned by the filter plugins are - now dynamically allocated in H5Zregister function. Access to - the functions in the filter library now always use the dynamic - library API. - - (ADB - 2017/11/16, HDFFV-10329) - - H5Zfilter_avail in H5Z.c The public function checked for plugins, while the private -- cgit v0.12 From bb3fb6f13461d724baa635e464585cb49d8848d2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 17 Nov 2017 14:20:14 -0600 Subject: HDFFV-10328 - fix typos --- src/H5Z.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/H5Z.c b/src/H5Z.c index 1f1a905..a9f7336 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -1219,12 +1219,12 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, */ if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { hbool_t issue_error = FALSE; - H5Z_class2_t *filter_info; + const H5Z_class2_t *filter_info; /* Try loading the filter */ if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { /* Register the filter we loaded */ - if (H5Z_register(filter_info < 0) + if (H5Z_register(filter_info) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ @@ -1235,7 +1235,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, issue_error = TRUE; /* Check for error */ - if(issue_error) { + if (issue_error) { /* Print out the filter name to give more info. But the name is optional for * the filter */ if (pline->filter[idx].name) @@ -1269,9 +1269,8 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, failed |= (unsigned)1 << idx; H5E_clear_stack (NULL); } - else { + else *nbytes = new_nbytes; - } } } else if (pline) { /* Write */ -- cgit v0.12