From f92ccce1f9134ccb06c59278075403657392ee0c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 10 Oct 2017 14:46:59 -0500 Subject: HDFFV-10297 merge from develop --- config/cmake/jrunTest.cmake | 30 +- config/cmake/vfdTest.cmake | 6 +- config/cmake_ext_mod/grepTest.cmake | 6 +- config/cmake_ext_mod/runTest.cmake | 28 +- java/examples/datasets/CMakeLists.txt | 4 +- java/examples/groups/CMakeLists.txt | 4 +- release_docs/RELEASE.txt | 23 + src/H5PLextern.h | 4 +- src/H5PLmodule.h | 10 +- src/H5PLprivate.h | 4 +- src/H5Pocpl.c | 440 ++- src/H5Z.c | 929 +++---- test/CMakeTests.cmake | 12 +- test/dsets.c | 2879 ++++++++++---------- tools/lib/h5diff_attr.c | 4 +- tools/lib/h5diff_dset.c | 105 +- tools/lib/h5tools_filters.c | 202 +- tools/src/h5repack/h5repack.c | 201 +- tools/src/h5repack/h5repack.h | 106 +- tools/src/h5repack/h5repack_copy.c | 185 +- tools/src/h5repack/h5repack_filters.c | 270 +- tools/src/h5repack/h5repack_main.c | 10 +- tools/src/h5repack/h5repack_opttable.c | 3 +- tools/src/h5repack/h5repack_parse.c | 13 +- tools/src/h5repack/h5repack_refs.c | 259 +- tools/src/h5repack/h5repack_verify.c | 205 +- tools/test/h5diff/CMakeLists.txt | 10 +- tools/test/h5diff/CMakeTests.cmake | 14 +- tools/test/h5dump/h5dumpgentest.c | 6 +- tools/test/h5repack/CMakeTests.cmake | 6 +- tools/test/h5repack/h5repacktst.c | 1692 ++++++------ .../testfiles/deflate_limit.h5repack_layout.h5.ddl | 4 +- .../h5repack_filters.h5-gzip_verbose_filters.tst | 5 +- .../testfiles/h5repack_layout.h5-plugin_test.ddl | 2 +- .../h5repack_layout.h5-plugin_version_test.ddl | 16 +- .../testfiles/h5repack_layout.h5-plugin_zero.ddl | 131 + .../plugin_none.h5repack_layout.UD.h5.tst | 5 +- .../testfiles/plugin_test.h5repack_layout.h5.tst | 5 +- .../plugin_version_test.h5repack_layout.h5.tst | 5 +- .../testfiles/plugin_zero.h5repack_layout.h5.tst | 19 +- 40 files changed, 3826 insertions(+), 4036 deletions(-) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 7af0590..b66f3a8 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -122,7 +122,7 @@ if (TEST_MASK_ERROR) endif () # if the return value is !=0 bail out -if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") message (STATUS "ERROR OUTPUT: ${TEST_STREAM}") message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}") endif () @@ -141,13 +141,13 @@ if (NOT TEST_SKIP_COMPARE) COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} RESULT_VARIABLE TEST_RESULT ) - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) list (LENGTH test_ref len_ref) - if (NOT ${len_act} STREQUAL "0" AND NOT ${len_ref} STREQUAL "0") + if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) @@ -160,14 +160,14 @@ if (NOT TEST_SKIP_COMPARE) endif () endforeach () else () - if (${len_act} STREQUAL "0") + if ("${len_act}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if (${len_ref} STREQUAL "0") + if ("${len_ref}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () endif () - if (NOT ${len_act} STREQUAL ${len_ref}) + if (NOT "${len_act}" STREQUAL "${len_ref}") set (TEST_RESULT 1) endif () endif () @@ -175,7 +175,7 @@ if (NOT TEST_SKIP_COMPARE) message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif () @@ -191,14 +191,14 @@ if (NOT TEST_SKIP_COMPARE) COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} RESULT_VARIABLE TEST_RESULT ) - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) list (LENGTH test_ref len_ref) math (EXPR _FP_LEN "${len_ref} - 1") - if (NOT ${len_act} STREQUAL "0" AND NOT ${len_ref} STREQUAL "0") + if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) @@ -211,14 +211,14 @@ if (NOT TEST_SKIP_COMPARE) endif () endforeach () else () - if (${len_act} STREQUAL "0") + if ("${len_act}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") endif () - if (${len_ref} STREQUAL "0") + if ("${len_ref}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () endif() - if (NOT ${len_act} STREQUAL ${len_ref}) + if (NOT "${len_act}" STREQUAL "${len_ref}") set (TEST_RESULT 1) endif () endif () @@ -239,15 +239,15 @@ if (TEST_GREP_COMPARE) # TEST_REFERENCE should always be matched string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) - if (${TEST_RESULT} STREQUAL "0") + if ("${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") endif () string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) - if (${TEST_EXPECT} STREQUAL "1") + if ("${TEST_EXPECT}" STREQUAL "1") # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match string (LENGTH "${TEST_MATCH}" TEST_RESULT) - if (NOT ${TEST_RESULT} STREQUAL "0") + if (NOT "${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") endif () endif () diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 67a2566..66a97c0 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -60,12 +60,12 @@ if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) endif () # if the return value is !=${TEST_EXPECT} bail out -if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") if (NOT TEST_NOERRDISPLAY) if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out TEST_STREAM) - message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") - endif () + message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") + endif () endif () message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") endif () diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index 5b0e8fd..b812d73 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -57,15 +57,15 @@ file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) # TEST_REFERENCE should always be matched string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) -if (${TEST_RESULT} STREQUAL "0") +if ("${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") endif () string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) -if (${TEST_EXPECT} STREQUAL "1") +if ("${TEST_EXPECT}" STREQUAL "1") # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match string (LENGTH "${TEST_MATCH}" TEST_RESULT) - if (NOT ${TEST_RESULT} STREQUAL "0") + if (NOT "${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") endif () endif () diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 3a02614..2479728 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -87,7 +87,7 @@ if (TEST_REGEX) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) string (REGEX MATCH "${TEST_REGEX}" REGEX_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${REGEX_MATCH}" "${TEST_MATCH}" REGEX_RESULT) - if (${REGEX_RESULT} STREQUAL "0") + if ("${REGEX_RESULT}" STREQUAL "0") message (STATUS "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_MATCH}") endif () endif () @@ -106,7 +106,7 @@ if (TEST_APPEND) endif () # if the return value is !=${TEST_EXPECT} bail out -if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") if (NOT TEST_NOERRDISPLAY) if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) @@ -193,13 +193,13 @@ if (NOT TEST_SKIP_COMPARE) endif () endif () - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) list (LENGTH test_ref len_ref) - if (NOT ${len_act} STREQUAL "0" AND NOT ${len_ref} STREQUAL "0") + if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) @@ -212,14 +212,14 @@ if (NOT TEST_SKIP_COMPARE) endif () endforeach () else () - if (${len_act} STREQUAL "0") + if ("${len_act}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if (${len_ref} STREQUAL "0") + if ("${len_ref}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () endif () - if (NOT ${len_act} STREQUAL ${len_ref}) + if (NOT "${len_act}" STREQUAL "${len_ref}") set (TEST_RESULT 1) endif () endif () @@ -227,7 +227,7 @@ if (NOT TEST_SKIP_COMPARE) message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif () @@ -243,14 +243,14 @@ if (NOT TEST_SKIP_COMPARE) COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} RESULT_VARIABLE TEST_RESULT ) - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) list (LENGTH test_ref len_ref) math (EXPR _FP_LEN "${len_ref} - 1") - if (NOT ${len_act} STREQUAL "0" AND NOT ${len_ref} STREQUAL "0") + if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") math (EXPR _FP_LEN "${len_ref} - 1") foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) @@ -263,14 +263,14 @@ if (NOT TEST_SKIP_COMPARE) endif () endforeach () else () - if (${len_act} STREQUAL "0") + if ("${len_act}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") endif () - if (${len_ref} STREQUAL "0") + if ("${len_ref}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () endif () - if (NOT ${len_act} STREQUAL ${len_ref}) + if (NOT "${len_act}" STREQUAL "${len_ref}") set (TEST_RESULT 1) endif () endif () @@ -278,7 +278,7 @@ if (NOT TEST_SKIP_COMPARE) message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") endif () endif () diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index d698cfd..3972ec8 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -101,7 +101,7 @@ if (BUILD_TESTING) endif (H5_HAVE_FILTER_SZIP) foreach (example ${HDF_JAVA_EXAMPLES}) - if (${example} STREQUAL "H5Ex_D_External") + if ("${example}" STREQUAL "H5Ex_D_External") add_test ( NAME JAVA_datasets-${example}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -129,7 +129,7 @@ if (BUILD_TESTING) ) set_tests_properties (JAVA_datasets-${example}-copy-objects PROPERTIES DEPENDS JAVA_datasets-${example}-clear-objects) set (last_test "JAVA_datasets-${example}-copy-objects") - if (${example} STREQUAL "H5Ex_D_Szip") + if ("${example}" STREQUAL "H5Ex_D_Szip") if (USE_FILTER_SZIP) ADD_H5_TEST (${example} 0) endif () diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index bb5f80f..b912208 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -90,8 +90,8 @@ ENDMACRO () if (BUILD_TESTING) foreach (example ${HDF_JAVA_EXAMPLES}) - if (NOT ${example} STREQUAL "H5Ex_G_Iterate" AND NOT ${example} STREQUAL "H5Ex_G_Visit") - if (${example} STREQUAL "H5Ex_G_Compact") + if (NOT "${example}" STREQUAL "H5Ex_G_Iterate" AND NOT "${example}" STREQUAL "H5Ex_G_Visit") + if ("${example}" STREQUAL "H5Ex_G_Compact") add_test ( NAME JAVA_groups-${example}-clear-h5s COMMAND ${CMAKE_COMMAND} diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7c87c4c..3e2660d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -206,6 +206,17 @@ Bug Fixes since HDF5-1.10.0-patch1 release Library ------- + - H5Zfilter_avail in H5Z.c + + The public function checked for plugins, while the private + function did not. + + Modified H5Zfilter_avail and private function, H5Z_filter_avail. + Moved check for plugin from public to private function. Updated + H5P__set_filter due to change in H5Z_filter_avail. Updated tests. + + (ADB - 2017/10/10, HDFFV-10297) + - Fix H5HL_offset_into() (1) Fix H5HL_offset_into() to return error when offset exceeds heap data @@ -301,6 +312,18 @@ Bug Fixes since HDF5-1.10.0-patch1 release ----- - h5repack + h5repack failed to copy a dataset with existing filter. + + Reworked code for h5repack and h5diff code in tools library. Added + improved error handling, cleanup of resources and checks of calls. + Modified H5Zfilter_avail and private function, H5Z_filter_avail. + Moved check for plugin from public to private function. Updated + H5P__set_filter due to change in H5Z_filter_avail. Updated tests. + + (ADB - 2017/10/10, HDFFV-10297) + + - h5repack + h5repack always set the User Defined filter flag to H5Z_FLAG_MANDATORY. Added another parameter to the 'UD=' option to set the flag by default diff --git a/src/H5PLextern.h b/src/H5PLextern.h index 7547ad7..cd5464d 100644 --- a/src/H5PLextern.h +++ b/src/H5PLextern.h @@ -11,9 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu - * 13 February 2013 + * Purpose: Header file for writing external HDF5 plugins. */ + #ifndef _H5PLextern_H #define _H5PLextern_H diff --git a/src/H5PLmodule.h b/src/H5PLmodule.h index b441aed..945441e 100644 --- a/src/H5PLmodule.h +++ b/src/H5PLmodule.h @@ -11,13 +11,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5PL package. Including this header means that the source file - * is part of the H5PL package. + * Purpose: This file contains declarations which define macros for the + * H5PL package. Including this header means that the source file + * is part of the H5PL package. */ + #ifndef _H5PLmodule_H #define _H5PLmodule_H diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index 0ab8f8c..bc12e64 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Raymond Lu - * 13 February 2013 +/* + * This file contains private information about the H5PL module */ #ifndef _H5PLprivate_H diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 0393f7f..be41e32 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5Pocpl.c - * Nov 28 2006 - * Quincey Koziol + * Created: H5Pocpl.c + * Nov 28 2006 + * Quincey Koziol * - * Purpose: Object creation property list class routines + * Purpose: Object creation property list class routines * *------------------------------------------------------------------------- */ @@ -26,21 +26,21 @@ /* Module Setup */ /****************/ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ #include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ -#include "H5PLprivate.h" /* Dynamic plugin */ -#include "H5Zprivate.h" /* Filter pipeline */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5PLprivate.h" /* Dynamic plugin */ +#include "H5Zprivate.h" /* Filter pipeline */ /****************/ @@ -100,7 +100,7 @@ static int H5P__ocrt_pipeline_cmp(const void *value1, const void *value2, size_t static herr_t H5P__ocrt_pipeline_close(const char *name, size_t size, void *value); /* Local routines */ -static herr_t H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, +static herr_t H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]); /*********************/ @@ -109,21 +109,21 @@ static herr_t H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, /* Object creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ - "object create", /* Class name for debugging */ - H5P_TYPE_OBJECT_CREATE, /* Class type */ - - &H5P_CLS_ROOT_g, /* Parent class */ - &H5P_CLS_OBJECT_CREATE_g, /* Pointer to class */ - &H5P_CLS_OBJECT_CREATE_ID_g, /* Pointer to class ID */ - NULL, /* Pointer to default property list ID */ - H5P__ocrt_reg_prop, /* Default property registration routine */ - - NULL, /* Class creation callback */ - NULL, /* Class creation callback info */ - NULL, /* Class copy callback */ - NULL, /* Class copy callback info */ - NULL, /* Class close callback */ - NULL /* Class close callback info */ + "object create", /* Class name for debugging */ + H5P_TYPE_OBJECT_CREATE, /* Class type */ + + &H5P_CLS_ROOT_g, /* Parent class */ + &H5P_CLS_OBJECT_CREATE_g, /* Pointer to class */ + &H5P_CLS_OBJECT_CREATE_ID_g, /* Pointer to class ID */ + NULL, /* Pointer to default property list ID */ + H5P__ocrt_reg_prop, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ }}; @@ -165,25 +165,25 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register max. compact attribute storage property */ - if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, + if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, NULL, NULL, NULL, H5O_CRT_ATTR_MAX_COMPACT_ENC, H5O_CRT_ATTR_MAX_COMPACT_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register min. dense attribute storage property */ - if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g, + if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g, NULL, NULL, NULL, H5O_CRT_ATTR_MIN_DENSE_ENC, H5O_CRT_ATTR_MIN_DENSE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object header flags property */ - if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g, + if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g, NULL, NULL, NULL, H5O_CRT_OHDR_FLAGS_ENC, H5O_CRT_OHDR_FLAGS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the pipeline property */ - if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, + if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, NULL, H5O_CRT_PIPELINE_SET, H5O_CRT_PIPELINE_GET, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC, H5O_CRT_PIPELINE_DEL, H5O_CRT_PIPELINE_COPY, H5O_CRT_PIPELINE_CMP, H5O_CRT_PIPELINE_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -194,9 +194,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_attr_phase_change + * Function: H5Pset_attr_phase_change * - * Purpose: Sets the cutoff values for indexes storing attributes + * Purpose: Sets the cutoff values for indexes storing attributes * in object headers for this file. If more than max_compact * attributes are in an object header, the attributes will be * moved to a heap and indexed with a B-tree. @@ -208,10 +208,10 @@ done: * never be stored in the object header but will be always be * stored in a heap. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 + * Programmer: Quincey Koziol + * Tuesday, November 28, 2006 * *------------------------------------------------------------------------- */ @@ -248,14 +248,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_attr_phase_change + * Function: H5Pget_attr_phase_change * - * Purpose: Gets the phase change values for attribute storage + * Purpose: Gets the phase change values for attribute storage * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 + * Programmer: Quincey Koziol + * Tuesday, November 28, 2006 * *------------------------------------------------------------------------- */ @@ -486,37 +486,37 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_modify_filter - * - * Purpose: Modifies the specified FILTER in the - * transient or permanent output filter pipeline - * depending on whether PLIST is a dataset creation or dataset - * transfer property list. The FLAGS argument specifies certain - * general properties of the filter and is documented below. - * The CD_VALUES is an array of CD_NELMTS integers which are - * auxiliary data for the filter. The integer vlues will be - * stored in the dataset object header as part of the filter - * information. - * - * The FLAGS argument is a bit vector of the following fields: - * - * H5Z_FLAG_OPTIONAL(0x0001) - * If this bit is set then the filter is optional. If the - * filter fails during an H5Dwrite() operation then the filter - * is just excluded from the pipeline for the chunk for which it - * failed; the filter will not participate in the pipeline - * during an H5Dread() of the chunk. If this bit is clear and - * the filter fails then the entire I/O operation fails. + * Function: H5P_modify_filter + * + * Purpose: Modifies the specified FILTER in the + * transient or permanent output filter pipeline + * depending on whether PLIST is a dataset creation or dataset + * transfer property list. The FLAGS argument specifies certain + * general properties of the filter and is documented below. + * The CD_VALUES is an array of CD_NELMTS integers which are + * auxiliary data for the filter. The integer vlues will be + * stored in the dataset object header as part of the filter + * information. + * + * The FLAGS argument is a bit vector of the following fields: + * + * H5Z_FLAG_OPTIONAL(0x0001) + * If this bit is set then the filter is optional. If the + * filter fails during an H5Dwrite() operation then the filter + * is just excluded from the pipeline for the chunk for which it + * failed; the filter will not participate in the pipeline + * during an H5Dread() of the chunk. If this bit is clear and + * the filter fails then the entire I/O operation fails. * If this bit is set but encoding is disabled for a filter, * attempting to write will generate an error. * - * Note: This function currently supports only the permanent filter - * pipeline. That is, PLIST_ID must be a dataset creation - * property list. + * Note: This function currently supports only the permanent filter + * pipeline. That is, PLIST_ID must be a dataset creation + * property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, October 17, 2007 * *------------------------------------------------------------------------- @@ -623,33 +623,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_filter - * - * Purpose: Adds the specified FILTER and corresponding properties to the - * end of the data or link output filter pipeline - * depending on whether PLIST is a dataset creation or group - * creation property list. The FLAGS argument specifies certain - * general properties of the filter and is documented below. - * The CD_VALUES is an array of CD_NELMTS integers which are - * auxiliary data for the filter. The integer vlues will be - * stored in the dataset object header as part of the filter - * information. - * - * The FLAGS argument is a bit vector of the following fields: - * - * H5Z_FLAG_OPTIONAL(0x0001) - * If this bit is set then the filter is optional. If the - * filter fails during an H5Dwrite() operation then the filter - * is just excluded from the pipeline for the chunk for which it - * failed; the filter will not participate in the pipeline - * during an H5Dread() of the chunk. If this bit is clear and - * the filter fails then the entire I/O operation fails. + * Function: H5Pset_filter + * + * Purpose: Adds the specified FILTER and corresponding properties to the + * end of the data or link output filter pipeline + * depending on whether PLIST is a dataset creation or group + * creation property list. The FLAGS argument specifies certain + * general properties of the filter and is documented below. + * The CD_VALUES is an array of CD_NELMTS integers which are + * auxiliary data for the filter. The integer vlues will be + * stored in the dataset object header as part of the filter + * information. + * + * The FLAGS argument is a bit vector of the following fields: + * + * H5Z_FLAG_OPTIONAL(0x0001) + * If this bit is set then the filter is optional. If the + * filter fails during an H5Dwrite() operation then the filter + * is just excluded from the pipeline for the chunk for which it + * failed; the filter will not participate in the pipeline + * during an H5Dread() of the chunk. If this bit is clear and + * the filter fails then the entire I/O operation fails. * If this bit is set but encoding is disabled for a filter, * attempting to write will generate an error. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * * Modifications: @@ -668,7 +668,7 @@ done: */ herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, - size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) + size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) { H5P_genplist_t *plist; /* Property list */ herr_t ret_value=SUCCEED; /* return value */ @@ -698,43 +698,43 @@ done: /*------------------------------------------------------------------------- - * Function: H5P__set_filter - * - * Purpose: Adds the specified FILTER and corresponding properties to the - * end of the data or link output filter pipeline - * depending on whether PLIST is a dataset creation or group - * creation property list. The FLAGS argument specifies certain - * general properties of the filter and is documented below. - * The CD_VALUES is an array of CD_NELMTS integers which are - * auxiliary data for the filter. The integer vlues will be - * stored in the dataset object header as part of the filter - * information. - * - * The FLAGS argument is a bit vector of the following fields: - * - * H5Z_FLAG_OPTIONAL(0x0001) - * If this bit is set then the filter is optional. If the - * filter fails during an H5Dwrite() operation then the filter - * is just excluded from the pipeline for the chunk for which it - * failed; the filter will not participate in the pipeline - * during an H5Dread() of the chunk. If this bit is clear and - * the filter fails then the entire I/O operation fails. - * If this bit is set but encoding is disabled for a filter, - * attempting to write will generate an error. - * - * If the filter is not registered, this function tries to load + * Function: H5P__set_filter + * + * Purpose: Adds the specified FILTER and corresponding properties to the + * end of the data or link output filter pipeline + * depending on whether PLIST is a dataset creation or group + * creation property list. The FLAGS argument specifies certain + * general properties of the filter and is documented below. + * The CD_VALUES is an array of CD_NELMTS integers which are + * auxiliary data for the filter. The integer vlues will be + * stored in the dataset object header as part of the filter + * information. + * + * The FLAGS argument is a bit vector of the following fields: + * + * H5Z_FLAG_OPTIONAL(0x0001) + * If this bit is set then the filter is optional. If the + * filter fails during an H5Dwrite() operation then the filter + * is just excluded from the pipeline for the chunk for which it + * failed; the filter will not participate in the pipeline + * during an H5Dread() of the chunk. If this bit is clear and + * the filter fails then the entire I/O operation fails. + * If this bit is set but encoding is disabled for a filter, + * attempting to write will generate an error. + * + * If the filter is not registered, this function tries to load * it dynamically during run time. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- */ static herr_t H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, - size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) + size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) { H5O_pline_t pline; /* Filter pipeline */ htri_t filter_avail; /* Filter availability */ @@ -746,16 +746,6 @@ H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, if((filter_avail = H5Z_filter_avail(filter)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't check filter availability") - /* If filter is not available, try to dynamically load it */ - if(!filter_avail) { - const H5Z_class2_t *filter_info; - - if(NULL == (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)filter))) - HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, FAIL, "failed to load dynamically loaded plugin") - if(H5Z_register(filter_info) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") - } /* end if */ - /* Get the pipeline property to append to */ if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") @@ -774,21 +764,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_nfilters + * Function: H5Pget_nfilters * - * Purpose: Returns the number of filters in the data or link - * pipeline depending on whether PLIST_ID is a dataset creation - * or group creation property list. In each pipeline the - * filters are numbered from zero through N-1 where N is the - * value returned by this function. During output to the file - * the filters of a pipeline are applied in increasing order - * (the inverse is true for input). + * Purpose: Returns the number of filters in the data or link + * pipeline depending on whether PLIST_ID is a dataset creation + * or group creation property list. In each pipeline the + * filters are numbered from zero through N-1 where N is the + * value returned by this function. During output to the file + * the filters of a pipeline are applied in increasing order + * (the inverse is true for input). * - * Return: Success: Number of filters or zero if there are none. + * Return: Success: Number of filters or zero if there are none. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 4, 1998 * * Modifications: @@ -827,25 +817,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_filter2 - * - * Purpose: This is the query counterpart of H5Pset_filter() and returns - * information about a particular filter number in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. FILTER_CONFIG is a bit + * Function: H5Pget_filter2 + * + * Purpose: This is the query counterpart of H5Pset_filter() and returns + * information about a particular filter number in a permanent + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. FILTER_CONFIG is a bit * field contaning encode/decode flags from H5Zpublic.h. The IDX * should be a value between zero and N-1 as described for * H5Pget_nfilters() and the function will return failure if the * filter number is out of range. * - * Return: Success: Filter identification number. + * Return: Success: Filter identification number. * - * Failure: H5Z_FILTER_ERROR (Negative) + * Failure: H5Z_FILTER_ERROR (Negative) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * * Modifications: @@ -859,8 +849,8 @@ done: */ H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, - size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, - size_t namelen, char name[]/*out*/, + size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, + size_t namelen, char name[]/*out*/, unsigned *filter_config /*out*/) { H5P_genplist_t *plist; /* Property list */ @@ -921,23 +911,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_filter_by_id + * Function: H5P_get_filter_by_id * - * Purpose: This is an additional query counterpart of H5Pset_filter() and + * Purpose: This is an additional query counterpart of H5Pset_filter() and * returns information about a particular filter in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. FILTER_CONFIG is a bit + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. FILTER_CONFIG is a bit * field contaning encode/decode flags from H5Zpublic.h. The ID * should be the filter ID to retrieve the parameters for. If the * filter is not set for the property list, an error will be returned. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, October 17, 2007 * *------------------------------------------------------------------------- @@ -971,23 +961,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_filter_by_id2 + * Function: H5Pget_filter_by_id2 * - * Purpose: This is an additional query counterpart of H5Pset_filter() and + * Purpose: This is an additional query counterpart of H5Pset_filter() and * returns information about a particular filter in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. FILTER_CONFIG is a bit + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. FILTER_CONFIG is a bit * field contaning encode/decode flags from H5Zpublic.h. The ID * should be the filter ID to retrieve the parameters for. If the * filter is not set for the property list, an error will be returned. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, April 5, 2003 * * Modifications: @@ -1047,16 +1037,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pall_filters_avail + * Function: H5Pall_filters_avail * - * Purpose: This is a query routine to verify that all the filters set + * Purpose: This is a query routine to verify that all the filters set * in the dataset creation property list are available currently. * - * Return: Success: TRUE if all filters available, FALSE if one or + * Return: Success: TRUE if all filters available, FALSE if one or * more filters not currently available. - * Failure: FAIL on error + * Failure: FAIL on error * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, April 8, 2003 * * Modifications: @@ -1096,16 +1086,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_filter_in_pline + * Function: H5P_filter_in_pline * - * Purpose: Check whether the filter is in the pipeline of the object - * creation property list. + * Purpose: Check whether the filter is in the pipeline of the object + * creation property list. * - * Return: TRUE: found - * FALSE: not found - * FAIL: error + * Return: TRUE: found + * FALSE: not found + * FAIL: error * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 26 April 2013 * *------------------------------------------------------------------------- @@ -1198,7 +1188,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * * Modifications: @@ -1258,7 +1248,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Dec 19, 2002 * * Modifications: @@ -1302,13 +1292,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_filter + * Function: H5P_get_filter * - * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id + * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, October 23, 2006 * *------------------------------------------------------------------------- @@ -1330,7 +1320,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, /* Filter parameters */ if(cd_values) { - size_t i; /* Local index variable */ + size_t i; /* Local index variable */ for(i = 0; i < filter->cd_nelmts && i < *cd_nelmts; i++) cd_values[i] = filter->cd_values[i]; @@ -1460,8 +1450,8 @@ done: * property in the dataset access property list is * decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * Monday, October 10, 2011 @@ -1553,15 +1543,15 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) * property in the dataset access property list is * decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Mohamad Chaarawi * Monday, October 10, 2011 * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5P__ocrt_pipeline_dec(const void **_pp, void *_value) { H5O_pline_t *pline = (H5O_pline_t *)_value; /* Property to set */ @@ -1637,7 +1627,7 @@ H5P__ocrt_pipeline_dec(const void **_pp, void *_value) filter.cd_values = (unsigned *)H5MM_xfree(filter.cd_values); } /* end for */ -done: +done: FUNC_LEAVE_NOAPI(ret_value) } /* H5P__ocrt_pipeline_dec() */ @@ -1830,32 +1820,32 @@ done: #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5Pget_filter1 - * - * Purpose: This is the query counterpart of H5Pset_filter() and returns - * information about a particular filter number in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. The IDX + * Function: H5Pget_filter1 + * + * Purpose: This is the query counterpart of H5Pset_filter() and returns + * information about a particular filter number in a permanent + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. The IDX * should be a value between zero and N-1 as described for * H5Pget_nfilters() and the function will return failure if the * filter number is out of range. * - * Return: Success: Filter identification number. + * Return: Success: Filter identification number. * - * Failure: H5Z_FILTER_ERROR (Negative) + * Failure: H5Z_FILTER_ERROR (Negative) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, April 15, 1998 * *------------------------------------------------------------------------- */ H5Z_filter_t H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, - size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, - size_t namelen, char name[]/*out*/) + size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, + size_t namelen, char name[]/*out*/) { H5O_pline_t pline; /* Filter pipeline */ const H5Z_filter_info_t *filter; /* Pointer to filter information */ @@ -1915,22 +1905,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_filter_by_id1 + * Function: H5Pget_filter_by_id1 * - * Purpose: This is an additional query counterpart of H5Pset_filter() and + * Purpose: This is an additional query counterpart of H5Pset_filter() and * returns information about a particular filter in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. The ID + * or transient pipeline depending on whether PLIST_ID is a + * dataset creation or transfer property list. On input, + * CD_NELMTS indicates the number of entries in the CD_VALUES + * array allocated by the caller while on exit it contains the + * number of values defined by the filter. The ID * should be the filter ID to retrieve the parameters for. If the * filter is not set for the property list, an error will be returned. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, April 5, 2003 * *------------------------------------------------------------------------- diff --git a/src/H5Z.c b/src/H5Z.c index ef34d7c..1d023b5 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -14,17 +14,17 @@ #include "H5Zmodule.h" /* This source code file is part of the H5Z module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5PLprivate.h" /* Plugins */ -#include "H5Sprivate.h" /* Dataspace functions */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5PLprivate.h" /* Plugins */ +#include "H5Sprivate.h" /* Dataspace functions */ +#include "H5Zpkg.h" /* Data filters */ #ifdef H5_HAVE_SZLIB_H # include "szlib.h" @@ -34,10 +34,10 @@ #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 */ @@ -56,11 +56,11 @@ typedef enum { hbool_t H5_PKG_INIT_VAR = FALSE; /* Local variables */ -static size_t H5Z_table_alloc_g = 0; -static size_t H5Z_table_used_g = 0; -static H5Z_class2_t *H5Z_table_g = NULL; +static size_t H5Z_table_alloc_g = 0; +static size_t H5Z_table_used_g = 0; +static H5Z_class2_t *H5Z_table_g = NULL; #ifdef H5Z_DEBUG -static H5Z_stats_t *H5Z_stat_table_g = NULL; +static H5Z_stats_t *H5Z_stat_table_g = NULL; #endif /* H5Z_DEBUG */ /* Local functions */ @@ -71,15 +71,11 @@ static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key); /*------------------------------------------------------------------------- - * Function: H5Z__init_package + * Function: H5Z__init_package * - * Purpose: Initializes the data filter layer. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 + * Purpose: Initializes the data filter layer. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -116,21 +112,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_term_package - * - * Purpose: Terminate the H5Z layer. - * - * Return: void + * Function: H5Z_term_package * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 + * Purpose: Terminate the H5Z layer. * + * Return: void *------------------------------------------------------------------------- */ int H5Z_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -140,54 +132,54 @@ H5Z_term_package(void) int dir, nprint = 0; size_t i; - if(H5DEBUG(Z)) { - for(i = 0; i < H5Z_table_used_g; i++) { - for(dir = 0; dir<2; dir++) { - if(0 == H5Z_stat_table_g[i].stats[dir].total) + if(H5DEBUG(Z)) { + for(i = 0; i < H5Z_table_used_g; i++) { + for(dir = 0; dir<2; dir++) { + if(0 == H5Z_stat_table_g[i].stats[dir].total) continue; - if(0 == nprint++) { - /* Print column headers */ - HDfprintf(H5DEBUG(Z), "H5Z: filter statistics " - "accumulated over life of library:\n"); - HDfprintf(H5DEBUG(Z), - " %-16s %10s %10s %8s %8s %8s %10s\n", - "Filter", "Total", "Errors", "User", - "System", "Elapsed", "Bandwidth"); - HDfprintf(H5DEBUG(Z), - " %-16s %10s %10s %8s %8s %8s %10s\n", - "------", "-----", "------", "----", - "------", "-------", "---------"); - } /* end if */ - - /* Truncate the comment to fit in the field */ - HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment); - comment[sizeof(comment) - 1] = '\0'; - - /* - * Format bandwidth to have four significant digits and - * units of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or - * the word `Inf' if the elapsed time is zero. - */ - H5_bandwidth(bandwidth, - (double)(H5Z_stat_table_g[i].stats[dir].total), - H5Z_stat_table_g[i].stats[dir].timer.etime); - - /* Print the statistics */ - HDfprintf(H5DEBUG(Z), - " %s%-15s %10Hd %10Hd %8.2f %8.2f %8.2f " - "%10s\n", dir?"<":">", comment, - H5Z_stat_table_g[i].stats[dir].total, - H5Z_stat_table_g[i].stats[dir].errors, - H5Z_stat_table_g[i].stats[dir].timer.utime, - H5Z_stat_table_g[i].stats[dir].timer.stime, - H5Z_stat_table_g[i].stats[dir].timer.etime, - bandwidth); - } /* end for */ - } /* end for */ - } /* end if */ + if(0 == nprint++) { + /* Print column headers */ + HDfprintf(H5DEBUG(Z), "H5Z: filter statistics " + "accumulated over life of library:\n"); + HDfprintf(H5DEBUG(Z), + " %-16s %10s %10s %8s %8s %8s %10s\n", + "Filter", "Total", "Errors", "User", + "System", "Elapsed", "Bandwidth"); + HDfprintf(H5DEBUG(Z), + " %-16s %10s %10s %8s %8s %8s %10s\n", + "------", "-----", "------", "----", + "------", "-------", "---------"); + } /* end if */ + + /* Truncate the comment to fit in the field */ + HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment); + comment[sizeof(comment) - 1] = '\0'; + + /* + * Format bandwidth to have four significant digits and + * units of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or + * the word `Inf' if the elapsed time is zero. + */ + H5_bandwidth(bandwidth, + (double)(H5Z_stat_table_g[i].stats[dir].total), + H5Z_stat_table_g[i].stats[dir].timer.etime); + + /* Print the statistics */ + HDfprintf(H5DEBUG(Z), + " %s%-15s %10Hd %10Hd %8.2f %8.2f %8.2f " + "%10s\n", dir?"<":">", comment, + H5Z_stat_table_g[i].stats[dir].total, + H5Z_stat_table_g[i].stats[dir].errors, + H5Z_stat_table_g[i].stats[dir].timer.utime, + H5Z_stat_table_g[i].stats[dir].timer.stime, + H5Z_stat_table_g[i].stats[dir].timer.etime, + bandwidth); + } /* end for */ + } /* end for */ + } /* end if */ #endif /* H5Z_DEBUG */ - /* Free the table of filters */ + /* Free the table of filters */ if(H5Z_table_g) { H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g); #ifdef H5Z_DEBUG @@ -198,7 +190,7 @@ H5Z_term_package(void) n++; } /* end if */ - /* Mark interface as closed */ + /* Mark interface as closed */ if(0 == n) H5_PKG_INIT_VAR = FALSE; } /* end if */ @@ -208,19 +200,11 @@ H5Z_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Zregister - * - * Purpose: This function registers new filter. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 + * Function: H5Zregister * - * Modifications: - * Changed to pass in H5Z_class_t struct - * Quincey Koziol, April 5, 2003 + * Purpose: This function registers new filter. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -235,7 +219,7 @@ H5Zregister(const void *cls) /* Check args */ if (cls_real==NULL) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class") + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class") /* Check H5Z_class_t version number; this is where a function to convert * from an outdated version should be called. @@ -272,15 +256,15 @@ H5Zregister(const void *cls) } /* end if */ if (cls_real->id<0 || cls_real->id>H5Z_FILTER_MAX) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") if (cls_real->idfilter==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified") /* Do it */ if (H5Z_register (cls_real)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") done: FUNC_LEAVE_API(ret_value) @@ -288,24 +272,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_register - * - * Purpose: Same as the public version except this one allows filters - * to be set for predefined method numbers id) + 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); - H5Z_class2_t *table = (H5Z_class2_t *)H5MM_realloc(H5Z_table_g, n * sizeof(H5Z_class2_t)); + 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)); + 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") - H5Z_table_g = 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") - H5Z_stat_table_g = stat_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; - } /* end if */ + H5Z_table_alloc_g = n; + } /* end if */ - /* Initialize */ - i = H5Z_table_used_g++; - HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); + /* Initialize */ + i = H5Z_table_used_g++; + HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); #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 { - /* Replace old contents */ - HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); + /* Replace old contents */ + HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); } /* end else */ done: @@ -356,15 +334,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Zunregister - * - * Purpose: This function unregisters a filter. - * - * Return: Non-negative on success/Negative on failure + * Function: H5Zunregister * - * Programmer: Quincey Koziol - * Thursday, November 14, 2002 + * Purpose: This function unregisters a filter. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -377,13 +351,13 @@ H5Zunregister(H5Z_filter_t id) /* Check args */ if(id < 0 || id > H5Z_FILTER_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") if(id < H5Z_FILTER_RESERVED) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters") /* Do it */ if(H5Z_unregister(id) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter") done: FUNC_LEAVE_API(ret_value) @@ -391,16 +365,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_unregister + * Function: H5Z_unregister * - * Purpose: Same as the public version except this one allows filters - * to be unset for predefined method numbers found = TRUE; ret_value = TRUE; @@ -546,19 +508,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_dset_cb + * 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. - * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. - * - * Programmer: Raymond Lu - * 6 May 2013 + * 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. *------------------------------------------------------------------------- */ static int @@ -574,7 +532,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * HDassert(obj_ptr); /* Get the dataset creation property */ - if((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0) + 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 */ @@ -583,7 +541,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and * let H5Z_unregister return failure. - */ + */ if(filter_in_pline) { object->found = TRUE; ret_value = TRUE; @@ -599,17 +557,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__flush_file_cb + * Function: H5Z__flush_file_cb * - * Purpose: The callback function for H5Z_unregister. It iterates - * through all opened files and flush them. - * - * Return: FALSE if finishes flushing and moves on - * FAIL if there is an error - * - * Programmer: Raymond Lu - * 6 May 2013 + * Purpose: The callback function for H5Z_unregister. It iterates + * through all opened files and flush them. * + * Return: FALSE if finishes flushing and moves on + * FAIL if there is an error *------------------------------------------------------------------------- */ static int @@ -621,7 +575,7 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_UNUS HDassert(obj_ptr); - /* Call the flush routine for mounted file hierarchies. Do a global flush + /* 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) @@ -634,17 +588,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Zfilter_avail - * - * Purpose: Check if a filter is available - * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure + * Function: H5Zfilter_avail * - * Programmer: Quincey Koziol - * Thursday, November 14, 2002 - * - * Modifications: + * Purpose: Check if a filter is available * + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure *------------------------------------------------------------------------- */ htri_t @@ -658,15 +606,9 @@ H5Zfilter_avail(H5Z_filter_t id) /* Check args */ 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") - else if(ret_value == FALSE) { - const H5Z_class2_t *filter_info; - if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)id))) - ret_value = TRUE; - } /* end if */ + 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) @@ -674,51 +616,48 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_filter_avail - * - * Purpose: Private function to check if a filter is available + * Function: H5Z_filter_avail * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure - * - * Programmer: Raymond Lu - * 13 February 2013 + * Purpose: Private function to check if a filter is available * + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure *------------------------------------------------------------------------- */ 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 */ 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(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) + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_filter_avail() */ /*------------------------------------------------------------------------- - * Function: H5Z_prelude_callback + * Function: H5Z_prelude_callback * - * Purpose: Makes a dataset creation "prelude" callback for the "can_apply" - * or "set_local" routines. + * Purpose: Makes a dataset creation "prelude" callback for the "can_apply" + * or "set_local" routines. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, April 4, 2003 - * - * Notes: - * The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see + * 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 + * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ static herr_t @@ -761,7 +700,7 @@ H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, if(status < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback") - /* Indicate filter can't apply to this combination of parameters. + /* 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)) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate") @@ -791,21 +730,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_prepare_prelude_callback_dcpl - * - * Purpose: Prepares to make a dataset creation "prelude" callback - * for the "can_apply" or "set_local" routines. + * Function: H5Z_prepare_prelude_callback_dcpl * - * Return: Non-negative on success/Negative on failure + * Purpose: Prepares to make a dataset creation "prelude" callback + * for the "can_apply" or "set_local" routines. * - * Programmer: Quincey Koziol - * Friday, April 4, 2003 - * - * Notes: - * The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see + * 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 + * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ static herr_t @@ -821,7 +755,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* 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 */ + 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 */ @@ -874,22 +808,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_can_apply - * - * Purpose: Checks if all the filters defined in the dataset creation - * property list can be applied to a particular combination of - * datatype and dataspace for a dataset. + * Function: H5Z_can_apply * - * Return: Non-negative on success/Negative on failure + * Purpose: Checks if all the filters defined in the dataset creation + * property list can be applied to a particular combination of + * datatype and dataspace for a dataset. * - * Programmer: Quincey Koziol - * Thursday, April 3, 2003 - * - * Notes: - * The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see + * 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 + * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ herr_t @@ -909,22 +838,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_set_local - * - * Purpose: Makes callbacks to modify dataset creation list property - * settings for filters on a new dataset, based on the datatype - * and dataspace of that dataset (chunk). + * Function: H5Z_set_local * - * Return: Non-negative on success/Negative on failure + * Purpose: Makes callbacks to modify dataset creation list property + * settings for filters on a new dataset, based on the datatype + * and dataspace of that dataset (chunk). * - * Programmer: Quincey Koziol - * Friday, April 4, 2003 - * - * Notes: - * The chunk dimensions are used to create a dataspace, instead - * of passing in the dataset's dataspace, since the chunk - * dimensions are what the I/O filter will actually see + * 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 + * dimensions are what the I/O filter will actually see *------------------------------------------------------------------------- */ herr_t @@ -944,17 +868,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_can_apply_direct - * - * Purpose: Checks if all the filters defined in the pipeline can be - * 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 + * Function: H5Z_can_apply_direct * - * Programmer: Neil Fortner - * Tuesday, September 22, 2009 + * Purpose: Checks if all the filters defined in the pipeline can be + * 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 *------------------------------------------------------------------------- */ herr_t @@ -976,22 +896,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_set_local_direct + * Function: H5Z_set_local_direct * - * Purpose: Makes callbacks to modify local settings for filters on a - * new opaque object. The pipeline is assumed to have at - * least one filter. + * Purpose: Makes callbacks to modify local settings for filters on a + * new opaque object. The pipeline is assumed to have at + * least one filter. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Tuesday, September 22, 2009 - * - * Notes: - * This callback will almost certainly not do anything - * useful, other than to make certain that the filter will - * accept opque data. + * 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 + * accept opaque data. *------------------------------------------------------------------------- */ herr_t @@ -1013,24 +928,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_modify - * - * Purpose: Modify filter parameters for specified pipeline. + * Function: H5Z_modify * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * - * Modifications: + * Purpose: Modify filter parameters for specified pipeline. * + * 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 cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) { - size_t idx; /* Index of filter in pipeline */ + size_t idx; /* Index of filter in pipeline */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1047,7 +956,7 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, /* 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") + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") /* Change parameters for filter */ pline->filter[idx].flags = flags; @@ -1055,11 +964,11 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, /* Free any existing parameters */ if(pline->filter[idx].cd_values != NULL && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) - H5MM_xfree(pline->filter[idx].cd_values); + H5MM_xfree(pline->filter[idx].cd_values); /* Set parameters */ if(cd_nelmts > 0) { - size_t i; /* Local index variable */ + size_t i; /* Local index variable */ /* Allocate memory or point at internal buffer */ if(cd_nelmts > H5Z_COMMON_CD_VALUES) { @@ -1071,8 +980,8 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, 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; @@ -1083,24 +992,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_append - * - * Purpose: Append another filter to the specified pipeline. + * Function: H5Z_append * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, August 4, 1998 - * - * Modifications: + * Purpose: Append another filter to the specified pipeline. * + * 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 cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) { - size_t idx; + size_t idx; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1115,7 +1018,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, * 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") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline") /* Check for freshly allocated filter pipeline */ if(pline->version == 0) @@ -1123,7 +1026,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, /* Allocate additional space in the pipeline if it's full */ if(pline->nused >= pline->nalloc) { - H5O_pline_t x; + H5O_pline_t x; size_t n; /* Each filter's data may be stored internally or may be @@ -1137,10 +1040,10 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, 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") + 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") /* Fix pointers in previous filters that need to point to their own * internal data. @@ -1150,18 +1053,18 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, x.filter[n].cd_values = x.filter[n]._cd_values; /* Point to newly allocated buffer */ - pline->nalloc = x.nalloc; - pline->filter = x.filter; + pline->nalloc = x.nalloc; + pline->filter = x.filter; } /* end if */ /* Add the new filter to the pipeline */ 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 */ + size_t i; /* Local index variable */ /* Allocate memory or point at internal buffer */ if(cd_nelmts > H5Z_COMMON_CD_VALUES) { @@ -1173,8 +1076,8 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, 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; @@ -1187,32 +1090,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_find_idx - * - * 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 + * Function: H5Z_find_idx * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * - * Modifications: + * 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 *------------------------------------------------------------------------- */ static int H5Z_find_idx(H5Z_filter_t id) { size_t i; /* Local index variable */ - int ret_value=FAIL; /* Return value */ + int ret_value = FAIL; /* Return value */ 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 - * - * Programmer: Robb Matzke - * Tuesday, August 4, 1998 - * - * Modifications: - * + * Function: H5Z_pipeline + * + * 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 H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, - unsigned *filter_mask/*in,out*/, H5Z_EDC_t edc_read, - H5Z_cb_t cb_struct, size_t *nbytes/*in,out*/, - size_t *buf_size/*in,out*/, void **buf/*in,out*/) + unsigned *filter_mask/*in,out*/, H5Z_EDC_t edc_read, + 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 */ - H5_timer_t timer; + 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(0 == (flags & ~((unsigned)H5Z_FLAG_INVMASK))); HDassert(filter_mask); - HDassert(nbytes && *nbytes>0); - HDassert(buf_size && *buf_size>0); + HDassert(nbytes && *nbytes > 0); + HDassert(buf_size && *buf_size > 0); HDassert(buf && *buf); - HDassert(!pline || pline->nusednused < H5Z_MAX_NFILTERS); if (pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */ - for (i=pline->nused; i>0; --i) { - idx = i-1; - - if (*filter_mask & ((unsigned)1<filter[idx].id)) < 0) { + for (i = pline->nused; i > 0; --i) { + idx = i - 1; + + if (*filter_mask & ((unsigned)1 << idx)) { + failed |= (unsigned)1 << idx; + 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) { hbool_t issue_error = FALSE; - const 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) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") + /* 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) + 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) - issue_error = TRUE; - } /* end if */ - else - issue_error = TRUE; + /* 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) + issue_error = TRUE; + } /* end if */ + else + issue_error = TRUE; /* Check for error */ if(issue_error) { - /* Print out the filter name to give more info. But the name is optional for - * the filter */ + /* Print out the filter name to give more info. But the name is optional for + * 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 @@ -1352,65 +1235,65 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, } /* end if */ } /* end if */ - fclass=&H5Z_table_g[fclass_idx]; + fclass = &H5Z_table_g[fclass_idx]; #ifdef H5Z_DEBUG - fstats=&H5Z_stat_table_g[fclass_idx]; - H5_timer_begin(&timer); + fstats = &H5Z_stat_table_g[fclass_idx]; + H5_timer_begin(&timer); #endif - 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); + 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); #ifdef H5Z_DEBUG - 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; + 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((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); - } else { + } + else { *nbytes = new_nbytes; } - } - } else if (pline) { /* Write */ - for (idx=0; idxnused; idx++) { - if (*filter_mask & ((unsigned)1<filter[idx].id))<0) { + } + } + else if (pline) { /* Write */ + for (idx = 0; idx < pline->nused; idx++) { + if (*filter_mask & ((unsigned)1 << idx)) { + failed |= (unsigned)1 << idx; + continue; /*filter excluded*/ + } + if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { /* Check if filter is optional -- If it isn't, then error */ - if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered") + if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0) + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered") - failed |= (unsigned)1 << idx; + failed |= (unsigned)1 << idx; H5E_clear_stack(NULL); - continue; /*filter excluded*/ - } - fclass=&H5Z_table_g[fclass_idx]; + continue; /*filter excluded*/ + } + fclass = &H5Z_table_g[fclass_idx]; #ifdef H5Z_DEBUG - fstats=&H5Z_stat_table_g[fclass_idx]; - H5_timer_begin(&timer); + fstats = &H5Z_stat_table_g[fclass_idx]; + 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); - fstats->stats[0].total += MAX(*nbytes, new_nbytes); - if (0==new_nbytes) fstats->stats[0].errors += *nbytes; + 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==(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) + 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") *nbytes = *buf_size; @@ -1418,10 +1301,11 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, failed |= (unsigned)1 << idx; H5E_clear_stack(NULL); - } else { + } + else { *nbytes = new_nbytes; } - } + } } *filter_mask = failed; @@ -1432,41 +1316,35 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_filter_info - * - * Purpose: Get pointer to filter info for pipeline - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 + * Function: H5Z_filter_info * - * Modifications: + * Purpose: Get pointer to filter info for pipeline * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ H5Z_filter_info_t * H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) { - size_t idx; /* Index of filter in pipeline */ + size_t idx; /* Index of filter in pipeline */ H5Z_filter_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) HDassert(pline); - HDassert(filter>=0 && filter<=H5Z_FILTER_MAX); + HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); /* Locate the filter in the pipeline */ - for(idx=0; idxnused; 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]; + ret_value = &pline->filter[idx]; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1474,41 +1352,35 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_filter_in_pline + * Function: H5Z_filter_in_pline * - * Purpose: Check wheter a filter is in the filter pipeline using the - * filter ID. This function is very similar to H5Z_filter_info - * - * Return: TRUE - found filter - * FALSE - not found - * FAIL - error - * - * Programmer: Raymond Lu - * 26 April 2013 - * - * Modifications: + * Purpose: Check wheter a filter is in the filter pipeline using the + * filter ID. This function is very similar to H5Z_filter_info * + * Return: TRUE - found filter + * FALSE - not found + * FAIL - error *------------------------------------------------------------------------- */ htri_t H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter) { - size_t idx; /* Index of filter in pipeline */ + 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(filter >= 0 && filter <= H5Z_FILTER_MAX); /* Locate the filter in the pipeline */ - for(idx=0; idxnused; 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) - ret_value = FALSE; + if(idx >= pline->nused) + ret_value = FALSE; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1517,18 +1389,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z_all_filters_avail - * - * Purpose: Verify that all the filters in a pipeline are currently - * available (i.e. registered) + * Function: H5Z_all_filters_avail * - * Return: Non-negative (TRUE/FALSE) on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, April 8, 2003 - * - * Modifications: + * 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 *------------------------------------------------------------------------- */ htri_t @@ -1543,15 +1409,14 @@ H5Z_all_filters_avail(const H5O_pline_t *pline) HDassert(pline); /* Iterate through all the filters in pipeline */ - for(i=0; inused; i++) { - + for(i = 0; i < pline->nused; i++) { /* Look for each filter in the list of registered filters */ - for(j=0; jfilter[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) + if(j == H5Z_table_used_g) HGOTO_DONE(FALSE) } /* end for */ @@ -1564,16 +1429,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_delete * - * Purpose: Delete filter FILTER from pipeline PLINE; - * deletes all filters if FILTER is H5Z_FILTER_NONE - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Pedro Vicente - * Monday, January 26, 2004 - * - * Modifications: + * Purpose: Delete filter FILTER from pipeline PLINE; + * deletes all filters if FILTER is H5Z_FILTER_NONE * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1588,7 +1447,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); /* if the pipeline has no filters, just return */ - if(pline->nused==0) + if(pline->nused == 0) HGOTO_DONE(SUCCEED) /* Delete all filters */ @@ -1649,14 +1508,8 @@ done: /*------------------------------------------------------------------------- * Function: H5Zget_filter_info * - * Purpose: Gets information about a pipeline data filter and stores it - * in filter_config_flags. - * - * Return: zero on success / negative on failure - * - * Programmer: James Laird and Nat Furrer - * Monday, June 7, 2004 - * + * Purpose: Gets information about a pipeline data filter and stores it + * in filter_config_flags. *------------------------------------------------------------------------- */ herr_t @@ -1679,21 +1532,15 @@ done: /*------------------------------------------------------------------------- * Function: H5Z_get_filter_info * - * Purpose: Gets information about a pipeline data filter and stores it - * in filter_config_flags. - * - * Return: zero on success / negative on failure - * - * Programmer: Quincey Koziol - * Saturday, May 11, 2013 - * + * Purpose: Gets information about a pipeline data filter and stores it + * in filter_config_flags. *------------------------------------------------------------------------- */ herr_t H5Z_get_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) { H5Z_class2_t *fclass; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index ca2ca77..b8d3689 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -660,7 +660,7 @@ foreach (test ${H5TEST_TESTS}) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) else () - if (${test} STREQUAL "big" AND CYGWIN) + if ("${test}" STREQUAL "big" AND CYGWIN) add_test (NAME H5TEST-${test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}" ) @@ -701,7 +701,7 @@ if (BUILD_SHARED_LIBS) ) foreach (test ${H5TEST_TESTS}) - if (${test} STREQUAL "big" AND CYGWIN) + if ("${test}" STREQUAL "big" AND CYGWIN) add_test (NAME H5TEST-shared-${test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared" ) @@ -998,8 +998,10 @@ endif () ############################################################################## if (WIN32) set (CMAKE_SEP "\;") + set (BIN_REL_PATH "../../") else () set (CMAKE_SEP ":") + set (BIN_REL_PATH "../") endif () add_test (NAME H5PLUGIN-plugin COMMAND $) @@ -1086,8 +1088,8 @@ if (HDF5_TEST_VFD) # Windows only macro macro (CHECK_VFD_TEST vfdtest vfdname resultcode) - if (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2") - if (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") + if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") + if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" @@ -1176,7 +1178,7 @@ if (HDF5_TEST_VFD) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS AND NOT ${vfdtest} STREQUAL "cache") + if (BUILD_SHARED_LIBS AND NOT "${vfdtest}" STREQUAL "cache") add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" diff --git a/test/dsets.c b/test/dsets.c index fb09892..6c6574a 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -12,17 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * - * Purpose: Tests the dataset interface (H5D) + * Purpose: Tests the dataset interface (H5D) */ -#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ #define H5D_TESTING -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ #define H5FD_TESTING -#define H5Z_FRIEND /*suppress error about including H5Zpkg */ +#define H5Z_FRIEND /*suppress error about including H5Zpkg */ #include "h5test.h" #include "H5srcdir.h" @@ -35,29 +35,29 @@ #endif const char *FILENAME[] = { - "dataset", /* 0 */ - "compact_dataset", /* 1 */ - "dset_offset", /* 2 */ - "max_compact_dataset", /* 3 */ - "simple", /* 4 */ - "set_local", /* 5 */ - "random_chunks", /* 6 */ - "huge_chunks", /* 7 */ - "chunk_cache", /* 8 */ - "big_chunk", /* 9 */ - "chunk_fast", /* 10 */ - "chunk_expand", /* 11 */ - "chunk_fixed", /* 12 */ + "dataset", /* 0 */ + "compact_dataset", /* 1 */ + "dset_offset", /* 2 */ + "max_compact_dataset", /* 3 */ + "simple", /* 4 */ + "set_local", /* 5 */ + "random_chunks", /* 6 */ + "huge_chunks", /* 7 */ + "chunk_cache", /* 8 */ + "big_chunk", /* 9 */ + "chunk_fast", /* 10 */ + "chunk_expand", /* 11 */ + "chunk_fixed", /* 12 */ "copy_dcpl_newfile",/* 13 */ "partial_chunks", /* 14 */ "layout_extend", /* 15 */ - "zero_chunk", /* 16 */ + "zero_chunk", /* 16 */ "chunk_single", /* 17 */ "swmr_non_latest", /* 18 */ "earray_hdr_fd", /* 19 */ "farray_hdr_fd", /* 20 */ "bt2_hdr_fd", /* 21 */ - "storage_size", /* 22 */ + "storage_size", /* 22 */ "dls_01_strings", /* 23 */ "power2up", /* 24 */ NULL @@ -68,39 +68,39 @@ const char *FILENAME[] = { #define FILE_DEFLATE_NAME "deflate.h5" /* Dataset names for testing filters */ -#define DSET_DEFAULT_NAME "default" -#define DSET_CHUNKED_NAME "chunked" -#define DSET_COMPACT_NAME "compact" -#define DSET_SIMPLE_IO_NAME "simple_io" -#define DSET_USERBLOCK_IO_NAME "userblock_io" -#define DSET_COMPACT_IO_NAME "compact_io" -#define DSET_COMPACT_MAX_NAME "max_compact" -#define DSET_COMPACT_MAX2_NAME "max_compact_2" -#define DSET_CONV_BUF_NAME "conv_buf" -#define DSET_TCONV_NAME "tconv" -#define DSET_DEFLATE_NAME "deflate" -#define DSET_SHUFFLE_NAME "shuffle" -#define DSET_FLETCHER32_NAME "fletcher32" -#define DSET_FLETCHER32_NAME_2 "fletcher32_2" -#define DSET_FLETCHER32_NAME_3 "fletcher32_3" -#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32" -#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2" +#define DSET_DEFAULT_NAME "default" +#define DSET_CHUNKED_NAME "chunked" +#define DSET_COMPACT_NAME "compact" +#define DSET_SIMPLE_IO_NAME "simple_io" +#define DSET_USERBLOCK_IO_NAME "userblock_io" +#define DSET_COMPACT_IO_NAME "compact_io" +#define DSET_COMPACT_MAX_NAME "max_compact" +#define DSET_COMPACT_MAX2_NAME "max_compact_2" +#define DSET_CONV_BUF_NAME "conv_buf" +#define DSET_TCONV_NAME "tconv" +#define DSET_DEFLATE_NAME "deflate" +#define DSET_SHUFFLE_NAME "shuffle" +#define DSET_FLETCHER32_NAME "fletcher32" +#define DSET_FLETCHER32_NAME_2 "fletcher32_2" +#define DSET_FLETCHER32_NAME_3 "fletcher32_3" +#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32" +#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2" #ifdef H5_HAVE_FILTER_SZIP -#define DSET_SZIP_NAME "szip" -#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32" -#define DSET_SHUF_SZIP_FLET_NAME_2 "shuffle+szip+fletcher32_2" +#define DSET_SZIP_NAME "szip" +#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32" +#define DSET_SHUF_SZIP_FLET_NAME_2 "shuffle+szip+fletcher32_2" #endif /* H5_HAVE_FILTER_SZIP */ -#define DSET_BOGUS_NAME "bogus" -#define DSET_MISSING_NAME "missing" -#define DSET_CAN_APPLY_NAME "can_apply" -#define DSET_CAN_APPLY_NAME2 "can_apply2" +#define DSET_BOGUS_NAME "bogus" +#define DSET_MISSING_NAME "missing" +#define DSET_CAN_APPLY_NAME "can_apply" +#define DSET_CAN_APPLY_NAME2 "can_apply2" #ifdef H5_HAVE_FILTER_SZIP -#define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip" +#define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip" #endif /* H5_HAVE_FILTER_SZIP */ -#define DSET_SET_LOCAL_NAME "set_local" -#define DSET_SET_LOCAL_NAME_2 "set_local_2" -#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" +#define DSET_SET_LOCAL_NAME "set_local" +#define DSET_SET_LOCAL_NAME_2 "set_local_2" +#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" #define DSET_NBIT_INT_NAME "nbit_int" #define DSET_NBIT_FLOAT_NAME "nbit_float" #define DSET_NBIT_DOUBLE_NAME "nbit_double" @@ -116,27 +116,27 @@ const char *FILENAME[] = { #define DSET_SCALEOFFSET_FLOAT_NAME_2 "scaleoffset_float_2" #define DSET_SCALEOFFSET_DOUBLE_NAME "scaleoffset_double" #define DSET_SCALEOFFSET_DOUBLE_NAME_2 "scaleoffset_double_2" -#define DSET_COMPARE_DCPL_NAME "compare_dcpl" -#define DSET_COMPARE_DCPL_NAME_2 "compare_dcpl_2" -#define DSET_COPY_DCPL_NAME_1 "copy_dcpl_1" -#define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2" -#define COPY_DCPL_EXTFILE_NAME "ext_file" -#define DSET_DEPREC_NAME "deprecated" -#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked" -#define DSET_DEPREC_NAME_COMPACT "deprecated_compact" -#define DSET_DEPREC_NAME_FILTER "deprecated_filter" +#define DSET_COMPARE_DCPL_NAME "compare_dcpl" +#define DSET_COMPARE_DCPL_NAME_2 "compare_dcpl_2" +#define DSET_COPY_DCPL_NAME_1 "copy_dcpl_1" +#define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2" +#define COPY_DCPL_EXTFILE_NAME "ext_file" +#define DSET_DEPREC_NAME "deprecated" +#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked" +#define DSET_DEPREC_NAME_COMPACT "deprecated_compact" +#define DSET_DEPREC_NAME_FILTER "deprecated_filter" /* Dataset names for testing Fixed Array Indexing */ -#define DSET_FIXED_MAX "DSET_FIXED_MAX" -#define DSET_FIXED_NOMAX "DSET_FIXED_NOMAX" -#define DSET_FIXED_BIG "DSET_FIXED_BIG" -#define POINTS 72 -#define POINTS_BIG 2500 +#define DSET_FIXED_MAX "DSET_FIXED_MAX" +#define DSET_FIXED_NOMAX "DSET_FIXED_NOMAX" +#define DSET_FIXED_BIG "DSET_FIXED_BIG" +#define POINTS 72 +#define POINTS_BIG 2500 /* Dataset names used for testing header flush dependencies */ #define DSET_EARRAY_HDR_FD "earray_hdr_fd" #define DSET_FARRAY_HDR_FD "farray_hdr_fd" -#define DSET_BT2_HDR_FD "bt2_hdr_fd" +#define DSET_BT2_HDR_FD "bt2_hdr_fd" /* Dataset names for testing Implicit Indexing */ #define DSET_SINGLE_MAX "DSET_SINGLE_MAX" @@ -146,14 +146,14 @@ const char *FILENAME[] = { #define SIXTY_FOUR_KB 65536 /* Temporary filter IDs used for testing */ -#define H5Z_FILTER_BOGUS 305 -#define H5Z_FILTER_CORRUPT 306 -#define H5Z_FILTER_CAN_APPLY_TEST 307 -#define H5Z_FILTER_SET_LOCAL_TEST 308 -#define H5Z_FILTER_DEPREC 309 -#define H5Z_FILTER_EXPAND 310 -#define H5Z_FILTER_CAN_APPLY_TEST2 311 -#define H5Z_FILTER_COUNT 312 +#define H5Z_FILTER_BOGUS 305 +#define H5Z_FILTER_CORRUPT 306 +#define H5Z_FILTER_CAN_APPLY_TEST 307 +#define H5Z_FILTER_SET_LOCAL_TEST 308 +#define H5Z_FILTER_DEPREC 309 +#define H5Z_FILTER_EXPAND 310 +#define H5Z_FILTER_CAN_APPLY_TEST2 311 +#define H5Z_FILTER_COUNT 312 /* Flags for testing filters */ #define DISABLE_FLETCHER32 0 @@ -182,15 +182,15 @@ const char *FILENAME[] = { /* Names for noencoder test */ #ifdef H5_HAVE_FILTER_SZIP -#define NOENCODER_FILENAME "noencoder.h5" +#define NOENCODER_FILENAME "noencoder.h5" #define NOENCODER_COPY_FILENAME "noencoder.h5.copy" -#define NOENCODER_TEST_DATASET "noencoder_tdset.h5" -#define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5" +#define NOENCODER_TEST_DATASET "noencoder_tdset.h5" +#define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5" #define NOENCODER_SZIP_SHUFF_FLETCH_DATASET "noencoder_szip_shuffle_fletcher_dset.h5" #endif /* H5_HAVE_FILTER_SZIP */ /* Names for zero-dim test */ -#define ZERODIM_DATASET "zerodim" +#define ZERODIM_DATASET "zerodim" #define ZERODIM_DATASET2 "zerodim2" /* Parameters for zero-dim test */ @@ -221,8 +221,8 @@ const char *FILENAME[] = { #define BYPASS_DATASET1 "Dset1" #define BYPASS_DATASET2 "Dset2" -#define T_BYPASS_DATASET1 "T_Dset1" -#define T_BYPASS_DATASET2 "T_Dset2" +#define T_BYPASS_DATASET1 "T_Dset1" +#define T_BYPASS_DATASET2 "T_Dset2" #define BYPASS_DIM 1000 #define BYPASS_CHUNK_DIM 500 @@ -234,7 +234,7 @@ const char *FILENAME[] = { #define EARRAY_CHUNK_DIM 3 #define EARRAY_EXTEND_INCR 15 #define EARRAY_MAX_EXTEND 75 - + /* Parameters for datasets in query storage size tests */ #define STORAGE_SIZE_DIM1 12 #define STORAGE_SIZE_DIM2 6 @@ -246,8 +246,8 @@ const char *FILENAME[] = { /* Shared global arrays */ #define DSET_DIM1 100 #define DSET_DIM2 200 -int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2]; -double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2]; +int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2]; +double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2]; size_t count_nbytes_read = 0; size_t count_nbytes_written = 0; @@ -266,29 +266,29 @@ const char *OLD_FILENAME[] = { /* Files created under 1.6 branch and 1.8 branch /* Local prototypes for filter functions */ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); static htri_t can_apply_bogus(hid_t dcpl_id, hid_t type_id, hid_t space_id); static herr_t set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t space_id); static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); static size_t filter_bogus3(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); static size_t filter_corrupt(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); static size_t filter_expand(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); static size_t filter_count(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ const H5Z_class2_t H5Z_COUNT[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_COUNT, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "count", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - filter_count, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_COUNT, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "count", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_count, /* The actual filter function */ }}; @@ -300,12 +300,7 @@ const H5Z_class2_t H5Z_COUNT[1] = {{ * appropriate. * * Return: Success: Data chunk size - * * Failure: 0 - * - * Programmer: Neil Fortner - * Wednesday, March 17, 2010 - * *------------------------------------------------------------------------- */ static size_t @@ -323,26 +318,21 @@ filter_count(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, /*------------------------------------------------------------------------- - * Function: test_create - * - * Purpose: Attempts to create a dataset. + * Function: test_create * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Purpose: Attempts to create a dataset. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t test_create(hid_t file) { - hid_t dataset, space, small_space, create_parms; - hsize_t dims[2], small_dims[2]; - herr_t status; - hsize_t csize[2]; + hid_t dataset, space, small_space, create_parms; + hsize_t dims[2], small_dims[2]; + herr_t status; + hsize_t csize[2]; TESTING("create, open, close"); @@ -359,11 +349,11 @@ test_create(hid_t file) assert(space>=0); /* - * Create a dataset using the default dataset creation properties. We're + * Create a dataset using the default dataset creation properties. We're * not sure what they are, so we won't check. */ dataset = H5Dcreate2(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dataset < 0) goto error; /* Close the dataset */ @@ -379,13 +369,13 @@ test_create(hid_t file) * reporting. */ H5E_BEGIN_TRY { - dataset = H5Dcreate2(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; if(dataset >= 0) { - H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); - goto error; + H5_FAILED(); + puts(" Library allowed overwrite of existing dataset."); + goto error; } /* @@ -402,12 +392,12 @@ test_create(hid_t file) * reporting. */ H5E_BEGIN_TRY { - dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT); + dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT); } H5E_END_TRY; if(dataset >= 0) { - H5_FAILED(); - puts(" Opened a non-existent dataset."); - goto error; + H5_FAILED(); + puts(" Opened a non-existent dataset."); + goto error; } /* @@ -424,12 +414,12 @@ test_create(hid_t file) assert(status >= 0); H5E_BEGIN_TRY { dataset = H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space, - H5P_DEFAULT, create_parms, H5P_DEFAULT); + H5P_DEFAULT, create_parms, H5P_DEFAULT); } H5E_END_TRY; if(dataset >= 0) { - H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); - goto error; + H5_FAILED(); + puts(" Opened a dataset with incorrect chunking parameters."); + goto error; } csize[0] = 5; @@ -438,7 +428,7 @@ test_create(hid_t file) assert(status >= 0); dataset = H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space, - H5P_DEFAULT, create_parms, H5P_DEFAULT); + H5P_DEFAULT, create_parms, H5P_DEFAULT); if(dataset < 0) goto error; H5Pclose(create_parms); @@ -475,19 +465,14 @@ test_create(hid_t file) /*------------------------------------------------------------------------- - * Function: test_simple_io - * - * Purpose: Tests simple I/O. That is, reading and writing a complete - * multi-dimensional array without data type or data space - * conversions, without compression, and stored contiguously. + * Function: test_simple_io * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Wednesday, December 10, 1997 + * Purpose: Tests simple I/O. That is, reading and writing a complete + * multi-dimensional array without data type or data space + * conversions, without compression, and stored contiguously. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -592,8 +577,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) PASSED(); } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + SKIPPED(); + puts(" Current VFD doesn't support continuous address space"); } /* end else */ return 0; @@ -616,26 +601,21 @@ error: /*------------------------------------------------------------------------- - * Function: test_userblock_offset - * - * Purpose: Tests H5Dget_offset when user block exists. + * Function: test_userblock_offset * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Raymond Lu - * Wednesday, November 27, 2002 + * Purpose: Tests H5Dget_offset when user block exists. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) { char filename[FILENAME_BUF_SIZE]; - hid_t file = -1, fcpl = -1, dataset = -1, space = -1; - int i, j; - hsize_t dims[2]; + hid_t file = -1, fcpl = -1, dataset = -1, space = -1; + int i, j; + hsize_t dims[2]; int f = -1; haddr_t offset; int rdata[DSET_DIM1][DSET_DIM2]; @@ -648,9 +628,9 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if((fcpl=H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; if(H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0) goto error; - if(new_format) - if(H5Pset_file_space_page_size(fcpl, (hsize_t)USER_BLOCK) < 0) - goto error; + if(new_format) + if(H5Pset_file_space_page_size(fcpl, (hsize_t)USER_BLOCK) < 0) + goto error; if((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) goto error; @@ -705,8 +685,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) PASSED(); } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + SKIPPED(); + puts(" Current VFD doesn't support continuous address space"); } /* end else */ return 0; @@ -735,12 +715,7 @@ error: * compact dataset. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Raymond Lu - * August 8, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -749,7 +724,7 @@ test_compact_io(hid_t fapl) hid_t file, dataset, space, plist; hsize_t dims[2]; int wbuf[16][8], rbuf[16][8]; - char filename[FILENAME_BUF_SIZE]; + char filename[FILENAME_BUF_SIZE]; int i, j, n; TESTING("compact dataset I/O"); @@ -834,10 +809,6 @@ test_compact_io(hid_t fapl) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Raymond Lu - * August 8, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -851,7 +822,7 @@ test_max_compact(hid_t fapl) size_t compact_size; int *wbuf = NULL; int *rbuf = NULL; - char filename[FILENAME_BUF_SIZE]; + char filename[FILENAME_BUF_SIZE]; int n; size_t u; @@ -988,31 +959,28 @@ error: * Function: test_layout_extend * * Purpose: Verify that the creation of extendible dataset with dataspace: - * cur_dims < max_dims (max_dims can be fixed size or H5S_UNLIMITED) - * will behave as follows: - * H5D_COMPACT layout: fail - * H5D_CONTIGUOUS layout: fail - * H5D_CHUNKED layout: succeed + * cur_dims < max_dims (max_dims can be fixed size or H5S_UNLIMITED) + * will behave as follows: + * H5D_COMPACT layout: fail + * H5D_CONTIGUOUS layout: fail + * H5D_CHUNKED layout: succeed * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi; August 2010 - * *------------------------------------------------------------------------- */ static herr_t test_layout_extend(hid_t fapl) { - char filename[FILENAME_BUF_SIZE]; /* File name */ - hid_t fid = -1; /* File id */ - hid_t sid_fix = -1, sid_unlim = -1; /* Dataspace id */ + char filename[FILENAME_BUF_SIZE]; /* File name */ + hid_t fid = -1; /* File id */ + hid_t sid_fix = -1, sid_unlim = -1; /* Dataspace id */ hid_t dcpl_compact = -1, dcpl_contig = -1, dcpl_chunked = -1; /* Dataset creation property list id */ - hid_t did_fixed = -1, did_unlim = -1; /* Dataset id */ - hsize_t cur_size[1] = {10}; /* Current size of dataspace */ - hsize_t max_unlim[1] = {H5S_UNLIMITED}; /* Maximum size of dataspace (unlimited) */ - hsize_t max_fix[1] = {100}; /* Maximum size of dataspace (fixed) */ - hsize_t chunk_dim[1] = {10}; /* Chunk size */ + hid_t did_fixed = -1, did_unlim = -1; /* Dataset id */ + hsize_t cur_size[1] = {10}; /* Current size of dataspace */ + hsize_t max_unlim[1] = {H5S_UNLIMITED}; /* Maximum size of dataspace (unlimited) */ + hsize_t max_fix[1] = {100}; /* Maximum size of dataspace (fixed) */ + hsize_t chunk_dim[1] = {10}; /* Chunk size */ TESTING("extendible dataset with various layout"); @@ -1035,14 +1003,14 @@ test_layout_extend(hid_t fapl) /* Create dataset with extendible dataspace (fixed max_dims) should fail */ H5E_BEGIN_TRY { - if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL) - TEST_ERROR + if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL) + TEST_ERROR } H5E_END_TRY; /* Create dataset with extendible dataspace (unlimited max_dims) should fail */ H5E_BEGIN_TRY { - if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL) - TEST_ERROR + if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL) + TEST_ERROR } H5E_END_TRY; /* Create property list for contiguous dataset creation */ @@ -1053,14 +1021,14 @@ test_layout_extend(hid_t fapl) /* Create dataset with extendible dataspace (fixed max_dims) should fail */ H5E_BEGIN_TRY { - if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL) - TEST_ERROR + if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL) + TEST_ERROR } H5E_END_TRY; /* Create dataset with extendible dataspace (unlimited max_dims) should fail*/ H5E_BEGIN_TRY { - if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL) - TEST_ERROR + if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL) + TEST_ERROR } H5E_END_TRY; /* Create property list for chunked dataset creation */ @@ -1072,11 +1040,11 @@ test_layout_extend(hid_t fapl) /* Create dataset with extendible dataspace (fixed max_dims) should succeed */ if((did_fixed = H5Dcreate2(fid, "chunked_fixed", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_chunked, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Create dataset with extendible dataspace (unlimited max_dims) should succeed */ if((did_unlim = H5Dcreate2(fid, "chunked_unlim", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_chunked, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Closing */ if(H5Sclose(sid_fix) < 0) FAIL_STACK_ERROR @@ -1111,17 +1079,12 @@ error: /*------------------------------------------------------------------------- - * Function: test_conv_buffer - * - * Purpose: Test size of data type conversion buffer. - * - * Return: Success: 0 + * Function: test_conv_buffer * - * Failure: -1 - * - * Programmer: Raymond Lu - * Monday, May 12, 2003 + * Purpose: Test size of data type conversion buffer. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -1255,26 +1218,21 @@ error: /*------------------------------------------------------------------------- - * Function: test_tconv - * - * Purpose: Test some simple data type conversion stuff. - * - * Return: Success: 0 + * Function: test_tconv * - * Failure: -1 - * - * Programmer: Robb Matzke - * Wednesday, January 14, 1998 + * Purpose: Test some simple data type conversion stuff. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t test_tconv(hid_t file) { - char *out = NULL, *in = NULL; - hsize_t dims[1]; - hid_t space = -1, dataset = -1; - int i; + char *out = NULL, *in = NULL; + hsize_t dims[1]; + hid_t space = -1, dataset = -1; + int i; if ((out = (char *)HDmalloc((size_t)(4 * 1000 * 1000))) == NULL) goto error; @@ -1297,7 +1255,7 @@ test_tconv(hid_t file) /* Create the data set */ if((dataset = H5Dcreate2(file, DSET_TCONV_NAME, H5T_STD_I32LE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* Write the data to the dataset */ @@ -1345,27 +1303,23 @@ error: /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS, /* Filter id number */ + H5Z_FILTER_BOGUS, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ - "bogus", /* Filter name for debugging */ + "bogus", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - filter_bogus, /* The actual filter function */ + filter_bogus, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: can_apply_bogus - * - * Purpose: A bogus 'can apply' callback that returns 0 for H5T_NATIVE_DOUBLE - * dataype, but returns 1 for all other datatypes + * Function: can_apply_bogus * - * Return: Success: Described above - * Failure: 0 - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 + * Purpose: A bogus 'can apply' callback that returns 0 for H5T_NATIVE_DOUBLE + * dataype, but returns 1 for all other datatypes * + * Return: Success: Described above + * Failure: 0 *------------------------------------------------------------------------- */ static htri_t @@ -1381,17 +1335,12 @@ can_apply_bogus(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSE /*------------------------------------------------------------------------- - * Function: filter_bogus - * - * Purpose: A bogus compression method that doesn't do anything. - * - * Return: Success: Data chunk size - * - * Failure: 0 + * Function: filter_bogus * - * Programmer: Robb Matzke - * Tuesday, April 21, 1998 + * Purpose: A bogus compression method that doesn't do anything. * + * Return: Success: Data chunk size + * Failure: 0 *------------------------------------------------------------------------- */ static size_t @@ -1404,18 +1353,14 @@ filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, /*------------------------------------------------------------------------- - * Function: set_local_bogus2 + * Function: set_local_bogus2 * - * Purpose: A 'set local' callback that stores the size of the datatype - * and adds it to all the H5T_NATIVE_INT values during - * filter operation. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 + * Purpose: A 'set local' callback that stores the size of the datatype + * and adds it to all the H5T_NATIVE_INT values during + * filter operation. * + * Return: Success: non-negative + * Failure: negative *------------------------------------------------------------------------- */ static herr_t @@ -1454,19 +1399,15 @@ set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) /*------------------------------------------------------------------------- - * Function: filter_bogus2 - * - * Purpose: A filter method that adds a value to data values on writing - * (if the parameter is set), but does not modify data values on - * reading (so that correct operation of the filter can be - * checked). + * Function: filter_bogus2 * - * Return: Success: Data chunk size - * Failure: 0 - * - * Programmer: Quincey Koziol - * Monday, April 7, 2003 + * Purpose: A filter method that adds a value to data values on writing + * (if the parameter is set), but does not modify data values on + * reading (so that correct operation of the filter can be + * checked). * + * Return: Success: Data chunk size + * Failure: 0 *------------------------------------------------------------------------- */ static size_t @@ -1512,17 +1453,12 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts, /*------------------------------------------------------------------------- - * Function: filter_bogus3 - * - * Purpose: A bogus compression method that returns a failure. + * Function: filter_bogus3 * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * 4 August 2010 + * Purpose: A bogus compression method that returns a failure. * + * Return: Success: Data chunk size + * Failure: 0 *------------------------------------------------------------------------- */ static size_t @@ -1536,29 +1472,24 @@ filter_bogus3(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts /* This message derives from H5Z */ const H5Z_class2_t H5Z_CORRUPT[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_CORRUPT, /* Filter id number */ + H5Z_FILTER_CORRUPT, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ - "corrupt", /* Filter name for debugging */ + "corrupt", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - filter_corrupt, /* The actual filter function */ + filter_corrupt, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: filter_corrupt - * - * Purpose: For testing Fletcher32 checksum. modify data slightly during - * writing so that when data is read back, the checksum should - * fail. + * Function: filter_corrupt * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * Jan 14, 2003 + * Purpose: For testing Fletcher32 checksum. modify data slightly during + * writing so that when data is read back, the checksum should + * fail. * + * Return: Success: Data chunk size + * Failure: 0 *------------------------------------------------------------------------- */ static size_t @@ -1581,7 +1512,7 @@ filter_corrupt(unsigned int flags, size_t cd_nelmts, if(offset > nbytes || (offset + length) > nbytes || length < sizeof(unsigned int)) TEST_ERROR - if(NULL == (data = HDmalloc((size_t)length))) + if(NULL == (data = HDmalloc((size_t)length))) TEST_ERROR HDmemset(data, (int)value, (size_t)length); @@ -1615,10 +1546,6 @@ error: * Purpose: Callback function to handle checksum failure. Let it continue. * * Return: continue - * - * Programmer: Raymond Lu - * Jan 14, 2003 - * *------------------------------------------------------------------------- */ static H5Z_cb_return_t @@ -1638,10 +1565,6 @@ filter_cb_cont(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU * Purpose: Callback function to handle checksum failure. Let it fail. * * Return: fail - * - * Programmer: Raymond Lu - * Jan 14, 2003 - * *------------------------------------------------------------------------- */ static H5Z_cb_return_t @@ -1656,35 +1579,31 @@ filter_cb_fail(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU /*------------------------------------------------------------------------- - * Function: test_filter_internal - * - * Purpose: Tests dataset compression. If compression is requested when - * it hasn't been compiled into the library (such as when - * updating an existing compressed dataset) then data is sent to - * the file uncompressed but no errors are returned. + * Function: test_filter_internal * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 + * Purpose: Tests dataset compression. If compression is requested when + * it hasn't been compiled into the library (such as when + * updating an existing compressed dataset) then data is sent to + * the file uncompressed but no errors are returned. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, int corrupted, hsize_t *dset_size) { - hid_t dataset; /* Dataset ID */ - hid_t dxpl; /* Dataset xfer property list ID */ - hid_t write_dxpl; /* Dataset xfer property list ID for writing */ - hid_t sid; /* Dataspace ID */ - const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ - const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ - const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */ - void *tconv_buf = NULL; /* Temporary conversion buffer */ - size_t i, j, n; /* Local index variables */ - herr_t status; /* Error status */ + hid_t dataset; /* Dataset ID */ + hid_t dxpl; /* Dataset xfer property list ID */ + hid_t write_dxpl; /* Dataset xfer property list ID for writing */ + hid_t sid; /* Dataspace ID */ + const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ + const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ + const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */ + void *tconv_buf = NULL; /* Temporary conversion buffer */ + size_t i, j, n; /* Local index variables */ + herr_t status; /* Error status */ /* Create the data space */ if((sid = H5Screate_simple(2, size, NULL)) < 0) goto error; @@ -1716,7 +1635,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Create the dataset */ if((dataset = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, - dcpl, H5P_DEFAULT)) < 0) goto error; + dcpl, H5P_DEFAULT)) < 0) goto error; PASSED(); @@ -1727,18 +1646,18 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, TESTING(" filters (uninitialized read)"); if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) - TEST_ERROR; + TEST_ERROR; for(i=0; i<(size_t)size[0]; i++) { - for(j=0; j<(size_t)size[1]; j++) { - if(0!=check[i][j]) { - H5_FAILED(); - printf(" Read a non-zero value.\n"); - printf(" At index %lu,%lu\n", - (unsigned long)i, (unsigned long)j); - goto error; - } - } + for(j=0; j<(size_t)size[1]; j++) { + if(0!=check[i][j]) { + H5_FAILED(); + printf(" Read a non-zero value.\n"); + printf(" At index %lu,%lu\n", + (unsigned long)i, (unsigned long)j); + goto error; + } + } } PASSED(); @@ -1750,13 +1669,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, TESTING(" filters (write)"); for(i=n=0; i=0) TEST_ERROR; - } else { + } + else { if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) - TEST_ERROR; + TEST_ERROR; /* Check that the values read are the same as the values written */ for(i=0; i=0) TEST_ERROR; - } else { + } + else { /* Read the dataset back and check it */ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) - TEST_ERROR; + TEST_ERROR; /* Check that the values read are the same as the values written */ for(i=0; i=0) TEST_ERROR; - } else { + } + else { if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0) - TEST_ERROR; + TEST_ERROR; /* Check that the values read are the same as the values written */ for(i=0; i<(size_t)hs_size[0]; i++) { - for(j=0; j<(size_t)hs_size[1]; j++) { - if(points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] != - check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]) { - H5_FAILED(); - fprintf(stderr," Read different values than written.\n"); - fprintf(stderr," At index %lu,%lu\n", - (unsigned long)((size_t)hs_offset[0]+i), - (unsigned long)((size_t)hs_offset[1]+j)); - fprintf(stderr," At original: %d\n", - (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]); - fprintf(stderr," At returned: %d\n", - (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]); - goto error; - } - } + for(j=0; j<(size_t)hs_size[1]; j++) { + if(points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] != + check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]) { + H5_FAILED(); + fprintf(stderr," Read different values than written.\n"); + fprintf(stderr," At index %lu,%lu\n", + (unsigned long)((size_t)hs_offset[0]+i), + (unsigned long)((size_t)hs_offset[1]+j)); + fprintf(stderr," At original: %d\n", + (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]); + fprintf(stderr," At returned: %d\n", + (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]); + goto error; + } + } } } @@ -2004,18 +1926,14 @@ error: } /*------------------------------------------------------------------------- - * Function: test_filter_noencoder - * - * Purpose: Tests filters with no encoder present. Ensures that data - * can still be decoded correctly and that errors are thrown - * when the application tries to write. - * - * Return: Success: 0 - * Failure: -1 + * Function: test_filter_noencoder * - * Programmer: Nat Furrer and James Laird - * Monday, June 7, 2004 + * Purpose: Tests filters with no encoder present. Ensures that data + * can still be decoded correctly and that errors are thrown + * when the application tries to write. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ #ifdef H5_HAVE_FILTER_SZIP @@ -2086,7 +2004,7 @@ test_filter_noencoder(const char *dset_name) */ dims = 20; /* Dataset is originally of size 10 */ H5E_BEGIN_TRY{ - err = H5Dset_extent(dset_id, &dims); + err = H5Dset_extent(dset_id, &dims); }H5E_END_TRY if(err >= 0) goto error; @@ -2095,7 +2013,7 @@ test_filter_noencoder(const char *dset_name) * the filter does not have an encoder. */ H5E_BEGIN_TRY{ - err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints); + err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints); }H5E_END_TRY if(err >= 0) goto error; @@ -2133,10 +2051,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Nat Furrer and James Laird - * Thursday, June 10, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -2200,16 +2114,12 @@ error: } /*------------------------------------------------------------------------- - * Function: test_filters - * - * Purpose: Tests dataset filter. - * - * Return: Success: 0 - * Failure: -1 + * Function: test_filters * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 + * Purpose: Tests dataset filter. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -2219,27 +2129,27 @@ H5_ATTR_UNUSED #endif /* H5_HAVE_FILTER_SZIP */ fapl) { - hid_t dc; /* Dataset creation property list ID */ + hid_t dc; /* Dataset creation property list ID */ const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ - hsize_t null_size; /* Size of dataset with null filter */ + hsize_t null_size; /* Size of dataset with null filter */ - hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */ + hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */ unsigned data_corrupt[3]; /* position and length of data to be corrupted */ #ifdef H5_HAVE_FILTER_DEFLATE - hsize_t deflate_size; /* Size of dataset with deflate filter */ + hsize_t deflate_size; /* Size of dataset with deflate filter */ #endif /* H5_HAVE_FILTER_DEFLATE */ #ifdef H5_HAVE_FILTER_SZIP - hsize_t szip_size; /* Size of dataset with szip filter */ - unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK; - unsigned szip_pixels_per_block=4; + hsize_t szip_size; /* Size of dataset with szip filter */ + unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK; + unsigned szip_pixels_per_block = 4; #endif /* H5_HAVE_FILTER_SZIP */ hsize_t shuffle_size; /* Size of dataset with shuffle filter */ #if(defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP) - hsize_t combo_size; /* Size of dataset with multiple filters */ + hsize_t combo_size; /* Size of dataset with multiple filters */ #endif /* defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP */ /* test the H5Zget_filter_info function */ @@ -2334,21 +2244,23 @@ H5_ATTR_UNUSED if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; - puts(""); - if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; - if(test_filter_internal(file,DSET_SZIP_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&szip_size) < 0) goto error; + puts(""); + if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; + if(test_filter_internal(file,DSET_SZIP_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&szip_size) < 0) goto error; if(H5Pclose (dc) < 0) goto error; - } else { - SKIPPED(); + } + else { + SKIPPED(); } TESTING("szip filter (without encoder)"); if( h5_szip_can_encode() != 1) { - puts(""); - if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error; - } else { - SKIPPED(); + puts(""); + if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error; + } + else { + SKIPPED(); } #else /* H5_HAVE_FILTER_SZIP */ @@ -2422,22 +2334,24 @@ H5_ATTR_UNUSED if(H5Pset_fletcher32 (dc) < 0) goto error; if(H5Pset_shuffle (dc) < 0) goto error; - /* Make sure encoding is enabled */ + /* Make sure encoding is enabled */ if( h5_szip_can_encode() == 1) { - puts(""); - if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; - if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error; - } else { - SKIPPED(); + puts(""); + if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; + if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error; + } + else { + SKIPPED(); } TESTING("shuffle+szip+checksum filters(checksum first, without encoder)"); if( h5_szip_can_encode() != 1) { - puts(""); - if(test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error; - } else { - SKIPPED(); + puts(""); + if(test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error; + } + else { + SKIPPED(); } /* Clean up objects used for this test */ @@ -2447,20 +2361,20 @@ H5_ATTR_UNUSED /* Make sure encoding is enabled */ if( h5_szip_can_encode() == 1) { - puts(""); - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; - if(H5Pset_shuffle (dc) < 0) goto error; - if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; - if(H5Pset_fletcher32 (dc) < 0) goto error; - - if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME_2,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error; + puts(""); + if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; + if(H5Pset_shuffle (dc) < 0) goto error; + if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; + if(H5Pset_fletcher32 (dc) < 0) goto error; - /* Clean up objects used for this test */ - if(H5Pclose (dc) < 0) goto error; + if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME_2,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error; - } else { - SKIPPED(); + /* Clean up objects used for this test */ + if(H5Pclose (dc) < 0) goto error; + } + else { + SKIPPED(); } #else /* H5_HAVE_FILTER_SZIP */ @@ -2476,16 +2390,12 @@ error: /*------------------------------------------------------------------------- - * Function: test_missing_filter - * - * Purpose: Tests library behavior when filter is missing + * Function: test_missing_filter * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Quincey Koziol - * Thursday, November 14, 2002 + * Purpose: Tests library behavior when filter is missing * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -2610,16 +2520,16 @@ test_missing_filter(hid_t file) /* Compare data */ /* Check that the values read are the same as the values written */ for(i=0; i<(size_t)dims[0]; i++) { - for(j=0; j<(size_t)dims[1]; j++) { - if(points[i][j] != check[i][j]) { - H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); - goto error; - } /* end if */ - } /* end for */ + for(j=0; j<(size_t)dims[1]; j++) { + if(points[i][j] != check[i][j]) { + H5_FAILED(); + printf(" Line %d: Read different values than written.\n",__LINE__); + printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + printf(" At original: %d\n",points[i][j]); + printf(" At returned: %d\n",check[i][j]); + goto error; + } /* end if */ + } /* end for */ } /* end for */ /* Close dataset */ @@ -2716,30 +2626,25 @@ error: /*------------------------------------------------------------------------- - * Function: test_onebyte_shuffle - * - * Purpose: Tests the 8-bit array with shuffling algorithm. - * The shuffled array should be the same result as - * that before the shuffling. - * - * Return: Success: 0 + * Function: test_onebyte_shuffle * - * Failure: -1 - * - * Programmer: Kent Yang - * Wednesday, Nov. 13th, 2002 + * Purpose: Tests the 8-bit array with shuffling algorithm. + * The shuffled array should be the same result as + * that before the shuffling. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t test_onebyte_shuffle(hid_t file) { - hid_t dataset, space,dc; - const hsize_t size[2] = {10, 20}; - const hsize_t chunk_size[2] = {10, 20}; - unsigned char orig_data[10][20]; - unsigned char new_data[10][20]; - size_t i, j; + hid_t dataset, space,dc; + const hsize_t size[2] = {10, 20}; + const hsize_t chunk_size[2] = {10, 20}; + unsigned char orig_data[10][20]; + unsigned char new_data[10][20]; + size_t i, j; TESTING("8-bit shuffling (setup)"); @@ -2753,11 +2658,11 @@ test_onebyte_shuffle(hid_t file) /* Create the dataset */ if((dataset = H5Dcreate2(file, DSET_ONEBYTE_SHUF_NAME, H5T_NATIVE_UCHAR, - space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; for(i= 0;i< 10; i++) - for(j = 0; j < 20; j++) - orig_data[i][j] = (unsigned char)HDrandom(); + for(j = 0; j < 20; j++) + orig_data[i][j] = (unsigned char)HDrandom(); PASSED(); @@ -2768,9 +2673,8 @@ test_onebyte_shuffle(hid_t file) */ TESTING("8-bit shuffling (write)"); - if(H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, - orig_data) < 0) - goto error; + if(H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) + goto error; PASSED(); @@ -2781,21 +2685,20 @@ test_onebyte_shuffle(hid_t file) TESTING("8-bit shuffling (read)"); /* Read the dataset back */ - if(H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, - new_data) < 0) - goto error; + if(H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) + goto error; /* Check that the values read are the same as the values written */ for(i=0; i<(size_t)size[0]; i++) { - for(j=0; j<(size_t)size[1]; j++) { - if(new_data[i][j] != orig_data[i][j]) { - H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", - (unsigned long)i, (unsigned long)j); - goto error; - } - } + for(j=0; j<(size_t)size[1]; j++) { + if(new_data[i][j] != orig_data[i][j]) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %lu,%lu\n", + (unsigned long)i, (unsigned long)j); + goto error; + } + } } /*---------------------------------------------------------------------- @@ -2820,12 +2723,7 @@ error: * Purpose: Tests the integer datatype for nbit filter * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Xiaowen Wu - * Wednesday, Dec. 23th, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -2871,14 +2769,14 @@ test_nbit_int(hid_t file) /* Initialize data, assuming size of long long >= size of int */ for(i= 0;i< (size_t)size[0]; i++) - for(j = 0; j < (size_t)size[1]; j++) { - power = HDpow(2.0f, (double)(precision - 1)); - orig_data[i][j] = (int)(((long long)HDrandom() % (long long)power) << offset); + for(j = 0; j < (size_t)size[1]; j++) { + power = HDpow(2.0f, (double)(precision - 1)); + orig_data[i][j] = (int)(((long long)HDrandom() % (long long)power) << offset); - /* even-numbered values are negtive */ - if((i*size[1]+j+1)%2 == 0) - orig_data[i][j] = -orig_data[i][j]; - } + /* even-numbered values are negtive */ + if((i*size[1]+j+1)%2 == 0) + orig_data[i][j] = -orig_data[i][j]; + } PASSED(); @@ -2889,8 +2787,7 @@ test_nbit_int(hid_t file) */ TESTING(" nbit int (write)"); - if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, - orig_data) < 0) + if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) goto error; PASSED(); @@ -2901,8 +2798,7 @@ test_nbit_int(hid_t file) TESTING(" nbit int (read)"); /* Read the dataset back */ - if(H5Dread(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, - new_data) < 0) + if(H5Dread(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) goto error; /* Check that the values read are the same as the values written @@ -2945,12 +2841,7 @@ error: * Purpose: Tests the float datatype of nbit filter * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Xiaowen Wu - * Friday, Jan. 21th, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -2966,7 +2857,7 @@ test_nbit_float(hid_t file) {-49140.0f, 2350.25f, -3.2110596e-1f, 6.4998865e-5f, -0.0f}}; float new_data[2][5]; size_t precision, offset; - size_t i, j; + size_t i, j; TESTING(" nbit float (setup)"); @@ -3068,12 +2959,7 @@ error: * Purpose: Tests the double datatype of nbit filter * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Xiaowen Wu - * Wednesday, Jan. 26th, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -3093,12 +2979,12 @@ test_nbit_double(hid_t file) H5_DOUBLE(1.2677579992621376e-61), H5_DOUBLE(64568.289448797700), H5_DOUBLE(-1.0619721778839084e-75) - }, + }, { H5_DOUBLE(2.1499497833454840e+56), - H5_DOUBLE(6.6562295504670740e-3), - H5_DOUBLE(-1.5747263393432150), - H5_DOUBLE(1.0711093225222612), + H5_DOUBLE(6.6562295504670740e-3), + H5_DOUBLE(-1.5747263393432150), + H5_DOUBLE(1.0711093225222612), H5_DOUBLE(-9.8971679387636870e-1) }}; double new_data[2][5]; @@ -3205,12 +3091,7 @@ error: * Purpose: Tests the simple version array datatype for nbit filter * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Xiaowen Wu - * Tuesday, Jan. 18th, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -3362,7 +3243,7 @@ test_nbit_compound(hid_t file) hid_t dataset, space, dc; const hsize_t size[2] = {2, 5}; const hsize_t chunk_size[2] = {2, 5}; - const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F}, + const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F}, {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}}; atomic orig_data[2][5]; atomic new_data[2][5]; @@ -3796,7 +3677,7 @@ test_nbit_compound_2(hid_t file) /* Check that the values read are the same as the values written * Use mask for checking the significant bits, ignoring the padding bits */ - /* The original code + /* The original code * i_mask = ~((unsigned)~0 << (precision[0] + offset[0])) & ((unsigned)~0 << offset[0]); * left shift a 32-bit integer for 32-bit. The result is undefined by C language. A user * discovered it using clang compiler with -fcatch-undefined-behavior option (see Issue 7674 @@ -4134,7 +4015,7 @@ test_nbit_int_size(hid_t file) printf(" line %d: H5Pset_order failed\n",__LINE__); goto error; } /* end if */ - + if(H5Tset_size(datatype, 4)<0) { H5_FAILED(); printf(" line %d: H5Pset_size failed\n",__LINE__); @@ -4190,7 +4071,7 @@ test_nbit_int_size(hid_t file) * Create a new dataset within the file. */ if((dataset = H5Dcreate2 (file, DSET_NBIT_INT_SIZE_NAME, datatype, - dataspace, H5P_DEFAULT, + dataspace, H5P_DEFAULT, dset_create_props, H5P_DEFAULT))<0) { H5_FAILED(); printf(" line %d: H5dwrite failed\n",__LINE__); @@ -4207,7 +4088,7 @@ test_nbit_int_size(hid_t file) goto error; } /* end if */ - /* + /* * Get the precision of the data type */ if((precision = H5Tget_precision(datatype)) == 0) { @@ -4216,10 +4097,10 @@ test_nbit_int_size(hid_t file) goto error; } /* end if */ - /* + /* * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2 */ - if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || + if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { H5_FAILED(); HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size); @@ -4243,7 +4124,7 @@ error: /*------------------------------------------------------------------------- * Function: test_nbit_flt_size * - * Purpose: Tests the correct size of the floating-number datatype for + * Purpose: Tests the correct size of the floating-number datatype for * nbit filter * * Return: Success: 0 @@ -4334,15 +4215,15 @@ test_nbit_flt_size(hid_t file) printf(" line %d: H5Pset_order failed\n",__LINE__); goto error; } /* end if */ - + if(H5Tset_ebias(datatype, 31)<0) { H5_FAILED(); printf(" line %d: H5Pset_size failed\n",__LINE__); goto error; } /* end if */ - /* - * Initiliaze data buffer with random data + /* + * Initiliaze data buffer with random data */ for (i=0; i < DSET_DIM1; i++) for (j=0; j < DSET_DIM2; j++) @@ -4388,7 +4269,7 @@ test_nbit_flt_size(hid_t file) * Create a new dataset within the file. */ if((dataset = H5Dcreate2 (file, DSET_NBIT_FLT_SIZE_NAME, datatype, - dataspace, H5P_DEFAULT, + dataspace, H5P_DEFAULT, dset_create_props, H5P_DEFAULT))<0) { H5_FAILED(); printf(" line %d: H5dwrite failed\n",__LINE__); @@ -4405,7 +4286,7 @@ test_nbit_flt_size(hid_t file) goto error; } /* end if */ - /* + /* * Get the precision of the data type */ if((precision = H5Tget_precision(datatype)) == 0) { @@ -4414,10 +4295,10 @@ test_nbit_flt_size(hid_t file) goto error; } /* end if */ - /* + /* * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2 */ - if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || + if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { H5_FAILED(); HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size); @@ -5162,18 +5043,18 @@ error: /*------------------------------------------------------------------------- - * Function: test_multiopen + * Function: test_multiopen * - * Purpose: Tests that a bug no longer exists. If a dataset is opened - * twice and one of the handles is used to extend the dataset, - * then the other handle should return the new size when - * queried. + * Purpose: Tests that a bug no longer exists. If a dataset is opened + * twice and one of the handles is used to extend the dataset, + * then the other handle should return the new size when + * queried. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 9, 1998 * *------------------------------------------------------------------------- @@ -5181,10 +5062,10 @@ error: static herr_t test_multiopen (hid_t file) { - hid_t dcpl = -1, space = -1, dset1 = -1, dset2 = -1; - hsize_t cur_size[1] = {10}; - static hsize_t max_size[1] = {H5S_UNLIMITED}; - hsize_t tmp_size[1]; + hid_t dcpl = -1, space = -1, dset1 = -1, dset2 = -1; + hsize_t cur_size[1] = {10}; + static hsize_t max_size[1] = {H5S_UNLIMITED}; + hsize_t tmp_size[1]; TESTING("multi-open with extending"); @@ -5204,9 +5085,9 @@ test_multiopen (hid_t file) if((space = H5Dget_space(dset2)) < 0) goto error; if(H5Sget_simple_extent_dims(space, tmp_size, NULL) < 0) goto error; if(cur_size[0] != tmp_size[0]) { - H5_FAILED(); - printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); - goto error; + H5_FAILED(); + printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); + goto error; } /* end if */ if(H5Dclose(dset1) < 0) goto error; @@ -5219,25 +5100,25 @@ test_multiopen (hid_t file) error: H5E_BEGIN_TRY { - H5Dclose(dset1); - H5Dclose(dset2); - H5Sclose(space); - H5Pclose(dcpl); + H5Dclose(dset1); + H5Dclose(dset2); + H5Sclose(space); + H5Pclose(dcpl); } H5E_END_TRY; return -1; } /*------------------------------------------------------------------------- - * Function: test_types + * Function: test_types * - * Purpose: Make some datasets with various types so we can test h5ls. + * Purpose: Make some datasets with various types so we can test h5ls. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, June 7, 1999 * *------------------------------------------------------------------------- @@ -5245,10 +5126,10 @@ test_multiopen (hid_t file) static herr_t test_types(hid_t file) { - hid_t grp=-1, type=-1, space=-1, dset=-1; - size_t i; - hsize_t nelmts; - unsigned char buf[32]; + hid_t grp=-1, type=-1, space=-1, dset=-1; + size_t i; + hsize_t nelmts; + unsigned char buf[32]; TESTING("various datatypes"); if((grp = H5Gcreate2(file, "typetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; @@ -5256,12 +5137,12 @@ test_types(hid_t file) /* bitfield_1 */ nelmts = sizeof(buf); if((type=H5Tcopy(H5T_STD_B8LE)) < 0 || - (space=H5Screate_simple(1, &nelmts, NULL)) < 0 || - (dset=H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + (space=H5Screate_simple(1, &nelmts, NULL)) < 0 || + (dset=H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; for(i=0; i= 5 || (j % 10) >= 5) { - if(rdata2[i][j] != 911) { - printf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", - __LINE__,(unsigned)i, (unsigned)j, rdata2[i][j]); - TEST_ERROR; - } /* end if */ - } /* end if */ - else { - if(rdata2[i][j] != wdata2[i][j]) { - printf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", - __LINE__,(unsigned)i, (unsigned)j, wdata2[i][j],(unsigned)i, (unsigned)j, rdata2[i][j]); - TEST_ERROR; - } /* end if */ - } /* end else */ - } /* end for */ + for(j = 0; j < MISSING_CHUNK_DIM; j++) { + + if((i % 10) >= 5 || (j % 10) >= 5) { + if(rdata2[i][j] != 911) { + printf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", + __LINE__,(unsigned)i, (unsigned)j, rdata2[i][j]); + TEST_ERROR; + } /* end if */ + } /* end if */ + else { + if(rdata2[i][j] != wdata2[i][j]) { + printf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", + __LINE__,(unsigned)i, (unsigned)j, wdata2[i][j],(unsigned)i, (unsigned)j, rdata2[i][j]); + TEST_ERROR; + } /* end if */ + } /* end else */ + } /* end for */ } /* end for */ /* Close everything */ @@ -6992,7 +6873,7 @@ error: /*------------------------------------------------------------------------- * Function: test_random_chunks_real * - * Purpose: Tests that write/read on randomly selected chunks + * Purpose: Tests that write/read on randomly selected chunks * * * Return: Success: 0 @@ -7013,7 +6894,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) check2[20][20]; hsize_t coord[NPOINTS][2]; hsize_t dsize[2]={100,100}, dmax[2]={H5S_UNLIMITED, H5S_UNLIMITED}, csize[2]={10,10}, nsize[2]={200,200}; - hsize_t fixed_dmax[2] = {1000, 1000}; + hsize_t fixed_dmax[2] = {1000, 1000}; hsize_t msize[1]={NPOINTS}; const char dname[]="dataset"; int chunk_row, chunk_col; @@ -7101,8 +6982,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) if(idx_type != H5D_CHUNK_IDX_FARRAY) FAIL_PUTS_ERROR("should be using Fixed Array as index"); } /* end else */ - } else if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } else if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); /* Get dataset dataspace */ if((s = H5Dget_space(d)) < 0) TEST_ERROR; @@ -7136,9 +7017,9 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Create dataspace with unlimited maximum dimensions */ if(early_alloc) { - if((s = H5Screate_simple(2, dsize, fixed_dmax)) < 0) TEST_ERROR; + if((s = H5Screate_simple(2, dsize, fixed_dmax)) < 0) TEST_ERROR; } else - if((s = H5Screate_simple(2, dsize, dmax)) < 0) TEST_ERROR; + if((s = H5Screate_simple(2, dsize, dmax)) < 0) TEST_ERROR; /* Create dataset creation property list */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; @@ -7158,13 +7039,13 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify index type */ if(low == H5F_LIBVER_LATEST) { - if(early_alloc) { - if(idx_type != H5D_CHUNK_IDX_NONE) - FAIL_PUTS_ERROR("should be using implicit indexing"); - } else if(idx_type != H5D_CHUNK_IDX_BT2) - FAIL_PUTS_ERROR("should be using v2 B-tree as index"); - } else if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + if(early_alloc) { + if(idx_type != H5D_CHUNK_IDX_NONE) + FAIL_PUTS_ERROR("should be using implicit indexing"); + } else if(idx_type != H5D_CHUNK_IDX_BT2) + FAIL_PUTS_ERROR("should be using v2 B-tree as index"); + } else if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); /* Extend both dimensions of the dataset */ if(H5Dset_extent(d, nsize) < 0) TEST_ERROR; @@ -7269,8 +7150,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) if(idx_type != H5D_CHUNK_IDX_FARRAY) FAIL_PUTS_ERROR("should be using Fixed Array as index"); } /* end else */ - } else if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } else if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); /* Extend both dimensions of the dataset */ if(H5Dset_extent(d, nsize) < 0) TEST_ERROR; @@ -7360,16 +7241,16 @@ error: /*------------------------------------------------------------------------- * Function: test_random_chunks * - * Purpose: Tests that write/read on randomly selected chunks + * Purpose: Tests that write/read on randomly selected chunks * First file: * One dataset has fixed dimensions without max. dims & H5D_ALLOC_TIME_EARLY * One dataset has fixed dimensions without max. dims & default alloc time - * Second file: - * One extendible dataset with unlimited max. dims & H5D_ALLOC_TIME_EARLY - * One extendible dataset with unlimited max. dims & default alloc time - * third file: - * one extendible dataset with fixed max. dims & H5D_ALLOC_TIME_EARLY - * one extendible dataset with fixed max. dims & default alloc time + * Second file: + * One extendible dataset with unlimited max. dims & H5D_ALLOC_TIME_EARLY + * One extendible dataset with unlimited max. dims & default alloc time + * third file: + * one extendible dataset with fixed max. dims & H5D_ALLOC_TIME_EARLY + * one extendible dataset with fixed max. dims & default alloc time * * All the datasets in second & third files are extended before write/read operations * @@ -7409,11 +7290,11 @@ set_local_deprec(hid_t H5_ATTR_UNUSED dcpl_id, hid_t H5_ATTR_UNUSED type_id, hid /* Old style H5Z_class_t, essentially a copy of the "bogus" filter */ const H5Z_class1_t H5Z_DEPREC[1] = {{ - H5Z_FILTER_DEPREC, /* Filter id number */ - "deprec", /* Filter name for debugging */ + H5Z_FILTER_DEPREC, /* Filter id number */ + "deprec", /* Filter name for debugging */ can_apply_deprec, /* The "can apply" callback */ set_local_deprec, /* The "set local" callback */ - filter_bogus, /* The actual filter function */ + filter_bogus, /* The actual filter function */ }}; @@ -7433,11 +7314,11 @@ const H5Z_class1_t H5Z_DEPREC[1] = {{ static herr_t test_deprec(hid_t file) { - hid_t dataset, space, small_space, create_parms, dcpl; - hsize_t dims[2], small_dims[2]; + hid_t dataset, space, small_space, create_parms, dcpl; + hsize_t dims[2], small_dims[2]; hsize_t deprec_size; - herr_t status; - hsize_t csize[2]; + herr_t status; + hsize_t csize[2]; TESTING("deprecated API routines"); @@ -7454,7 +7335,7 @@ test_deprec(hid_t file) assert(space>=0); /* - * Create a dataset using the default dataset creation properties. We're + * Create a dataset using the default dataset creation properties. We're * not sure what they are, so we won't check. */ if((dataset = H5Dcreate1(file, DSET_DEPREC_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT)) < 0) goto error; @@ -7468,13 +7349,13 @@ test_deprec(hid_t file) * reporting. */ H5E_BEGIN_TRY { - dataset = H5Dcreate1(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, - H5P_DEFAULT); + dataset = H5Dcreate1(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, + H5P_DEFAULT); } H5E_END_TRY; if(dataset >= 0) { - H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); - goto error; + H5_FAILED(); + puts(" Library allowed overwrite of existing dataset."); + goto error; } /* @@ -7490,12 +7371,12 @@ test_deprec(hid_t file) * reporting. */ H5E_BEGIN_TRY { - dataset = H5Dopen1(file, "does_not_exist"); + dataset = H5Dopen1(file, "does_not_exist"); } H5E_END_TRY; if(dataset >= 0) { - H5_FAILED(); - puts(" Opened a non-existent dataset."); - goto error; + H5_FAILED(); + puts(" Opened a non-existent dataset."); + goto error; } /* @@ -7539,12 +7420,12 @@ test_deprec(hid_t file) assert(status >= 0); H5E_BEGIN_TRY { dataset = H5Dcreate1(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, - create_parms); + create_parms); } H5E_END_TRY; if(dataset >= 0) { - H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); - goto error; + H5_FAILED(); + puts(" Opened a dataset with incorrect chunking parameters."); + goto error; } csize[0] = 5; @@ -7649,7 +7530,7 @@ test_huge_chunks(hid_t fapl) ret = H5Pset_chunk(dcpl, 1, &chunk_dim); } H5E_END_TRY; if(ret >= 0) - FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.") + FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.") /* Try to set too large of a chunk for n-D dataset (# of elements) */ chunk_dim2[0] = TOO_HUGE_CHUNK_DIM2_0; @@ -7659,7 +7540,7 @@ test_huge_chunks(hid_t fapl) ret = H5Pset_chunk(dcpl, 3, chunk_dim2); } H5E_END_TRY; if(ret >= 0) - FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.") + FAIL_PUTS_ERROR(" Set chunk size with too large of chunk dimensions.") /* Set 1-D chunk size */ chunk_dim = HUGE_CHUNK_DIM; @@ -7674,7 +7555,7 @@ test_huge_chunks(hid_t fapl) dsid = H5Dcreate2(fid, HUGE_DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); } H5E_END_TRY; if(dsid >= 0) - FAIL_PUTS_ERROR(" 1-D Dataset with too large of chunk dimensions created.") + FAIL_PUTS_ERROR(" 1-D Dataset with too large of chunk dimensions created.") /* Close 1-D dataspace */ if(H5Sclose(sid) < 0) FAIL_STACK_ERROR @@ -7697,7 +7578,7 @@ test_huge_chunks(hid_t fapl) dsid = H5Dcreate2(fid, HUGE_DATASET2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); } H5E_END_TRY; if(dsid >= 0) - FAIL_PUTS_ERROR(" n-D Dataset with too large of chunk dimensions created.") + FAIL_PUTS_ERROR(" n-D Dataset with too large of chunk dimensions created.") /* Close n-D dataspace */ if(H5Sclose(sid) < 0) FAIL_STACK_ERROR @@ -7950,24 +7831,24 @@ static herr_t test_big_chunks_bypass_cache(hid_t fapl) { char filename[FILENAME_BUF_SIZE]; - hid_t fid = -1; /* File ID */ - hid_t fapl_local = -1; /* File access property list ID */ - hid_t dcpl = -1, t_dcpl = -1; /* Dataset creation property list ID */ - hid_t sid = -1, t_sid = -1; /* Dataspace ID */ - hid_t mid; /* Memory space ID */ - hid_t dsid = -1, t_dsid = -1; /* Dataset ID */ - hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */ + hid_t fid = -1; /* File ID */ + hid_t fapl_local = -1; /* File access property list ID */ + hid_t dcpl = -1, t_dcpl = -1; /* Dataset creation property list ID */ + hid_t sid = -1, t_sid = -1; /* Dataspace ID */ + hid_t mid; /* Memory space ID */ + hid_t dsid = -1, t_dsid = -1; /* Dataset ID */ + hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */ hsize_t t_dim[2], t_max[2], t_chunk_dim[2]; /* Dataset and chunk dimensions */ - size_t rdcc_nelmts, rdcc_nbytes; /* Chunk cache parameters */ - int fvalue = BYPASS_FILL_VALUE; /* Fill value */ - hsize_t count, stride, offset, block; /* Setting for hyperslab (1-D) */ + size_t rdcc_nelmts, rdcc_nbytes; /* Chunk cache parameters */ + int fvalue = BYPASS_FILL_VALUE; /* Fill value */ + hsize_t count, stride, offset, block; /* Setting for hyperslab (1-D) */ hsize_t t_count[2], t_stride[2], t_offset[2], t_block[2]; /* Setting for hyperslab (2-D) */ - /* Buffers for reading and writing data (1-D) */ - int *wdata = NULL, *rdata1 = NULL, *rdata2 = NULL; - /* Buffer for reading and writing data (2-D) */ + /* Buffers for reading and writing data (1-D) */ + int *wdata = NULL, *rdata1 = NULL, *rdata2 = NULL; + /* Buffer for reading and writing data (2-D) */ static int t_wdata[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2], t_rdata1[BYPASS_DIM][BYPASS_DIM], t_rdata2[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2]; - int i, j; /* Local index variables */ + int i, j; /* Local index variables */ H5F_libver_t low; /* File format low bound */ H5D_chunk_index_t idx_type, t_idx_type; /* Dataset chunk index types */ @@ -8030,13 +7911,13 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Chunk index type expected depends on whether we are using the latest version of the format */ if(low == H5F_LIBVER_LATEST) { - /* Verify index type */ - if(idx_type != H5D_CHUNK_IDX_FARRAY) FAIL_PUTS_ERROR("should be using Fixed Array as index"); - if(t_idx_type != H5D_CHUNK_IDX_BT2) FAIL_PUTS_ERROR("should be using v2 B-tree as index"); + /* Verify index type */ + if(idx_type != H5D_CHUNK_IDX_FARRAY) FAIL_PUTS_ERROR("should be using Fixed Array as index"); + if(t_idx_type != H5D_CHUNK_IDX_BT2) FAIL_PUTS_ERROR("should be using v2 B-tree as index"); } else { - /* Verify index type */ - if(idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index"); - if(t_idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + /* Verify index type */ + if(idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + if(t_idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index"); } /* end else */ /* Select first chunk to write the data */ @@ -8064,8 +7945,8 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Initialize data to write for 2-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) - for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) - t_wdata[i][j] = j; + for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) + t_wdata[i][j] = j; /* Set up memory space for the 2-D dataset */ mid = H5Screate_simple(2, t_block, NULL); @@ -8109,22 +7990,22 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the first 2-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) - for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) - if(t_rdata1[i][j] != j) { - printf(" Read different values than written in the 1st chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", - __LINE__, i, j, t_rdata1[i][j], j); - TEST_ERROR - } /* end if */ + for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) + if(t_rdata1[i][j] != j) { + printf(" Read different values than written in the 1st chunk.\n"); + printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + __LINE__, i, j, t_rdata1[i][j], j); + TEST_ERROR + } /* end if */ for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++) - for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) - if(t_rdata1[i][j] != fvalue) { - printf(" Read different values than written in the 2nd chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", - __LINE__, i, j, t_rdata1[i][j], fvalue); + for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) + if(t_rdata1[i][j] != fvalue) { + printf(" Read different values than written in the 2nd chunk.\n"); + printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + __LINE__, i, j, t_rdata1[i][j], fvalue); TEST_ERROR - } /* end if */ + } /* end if */ /* Close the first 1-D & 2-D datasets */ if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR @@ -8160,13 +8041,13 @@ test_big_chunks_bypass_cache(hid_t fapl) * half chunk should bypass the cache because the chunk is bigger than * the cache size. */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Verify data for the second 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) - if(rdata2[i] != i) { + if(rdata2[i] != i) { printf(" Read different values than written in the chunk.\n"); printf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i); TEST_ERROR @@ -8174,13 +8055,13 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the second 2-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) - for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) - if(t_rdata2[i][j] != j) { - printf(" Read different values than written in the chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", - __LINE__, i, j, t_rdata2[i][j], j); - TEST_ERROR - } /* end if */ + for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) + if(t_rdata2[i][j] != j) { + printf(" Read different values than written in the chunk.\n"); + printf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", + __LINE__, i, j, t_rdata2[i][j], j); + TEST_ERROR + } /* end if */ /* Close IDs */ if(H5Sclose(sid) < 0) FAIL_STACK_ERROR @@ -8285,10 +8166,10 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Loop over using SWMR access to write */ for(swmr = 0; swmr <= 1; swmr++) { - int compress; /* Whether chunks should be compressed */ + int compress; /* Whether chunks should be compressed */ /* SWMR is now supported with/without latest format: */ - /* (1) write+latest-format (2) SWMR-write+non-latest-format */ + /* (1) write+latest-format (2) SWMR-write+non-latest-format */ /* Skip this iteration if SWMR I/O is not supported for the VFD specified * by the environment variable. @@ -8300,10 +8181,10 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Loop over compressing chunks */ for(compress = 0; compress <= 1; compress++) #else - /* Loop over without compression */ + /* Loop over without compression */ for(compress = 0; compress <= 0; compress++) #endif /* H5_HAVE_FILTER_DEFLATE */ - { + { H5D_alloc_time_t alloc_time; /* Storage allocation time */ /* Loop over storage allocation time */ @@ -8572,11 +8453,11 @@ error: * Function: test_reopen_chunk_fast * * Purpose: To verify a bug in extensible arrays as chunk index. - * When the dataset is closed in H5D_close(), the pointer - * to the extensible array struct in the layout message - * is copied via H5D_flush_real() before H5D_chunk_dest(). - * This causes an abort from "Assertion `ea->hdr' failed." - * later when the dataset is re-opened and read. + * When the dataset is closed in H5D_close(), the pointer + * to the extensible array struct in the layout message + * is copied via H5D_flush_real() before H5D_chunk_dest(). + * This causes an abort from "Assertion `ea->hdr' failed." + * later when the dataset is re-opened and read. * * Return: Success: 0 * Failure: -1 @@ -8596,8 +8477,8 @@ test_reopen_chunk_fast(hid_t fapl) hid_t scalar_sid = -1;/* Scalar dataspace ID */ hid_t dsid = -1; /* Dataset ID */ hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */ - hsize_t hs_offset; /* Hyperslab offset */ - hsize_t hs_size; /* Hyperslab size */ + hsize_t hs_offset; /* Hyperslab offset */ + hsize_t hs_size; /* Hyperslab size */ H5D_alloc_time_t alloc_time; /* Storage allocation time */ unsigned write_elem, read_elem; /* Element written/read */ unsigned u; /* Local index variable */ @@ -8608,71 +8489,71 @@ test_reopen_chunk_fast(hid_t fapl) /* Loop over storage allocation time */ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { - /* Create file */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - - /* Create dataset creation property list */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - - /* Set chunking */ - chunk_dim = 10; - if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR - - /* Set fill time */ - if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR - - /* Set allocation time */ - if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR - - /* Create scalar dataspace */ - if((scalar_sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR - - /* Create 1-D dataspace */ - dim = 100; - max_dim = H5S_UNLIMITED; - if((sid = H5Screate_simple(1, &dim, &max_dim)) < 0) FAIL_STACK_ERROR - - /* Create chunked dataset */ - if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Fill existing elements */ - hs_size = 1; - for(u = 0; u < 100; u++) { - /* Select a single element in the dataset */ - hs_offset = u; - if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) - FAIL_STACK_ERROR - /* Write element to dataset */ - write_elem = u; - if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) - FAIL_STACK_ERROR - } /* end for */ - - /* Close everything */ - if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR - - /* Reopen the dataset */ - if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - hs_size = 1; - - /* Read from dataset */ - for(u = 0; u < 100; u++) { - /* Select a single element in the dataset */ - hs_offset = u; - if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) - FAIL_STACK_ERROR - - /* Read element from dataset */ - if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) - FAIL_STACK_ERROR - } /* end for */ - - if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR - if(H5Sclose(sid) < 0) FAIL_STACK_ERROR - if(H5Sclose(scalar_sid) < 0) FAIL_STACK_ERROR - if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Create file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + + /* Create dataset creation property list */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR + + /* Set chunking */ + chunk_dim = 10; + if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR + + /* Set fill time */ + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR + + /* Set allocation time */ + if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR + + /* Create scalar dataspace */ + if((scalar_sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR + + /* Create 1-D dataspace */ + dim = 100; + max_dim = H5S_UNLIMITED; + if((sid = H5Screate_simple(1, &dim, &max_dim)) < 0) FAIL_STACK_ERROR + + /* Create chunked dataset */ + if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_UINT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Fill existing elements */ + hs_size = 1; + for(u = 0; u < 100; u++) { + /* Select a single element in the dataset */ + hs_offset = u; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) + FAIL_STACK_ERROR + /* Write element to dataset */ + write_elem = u; + if(H5Dwrite(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &write_elem) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Close everything */ + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + + /* Reopen the dataset */ + if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + hs_size = 1; + + /* Read from dataset */ + for(u = 0; u < 100; u++) { + /* Select a single element in the dataset */ + hs_offset = u; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &hs_offset, NULL, &hs_size, NULL) < 0) + FAIL_STACK_ERROR + + /* Read element from dataset */ + if(H5Dread(dsid, H5T_NATIVE_UINT, scalar_sid, sid, H5P_DEFAULT, &read_elem) < 0) + FAIL_STACK_ERROR + } /* end for */ + + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(scalar_sid) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR } /* end for */ @@ -8801,12 +8682,12 @@ error: /* This message derives from H5Z */ const H5Z_class2_t H5Z_EXPAND[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_EXPAND, /* Filter id number */ + H5Z_FILTER_EXPAND, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ - "expand", /* Filter name for debugging */ + "expand", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - filter_expand, /* The actual filter function */ + filter_expand, /* The actual filter function */ }}; /* Global "expansion factor" for filter_expand() routine */ @@ -8819,15 +8700,15 @@ static size_t filter_expand_factor_g = 0; * Purpose: For testing library's behavior when a filter expands a chunk * too much. * - * Note: This filter doesn't actually re-allocate the buffer to be - * larger, it just changes the buffer size to a value that's too - * large. The library should throw an error before using the - * incorrect buffer information. + * Note: This filter doesn't actually re-allocate the buffer to be + * larger, it just changes the buffer size to a value that's too + * large. The library should throw an error before using the + * incorrect buffer information. * - * Return: Success: Data chunk size - * Failure: 0 + * Return: Success: Data chunk size + * Failure: 0 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Mar 31, 2009 * *------------------------------------------------------------------------- @@ -8880,22 +8761,22 @@ static herr_t test_chunk_expand(hid_t fapl) { char filename[FILENAME_BUF_SIZE]; - hid_t fid = -1; /* File ID */ - hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list ID */ - hid_t sid = -1, sid2 = -1; /* Dataspace ID */ - hid_t scalar_sid = -1; /* Scalar dataspace ID */ - hid_t dsid = -1, dsid2 = -1; /* Dataset ID */ - hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */ - hsize_t dim2[2], max_dim2[2], chunk_dim2[2]; /* Dataset and chunk dimensions */ - H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index type */ - H5F_libver_t low, high; /* File format bounds */ - hsize_t hs_offset, hs_offset2[2]; /* Hyperslab offset */ - hsize_t hs_size, hs_size2[2]; /* Hyperslab size */ - H5D_alloc_time_t alloc_time; /* Storage allocation time */ - unsigned write_elem, read_elem; /* Element written/read */ - unsigned write_elem2, read_elem2; /* Element written/read */ - unsigned u; /* Local index variable */ - herr_t status; /* Generic return value */ + hid_t fid = -1; /* File ID */ + hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list ID */ + hid_t sid = -1, sid2 = -1; /* Dataspace ID */ + hid_t scalar_sid = -1; /* Scalar dataspace ID */ + hid_t dsid = -1, dsid2 = -1; /* Dataset ID */ + hsize_t dim, max_dim, chunk_dim; /* Dataset and chunk dimensions */ + hsize_t dim2[2], max_dim2[2], chunk_dim2[2]; /* Dataset and chunk dimensions */ + H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index type */ + H5F_libver_t low, high; /* File format bounds */ + hsize_t hs_offset, hs_offset2[2]; /* Hyperslab offset */ + hsize_t hs_size, hs_size2[2]; /* Hyperslab size */ + H5D_alloc_time_t alloc_time; /* Storage allocation time */ + unsigned write_elem, read_elem; /* Element written/read */ + unsigned write_elem2, read_elem2; /* Element written/read */ + unsigned u; /* Local index variable */ + herr_t status; /* Generic return value */ TESTING("filter expanding chunks too much"); @@ -8905,8 +8786,8 @@ test_chunk_expand(hid_t fapl) if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR if(sizeof(size_t) <= 4 && low != H5F_LIBVER_LATEST) { - SKIPPED(); - puts(" Current machine can't test for error w/old file format"); + SKIPPED(); + puts(" Current machine can't test for error w/old file format"); } /* end if */ else { /* Register "expansion" filter */ @@ -9261,25 +9142,25 @@ error: /*------------------------------------------------------------------------- * Function: test_fixed_array * - * Purpose: Tests support for Fixed Array and Implicit Indexing + * Purpose: Tests support for Fixed Array and Implicit Indexing * - * Create the following 3 datasets: - * 1) extendible chunked dataset with fixed max. dims - * 2) extendible chunked dataset with NULL max. dims - * 3) extendible chunked dataset with same max. dims - * (Note that the third dataset is created with bigger size for curr & max. dims - * so that Fixed Array Indexing with paging is exercised) + * Create the following 3 datasets: + * 1) extendible chunked dataset with fixed max. dims + * 2) extendible chunked dataset with NULL max. dims + * 3) extendible chunked dataset with same max. dims + * (Note that the third dataset is created with bigger size for curr & max. dims + * so that Fixed Array Indexing with paging is exercised) * * Repeat the following test with/without compression filter * Repeat the following test with H5D_ALLOC_TIME_EARLY/H5D_ALLOC_TIME_LATE/H5D_ALLOC_TIME_INCR - * For the old format, - * verify that v1 btree indexing type is used for - * all 3 datasets with all settings + * For the old format, + * verify that v1 btree indexing type is used for + * all 3 datasets with all settings * For the new format: - * Verify that Implicit Index type is used for - * #1, #2, #3 datasets when ALLOC_TIME_EARLY and compression are true - * Verify Fixed Array indexing type is used for - * #1, #2, #3 datasets with all other settings + * Verify that Implicit Index type is used for + * #1, #2, #3 datasets when ALLOC_TIME_EARLY and compression are true + * Verify Fixed Array indexing type is used for + * #1, #2, #3 datasets with all other settings * * Return: Success: 0 * Failure: -1 @@ -9291,7 +9172,7 @@ error: static herr_t test_fixed_array(hid_t fapl) { - char filename[FILENAME_BUF_SIZE]; /* File name */ + char filename[FILENAME_BUF_SIZE]; /* File name */ hid_t fid = -1; /* File ID */ hid_t dcpl = -1; /* Dataset creation property list ID */ @@ -9300,23 +9181,23 @@ test_fixed_array(hid_t fapl) hid_t sid_max = -1; /* Dataspace ID for dataset with maximum dimensions set */ hid_t dsid = -1; /* Dataset ID for dataset with fixed dimensions */ - hid_t dsid_big = -1; /* Dataset ID for big dataset with fixed dimensions */ - hid_t dsid_max = -1; /* Dataset ID for dataset with maximum dimensions set */ + hid_t dsid_big = -1; /* Dataset ID for big dataset with fixed dimensions */ + hid_t dsid_max = -1; /* Dataset ID for dataset with maximum dimensions set */ - hsize_t dim2[2] = {48, 18}; /* Dataset dimensions */ - hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */ - hsize_t dim2_max[2] = {120, 50}; /* Maximum dataset dimensions */ + hsize_t dim2[2] = {48, 18}; /* Dataset dimensions */ + hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */ + hsize_t dim2_max[2] = {120, 50}; /* Maximum dataset dimensions */ - hid_t mem_id; /* Memory space ID */ - hid_t big_mem_id; /* Memory space ID for big dataset */ + hid_t mem_id; /* Memory space ID */ + hid_t big_mem_id; /* Memory space ID for big dataset */ - hsize_t msize[1] = {POINTS}; /* Size of memory space */ + hsize_t msize[1] = {POINTS}; /* Size of memory space */ hsize_t msize_big[1] = {POINTS_BIG}; /* Size of memory space for big dataset */ int wbuf[POINTS]; /* write buffer */ - int *wbuf_big = NULL; /* write buffer for big dataset */ - int rbuf[POINTS]; /* read buffer */ - int *rbuf_big = NULL; /* read buffer for big dataset */ + int *wbuf_big = NULL; /* write buffer for big dataset */ + int rbuf[POINTS]; /* read buffer */ + int *rbuf_big = NULL; /* read buffer for big dataset */ hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */ int chunks[12][6]; /* # of chunks for dataset dimensions */ @@ -9324,22 +9205,22 @@ test_fixed_array(hid_t fapl) int chunk_row; /* chunk row index */ int chunk_col; /* chunk column index */ - hsize_t coord[POINTS][2]; /* datdaset coordinates */ + hsize_t coord[POINTS][2]; /* datdaset coordinates */ hsize_t coord_big[POINTS_BIG][2]; /* big dataset coordinates */ - H5D_chunk_index_t idx_type; /* Dataset chunk index type */ - H5F_libver_t low, high; /* File format bounds */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + H5F_libver_t low, high; /* File format bounds */ H5D_alloc_time_t alloc_time; /* Storage allocation time */ #ifdef H5_HAVE_FILTER_DEFLATE - unsigned compress; /* Whether chunks should be compressed */ + unsigned compress; /* Whether chunks should be compressed */ #endif /* H5_HAVE_FILTER_DEFLATE */ - h5_stat_size_t empty_size; /* Size of an empty file */ - h5_stat_size_t file_size; /* Size of each file created */ + h5_stat_size_t empty_size; /* Size of an empty file */ + h5_stat_size_t file_size; /* Size of each file created */ - size_t i, j; /* local index variables */ - herr_t ret; /* Generic return value */ + size_t i, j; /* local index variables */ + herr_t ret; /* Generic return value */ TESTING("datasets w/fixed array as chunk index"); @@ -9378,8 +9259,8 @@ test_fixed_array(hid_t fapl) if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR /* Set chunking */ - if((ret = H5Pset_chunk(dcpl, 2, chunk_dim2)) < 0) - FAIL_PUTS_ERROR(" Problem with setting chunk.") + if((ret = H5Pset_chunk(dcpl, 2, chunk_dim2)) < 0) + FAIL_PUTS_ERROR(" Problem with setting chunk.") #ifdef H5_HAVE_FILTER_DEFLATE /* Check if we should compress the chunks */ @@ -9393,243 +9274,243 @@ test_fixed_array(hid_t fapl) /* Set allocation time */ if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR - /* Initialization of chunk array for repeated coordinates */ - for(i = 0; i < dim2[0]/chunk_dim2[0]; i++) - for(j = 0; j < dim2[1]/chunk_dim2[1]; j++) - chunks[i][j] = 0; - - /* Generate random point coordinates. Only one point is selected per chunk */ - for(i = 0; i < POINTS; i++){ - do { - chunk_row = (int)HDrandom () % (int)(dim2[0]/chunk_dim2[0]); - chunk_col = (int)HDrandom () % (int)(dim2[1]/chunk_dim2[1]); - } while (chunks[chunk_row][chunk_col]); - - wbuf[i] = chunks[chunk_row][chunk_col] = chunk_row+chunk_col+1; - coord[i][0] = (hsize_t)chunk_row * chunk_dim2[0]; - coord[i][1] = (hsize_t)chunk_col * chunk_dim2[1]; - } /* end for */ - - /* Create first dataset with cur and max dimensions */ - if((sid_max = H5Screate_simple(2, dim2, dim2_max)) < 0) FAIL_STACK_ERROR - dsid_max = H5Dcreate2(fid, DSET_FIXED_MAX, H5T_NATIVE_INT, sid_max, H5P_DEFAULT, dcpl, H5P_DEFAULT); - if(dsid_max < 0) - FAIL_PUTS_ERROR(" Creating Chunked Dataset with maximum dimensions.") - - /* Get the chunk index type */ - if(H5D__layout_idx_type_test(dsid_max, &idx_type) < 0) FAIL_STACK_ERROR - - /* Chunk index type depends on whether we are using the latest version of the format */ - if(low == H5F_LIBVER_LATEST) { - if(alloc_time == H5D_ALLOC_TIME_EARLY + /* Initialization of chunk array for repeated coordinates */ + for(i = 0; i < dim2[0]/chunk_dim2[0]; i++) + for(j = 0; j < dim2[1]/chunk_dim2[1]; j++) + chunks[i][j] = 0; + + /* Generate random point coordinates. Only one point is selected per chunk */ + for(i = 0; i < POINTS; i++){ + do { + chunk_row = (int)HDrandom () % (int)(dim2[0]/chunk_dim2[0]); + chunk_col = (int)HDrandom () % (int)(dim2[1]/chunk_dim2[1]); + } while (chunks[chunk_row][chunk_col]); + + wbuf[i] = chunks[chunk_row][chunk_col] = chunk_row+chunk_col+1; + coord[i][0] = (hsize_t)chunk_row * chunk_dim2[0]; + coord[i][1] = (hsize_t)chunk_col * chunk_dim2[1]; + } /* end for */ + + /* Create first dataset with cur and max dimensions */ + if((sid_max = H5Screate_simple(2, dim2, dim2_max)) < 0) FAIL_STACK_ERROR + dsid_max = H5Dcreate2(fid, DSET_FIXED_MAX, H5T_NATIVE_INT, sid_max, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dsid_max < 0) + FAIL_PUTS_ERROR(" Creating Chunked Dataset with maximum dimensions.") + + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(dsid_max, &idx_type) < 0) FAIL_STACK_ERROR + + /* Chunk index type depends on whether we are using the latest version of the format */ + if(low == H5F_LIBVER_LATEST) { + if(alloc_time == H5D_ALLOC_TIME_EARLY #ifdef H5_HAVE_FILTER_DEFLATE - && !compress + && !compress #endif /* H5_HAVE_FILTER_DEFLATE */ - ) { - if(idx_type != H5D_CHUNK_IDX_NONE) - FAIL_PUTS_ERROR("should be using Non Index as index"); - } else if (idx_type != H5D_CHUNK_IDX_FARRAY) - FAIL_PUTS_ERROR("should be using Fixed Array as index"); - } /* end if */ - else { - if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index"); - } /* end else */ - - /* Create dataspace for write buffer */ - if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; - - /* Select the random points for writing */ - if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) - TEST_ERROR; - - /* Write into dataset */ - if(H5Dwrite(dsid_max, H5T_NATIVE_INT, mem_id, sid_max, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; - - /* Closing */ - if(H5Dclose(dsid_max) < 0) FAIL_STACK_ERROR - if(H5Sclose(sid_max) < 0) FAIL_STACK_ERROR - if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR - - - /* Create second dataset with curr dim but NULL max dim */ - if((sid = H5Screate_simple(2, dim2, NULL)) < 0) FAIL_STACK_ERROR - dsid = H5Dcreate2(fid, DSET_FIXED_NOMAX, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - if(dsid < 0) - FAIL_PUTS_ERROR(" Creating Chunked Dataset.") - - /* Get the chunk index type */ - if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR - - /* Chunk index type depends on whether we are using the latest version of the format */ - if(low == H5F_LIBVER_LATEST) { - if(alloc_time == H5D_ALLOC_TIME_EARLY + ) { + if(idx_type != H5D_CHUNK_IDX_NONE) + FAIL_PUTS_ERROR("should be using Non Index as index"); + } else if (idx_type != H5D_CHUNK_IDX_FARRAY) + FAIL_PUTS_ERROR("should be using Fixed Array as index"); + } /* end if */ + else { + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } /* end else */ + + /* Create dataspace for write buffer */ + if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + + /* Select the random points for writing */ + if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) + TEST_ERROR; + + /* Write into dataset */ + if(H5Dwrite(dsid_max, H5T_NATIVE_INT, mem_id, sid_max, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; + + /* Closing */ + if(H5Dclose(dsid_max) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid_max) < 0) FAIL_STACK_ERROR + if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR + + + /* Create second dataset with curr dim but NULL max dim */ + if((sid = H5Screate_simple(2, dim2, NULL)) < 0) FAIL_STACK_ERROR + dsid = H5Dcreate2(fid, DSET_FIXED_NOMAX, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dsid < 0) + FAIL_PUTS_ERROR(" Creating Chunked Dataset.") + + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR + + /* Chunk index type depends on whether we are using the latest version of the format */ + if(low == H5F_LIBVER_LATEST) { + if(alloc_time == H5D_ALLOC_TIME_EARLY #ifdef H5_HAVE_FILTER_DEFLATE - && !compress + && !compress #endif /* H5_HAVE_FILTER_DEFLATE */ - ) { - if(idx_type != H5D_CHUNK_IDX_NONE) - FAIL_PUTS_ERROR("should be using Non Index as index"); - } else if(idx_type != H5D_CHUNK_IDX_FARRAY) - FAIL_PUTS_ERROR("should be using Fixed Array as index"); - } else { - if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index"); - } /* end else */ - - /* Create dataspace for write buffer */ - if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; - - /* Select the random points for writing */ - if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) - TEST_ERROR; - - /* Write into dataset */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; - - /* Closing */ - if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR - if(H5Sclose(sid) < 0) FAIL_STACK_ERROR - if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR - - /* Create the third dataset with bigger size and both curr & max dimensions are the same */ - if((sid_big = H5Screate_simple(2, dim2_big, dim2_big)) < 0) FAIL_STACK_ERROR - dsid_big = H5Dcreate2(fid, DSET_FIXED_BIG, H5T_NATIVE_INT, sid_big, H5P_DEFAULT, dcpl, H5P_DEFAULT); - if(dsid_big < 0) - FAIL_PUTS_ERROR(" Creating Big Chunked Dataset.") - - /* Get the chunk index type */ - if(H5D__layout_idx_type_test(dsid_big, &idx_type) < 0) FAIL_STACK_ERROR - - /* Chunk index type depends on whether we are using the latest version of the format */ - if(low == H5F_LIBVER_LATEST) { - if(alloc_time == H5D_ALLOC_TIME_EARLY + ) { + if(idx_type != H5D_CHUNK_IDX_NONE) + FAIL_PUTS_ERROR("should be using Non Index as index"); + } else if(idx_type != H5D_CHUNK_IDX_FARRAY) + FAIL_PUTS_ERROR("should be using Fixed Array as index"); + } else { + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } /* end else */ + + /* Create dataspace for write buffer */ + if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + + /* Select the random points for writing */ + if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) + TEST_ERROR; + + /* Write into dataset */ + if(H5Dwrite(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; + + /* Closing */ + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR + + /* Create the third dataset with bigger size and both curr & max dimensions are the same */ + if((sid_big = H5Screate_simple(2, dim2_big, dim2_big)) < 0) FAIL_STACK_ERROR + dsid_big = H5Dcreate2(fid, DSET_FIXED_BIG, H5T_NATIVE_INT, sid_big, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dsid_big < 0) + FAIL_PUTS_ERROR(" Creating Big Chunked Dataset.") + + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(dsid_big, &idx_type) < 0) FAIL_STACK_ERROR + + /* Chunk index type depends on whether we are using the latest version of the format */ + if(low == H5F_LIBVER_LATEST) { + if(alloc_time == H5D_ALLOC_TIME_EARLY #ifdef H5_HAVE_FILTER_DEFLATE - && !compress + && !compress #endif /* H5_HAVE_FILTER_DEFLATE */ - ) { - if(idx_type != H5D_CHUNK_IDX_NONE) - FAIL_PUTS_ERROR("should be using Non Index as index"); - } else if(idx_type != H5D_CHUNK_IDX_FARRAY) - FAIL_PUTS_ERROR("should be using Fixed Array as index"); - } /* end if */ - else { - if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index"); - } /* end else */ - - /* Initialization of chunk array for repeated coordinates */ - for(i = 0; i < dim2_big[0]/chunk_dim2[0]; i++) - for(j = 0; j < dim2_big[1]/chunk_dim2[1]; j++) - chunks_big[i][j] = 0; - - /* Generate random point coordinates. Only one point is selected per chunk */ - for(i = 0; i < POINTS_BIG; i++){ - do { - chunk_row = (int)HDrandom () % (int)(dim2_big[0]/chunk_dim2[0]); - chunk_col = (int)HDrandom () % (int)(dim2_big[1]/chunk_dim2[1]); - } while (chunks_big[chunk_row][chunk_col]); - - wbuf_big[i] = chunks_big[chunk_row][chunk_col] = chunk_row+chunk_col+1; - coord_big[i][0] = (hsize_t)chunk_row * chunk_dim2[0]; - coord_big[i][1] = (hsize_t)chunk_col * chunk_dim2[1]; - } /* end for */ - - /* Create dataspace for write buffer */ - if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; - - /* Select the random points for writing */ - if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) - TEST_ERROR; - - /* Write into dataset */ - if(H5Dwrite(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, wbuf_big) < 0) TEST_ERROR; - - /* Closing */ - if(H5Dclose(dsid_big) < 0) FAIL_STACK_ERROR - if(H5Sclose(sid_big) < 0) FAIL_STACK_ERROR - if(H5Sclose(big_mem_id) < 0) FAIL_STACK_ERROR - if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - - /* Open the first dataset */ - if((dsid = H5Dopen2(fid, DSET_FIXED_MAX, H5P_DEFAULT)) < 0) TEST_ERROR; - - /* Get dataset dataspace */ - if((sid = H5Dget_space(dsid)) < 0) TEST_ERROR; - - /* Create dataspace for read buffer */ - if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; - - /* Select the random points for reading */ - if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; - - /* Read from dataset */ - if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; - - /* Verify that written and read data are the same */ - for(i = 0; i < POINTS; i++) - if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", - __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); - TEST_ERROR; - } /* end if */ - - /* Closing */ - if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + ) { + if(idx_type != H5D_CHUNK_IDX_NONE) + FAIL_PUTS_ERROR("should be using Non Index as index"); + } else if(idx_type != H5D_CHUNK_IDX_FARRAY) + FAIL_PUTS_ERROR("should be using Fixed Array as index"); + } /* end if */ + else { + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } /* end else */ + + /* Initialization of chunk array for repeated coordinates */ + for(i = 0; i < dim2_big[0]/chunk_dim2[0]; i++) + for(j = 0; j < dim2_big[1]/chunk_dim2[1]; j++) + chunks_big[i][j] = 0; + + /* Generate random point coordinates. Only one point is selected per chunk */ + for(i = 0; i < POINTS_BIG; i++){ + do { + chunk_row = (int)HDrandom () % (int)(dim2_big[0]/chunk_dim2[0]); + chunk_col = (int)HDrandom () % (int)(dim2_big[1]/chunk_dim2[1]); + } while (chunks_big[chunk_row][chunk_col]); + + wbuf_big[i] = chunks_big[chunk_row][chunk_col] = chunk_row+chunk_col+1; + coord_big[i][0] = (hsize_t)chunk_row * chunk_dim2[0]; + coord_big[i][1] = (hsize_t)chunk_col * chunk_dim2[1]; + } /* end for */ + + /* Create dataspace for write buffer */ + if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; + + /* Select the random points for writing */ + if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) + TEST_ERROR; + + /* Write into dataset */ + if(H5Dwrite(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, wbuf_big) < 0) TEST_ERROR; + + /* Closing */ + if(H5Dclose(dsid_big) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid_big) < 0) FAIL_STACK_ERROR + if(H5Sclose(big_mem_id) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + + /* Open the first dataset */ + if((dsid = H5Dopen2(fid, DSET_FIXED_MAX, H5P_DEFAULT)) < 0) TEST_ERROR; + + /* Get dataset dataspace */ + if((sid = H5Dget_space(dsid)) < 0) TEST_ERROR; + + /* Create dataspace for read buffer */ + if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + + /* Select the random points for reading */ + if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; + + /* Read from dataset */ + if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; + + /* Verify that written and read data are the same */ + for(i = 0; i < POINTS; i++) + if(rbuf[i] != wbuf[i]){ + printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + TEST_ERROR; + } /* end if */ + + /* Closing */ + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR if(H5Sclose(sid) < 0) FAIL_STACK_ERROR if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR - /* Open the second dataset */ - if((dsid = H5Dopen2(fid, DSET_FIXED_NOMAX, H5P_DEFAULT)) < 0) TEST_ERROR; + /* Open the second dataset */ + if((dsid = H5Dopen2(fid, DSET_FIXED_NOMAX, H5P_DEFAULT)) < 0) TEST_ERROR; - /* Get dataset dataspace */ - if((sid = H5Dget_space(dsid)) < 0) TEST_ERROR; + /* Get dataset dataspace */ + if((sid = H5Dget_space(dsid)) < 0) TEST_ERROR; - /* Create dataspace for read buffer */ - if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + /* Create dataspace for read buffer */ + if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; - /* Select the random points for reading */ - if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; + /* Select the random points for reading */ + if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; - /* Read from dataset */ - if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; + /* Read from dataset */ + if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; - /* Verify that written and read data are the same */ - for(i = 0; i < POINTS; i++) - if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", - __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); - TEST_ERROR; - } /* end if */ + /* Verify that written and read data are the same */ + for(i = 0; i < POINTS; i++) + if(rbuf[i] != wbuf[i]){ + printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + TEST_ERROR; + } /* end if */ - /* Closing */ - if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + /* Closing */ + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR if(H5Sclose(sid) < 0) FAIL_STACK_ERROR if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR - /* Open the third dataset */ - if((dsid_big = H5Dopen2(fid, DSET_FIXED_BIG, H5P_DEFAULT)) < 0) TEST_ERROR; - /* Get dataset dataspace */ - if((sid_big = H5Dget_space(dsid_big)) < 0) TEST_ERROR; - - /* Create dataspace for read buffer */ - if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; - - /* Select the random points for reading */ - if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) TEST_ERROR; - /* Read from dataset */ - if(H5Dread(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, rbuf_big) < 0) TEST_ERROR; - - /* Verify that written and read data are the same */ - for(i = 0; i < POINTS_BIG; i++) - if(rbuf_big[i] != wbuf_big[i]) { - printf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", - __LINE__,(unsigned)i,wbuf_big[i],(unsigned)i,rbuf_big[i]); - TEST_ERROR; - } /* end if */ - - /* Closing */ - if(H5Dclose(dsid_big) < 0) FAIL_STACK_ERROR + /* Open the third dataset */ + if((dsid_big = H5Dopen2(fid, DSET_FIXED_BIG, H5P_DEFAULT)) < 0) TEST_ERROR; + /* Get dataset dataspace */ + if((sid_big = H5Dget_space(dsid_big)) < 0) TEST_ERROR; + + /* Create dataspace for read buffer */ + if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; + + /* Select the random points for reading */ + if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) TEST_ERROR; + /* Read from dataset */ + if(H5Dread(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, rbuf_big) < 0) TEST_ERROR; + + /* Verify that written and read data are the same */ + for(i = 0; i < POINTS_BIG; i++) + if(rbuf_big[i] != wbuf_big[i]) { + printf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", + __LINE__,(unsigned)i,wbuf_big[i],(unsigned)i,rbuf_big[i]); + TEST_ERROR; + } /* end if */ + + /* Closing */ + if(H5Dclose(dsid_big) < 0) FAIL_STACK_ERROR if(H5Sclose(sid_big) < 0) FAIL_STACK_ERROR if(H5Sclose(big_mem_id) < 0) FAIL_STACK_ERROR @@ -9641,13 +9522,13 @@ test_fixed_array(hid_t fapl) /* Close everything */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Get the size of the file */ - if((file_size = h5_get_file_size(filename, fapl)) < 0) - TEST_ERROR + /* Get the size of the file */ + if((file_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR - /* Verify the file is correct size */ - if(file_size != empty_size) - TEST_ERROR + /* Verify the file is correct size */ + if(file_size != empty_size) + TEST_ERROR } /* end for */ #ifdef H5_HAVE_FILTER_DEFLATE @@ -9682,18 +9563,18 @@ error: * * Purpose: Tests support for Single Chunk indexing type * - * Create the following 2 datasets: - * 1) chunked dataset with NULL max dims and cur_dims = chunk_dims - * 2) chunked dataset with cur_dims = max_dims = chunk_dims + * Create the following 2 datasets: + * 1) chunked dataset with NULL max dims and cur_dims = chunk_dims + * 2) chunked dataset with cur_dims = max_dims = chunk_dims * * Repeat the following test with/without compression filter * Repeat the following test with H5D_ALLOC_TIME_EARLY/H5D_ALLOC_TIME_LATE/H5D_ALLOC_TIME_INCR - * For the old format, - * verify that v1 btree indexing type is used for - * all datasets with all settings + * For the old format, + * verify that v1 btree indexing type is used for + * all datasets with all settings * For the new format: - * Verify that Single Chunk indexing type is used for - * all datasets with all settings + * Verify that Single Chunk indexing type is used for + * all datasets with all settings * * Return: Success: 0 * Failure: -1 @@ -9705,30 +9586,30 @@ error: static herr_t test_single_chunk(hid_t fapl) { - char filename[FILENAME_BUF_SIZE]; /* File name */ + char filename[FILENAME_BUF_SIZE]; /* File name */ hid_t fid = -1; /* File ID */ hid_t dcpl = -1; /* Dataset creation property list ID */ hid_t t_dcpl = -1; /* Dataset creation property list ID */ - hid_t sid = -1, sid_max = -1; /* Dataspace ID for dataset with fixed dimensions */ - hid_t did = -1, did_max = -1; /* Dataset ID for dataset with fixed dimensions */ - hsize_t dim2[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */ + hid_t sid = -1, sid_max = -1; /* Dataspace ID for dataset with fixed dimensions */ + hid_t did = -1, did_max = -1; /* Dataset ID for dataset with fixed dimensions */ + hsize_t dim2[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */ hsize_t t_dim2[2] = {DSET_TMP_DIM1, DSET_TMP_DIM2}; /* Dataset dimensions */ int *wbuf = NULL; /* write buffer */ int *t_wbuf = NULL; /* write buffer */ - int *rbuf = NULL; /* read buffer */ + int *rbuf = NULL; /* read buffer */ int *t_rbuf = NULL; /* read buffer */ - H5D_chunk_index_t idx_type; /* Dataset chunk index type */ - H5F_libver_t low, high; /* File format bounds */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + H5F_libver_t low, high; /* File format bounds */ H5D_alloc_time_t alloc_time; /* Storage allocation time */ #ifdef H5_HAVE_FILTER_DEFLATE - unsigned compress; /* Whether chunks should be compressed */ + unsigned compress; /* Whether chunks should be compressed */ #endif /* H5_HAVE_FILTER_DEFLATE */ - size_t n, i; /* local index variables */ - herr_t ret; /* Generic return value */ + size_t n, i; /* local index variables */ + herr_t ret; /* Generic return value */ h5_stat_size_t empty_size; /* Size of an empty file */ h5_stat_size_t file_size; /* Size of each file created */ @@ -9760,10 +9641,10 @@ test_single_chunk(hid_t fapl) TEST_ERROR for(i = n = 0; i < (DSET_DIM1 * DSET_DIM2); i++) - wbuf[i] = (int)n++; + wbuf[i] = (int)n++; for(i = n = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++) - t_wbuf[i] = (int)n++; + t_wbuf[i] = (int)n++; #ifdef H5_HAVE_FILTER_DEFLATE /* Loop over compressing chunks */ @@ -9780,18 +9661,18 @@ test_single_chunk(hid_t fapl) if((t_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR /* Set chunking */ - if((ret = H5Pset_chunk(dcpl, 2, dim2)) < 0) - FAIL_PUTS_ERROR(" Problem with setting chunk.") + if((ret = H5Pset_chunk(dcpl, 2, dim2)) < 0) + FAIL_PUTS_ERROR(" Problem with setting chunk.") - if((ret = H5Pset_chunk(t_dcpl, 2, t_dim2)) < 0) - FAIL_PUTS_ERROR(" Problem with setting chunk.") + if((ret = H5Pset_chunk(t_dcpl, 2, t_dim2)) < 0) + FAIL_PUTS_ERROR(" Problem with setting chunk.") #ifdef H5_HAVE_FILTER_DEFLATE /* Check if we should compress the chunks */ if(compress) { if(H5Pset_deflate(dcpl, 9) < 0) FAIL_STACK_ERROR if(H5Pset_deflate(t_dcpl, 9) < 0) FAIL_STACK_ERROR - } + } #endif /* H5_HAVE_FILTER_DEFLATE */ /* Set fill time */ @@ -9802,94 +9683,94 @@ test_single_chunk(hid_t fapl) if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR if(H5Pset_alloc_time(t_dcpl, alloc_time) < 0) FAIL_STACK_ERROR - /* Create first dataset with cur and max dimensions */ - if((sid_max = H5Screate_simple(2, dim2, dim2)) < 0) FAIL_STACK_ERROR - did_max = H5Dcreate2(fid, DSET_SINGLE_MAX, H5T_NATIVE_INT, sid_max, H5P_DEFAULT, dcpl, H5P_DEFAULT); - if(did_max < 0) - FAIL_PUTS_ERROR(" Creating Chunked Dataset with maximum dimensions.") - - /* Get the chunk index type */ - if(H5D__layout_idx_type_test(did_max, &idx_type) < 0) FAIL_STACK_ERROR - - /* Chunk index type depends on whether we are using the latest version of the format */ - if(low == H5F_LIBVER_LATEST) { - if(idx_type != H5D_CHUNK_IDX_SINGLE) - FAIL_PUTS_ERROR("should be using Single Chunk indexing"); - } /* end if */ - else { - if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index"); - } /* end else */ - - /* Write into dataset */ - if(H5Dwrite(did_max, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; - - /* Closing */ - if(H5Dclose(did_max) < 0) FAIL_STACK_ERROR - if(H5Sclose(sid_max) < 0) FAIL_STACK_ERROR - - /* Create second dataset with curr dim but NULL max dim */ - if((sid = H5Screate_simple(2, t_dim2, NULL)) < 0) FAIL_STACK_ERROR - did = H5Dcreate2(fid, DSET_SINGLE_NOMAX, H5T_NATIVE_INT, sid, H5P_DEFAULT, t_dcpl, H5P_DEFAULT); - if(did < 0) - FAIL_PUTS_ERROR(" Creating Chunked Dataset.") - - /* Get the chunk index type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - - /* Chunk index type depends on whether we are using the latest version of the format */ - if(low == H5F_LIBVER_LATEST) { - if(idx_type != H5D_CHUNK_IDX_SINGLE) - FAIL_PUTS_ERROR("should be using Single Chunk indexing"); - } else { - if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index"); - } /* end else */ - - /* Write into dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, t_wbuf) < 0) TEST_ERROR; - - /* Closing */ - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - if(H5Sclose(sid) < 0) FAIL_STACK_ERROR - - /* Open the first dataset */ - if((did_max = H5Dopen2(fid, DSET_SINGLE_MAX, H5P_DEFAULT)) < 0) TEST_ERROR; - - /* Read from dataset */ - if(H5Dread(did_max, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; - - /* Verify that written and read data are the same */ - for(i = 0; i < (DSET_DIM1 * DSET_DIM2); i++) - if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", - __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); - TEST_ERROR; - } /* end if */ - - /* Closing */ - if(H5Dclose(did_max) < 0) FAIL_STACK_ERROR - - /* Open the second dataset */ - if((did = H5Dopen2(fid, DSET_SINGLE_NOMAX, H5P_DEFAULT)) < 0) TEST_ERROR; - - HDmemset(rbuf, 0, sizeof(int) * (DSET_DIM1 * DSET_DIM2)); - - /* Read from dataset */ - if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rbuf) < 0) TEST_ERROR; - - /* Verify that written and read data are the same */ - for(i = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++) - if(t_rbuf[i] != t_wbuf[i]) { - printf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", - __LINE__,(unsigned)i,t_wbuf[i],(unsigned)i,t_rbuf[i]); - TEST_ERROR; - } /* end if */ - - /* Closing */ - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - - /* Delete datasets */ + /* Create first dataset with cur and max dimensions */ + if((sid_max = H5Screate_simple(2, dim2, dim2)) < 0) FAIL_STACK_ERROR + did_max = H5Dcreate2(fid, DSET_SINGLE_MAX, H5T_NATIVE_INT, sid_max, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(did_max < 0) + FAIL_PUTS_ERROR(" Creating Chunked Dataset with maximum dimensions.") + + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(did_max, &idx_type) < 0) FAIL_STACK_ERROR + + /* Chunk index type depends on whether we are using the latest version of the format */ + if(low == H5F_LIBVER_LATEST) { + if(idx_type != H5D_CHUNK_IDX_SINGLE) + FAIL_PUTS_ERROR("should be using Single Chunk indexing"); + } /* end if */ + else { + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } /* end else */ + + /* Write into dataset */ + if(H5Dwrite(did_max, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; + + /* Closing */ + if(H5Dclose(did_max) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid_max) < 0) FAIL_STACK_ERROR + + /* Create second dataset with curr dim but NULL max dim */ + if((sid = H5Screate_simple(2, t_dim2, NULL)) < 0) FAIL_STACK_ERROR + did = H5Dcreate2(fid, DSET_SINGLE_NOMAX, H5T_NATIVE_INT, sid, H5P_DEFAULT, t_dcpl, H5P_DEFAULT); + if(did < 0) + FAIL_PUTS_ERROR(" Creating Chunked Dataset.") + + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR + + /* Chunk index type depends on whether we are using the latest version of the format */ + if(low == H5F_LIBVER_LATEST) { + if(idx_type != H5D_CHUNK_IDX_SINGLE) + FAIL_PUTS_ERROR("should be using Single Chunk indexing"); + } else { + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } /* end else */ + + /* Write into dataset */ + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, t_wbuf) < 0) TEST_ERROR; + + /* Closing */ + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + + /* Open the first dataset */ + if((did_max = H5Dopen2(fid, DSET_SINGLE_MAX, H5P_DEFAULT)) < 0) TEST_ERROR; + + /* Read from dataset */ + if(H5Dread(did_max, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; + + /* Verify that written and read data are the same */ + for(i = 0; i < (DSET_DIM1 * DSET_DIM2); i++) + if(rbuf[i] != wbuf[i]){ + printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + TEST_ERROR; + } /* end if */ + + /* Closing */ + if(H5Dclose(did_max) < 0) FAIL_STACK_ERROR + + /* Open the second dataset */ + if((did = H5Dopen2(fid, DSET_SINGLE_NOMAX, H5P_DEFAULT)) < 0) TEST_ERROR; + + HDmemset(rbuf, 0, sizeof(int) * (DSET_DIM1 * DSET_DIM2)); + + /* Read from dataset */ + if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rbuf) < 0) TEST_ERROR; + + /* Verify that written and read data are the same */ + for(i = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++) + if(t_rbuf[i] != t_wbuf[i]) { + printf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", + __LINE__,(unsigned)i,t_wbuf[i],(unsigned)i,t_rbuf[i]); + TEST_ERROR; + } /* end if */ + + /* Closing */ + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Delete datasets */ if(H5Ldelete(fid, DSET_SINGLE_NOMAX, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Ldelete(fid, DSET_SINGLE_MAX, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -9942,19 +9823,19 @@ error: /*------------------------------------------------------------------------- * - * test_idx_compatible(): - * Verify that the library can read datasets created with - * 1.6/1.8 library that use the B-tree indexing method. + * test_idx_compatible(): + * Verify that the library can read datasets created with + * 1.6/1.8 library that use the B-tree indexing method. * * Programmer: Vailin Choi; 26th August, 2009 * *------------------------------------------------------------------------- */ -static herr_t +static herr_t test_idx_compatible(void) { - hid_t fid = -1; /* File id */ - hid_t did = -1; /* Dataset id */ + hid_t fid = -1; /* File id */ + hid_t did = -1; /* Dataset id */ const char *filename = NULL; /* old test file name */ unsigned j; /* Local index variable */ H5D_chunk_index_t idx_type; /* Chunked dataset index type */ @@ -9964,41 +9845,41 @@ test_idx_compatible(void) for(j = 0; j < NELMTS(OLD_FILENAME); j++) { - /* Generate correct name for test file by prepending the source path */ - filename = H5_get_srcdir_filename(OLD_FILENAME[j]); + /* Generate correct name for test file by prepending the source path */ + filename = H5_get_srcdir_filename(OLD_FILENAME[j]); - /* Open the file */ - if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - TEST_ERROR + /* Open the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + TEST_ERROR - /* Should be able to read the dataset w/o filter created under 1.8/1.6 */ - if((did = H5Dopen2(fid, DSET, H5P_DEFAULT)) < 0) - TEST_ERROR + /* Should be able to read the dataset w/o filter created under 1.8/1.6 */ + if((did = H5Dopen2(fid, DSET, H5P_DEFAULT)) < 0) + TEST_ERROR - /* Get the chunk index type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - /* Verify index type */ - if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index") + /* Verify index type */ + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index") - if(H5Dclose(did) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR - /* Should be able to read the dataset w/ filter created under 1.8/1.6 */ - if((did = H5Dopen2(fid, DSET_FILTER, H5P_DEFAULT)) < 0) - TEST_ERROR + /* Should be able to read the dataset w/ filter created under 1.8/1.6 */ + if((did = H5Dopen2(fid, DSET_FILTER, H5P_DEFAULT)) < 0) + TEST_ERROR - /* Get the chunk index type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - /* Verify index type */ - if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("should be using v1 B-tree as index") + /* Verify index type */ + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index") - if(H5Dclose(did) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close the file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR } PASSED(); @@ -10007,7 +9888,7 @@ test_idx_compatible(void) error: H5E_BEGIN_TRY { H5Dclose(did); - H5Fclose(fid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* test_idx_compatible */ @@ -10271,7 +10152,7 @@ error: /*------------------------------------------------------------------------- * Function: test_zero_dim_dset * - * Purpose: Tests support for reading a 1D chunled dataset with + * Purpose: Tests support for reading a 1D chunled dataset with * dimension size = 0. * * Return: Success: 0 @@ -10346,9 +10227,9 @@ error: * Function: test_swmr_non_latest * * Purpose: Checks that a file created with either: - * (a) SWMR-write + non-latest-format - * (b) write + latest format - * will generate datset with latest chunk indexing type. + * (a) SWMR-write + non-latest-format + * (b) write + latest format + * will generate datset with latest chunk indexing type. * * Return: Success: 0 * Failure: -1 @@ -10359,17 +10240,17 @@ static herr_t test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - hid_t dcpl = -1; /* Dataset creation property list ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t did = -1; /* Dataset ID */ - hsize_t dim[1], dims2[2]; /* Size of dataset */ - hsize_t max_dim[1], max_dims2[2]; /* Maximum size of dataset */ - hsize_t chunk_dim[1], chunk_dims2[2]; /* Chunk dimensions */ - H5D_chunk_index_t idx_type; /* Chunk index type */ - int data; /* Data to be written to the dataset */ - H5F_libver_t low; /* File format low bound */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t dcpl = -1; /* Dataset creation property list ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t did = -1; /* Dataset ID */ + hsize_t dim[1], dims2[2]; /* Size of dataset */ + hsize_t max_dim[1], max_dims2[2]; /* Maximum size of dataset */ + hsize_t chunk_dim[1], chunk_dims2[2]; /* Chunk dimensions */ + H5D_chunk_index_t idx_type; /* Chunk index type */ + int data; /* Data to be written to the dataset */ + H5F_libver_t low; /* File format low bound */ TESTING("File created with write+latest-format/SWMR-write+non-latest-format: dataset with latest chunk index"); @@ -10383,35 +10264,35 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) } /* end if */ /* Check if we are using the latest version of the format */ - if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) + if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) FAIL_STACK_ERROR h5_fixname(FILENAME[18], fapl, filename, sizeof filename); if(low == H5F_LIBVER_LATEST) { /* Create file with write+latest-format */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } else { /* Create file with SWMR-write+non-latest-format */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } /* end else */ /* Create a chunked dataset: this will use extensible array chunk indexing */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR chunk_dim[0] = 6; - if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0) + if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0) FAIL_STACK_ERROR dim[0] = 1; max_dim[0] = H5S_UNLIMITED; - if((sid = H5Screate_simple(1, dim, max_dim)) < 0) + if((sid = H5Screate_simple(1, dim, max_dim)) < 0) FAIL_STACK_ERROR - if((did = H5Dcreate2(fid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Write to the dataset */ @@ -10420,9 +10301,9 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR /* Verify the dataset's indexing type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - if(idx_type != H5D_CHUNK_IDX_EARRAY) + if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("created dataset not indexed by extensible array") /* Closing */ @@ -10432,7 +10313,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Open the file again */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Open the dataset in the file */ @@ -10440,9 +10321,9 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR /* Verify the dataset's indexing type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - if(idx_type != H5D_CHUNK_IDX_EARRAY) + if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("created dataset not indexed by extensible array") /* Read from the dataset and verify data read is correct */ @@ -10459,25 +10340,25 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR /* Create a chunked dataset in the group: this will use v2 B-tree chunk indexing */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR chunk_dims2[0] = chunk_dims2[1] = 10; - if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0) + if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0) FAIL_STACK_ERROR dims2[0] = dims2[1] = 1; max_dims2[0] = max_dims2[1] = H5S_UNLIMITED; - if((sid = H5Screate_simple(2, dims2, max_dims2)) < 0) + if((sid = H5Screate_simple(2, dims2, max_dims2)) < 0) FAIL_STACK_ERROR - if((did = H5Dcreate2(gid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(gid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify the dataset's indexing type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - if(idx_type != H5D_CHUNK_IDX_BT2) + if(idx_type != H5D_CHUNK_IDX_BT2) FAIL_PUTS_ERROR("created dataset not indexed by v2 B-tree") /* Closing */ @@ -10500,9 +10381,9 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR /* Verify the dataset's indexing type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - if(idx_type != H5D_CHUNK_IDX_BT2) + if(idx_type != H5D_CHUNK_IDX_BT2) FAIL_PUTS_ERROR("created dataset not indexed by v2 B-tree") /* Closing */ @@ -10520,9 +10401,9 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR /* Verify the dataset's indexing type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - if(idx_type != H5D_CHUNK_IDX_EARRAY) + if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("created dataset not indexed by extensible array") /* Close the dataset */ @@ -10537,9 +10418,9 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR /* Verify the dataset's indexing type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - if(idx_type != H5D_CHUNK_IDX_BT2) + if(idx_type != H5D_CHUNK_IDX_BT2) FAIL_PUTS_ERROR("created dataset not indexed by v2 B-tree") /* Write to the dataset in the group */ @@ -10553,7 +10434,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Open the file again with SWMR read access */ - if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) + if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) @@ -10653,7 +10534,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* Verify the chunk index type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR; if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("should be using extensible array as index"); @@ -10773,7 +10654,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* Verify the chunk index type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR; if(idx_type != H5D_CHUNK_IDX_FARRAY) FAIL_PUTS_ERROR("should be using fixed array as index"); @@ -10893,7 +10774,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* Verify the chunk index type */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR; if(idx_type != H5D_CHUNK_IDX_BT2) FAIL_PUTS_ERROR("should be using fixed array as index"); @@ -11348,7 +11229,7 @@ error: /*------------------------------------------------------------------------- * Function: test_power2up * - * Purpose: Tests that the H5VM_power2up(n) function does not result in an + * Purpose: Tests that the H5VM_power2up(n) function does not result in an * infinite loop when input n exceeds 2^63. (HDFFV-10217) * H5VM_power2up() is used to calculate the next power of 2 for * a dataset's scaled dimension sizes. @@ -11388,12 +11269,12 @@ test_power2up(hid_t fapl) sid = H5Screate_simple(2, dims, max_dims); /* Create dataset creation property list */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR /* Set chunk size */ chunk_dims[0] = chunk_dims[1] = 1; - if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) + if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR /* Create chunked dataset */ @@ -11411,13 +11292,13 @@ test_power2up(hid_t fapl) TEST_ERROR /* Closing */ - if(H5Dclose(did) < 0) + if(H5Dclose(did) < 0) TEST_ERROR - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) TEST_ERROR - if(H5Pclose(dcpl) < 0) + if(H5Pclose(dcpl) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) + if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); @@ -12460,33 +12341,33 @@ error: /*------------------------------------------------------------------------- * DLS bug -- HDFFV-9672 * - * The following functions replicate the test code provided by DLS to + * The following functions replicate the test code provided by DLS to * expose bug hdffv-9672. All functions associated with this test * have the prefix DLS_01_ * * The note documenting the bug is reproduced below: * * ------------------------------------------------------ - * + * * Hi, * We've found an issue regarding fixed length strings. * - * If we create a chunked dataset of large fixed length strings - * (up to 1kb per string) with small chunk sizes (~8 elements per + * If we create a chunked dataset of large fixed length strings + * (up to 1kb per string) with small chunk sizes (~8 elements per * chunk) then the resulting dataset may not be read later. - * This only happens if the file is created with LIBVER_LATEST + * This only happens if the file is created with LIBVER_LATEST * for the version bounds. * * Calling H5Oget_info(...) on the dataset results in the following: - * - * H5Dearray.c:250: H5D__earray_crt_context: Assertion + * + * H5Dearray.c:250: H5D__earray_crt_context: Assertion * `udata->chunk_size > 0' failed. - * + * * Example: - * void create_data(...) + * void create_data(...) * { * ... - * + * * hsize_t chunks[1] = {8} ; * * err = H5Tset_size( tid, 256 ); @@ -12494,45 +12375,45 @@ error: * err = H5Pset_chunk( dcpl, 1, chunks ); * * H5Dcreate2( fid, "data", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT ); - * + * * // write data - * } - * - * void read_data(...) - * { - * ... - * + * } + * + * void read_data(...) + * { + * ... + * * H5O_into_t info; status = H5Oget_info( did, &info ) // crash - * ... - * } - * - * If the size of the chunk is increased (usually matching the - * string length) then this problem disappears. - * - * A full program that produces such a file (and crashes trying to + * ... + * } + * + * If the size of the chunk is increased (usually matching the + * string length) then this problem disappears. + * + * A full program that produces such a file (and crashes trying to * read it) is attached. - * + * * Tested with 1.10.0-alpha1. - * + * * Regards, - * + * * Charles Mita * Software Engineer * Diamond Light Source Ltd. * +44 1235 778029 * * ------------------------------------------------------ - * + * * The bug in question turned out to be caused by a failure to update - * the enc_bytes_per_dim field in the layout if the size of the - * underlying type required more bytes to encode than any of the + * the enc_bytes_per_dim field in the layout if the size of the + * underlying type required more bytes to encode than any of the * chunk dimensions. * - * At least in debug builds, the following test code exposes the + * At least in debug builds, the following test code exposes the * failure via an assertion failure. * - * Note that the test code make no attempt to run with different - * file drivers, as the bug is in the actual on disk encoding of + * Note that the test code make no attempt to run with different + * file drivers, as the bug is in the actual on disk encoding of * the chunk layout. * * JRM -- 2/5/16 @@ -12540,10 +12421,10 @@ error: *------------------------------------------------------------------------- */ -#define DLS_01_DATASET "data" -#define DLS_01_STR_SIZE 256 -#define DLS_01_CHUNK_SIZE 8 -#define DLS_01_DIMS 4 +#define DLS_01_DATASET "data" +#define DLS_01_STR_SIZE 256 +#define DLS_01_CHUNK_SIZE 8 +#define DLS_01_DIMS 4 static herr_t dls_01_setup_file( hid_t fid ); static herr_t dls_01_write_data( hid_t fid, char* buffer ); @@ -12664,18 +12545,18 @@ dls_01_main( void ) { char filename[512]; int status = 0; hid_t fapl = 0, fid = 0; - const char* strings[DLS_01_DIMS] = - { "String 1", "Test string 2", "Another string", "Final String" }; + const char* strings[DLS_01_DIMS] = + { "String 1", "Test string 2", "Another string", "Final String" }; char* buffer = NULL; TESTING("Testing DLS bugfix 1"); - if ( NULL == h5_fixname(FILENAME[23], H5P_DEFAULT, filename, + if ( NULL == h5_fixname(FILENAME[23], H5P_DEFAULT, filename, sizeof(filename)) ) - TEST_ERROR + TEST_ERROR buffer = (char *)HDcalloc( DLS_01_DIMS, DLS_01_STR_SIZE ); - if ( NULL == buffer ) + if ( NULL == buffer ) TEST_ERROR HDstrcpy( buffer, strings[0] ); @@ -12693,10 +12574,10 @@ dls_01_main( void ) { if ( fid <= 0 ) TEST_ERROR if ( 0 != dls_01_setup_file( fid ) ) - goto error; + goto error; if ( 0 != dls_01_write_data( fid, buffer ) ) - goto error; + goto error; status = H5Fclose( fid ); if ( status != 0 ) TEST_ERROR @@ -12705,7 +12586,7 @@ dls_01_main( void ) { if ( fid <= 0 ) TEST_ERROR if ( 0 != dls_01_read_stuff( fid ) ) - goto error; + goto error; status = H5Fclose( fid ); if ( status != 0 ) TEST_ERROR @@ -12754,7 +12635,7 @@ test_compact_open_close_dirty(hid_t fapl) hid_t dcpl = -1; /* Dataset creation property list */ hsize_t dims[1] = {10}; /* Dimension */ int wbuf[10]; /* Data buffer */ - char filename[FILENAME_BUF_SIZE]; /* Filename */ + char filename[FILENAME_BUF_SIZE]; /* Filename */ int i; /* Local index variable */ hbool_t dirty; /* The dirty flag */ @@ -12770,15 +12651,15 @@ test_compact_open_close_dirty(hid_t fapl) wbuf[i] = i; /* Create dataspace */ - if((sid = H5Screate_simple(1, dims, NULL)) < 0) + if((sid = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR /* Set compact layout */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR - if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) TEST_ERROR - if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) + if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR /* Create a compact dataset */ @@ -12790,7 +12671,7 @@ test_compact_open_close_dirty(hid_t fapl) TEST_ERROR /* Close the dataset */ - if(H5Dclose(did) < 0) + if(H5Dclose(did) < 0) TEST_ERROR /* Verify the repeated open/close of the dataset will not fail */ @@ -12802,7 +12683,7 @@ test_compact_open_close_dirty(hid_t fapl) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - } + } /* Open the dataset */ if((did = H5Dopen2(fid, DSET_COMPACT_MAX_NAME, H5P_DEFAULT)) < 0) @@ -12817,11 +12698,11 @@ test_compact_open_close_dirty(hid_t fapl) TEST_ERROR /* Close the dataset */ - if(H5Dclose(did) < 0) + if(H5Dclose(did) < 0) TEST_ERROR /* Close the dataspace */ - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) TEST_ERROR /* Close the dataset creation property list */ @@ -12847,24 +12728,24 @@ error: /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Tests the dataset interface (H5D) + * Purpose: Tests the dataset interface (H5D) * - * Return: Success: exit(EXIT_SUCCESS) + * Return: Success: exit(EXIT_SUCCESS) * - * Failure: exit(EXIT_FAILURE) + * Failure: exit(EXIT_FAILURE) * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ int main(void) { - char filename[FILENAME_BUF_SIZE]; - hid_t file, grp, fapl, fapl2; + char filename[FILENAME_BUF_SIZE]; + hid_t file, grp, fapl, fapl2; hid_t fcpl = -1, fcpl2 = -1; unsigned new_format; unsigned paged; @@ -12872,7 +12753,7 @@ main(void) size_t rdcc_nelmts; size_t rdcc_nbytes; double rdcc_w0; - int nerrors = 0; + int nerrors = 0; const char *envval; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -12961,62 +12842,62 @@ main(void) if(H5Gclose(grp) < 0) goto error; - nerrors += (test_create(file) < 0 ? 1 : 0); - nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); - nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); + nerrors += (test_create(file) < 0 ? 1 : 0); + nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); + nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0); - nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); - nerrors += (test_tconv(file) < 0 ? 1 : 0); - nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0); - nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0); - nerrors += (test_nbit_int(file) < 0 ? 1 : 0); - nerrors += (test_nbit_float(file) < 0 ? 1 : 0); - nerrors += (test_nbit_double(file) < 0 ? 1 : 0); - nerrors += (test_nbit_array(file) < 0 ? 1 : 0); - nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); - nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); - nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); - nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0); - nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); - nerrors += (test_multiopen (file) < 0 ? 1 : 0); - nerrors += (test_types(file) < 0 ? 1 : 0); + nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); + nerrors += (test_tconv(file) < 0 ? 1 : 0); + nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0); + nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0); + nerrors += (test_nbit_int(file) < 0 ? 1 : 0); + nerrors += (test_nbit_float(file) < 0 ? 1 : 0); + nerrors += (test_nbit_double(file) < 0 ? 1 : 0); + nerrors += (test_nbit_array(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); + nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0); + nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); + nerrors += (test_multiopen (file) < 0 ? 1 : 0); + nerrors += (test_types(file) < 0 ? 1 : 0); nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0); - nerrors += (test_missing_filter(file) < 0 ? 1 : 0); - nerrors += (test_can_apply(file) < 0 ? 1 : 0); - nerrors += (test_can_apply2(file) < 0 ? 1 : 0); - nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); - nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); - nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); - nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0); - nerrors += (test_filter_delete(file) < 0 ? 1 : 0); - nerrors += (test_filters_endianess() < 0 ? 1 : 0); - nerrors += (test_zero_dims(file) < 0 ? 1 : 0); - nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); - nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0); + nerrors += (test_missing_filter(file) < 0 ? 1 : 0); + nerrors += (test_can_apply(file) < 0 ? 1 : 0); + nerrors += (test_can_apply2(file) < 0 ? 1 : 0); + nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); + nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); + nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); + nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0); + nerrors += (test_filter_delete(file) < 0 ? 1 : 0); + nerrors += (test_filters_endianess() < 0 ? 1 : 0); + nerrors += (test_zero_dims(file) < 0 ? 1 : 0); + nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); + nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0); #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += (test_deprec(file) < 0 ? 1 : 0); + nerrors += (test_deprec(file) < 0 ? 1 : 0); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); + nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); - nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0); - nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0); - nerrors += (test_idx_compatible() < 0 ? 1 : 0); + nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); + nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0); + nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0); + nerrors += (test_idx_compatible() < 0 ? 1 : 0); nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0); - nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0); + nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0); nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0); nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0); nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index b7448db..ed03cf4 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -461,8 +461,8 @@ hsize_t diff_attr(hid_t loc1_id, for(j = 0; j < rank1; j++) nelmts1 *= dims1[j]; - buf1 = (void *)HDmalloc((size_t)(nelmts1 * msize1)); - buf2 = (void *)HDmalloc((size_t)(nelmts1 * msize2)); + buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1); + buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2); if(buf1 == NULL || buf2 == NULL) { parallel_print("cannot read into memory\n"); goto error; diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index ea79c6c..f046369 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -170,6 +170,7 @@ hsize_t diff_datasetid( hid_t did1, const char *obj2_name, diff_opt_t *options) { + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ hid_t sid1=-1; hid_t sid2=-1; hid_t f_tid1=-1; @@ -211,30 +212,31 @@ hsize_t diff_datasetid( hid_t did1, int i; unsigned int vl_data = 0; /*contains VL datatypes */ + options->err_stat = 1; h5difftrace("diff_datasetid start\n"); /* Get the dataspace handle */ if((sid1 = H5Dget_space(did1)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); /* Get rank */ if((rank1 = H5Sget_simple_extent_ndims(sid1)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); /* Get the dataspace handle */ if((sid2 = H5Dget_space(did2)) < 0 ) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); /* Get rank */ if((rank2 = H5Sget_simple_extent_ndims(sid2)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); /* Get dimensions */ if(H5Sget_simple_extent_dims(sid1, dims1, maxdim1) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); /* Get dimensions */ if(H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); h5diffdebug3("rank: %ld - %ld\n", rank1, rank2); /*------------------------------------------------------------------------- @@ -244,25 +246,25 @@ hsize_t diff_datasetid( hid_t did1, /* Get the data type */ if((f_tid1 = H5Dget_type(did1)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); /* Get the data type */ if((f_tid2 = H5Dget_type(did2)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); /*------------------------------------------------------------------------- * get the storage layout type *------------------------------------------------------------------------- */ if((dcpl1 = H5Dget_create_plist(did1)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); if((dcpl2 = H5Dget_create_plist(did2)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); if((stl1 = H5Pget_layout(dcpl1)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); if((stl2 = H5Pget_layout(dcpl2)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); /*------------------------------------------------------------------------- * check for empty datasets @@ -303,10 +305,10 @@ hsize_t diff_datasetid( hid_t did1, */ h5difftrace("check for memory type and sizes\n"); if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); m_size1 = H5Tget_size(m_tid1); m_size2 = H5Tget_size(m_tid2); @@ -368,14 +370,14 @@ hsize_t diff_datasetid( hid_t did1, if (FAIL == match_up_memsize (f_tid1, f_tid2, &m_tid1, &m_tid2, &m_size1, &m_size2)) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "match_up_memsize failed"); h5diffdebug3("m_size: %ld - %ld\n", m_size1, m_size2); dadims = dims1; dam_size = m_size1; dam_tid = m_tid1; danelmts = nelmts1; need = (size_t)(nelmts1 * m_size1); /* bytes needed */ - } + } else { h5diffdebug3("Array dims: %d - %d\n", dims1[0], dims2[0]); /* Compare the smallest array, but create the largest buffer */ @@ -413,10 +415,10 @@ hsize_t diff_datasetid( hid_t did1, if(buf1 != NULL && buf2 != NULL) { h5difftrace("buf1 != NULL && buf2 != NULL\n"); if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); h5difftrace("H5Dread did2\n"); if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); /* array diff */ nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims, @@ -427,6 +429,14 @@ hsize_t diff_datasetid( hid_t did1, H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); } /* end if */ + if(buf1 != NULL) { + HDfree(buf1); + buf1 = NULL; + } + if(buf2 != NULL) { + HDfree(buf2); + buf2 = NULL; + } } /* end if */ else { /* possibly not enough memory, read/compare by hyperslabs */ size_t p_type_nbytes = dam_size; /*size of memory type */ @@ -468,9 +478,9 @@ hsize_t diff_datasetid( hid_t did1, * E.g., sm_space. */ if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); @@ -487,19 +497,19 @@ hsize_t diff_datasetid( hid_t did1, hs_nelmts *= hs_size[i]; } /* end for */ if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); } /* end if */ else hs_nelmts = 1; if(H5Dread(did1, m_tid1, sm_space, sid1, H5P_DEFAULT, sm_buf1) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); if(H5Dread(did2, m_tid2, sm_space, sid2, H5P_DEFAULT, sm_buf2) < 0) - goto error; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); /* get array differences. in the case of hyperslab read, increment the number of differences found in each hyperslab and pass the position at the beginning for printing */ @@ -521,6 +531,14 @@ hsize_t diff_datasetid( hid_t did1, carry = 0; } /* i */ } /* elmtno */ + if(sm_buf1 != NULL) { + HDfree(sm_buf1); + sm_buf1 = NULL; + } + if(sm_buf2 != NULL) { + HDfree(sm_buf2); + sm_buf2 = NULL; + } H5Sclose(sm_space); } /* hyperslab read */ @@ -531,40 +549,11 @@ hsize_t diff_datasetid( hid_t did1, * close *------------------------------------------------------------------------- */ - h5difftrace("compare attributes?\n"); - - /* free */ - if(buf1 != NULL) { - HDfree(buf1); - buf1 = NULL; - } /* end if */ - if(buf2 != NULL) { - HDfree(buf2); - buf2 = NULL; - } /* end if */ - if(sm_buf1 != NULL) { - HDfree(sm_buf1); - sm_buf1 = NULL; - } /* end if */ - if(sm_buf2 != NULL) { - HDfree(sm_buf2); - sm_buf2 = NULL; - } /* end if */ + h5difftrace("reclaim any VL memory\n"); - H5E_BEGIN_TRY { - H5Sclose(sid1); - H5Sclose(sid2); - H5Tclose(f_tid1); - H5Tclose(f_tid2); - H5Tclose(m_tid1); - H5Tclose(m_tid2); - } H5E_END_TRY; - h5difftrace("diff_datasetid finish\n"); - - return nfound; +done: -error: - options->err_stat=1; + options->err_stat = ret_value; /* free */ if(buf1 != NULL) { @@ -606,7 +595,7 @@ error: H5Tclose(m_tid2); /* enable error reporting */ } H5E_END_TRY; - h5difftrace("diff_datasetid errored\n"); + h5diffdebug3("diff_datasetid return:%d with nfound:%d\n", ret_value, nfound); return nfound; } diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 6ee58c5..abd55db 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -20,9 +20,9 @@ */ static void print_warning(const char *dname, const char *fname) { - fprintf(stderr, - "warning: dataset <%s> cannot be read, %s filter is not available\n", - dname, fname); + fprintf(stderr, + "warning: dataset <%s> cannot be read, %s filter is not available\n", + dname, fname); } /*------------------------------------------------------------------------- @@ -34,100 +34,97 @@ static void print_warning(const char *dname, const char *fname) * 2) the internal filters might be turned off * * Return: 1, can read, 0, cannot, -1 error - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: March 1, 2004 - * *------------------------------------------------------------------------- */ int h5tools_canreadf(const char* name, /* object name, serves also as boolean print */ hid_t dcpl_id) /* dataset creation property list */ { + int ret_value = 1; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + int nfilters; /* number of filters */ + H5Z_filter_t filtn; /* filter identification number */ + int i; /* index */ + int udfilter_avail; /* index */ + + /* get information about filters */ + if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); + + /* if we do not have filters, we can read the dataset safely */ + if (!nfilters) + HGOTO_DONE(1); + + /* check availability of filters */ + for (i = 0; i < nfilters; i++) { + if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, 0, 0, 0, (size_t) 0, 0, NULL)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_filter2 failed"); + + switch (filtn) { + /*------------------------------------------------------------------------- + * user defined filter + *------------------------------------------------------------------------- + */ + default: + if ((udfilter_avail = H5Zfilter_avail(filtn)) < 0) { + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Zfilter_avail failed"); + } + else if (!udfilter_avail) { + if (name) + print_warning(name, "user defined"); + ret_value = 0; + } + break; - int nfilters; /* number of filters */ - H5Z_filter_t filtn; /* filter identification number */ - int i; /* index */ - int udfilter_avail; /* index */ - - /* get information about filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - return -1; - - /* if we do not have filters, we can read the dataset safely */ - if (!nfilters) - return 1; - - /* check availability of filters */ - for (i = 0; i < nfilters; i++) { - if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, 0, 0, 0, (size_t) 0, 0, NULL)) < 0) - return -1; - - switch (filtn) { - /*------------------------------------------------------------------------- - * user defined filter - *------------------------------------------------------------------------- - */ - default: - if ((udfilter_avail = H5Zfilter_avail(filtn)) < 0) - return -1; - else if (udfilter_avail == 0) { - if (name) - print_warning(name, "user defined"); - return 0; - } - break; - - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE 1 , deflation like gzip - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_DEFLATE: + /*------------------------------------------------------------------------- + * H5Z_FILTER_DEFLATE 1 , deflation like gzip + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_DEFLATE: #ifndef H5_HAVE_FILTER_DEFLATE - if (name) - print_warning(name,"deflate"); - return 0; + if (name) + print_warning(name,"deflate"); + ret_value = 0; #endif - break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP 4 , szip compression - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_SZIP: + break; + /*------------------------------------------------------------------------- + * H5Z_FILTER_SZIP 4 , szip compression + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_SZIP: #ifndef H5_HAVE_FILTER_SZIP - if (name) - print_warning(name,"SZIP"); - return 0; + if (name) + print_warning(name,"SZIP"); + ret_value = 0; #endif - break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_SHUFFLE 2 , shuffle the data - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_SHUFFLE: - break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_FLETCHER32: - break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_NBIT - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_NBIT: - break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_SCALEOFFSET: - break; - }/*switch*/ - }/*for*/ - - return 1; + break; + /*------------------------------------------------------------------------- + * H5Z_FILTER_SHUFFLE 2 , shuffle the data + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_SHUFFLE: + break; + /*------------------------------------------------------------------------- + * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_FLETCHER32: + break; + /*------------------------------------------------------------------------- + * H5Z_FILTER_NBIT + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_NBIT: + break; + /*------------------------------------------------------------------------- + * H5Z_FILTER_SCALEOFFSET + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_SCALEOFFSET: + break; + }/*switch*/ + }/*for*/ + +done: + return ret_value; } /*------------------------------------------------------------------------- @@ -138,31 +135,26 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr * except SZIP, which may be configured decoder-only. * * Return: 1, can write, 0, cannot, -1 error - * - * Programmer: - * - * Date: October 5, 2004 - * *------------------------------------------------------------------------- */ H5_ATTR_CONST int h5tools_can_encode(H5Z_filter_t filtn) { switch (filtn) { - /* user defined filter */ - default: + /* user defined filter */ + default: return 0; - case H5Z_FILTER_DEFLATE: + case H5Z_FILTER_DEFLATE: #ifndef H5_HAVE_FILTER_DEFLATE return 0; #endif break; - case H5Z_FILTER_SZIP: + case H5Z_FILTER_SZIP: #ifndef H5_HAVE_FILTER_SZIP return 0; #else - { + { unsigned int filter_config_flags; if (H5Zget_filter_info(filtn, &filter_config_flags) < 0) @@ -171,36 +163,36 @@ h5tools_can_encode(H5Z_filter_t filtn) { & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { /* filter present but neither encode nor decode is supported (???) */ return -1; - } + } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) { /* decoder only: read but not write */ return 0; - } + } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) { /* encoder only: write but not read (???) */ return -1; - } + } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) { return 1; } - } + } #endif break; - case H5Z_FILTER_SHUFFLE: + case H5Z_FILTER_SHUFFLE: break; - case H5Z_FILTER_FLETCHER32: + case H5Z_FILTER_FLETCHER32: break; - case H5Z_FILTER_NBIT: + case H5Z_FILTER_NBIT: break; - case H5Z_FILTER_SCALEOFFSET: + case H5Z_FILTER_SCALEOFFSET: break; }/*switch*/ diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 7ed9a90..6b8cf8a 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -284,8 +284,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout, /* Set return value */ ret_value = dt_ret->id_out; - /* Increment the ref count on id_out, because the calling function will try - * to close it */ + /* Increment the ref count on id_out, because the calling function will try to close it */ if(H5Iinc_ref(ret_value) < 0) ret_value = -1; @@ -482,24 +481,8 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, if (options->verbose) printf(FORMAT_OBJ_ATTR, "attr", name); - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if (H5Tclose(ftype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Tclose(wtype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Sclose(space_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - if (H5Aclose(attr_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); } /* u */ - return 0; - done: H5E_BEGIN_TRY { if (buf) { @@ -541,8 +524,8 @@ static int check_options(pack_opt_t *options) { *------------------------------------------------------------------------- */ if (options->verbose && have_request(options) /* only print if requested */) { - printf("Objects to modify layout are...\n"); if (options->all_layout == 1) { + printf("All objects to modify layout are...\n"); switch (options->layout_g) { case H5D_COMPACT: strcpy(slayout, "compact"); @@ -563,14 +546,17 @@ static int check_options(pack_opt_t *options) { strcpy(slayout, "invalid layout\n"); HGOTO_DONE(FAIL); } - printf(" Apply %s layout to all\n", slayout); + printf(" Apply %s layout to all", slayout); if (H5D_CHUNKED == options->layout_g) { - printf("with dimension ["); + printf("with dimension [ "); for (j = 0; j < options->chunk_g.rank; j++) printf("%d ", (int) options->chunk_g.chunk_lengths[j]); - printf("]\n"); + printf("]"); } + printf("\n"); } + else + printf("No all objects to modify layout\n"); }/* verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { @@ -601,10 +587,14 @@ static int check_options(pack_opt_t *options) { */ if (options->verbose && have_request(options) /* only print if requested */) { - printf("Objects to apply filter are...\n"); if (options->all_filter == 1) { + printf("All objects to apply filter are...\n"); for (k = 0; k < options->n_filter_g; k++) { H5Z_filter_t filtn = options->filter_g[k].filtn; + if (filtn < 0) { + printf(" Unknown\n"); + continue; + } switch (filtn) { case H5Z_FILTER_NONE: printf(" Uncompress all\n"); @@ -623,6 +613,8 @@ static int check_options(pack_opt_t *options) { } /* k */ }; } + else + printf("No all objects to apply filter\n"); } /* verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { @@ -631,7 +623,12 @@ static int check_options(pack_opt_t *options) { for (j = 0; j < pack.nfilters; j++) { if (options->verbose) { - printf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); + if(pack.filter[j].filtn >= 0) { + if(pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) + printf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), pack.filter[j].filtn); + else + printf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); + } } has_cp = 1; } /* j */ @@ -661,8 +658,7 @@ static int check_options(pack_opt_t *options) { */ if (options->ublock_filename != NULL && options->ublock_size == 0) { if (options->verbose) { - printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", - options->ublock_filename); + printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename); options->ublock_size = 1024; } } @@ -692,27 +688,29 @@ done: *------------------------------------------------------------------------- */ static int check_objects(const char* fname, pack_opt_t *options) { + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ hid_t fid; + hid_t did; + hid_t sid; unsigned int i; + unsigned int uf; trav_table_t *travt = NULL; /* nothing to do */ if (options->op_tbl->nelems == 0) - return 0; + HGOTO_DONE(0); /*------------------------------------------------------------------------- - * open the file - *------------------------------------------------------------------------- - */ - if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) { - printf("<%s>: %s\n", fname, H5FOPENERROR); - return -1; - } + * open the file + *------------------------------------------------------------------------- + */ + if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); /*------------------------------------------------------------------------- - * get the list of objects in the file - *------------------------------------------------------------------------- - */ + * get the list of objects in the file + *------------------------------------------------------------------------- + */ /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); @@ -721,15 +719,15 @@ static int check_objects(const char* fname, pack_opt_t *options) { /* get the list of objects in the file */ if (h5trav_gettable(fid, travt) < 0) - goto done; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); /*------------------------------------------------------------------------- - * compare with user supplied list - *------------------------------------------------------------------------- - */ + * compare with user supplied list + *------------------------------------------------------------------------- + */ if (options->verbose) - printf("Opening file <%s>. Searching for objects to modify...\n", fname); + printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs); for (i = 0; i < options->op_tbl->nelems; i++) { char* name = options->op_tbl->objs[i].path; @@ -737,73 +735,70 @@ static int check_objects(const char* fname, pack_opt_t *options) { printf(" <%s>", name); /* the input object names are present in the file and are valid */ - if (h5trav_getindext(name, travt) < 0) { - error_msg("%s Could not find <%s> in file <%s>. Exiting...\n", + if (h5trav_getindext(name, travt) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose ? "\n" : ""), name, fname); - goto done; - } if (options->verbose) printf("...Found\n"); - /* check for extra filter conditions */ - switch (options->op_tbl->objs[i].filter->filtn) { - /* chunk size must be smaller than pixels per block */ - case H5Z_FILTER_SZIP: - { - int j; - hsize_t csize = 1; - unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0]; - hsize_t dims[H5S_MAX_RANK]; - int rank; - hid_t did; - hid_t sid; - - if (options->op_tbl->objs[i].chunk.rank > 0) { - rank = options->op_tbl->objs[i].chunk.rank; - for (j = 0; j < rank; j++) - csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j]; - } - else { - if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) - goto done; - if ((sid = H5Dget_space(did)) < 0) - goto done; - if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) - goto done; - HDmemset(dims, 0, sizeof dims); - if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) - goto done; - for (j = 0; j < rank; j++) - csize *= dims[j]; - if (H5Sclose(sid) < 0) - goto done; - if (H5Dclose(did) < 0) - goto done; - } - - if (csize < ppb) { - printf(" \n"); - goto done; + for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) { + if (options->op_tbl->objs[i].filter[uf].filtn < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); + /* check for extra filter conditions */ + switch (options->op_tbl->objs[i].filter[uf].filtn) { + /* chunk size must be smaller than pixels per block */ + case H5Z_FILTER_SZIP: + { + int j; + hsize_t csize = 1; + unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0]; + hsize_t dims[H5S_MAX_RANK]; + int rank; + + if (options->op_tbl->objs[i].chunk.rank > 0) { + rank = options->op_tbl->objs[i].chunk.rank; + for (j = 0; j < rank; j++) + csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j]; + } + else { + if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + if ((sid = H5Dget_space(did)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + HDmemset(dims, 0, sizeof dims); + if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + for (j = 0; j < rank; j++) + csize *= dims[j]; + if (H5Sclose(sid) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + if (H5Dclose(did) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + } + + if (csize < ppb) { + printf(" \n"); + HGOTO_DONE(0); + } } + break; + default: + break; } - break; - default: - break; - } - } /* i */ - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - H5Fclose(fid); - trav_table_free(travt); - return 0; + } /* for uf */ + } /* for i */ done: - H5Fclose(fid); - trav_table_free(travt); - return -1; + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Sclose(sid); + H5Dclose(did); + } H5E_END_TRY; + if (travt) + trav_table_free(travt); + return ret_value; } /*------------------------------------------------------------------------- @@ -833,7 +828,9 @@ static int have_request(pack_opt_t *options) { */ static const char* get_sfilter(H5Z_filter_t filtn) { - if (filtn == H5Z_FILTER_NONE) + if (filtn < 0) + return NULL; + else if (filtn == H5Z_FILTER_NONE) return "NONE"; else if (filtn == H5Z_FILTER_DEFLATE) return "GZIP"; diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h index c8c6a0e..0252768 100644 --- a/tools/src/h5repack/h5repack.h +++ b/tools/src/h5repack/h5repack.h @@ -29,7 +29,7 @@ #define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */ /* File space default information */ -#define FS_PAGESIZE_DEF 4096 +#define FS_PAGESIZE_DEF 4096 #define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR #define FS_PERSIST_DEF FALSE #define FS_THRESHOLD_DEF 1 @@ -42,7 +42,7 @@ /* a list of names */ typedef struct { - char obj[MAX_NC_NAME]; + char obj[MAX_NC_NAME]; } obj_list_t; /* @@ -60,16 +60,16 @@ typedef struct { #define CD_VALUES 20 typedef struct { - H5Z_filter_t filtn; /* filter identification number */ - unsigned filt_flag; /* filter definition flag */ - unsigned cd_values[CD_VALUES]; /* filter client data values */ - size_t cd_nelmts; /* filter client number of values */ + H5Z_filter_t filtn; /* filter identification number */ + unsigned filt_flag; /* filter definition flag */ + unsigned cd_values[CD_VALUES]; /* filter client data values */ + size_t cd_nelmts; /* filter client number of values */ } filter_info_t; /* chunk lengths along each dimension and rank */ typedef struct { - hsize_t chunk_lengths[MAX_VAR_DIMS]; - int rank; + hsize_t chunk_lengths[MAX_VAR_DIMS]; + int rank; } chunk_info_t; /* we currently define a maximum value for the filters array, @@ -78,19 +78,19 @@ typedef struct { /* information for one object, contains PATH, CHUNK info and FILTER info */ typedef struct { - char path[MAX_NC_NAME]; /* name of object */ - filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */ - int nfilters; /* current number of filters */ - H5D_layout_t layout; /* layout information */ - chunk_info_t chunk; /* chunk information */ - hid_t refobj_id; /* object ID, references */ + char path[MAX_NC_NAME]; /* name of object */ + filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */ + int nfilters; /* current number of filters */ + H5D_layout_t layout; /* layout information */ + chunk_info_t chunk; /* chunk information */ + hid_t refobj_id; /* object ID, references */ } pack_info_t; /* store a table of all objects */ typedef struct { - unsigned int size; - unsigned int nelems; - pack_info_t *objs; + unsigned int size; + unsigned int nelems; + pack_info_t *objs; } pack_opttbl_t; @@ -101,30 +101,30 @@ typedef struct { /* all the above, ready to go to the hrepack call */ typedef struct { - pack_opttbl_t *op_tbl; /*table with all -c and -f options */ - int all_layout; /*apply the layout to all objects */ - int all_filter; /*apply the filter to all objects */ - filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */ - int n_filter_g; /*number of global filters */ - chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ - H5D_layout_t layout_g; /*global layout information for the ALL case */ - int verbose; /*verbose mode */ - hsize_t min_comp; /*minimum size to compress, in bytes */ - int use_native; /*use a native type in write */ - hbool_t latest; /*pack file with the latest file format */ - int grp_compact; /* Set the maximum number of links to store as header messages in the group */ - int grp_indexed; /* Set the minimum number of links to store in the indexed format */ - int msg_size[8]; /* Minimum size of shared messages: dataspace, - datatype, fill value, filter pipleline, attribute */ - const char *ublock_filename; /* user block file name */ - hsize_t ublock_size; /* user block size */ - hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */ - hsize_t threshold; /* alignment threshold for H5Pset_alignment */ - hsize_t alignment; /* alignment for H5Pset_alignment */ - H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ - int fs_persist; /* Free space section threshold */ - long fs_threshold; /* Free space section threshold */ - long long fs_pagesize; /* File space page size */ + pack_opttbl_t *op_tbl; /*table with all -c and -f options */ + int all_layout; /*apply the layout to all objects */ + int all_filter; /*apply the filter to all objects */ + filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */ + int n_filter_g; /*number of global filters */ + chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ + H5D_layout_t layout_g; /*global layout information for the ALL case */ + int verbose; /*verbose mode */ + hsize_t min_comp; /*minimum size to compress, in bytes */ + int use_native; /*use a native type in write */ + hbool_t latest; /*pack file with the latest file format */ + int grp_compact; /* Set the maximum number of links to store as header messages in the group */ + int grp_indexed; /* Set the minimum number of links to store in the indexed format */ + int msg_size[8]; /* Minimum size of shared messages: dataspace, + datatype, fill value, filter pipleline, attribute */ + const char *ublock_filename; /* user block file name */ + hsize_t ublock_size; /* user block size */ + hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */ + hsize_t threshold; /* alignment threshold for H5Pset_alignment */ + hsize_t alignment; /* alignment for H5Pset_alignment */ + H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ + int fs_persist; /* Free space section threshold */ + long fs_threshold; /* Free space section threshold */ + long long fs_pagesize; /* File space page size */ } pack_opt_t; @@ -214,18 +214,18 @@ int apply_filters(const char* name, /* object name from traverse list */ * options table *------------------------------------------------------------------------- */ -int options_table_init( pack_opttbl_t **tbl ); -int options_table_free( pack_opttbl_t *table ); -int options_add_layout( obj_list_t *obj_list, - unsigned n_objs, - pack_info_t *pack, - pack_opttbl_t *table ); -int options_add_filter ( obj_list_t *obj_list, - unsigned n_objs, - filter_info_t filt, - pack_opttbl_t *table ); -pack_info_t* options_get_object( const char *path, - pack_opttbl_t *table); +int options_table_init(pack_opttbl_t **tbl); +int options_table_free(pack_opttbl_t *table); +int options_add_layout(obj_list_t *obj_list, + unsigned n_objs, + pack_info_t *pack, + pack_opttbl_t *table); +int options_add_filter(obj_list_t *obj_list, + unsigned n_objs, + filter_info_t filt, + pack_opttbl_t *table); +pack_info_t* options_get_object(const char *path, + pack_opttbl_t *table); /*------------------------------------------------------------------------- * parse functions diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 9df7917..080defa 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -109,9 +109,8 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) * open input file *------------------------------------------------------------------------- */ - if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) { + if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR); - } /* get user block size and file space strategy/persist/threshold */ { @@ -119,23 +118,20 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) hid_t grp_in = -1; /* group ID */ hid_t gcpl_in = -1; /* group creation property list */ - if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) { + if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); - } - if (H5Pget_userblock(fcpl_in, &ub_size) < 0) { + if (H5Pget_userblock(fcpl_in, &ub_size) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size"); - } /* If the -S option is not set, get "strategy" from the input file */ - if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) { + if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy"); - } /* If the -G option is not set, get "pagesize" from the input file */ - if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) { + if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space threshold"); - } + /* open root group */ if ((grp_in = H5Gopen2(fidin, "/", H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); @@ -148,23 +144,19 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); - if (H5Pclose(fcpl_in) < 0) { + if (H5Pclose(fcpl_in) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list"); - } } /* Check if we need to create a non-default file creation property list */ if (options->latest || ub_size > 0) { /* Create file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); - } - if (ub_size > 0) { - if (H5Pset_userblock(fcpl, ub_size) < 0) { + if (ub_size > 0) + if (H5Pset_userblock(fcpl, ub_size) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size"); - } - } if (options->latest) { unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; @@ -172,9 +164,8 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) /* Adjust group creation parameters for root group */ /* (So that it is created in "dense storage" form) */ if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, - (unsigned) options->grp_indexed) < 0) { + (unsigned) options->grp_indexed) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed to adjust group creation parameters for root group"); - } for (i = 0; i < 5; i++) { if (options->msg_size[i] > 0) { @@ -209,26 +200,21 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) } /* end for */ if (nindex > 0) { - if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) { + if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes"); - } /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ - for (i = 0; i < (nindex - 1); i++) { - if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) { + for (i = 0; i < (nindex - 1); i++) + if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index"); - } /* end if */ - } /* end for */ } /* if (nindex>0) */ /* Create file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); - } /* end if */ - if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set property for using latest version of the format"); - } /* end if */ } /* end if */ } /* end if */ #if defined (H5REPACK_DEBUG_USER_BLOCK) @@ -241,17 +227,14 @@ print_user_block(fnamein, fidin); */ if (options->ublock_size > 0) { /* either use the FCPL already created or create a new one */ - if (fcpl == H5P_DEFAULT) { + if (fcpl == H5P_DEFAULT) /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); - } - } /* set user block size */ - if (H5Pset_userblock(fcpl, options->ublock_size) < 0) { + if (H5Pset_userblock(fcpl, options->ublock_size) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set userblock size"); - } } /*------------------------------------------------------------------------- @@ -260,16 +243,13 @@ print_user_block(fnamein, fidin); */ if (options->alignment > 0) { /* either use the FAPL already created or create a new one */ - if (fapl == H5P_DEFAULT) { + if (fapl == H5P_DEFAULT) /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); - } - } - if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { + if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alignment failed to set alignment"); - } } /*------------------------------------------------------------------------- @@ -278,16 +258,13 @@ print_user_block(fnamein, fidin); */ if (options->meta_block_size > 0) { /* either use the FAPL already created or create a new one */ - if (fapl == H5P_DEFAULT) { + if (fapl == H5P_DEFAULT) /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); - } - } - if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) { + if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_meta_block_size failed to set metadata block size"); - } } /*------------------------------------------------------------------------- @@ -296,12 +273,10 @@ print_user_block(fnamein, fidin); */ /* either use the FCPL already created or create a new one */ - if (fcpl == H5P_DEFAULT) { + if (fcpl == H5P_DEFAULT) /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); - } - } if(H5Pset_link_creation_order(fcpl, crt_order_flags ) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed"); @@ -328,9 +303,8 @@ print_user_block(fnamein, fidin); set_threshold = (hsize_t)options->fs_threshold; /* Set file space information as specified */ - if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0) { + if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_strategy failed to set file space strategy"); - } if(options->fs_pagesize == -1) /* A "0" file space page size is specified by user */ set_pagesize = (hsize_t)0; @@ -338,30 +312,26 @@ print_user_block(fnamein, fidin); set_pagesize = (hsize_t)options->fs_pagesize; if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */ - if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0) { + if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_page_size failed to set file space page size"); - } /*------------------------------------------------------------------------- * create the output file *------------------------------------------------------------------------- */ if (options->verbose) - printf("Making file <%s>...\n", fnameout); + printf("Making new file ...\n"); - if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { + if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fcreate could not create file <%s>:", fnameout); - } /*------------------------------------------------------------------------- * write a new user block if requested *------------------------------------------------------------------------- */ - if (options->ublock_size > 0) { - if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) { + if (options->ublock_size > 0) + if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting..."); - } - } /*------------------------------------------------------------------------- * get list of objects @@ -381,18 +351,16 @@ print_user_block(fnamein, fidin); * do the copy *------------------------------------------------------------------------- */ - if (do_copy_objects(fidin, fidout, travt, options) < 0) { + if (do_copy_objects(fidin, fidout, travt, options) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout); - } /* end if */ /*------------------------------------------------------------------------- * do the copy of referenced objects * and create hard links *------------------------------------------------------------------------- */ - if (do_copy_refobjs(fidin, fidout, travt, options) < 0) { + if (do_copy_refobjs(fidin, fidout, travt, options) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout); - } /*------------------------------------------------------------------------- * close @@ -417,11 +385,9 @@ print_user_block(fnamein, fidin); *------------------------------------------------------------------------- */ - if (ub_size > 0 && options->ublock_size == 0) { - if (copy_user_block(fnamein, fnameout, ub_size) < 0) { + if (ub_size > 0 && options->ublock_size == 0) + if (copy_user_block(fnamein, fnameout, ub_size) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting..."); - } - } return 0; @@ -732,13 +698,14 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, unsigned crt_order_flags; /* group creation order flag */ unsigned i; unsigned u; + unsigned uf; int is_ref = 0; htri_t is_named; hbool_t limit_maxdims; hsize_t size_dset; /*------------------------------------------------------------------------- - * copy the suppplied object list + * copy the supplied object list *------------------------------------------------------------------------- */ @@ -748,12 +715,13 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, printf("-----------------------------------------\n"); } - for (i = 0; i < travt->nobjs; i++) { - /* init variables per obj */ - buf = NULL; - limit_maxdims = FALSE; + if (travt->objs) { + for (i = 0; i < travt->nobjs; i++) { + /* init variables per obj */ + buf = NULL; + limit_maxdims = FALSE; - switch (travt->objs[i].type) { + switch (travt->objs[i].type) { case H5TRAV_TYPE_UNKNOWN: break; @@ -833,10 +801,15 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, req_filter = 1; /* check if filters were requested for individual objects */ - for (u = 0; u < options->op_tbl->nelems; u++) - if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) - if (options->op_tbl->objs[u].filter->filtn > 0) - req_filter = 1; + if (options->op_tbl->objs) { + for (u = 0; u < options->op_tbl->nelems; u++) { + if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) + for (uf = 0; uf < options->op_tbl->objs[uf].nfilters; uf++) { + if (options->op_tbl->objs[u].filter[uf].filtn > 0) + req_filter = 1; + } + } + } /* check if layout change requested individual object */ if (options->layout_g != H5D_LAYOUT_ERROR) { @@ -1012,9 +985,10 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, buf = HDmalloc(need); if (buf != NULL) { - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + if(H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + if(H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); /* Check if we have VL data in the dataset's * datatype that must be reclaimed */ @@ -1097,9 +1071,10 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, hs_select_nelmts = 1; } /* rank */ - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); - CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); + if(H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + if(H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); /* reclaim any VL memory, if necessary */ if (vl_data) @@ -1293,19 +1268,9 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, default: HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Object type not found"); - } /* switch */ - - /* free */ - if (buf != NULL) { - HDfree(buf); - buf = NULL; - } - } /* i */ - - /* Finalize (link) the stack of named datatypes (if any) */ - named_datatype_free(&named_dt_head, 0); - - return ret_value; + } /* switch */ + } /* end for */ + } /* end if */ done: H5E_BEGIN_TRY @@ -1322,8 +1287,7 @@ done: H5Tclose(wtype_id); H5Tclose(type_in); H5Tclose(type_out); - named_datatype_free(&named_dt_head, 1); - }H5E_END_TRY; + } H5E_END_TRY; /* free */ if (buf != NULL) @@ -1331,6 +1295,14 @@ done: if (hslab_buf != NULL) HDfree(hslab_buf); + /* Finalize (link) the stack of named datatypes (if any) */ + if (0 == ret_value && named_dt_head != NULL) + named_datatype_free(&named_dt_head, 0); + else + H5E_BEGIN_TRY { + named_datatype_free(&named_dt_head, 1); + } H5E_END_TRY; + return ret_value; } @@ -1364,8 +1336,11 @@ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int p for (i = 0; i < nfilters; i++) { cd_nelmts = NELMTS(cd_values); - filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts, - cd_values, sizeof(f_objname), f_objname, NULL); + if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_objname), f_objname, NULL)) < 0) { + HDstrcat(strfilter, "ERROR "); + continue; + } switch (filtn) { case H5Z_FILTER_NONE: @@ -1551,7 +1526,7 @@ void print_user_block(const char *filename, hid_t fid) } /* open file */ - if((fh = HDopen(filename, O_RDONLY, 0)) < 0) { + if((fh = HDopen(filename, O_RDONLY)) < 0) { HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed to open file <%s>", filename); } diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index a74e5f3..e968b3c 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -25,23 +25,71 @@ #define MIN(a,b) (((a)<(b)) ? (a) : (b)) /*------------------------------------------------------------------------- + * Function: aux_copy_obj + * + * Purpose: copy the object filters for object copy + * + * Return: 0 success, -1 failure + *------------------------------------------------------------------------- + */ +static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ + const char* name, /* object name from traverse list */ + pack_info_t *objout /*OUT*/) /* info about object to filter */ +{ + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + int nfilters; /* number of filters in DCPL */ + char f_objname[256]; /* filter objname */ + H5D_layout_t layout; + int rank; /* rank of dataset */ + hsize_t chsize[64]; /* chunk size in elements */ + unsigned int i, j; + + /* get information about input filters */ + if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); + /* copy filter_info_t structure */ + for (i = 0; i < nfilters; i++) { + if ((objout->filter[i].filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &objout->filter[i].filt_flag, &objout->filter[i].cd_nelmts, + objout->filter[i].cd_values, sizeof(f_objname), f_objname, NULL)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_filter2 failed"); + } + + objout->nfilters = nfilters; + HDstrcpy(objout->path, name); + + if ((layout = H5Pget_layout(dcpl_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); + objout->layout = layout; + + if (layout == H5D_CHUNKED) { + if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); + objout->chunk.rank = rank; + for (i = 0; i < rank; i++) + objout->chunk.chunk_lengths[i] = chsize[i]; + } + +done: + return ret_value; +} + +/*------------------------------------------------------------------------- * Function: aux_find_obj * * Purpose: find the object name NAME (got from the traverse list) * in the repack options list - * *------------------------------------------------------------------------- */ static int aux_find_obj(const char* name, /* object name from traverse list */ - pack_opt_t *options, /* repack options */ - pack_info_t *obj /*OUT*/) /* info about object to filter */ + pack_opt_t *options, /* repack options */ + pack_info_t *obj /*OUT*/) /* info about object to filter */ { char *pdest; int result; unsigned int i; for (i = 0; i < options->op_tbl->nelems; i++) { - if (HDstrcmp(options->op_tbl->objs[i].path,name) == 0) { + if (HDstrcmp(options->op_tbl->objs[i].path, name) == 0) { *obj = options->op_tbl->objs[i]; return (int) i; } @@ -66,14 +114,12 @@ static int aux_find_obj(const char* name, /* object name from traverse list */ * in the repack options list; assign the filter information OBJ * * Return: 0 not found, 1 found - * *------------------------------------------------------------------------- */ static int aux_assign_obj(const char* name, /* object name from traverse list */ - pack_opt_t *options, /* repack options */ - pack_info_t *obj /*OUT*/) /* info about object to filter */ + pack_opt_t *options, /* repack options */ + pack_info_t *obj /*OUT*/) /* info about object to filter */ { - int idx, i; pack_info_t tmp; @@ -83,7 +129,6 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */ /* name was on input */ if (idx >= 0) { - /* applying to all objects */ if (options->all_layout) { /* assign the global layout info to the OBJ info */ @@ -92,8 +137,7 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */ case H5D_CHUNKED: tmp.chunk.rank = options->chunk_g.rank; for (i = 0; i < tmp.chunk.rank; i++) - tmp.chunk.chunk_lengths[i] = - options->chunk_g.chunk_lengths[i]; + tmp.chunk.chunk_lengths[i] = options->chunk_g.chunk_lengths[i]; break; case H5D_LAYOUT_ERROR: case H5D_COMPACT: @@ -111,8 +155,7 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */ case H5D_CHUNKED: tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank; for (i = 0; i < tmp.chunk.rank; i++) - tmp.chunk.chunk_lengths[i] = - options->op_tbl->objs[idx].chunk.chunk_lengths[i]; + tmp.chunk.chunk_lengths[i] = options->op_tbl->objs[idx].chunk.chunk_lengths[i]; break; case H5D_LAYOUT_ERROR: case H5D_COMPACT: @@ -123,7 +166,6 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */ default: break; }/*switch*/ - } /* applying to all objects */ @@ -183,28 +225,24 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */ * of H5Z_FILTER_NONE present in the PACK_INFO_T filter array * * Return: 0 success, -1 an error occured - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December 19, 2003 - * *------------------------------------------------------------------------- */ int apply_filters(const char* name, /* object name from traverse list */ - int rank, /* rank of dataset */ - hsize_t *dims, /* dimensions of dataset */ - size_t msize, /* size of type */ - hid_t dcpl_id, /* dataset creation property list */ - pack_opt_t *options, /* repack options */ - int *has_filter) /* (OUT) object NAME has a filter */ + int rank, /* rank of dataset */ + hsize_t *dims, /* dimensions of dataset */ + size_t msize, /* size of type */ + hid_t dcpl_id, /* dataset creation property list */ + pack_opt_t *options, /* repack options */ + int *has_filter) /* (OUT) object NAME has a filter */ { int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - int nfilters; /* number of filters in DCPL */ - hsize_t chsize[64]; /* chunk size in elements */ + int nfilters; /* number of filters in DCPL */ + hsize_t chsize[64]; /* chunk size in elements */ H5D_layout_t layout; - int i; + int i, j; pack_info_t obj; + pack_info_t filtobj; *has_filter = 0; @@ -212,15 +250,16 @@ int apply_filters(const char* name, /* object name from traverse list */ HGOTO_DONE(0); /*------------------------------------------------------------------------- - * initialize the assigment object - *------------------------------------------------------------------------- - */ + * initialize the assigment object + *------------------------------------------------------------------------- + */ init_packobject(&obj); + init_packobject(&filtobj); /*------------------------------------------------------------------------- - * find options - *------------------------------------------------------------------------- - */ + * find options + *------------------------------------------------------------------------- + */ if (aux_assign_obj(name, options, &obj) == 0) HGOTO_DONE(0); @@ -228,55 +267,61 @@ int apply_filters(const char* name, /* object name from traverse list */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); + /*------------------------------------------------------------------------- - * check if we have filters in the pipeline - * we want to replace them with the input filters - * only remove if we are inserting new ones - *------------------------------------------------------------------------- - */ + * check if we have filters in the pipeline + * we want to replace them with the input filters + * only remove if we are inserting new ones + *------------------------------------------------------------------------- + */ if (nfilters && obj.nfilters) { *has_filter = 1; if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed"); - } - /*------------------------------------------------------------------------- - * check if there is an existent chunk - * read it only if there is not a requested layout - *------------------------------------------------------------------------- - */ - if (obj.layout == -1) { - if ((layout = H5Pget_layout(dcpl_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); - - if (layout == H5D_CHUNKED) { - if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); - obj.layout = H5D_CHUNKED; - obj.chunk.rank = rank; - for (i = 0; i < rank; i++) - obj.chunk.chunk_lengths[i] = chsize[i]; + /*------------------------------------------------------------------------- + * check if there is an existent chunk + * read it only if there is not a requested layout + *------------------------------------------------------------------------- + */ + if (obj.layout == -1) { + if ((layout = H5Pget_layout(dcpl_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); + + if (layout == H5D_CHUNKED) { + if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); + obj.layout = H5D_CHUNKED; + obj.chunk.rank = rank; + for (i = 0; i < rank; i++) + obj.chunk.chunk_lengths[i] = chsize[i]; + } } } + else if(nfilters) { + *has_filter = 1; + if (aux_copy_obj(dcpl_id, name, &filtobj) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "aux_copy_obj failed"); + } /*------------------------------------------------------------------------- - * the type of filter and additional parameter - * type can be one of the filters - * H5Z_FILTER_NONE 0 , uncompress if compressed - * H5Z_FILTER_DEFLATE 1 , deflation like gzip - * H5Z_FILTER_SHUFFLE 2 , shuffle the data - * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC - * H5Z_FILTER_SZIP 4 , szip compression - * H5Z_FILTER_NBIT 5 , nbit compression - * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression - *------------------------------------------------------------------------- - */ + * the type of filter and additional parameter + * type can be one of the filters + * H5Z_FILTER_NONE 0 , uncompress if compressed + * H5Z_FILTER_DEFLATE 1 , deflation like gzip + * H5Z_FILTER_SHUFFLE 2 , shuffle the data + * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC + * H5Z_FILTER_SZIP 4 , szip compression + * H5Z_FILTER_NBIT 5 , nbit compression + * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression + *------------------------------------------------------------------------- + */ if (obj.nfilters) { /*------------------------------------------------------------------------- - * filters require CHUNK layout; if we do not have one define a default - *------------------------------------------------------------------------- - */ + * filters require CHUNK layout; if we do not have one define a default + *------------------------------------------------------------------------- + */ if (obj.layout == -1) { /* stripmine info */ hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ @@ -285,9 +330,9 @@ int apply_filters(const char* name, /* object name from traverse list */ obj.chunk.rank = rank; /* - * determine the strip mine size. The strip mine is - * a hyperslab whose size is manageable. - */ + * determine the strip mine size. The strip mine is + * a hyperslab whose size is manageable. + */ sm_nbytes = msize; for (i = rank; i > 0; --i) { @@ -305,18 +350,21 @@ int apply_filters(const char* name, /* object name from traverse list */ } for (i = 0; i < obj.nfilters; i++) { + if (obj.filter[i].filtn < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); + switch (obj.filter[i].filtn) { /*------------------------------------------------------------------------- - * H5Z_FILTER_NONE 0 , uncompress if compressed - *------------------------------------------------------------------------- - */ + * H5Z_FILTER_NONE 0 , uncompress if compressed + *------------------------------------------------------------------------- + */ case H5Z_FILTER_NONE: break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE 1 , deflation like gzip - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5Z_FILTER_DEFLATE 1 , deflation like gzip + *------------------------------------------------------------------------- + */ case H5Z_FILTER_DEFLATE: { unsigned aggression; /* the deflate level */ @@ -330,10 +378,10 @@ int apply_filters(const char* name, /* object name from traverse list */ } break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP 4 , szip compression - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5Z_FILTER_SZIP 4 , szip compression + *------------------------------------------------------------------------- + */ case H5Z_FILTER_SZIP: { unsigned options_mask; @@ -350,10 +398,10 @@ int apply_filters(const char* name, /* object name from traverse list */ } break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_SHUFFLE 2 , shuffle the data - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5Z_FILTER_SHUFFLE 2 , shuffle the data + *------------------------------------------------------------------------- + */ case H5Z_FILTER_SHUFFLE: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); @@ -361,31 +409,30 @@ int apply_filters(const char* name, /* object name from traverse list */ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shuffle failed"); break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC + *------------------------------------------------------------------------- + */ case H5Z_FILTER_FLETCHER32: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); if (H5Pset_fletcher32(dcpl_id) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fletcher32 failed"); break; - /*----------- ------------------------------------------------------------- - * H5Z_FILTER_NBIT , NBIT compression - *------------------------------------------------------------------------- - */ + /*----------- ------------------------------------------------------------- + * H5Z_FILTER_NBIT , NBIT compression + *------------------------------------------------------------------------- + */ case H5Z_FILTER_NBIT: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); if (H5Pset_nbit(dcpl_id) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_nbit failed"); break; - /*----------- ------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET , scale+offset compression - *------------------------------------------------------------------------- - */ - + /*----------- ------------------------------------------------------------- + * H5Z_FILTER_SCALEOFFSET , scale+offset compression + *------------------------------------------------------------------------- + */ case H5Z_FILTER_SCALEOFFSET: { H5Z_SO_scale_type_t scale_type; @@ -402,12 +449,12 @@ int apply_filters(const char* name, /* object name from traverse list */ break; default: { + if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); if (H5Pset_filter(dcpl_id, obj.filter[i].filtn, obj.filter[i].filt_flag, obj.filter[i].cd_nelmts, obj.filter[i].cd_values) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_filter failed"); - if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); } break; } /* switch */ @@ -415,10 +462,20 @@ int apply_filters(const char* name, /* object name from traverse list */ } /*obj.nfilters*/ + if (filtobj.nfilters) { + for (i = 0; i < filtobj.nfilters; i++) { + if (filtobj.filter[i].filtn < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); + + if (H5Zfilter_avail(filtobj.filter[i].filtn) <= 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "%d filter unavailable", filtobj.filter[i].filtn); + } /* for */ + } /* nfilters */ + /*------------------------------------------------------------------------- - * layout - *------------------------------------------------------------------------- - */ + * layout + *------------------------------------------------------------------------- + */ if (obj.layout >= 0) { /* a layout was defined */ @@ -438,7 +495,6 @@ int apply_filters(const char* name, /* object name from traverse list */ if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed"); } - } done: diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 3860451..d34c394 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -428,13 +428,13 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char) opt) { - /* -i for backward compability */ + /* -i for backward compatibility */ case 'i': infile = opt_arg; has_i_o = 1; break; - /* -o for backward compability */ + /* -o for backward compatibility */ case 'o': outfile = opt_arg; has_i_o = 1; @@ -695,8 +695,10 @@ int main(int argc, const char **argv) } /* initialize options */ - h5repack_init(&options, 0, FALSE); - + if (h5repack_init(&options, 0, FALSE) < 0) { + h5tools_setstatus(EXIT_FAILURE); + goto done; + } /* Initialize default indexing options */ sort_by = H5_INDEX_CRT_ORDER; diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c index 6c409ec..7ab8c6e 100644 --- a/tools/src/h5repack/h5repack_opttable.c +++ b/tools/src/h5repack/h5repack_opttable.c @@ -30,6 +30,7 @@ void init_packobject(pack_info_t *obj) { HDstrcpy(obj->path, "\0"); for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) { obj->filter[j].filtn = -1; + obj->filter[j].cd_nelmts = CD_VALUES; for (k = 0; k < CD_VALUES; k++) obj->filter[j].cd_values[k] = 0; } @@ -261,7 +262,7 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pa /* search if this object is already in the table; "path" is the key */ if (table->nelems > 0) { - /* go tru the supplied list of names */ + /* go through the supplied list of names */ for (j = 0; j < n_objs; j++) { /* linear table search */ for (i = 0; i < table->nelems; i++) { diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index 4d62723..05af197 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/h5repack/h5repack_parse.c @@ -58,26 +58,30 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, /* check for the end of object list and number of objects */ for (i = 0, n = 0; i < len; i++) { c = str[i]; - if (c == ':') + if (c == ':') { end_obj = (int) i; + break; + } if (c == ',') n++; } + n++; /* Check for missing : */ if (end_obj == -1) { /* apply to all objects */ options->all_filter = 1; *is_glb = 1; + *n_objs = 1; } + else + *n_objs = n; - n++; obj_list = (obj_list_t *) HDmalloc(n * sizeof(obj_list_t)); if (obj_list == NULL) { error_msg("could not allocate object list\n"); return NULL; } - *n_objs = n; /* get object list */ if (end_obj > 0) @@ -89,6 +93,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, sobj[k] = '\0'; else sobj[k + 1] = '\0'; + HDstrcpy(obj_list[n].obj, sobj); HDmemset(sobj, 0, sizeof(sobj)); n++; @@ -142,7 +147,6 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, if (l == 2) { smask[l] = '\0'; i = len - 1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ if (HDstrcmp(smask,"NN") == 0) filt->cd_values[j++] = H5_SZIP_NN_OPTION_MASK; else if (HDstrcmp(smask,"EC") == 0) @@ -193,7 +197,6 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, if (l == 2) { smask[l] = '\0'; i = len - 1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ if (HDstrcmp(smask,"IN") == 0) filt->cd_values[j++] = H5Z_SO_INT; else if (HDstrcmp(smask, "DS") == H5Z_SO_FLOAT_DSCALE) diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 36038b5..376ab92 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -30,15 +30,10 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, /*------------------------------------------------------------------------- * Function: do_copy_refobjs * - * Purpose: duplicate all referenced HDF5 objects in the file - * and create hard links - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December, 10, 2003 + * Purpose: duplicate all referenced HDF5 objects in the file + * and create hard links * + * Return: 0, ok, -1 no *------------------------------------------------------------------------- */ @@ -47,41 +42,39 @@ int do_copy_refobjs(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t grp_in = (-1); /* read group ID */ - hid_t grp_out = (-1); /* write group ID */ - hid_t dset_in = (-1); /* read dataset ID */ - hid_t dset_out = (-1); /* write dataset ID */ - hid_t type_in = (-1); /* named type ID */ - hid_t dcpl_id = (-1); /* dataset creation property list ID */ - hid_t space_id = (-1); /* space ID */ - hid_t ftype_id = (-1); /* file data type ID */ - hid_t mtype_id = (-1); /* memory data type ID */ + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + hid_t grp_in = -1; /* read group ID */ + hid_t grp_out = -1; /* write group ID */ + hid_t dset_in = -1; /* read dataset ID */ + hid_t dset_out = -1; /* write dataset ID */ + hid_t type_in = -1; /* named type ID */ + hid_t dcpl_id = -1; /* dataset creation property list ID */ + hid_t space_id = -1; /* space ID */ + hid_t ftype_id = -1; /* file data type ID */ + hid_t mtype_id = -1; /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */ unsigned int i, j; int k; - named_dt_t *named_dt_head=NULL; /* Pointer to the stack of named datatypes - copied */ + named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ /*------------------------------------------------------------------------- * browse *------------------------------------------------------------------------- */ for(i = 0; i < travt->nobjs; i++) { - switch(travt->objs[i].type) - { + switch(travt->objs[i].type) { /*------------------------------------------------------------------------- - * H5TRAV_TYPE_GROUP - *------------------------------------------------------------------------- - */ + * H5TRAV_TYPE_GROUP + *------------------------------------------------------------------------- + */ case H5TRAV_TYPE_GROUP: /*------------------------------------------------------------------------- - * copy referenced objects in attributes - *------------------------------------------------------------------------- - */ + * copy referenced objects in attributes + *------------------------------------------------------------------------- + */ if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); @@ -97,18 +90,18 @@ int do_copy_refobjs(hid_t fidin, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); /*------------------------------------------------------------------------- - * check for hard links - *------------------------------------------------------------------------- - */ + * check for hard links + *------------------------------------------------------------------------- + */ if(travt->objs[i].nlinks) for(j = 0; j < travt->objs[i].nlinks; j++) H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT); break; /*------------------------------------------------------------------------- - * H5TRAV_TYPE_DATASET - *------------------------------------------------------------------------- - */ + * H5TRAV_TYPE_DATASET + *------------------------------------------------------------------------- + */ case H5TRAV_TYPE_DATASET: if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); @@ -141,16 +134,16 @@ int do_copy_refobjs(hid_t fidin, */ if(h5tools_canreadf(NULL, dcpl_id) == 1) { /*------------------------------------------------------------------------- - * test for a valid output dataset - *------------------------------------------------------------------------- - */ + * test for a valid output dataset + *------------------------------------------------------------------------- + */ dset_out = FAIL; /*------------------------------------------------------------------------- - * object references are a special case - * we cannot just copy the buffers, but instead we recreate the reference - *------------------------------------------------------------------------- - */ + * object references are a special case + * we cannot just copy the buffers, but instead we recreate the reference + *------------------------------------------------------------------------- + */ if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { hid_t refobj_id; hobj_ref_t *refbuf = NULL; /* buffer for object references */ @@ -159,9 +152,9 @@ int do_copy_refobjs(hid_t fidin, unsigned u; /*------------------------------------------------------------------------- - * read to memory - *------------------------------------------------------------------------- - */ + * read to memory + *------------------------------------------------------------------------- + */ if(nelmts) { buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf==NULL) { @@ -201,9 +194,9 @@ int do_copy_refobjs(hid_t fidin, } /*nelmts*/ /*------------------------------------------------------------------------- - * create/write dataset/close - *------------------------------------------------------------------------- - */ + * create/write dataset/close + *------------------------------------------------------------------------- + */ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); if(nelmts) @@ -223,11 +216,10 @@ int do_copy_refobjs(hid_t fidin, } /*H5T_STD_REF_OBJ*/ /*------------------------------------------------------------------------- - * dataset region references - *------------------------------------------------------------------------- - */ - else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) - { + * dataset region references + *------------------------------------------------------------------------- + */ + else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) { hid_t refobj_id; hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */ hdset_reg_ref_t *buf = NULL; /* output buffer */ @@ -235,9 +227,9 @@ int do_copy_refobjs(hid_t fidin, unsigned u; /*------------------------------------------------------------------------- - * read input to memory - *------------------------------------------------------------------------- - */ + * read input to memory + *------------------------------------------------------------------------- + */ if(nelmts) { buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { @@ -248,9 +240,9 @@ int do_copy_refobjs(hid_t fidin, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); /*------------------------------------------------------------------------- - * create output - *------------------------------------------------------------------------- - */ + * create output + *------------------------------------------------------------------------- + */ refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { printf("cannot allocate memory\n"); @@ -289,9 +281,9 @@ int do_copy_refobjs(hid_t fidin, } /*nelmts*/ /*------------------------------------------------------------------------- - * create/write dataset/close - *------------------------------------------------------------------------- - */ + * create/write dataset/close + *------------------------------------------------------------------------- + */ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); if(nelmts) @@ -310,25 +302,25 @@ int do_copy_refobjs(hid_t fidin, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); } /* H5T_STD_REF_DSETREG */ /*------------------------------------------------------------------------- - * not references, open previously created object in 1st traversal - *------------------------------------------------------------------------- - */ + * not references, open previously created object in 1st traversal + *------------------------------------------------------------------------- + */ else { if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); } /* end else */ /*------------------------------------------------------------------------- - * copy referenced objects in attributes - *------------------------------------------------------------------------- - */ + * copy referenced objects in attributes + *------------------------------------------------------------------------- + */ if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); /*------------------------------------------------------------------------- - * check for hard links - *------------------------------------------------------------------------- - */ + * check for hard links + *------------------------------------------------------------------------- + */ if(travt->objs[i].nlinks) for(j = 0; j < travt->objs[i].nlinks; j++) H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT); @@ -338,9 +330,9 @@ int do_copy_refobjs(hid_t fidin, } /*can_read*/ /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ + * close + *------------------------------------------------------------------------- + */ if(H5Tclose(ftype_id) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); if(H5Tclose(mtype_id) < 0) @@ -354,9 +346,9 @@ int do_copy_refobjs(hid_t fidin, break; /*------------------------------------------------------------------------- - * H5TRAV_TYPE_NAMED_DATATYPE - *------------------------------------------------------------------------- - */ + * H5TRAV_TYPE_NAMED_DATATYPE + *------------------------------------------------------------------------- + */ case H5TRAV_TYPE_NAMED_DATATYPE: if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); @@ -365,9 +357,9 @@ int do_copy_refobjs(hid_t fidin, break; /*------------------------------------------------------------------------- - * H5TRAV_TYPE_LINK - *------------------------------------------------------------------------- - */ + * H5TRAV_TYPE_LINK + *------------------------------------------------------------------------- + */ case H5TRAV_TYPE_LINK: /*nothing to do */ break; @@ -410,27 +402,22 @@ done: /*------------------------------------------------------------------------- * Function: copy_refs_attr * - * Purpose: duplicate all referenced HDF5 located in attributes - * relative to LOC_IN, which is obtained either from - * loc_id = H5Gopen2(fid, name, H5P_DEFAULT); - * loc_id = H5Dopen2(fid, name, H5P_DEFAULT); - * loc_id = H5Topen2(fid, name, H5P_DEFAULT); - * - * Return: 0, ok, -1 no + * Purpose: duplicate all referenced HDF5 located in attributes + * relative to LOC_IN, which is obtained either from + * loc_id = H5Gopen2(fid, name, H5P_DEFAULT); + * loc_id = H5Dopen2(fid, name, H5P_DEFAULT); + * loc_id = H5Topen2(fid, name, H5P_DEFAULT); * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Return: 0, ok, -1 no * - * Modifier: xcao@hdfgroup.org, 9/12/2011 - * Update values of references(object and region) for the following types: + * Modified: + * Update values of references(object and region) for the following types: * 1) References, * 2) ARRAY of reference, * 3) VLEN of references. * 4) COMPOUND of references. - * This function does not handle references in other complicated structures, - * such as references in nested compound datatypes. - * - * Date: October, 28, 2003 - * + * This function does not handle references in other complicated structures, + * such as references in nested compound datatypes. *------------------------------------------------------------------------- */ @@ -438,30 +425,32 @@ static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, trav_table_t *travt, - hid_t fidout /* for saving references */ - ) + hid_t fidout) /* for saving references */ { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t attr_id = -1; /* attr ID */ - hid_t attr_out = -1; /* attr ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file data type ID */ - hid_t mtype_id = -1; /* memory data type ID */ - size_t msize; /* memory size of type */ - hsize_t nelmts; /* number of elements in dataset */ - hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ - char name[255]; - H5O_info_t oinfo; /* Object info */ - unsigned u, i, j; - int rank; + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + hid_t attr_id = -1; /* attr ID */ + hid_t attr_out = -1; /* attr ID */ + hid_t space_id = -1; /* space ID */ + hid_t ftype_id = -1; /* file data type ID */ + hid_t mtype_id = -1; /* memory data type ID */ + size_t msize; /* memory size of type */ + hsize_t nelmts; /* number of elements in dataset */ + hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ + char name[255]; + H5O_info_t oinfo; /* Object info */ + unsigned u, i, j; + int rank; H5T_class_t type_class = -1; - hbool_t is_ref=0, is_ref_vlen=0, is_ref_array=0, is_ref_comp=0; - void *refbuf = NULL; - void *buf = NULL; - const char* refname = NULL; - unsigned *ref_comp_index = NULL; - size_t *ref_comp_size = NULL; - int ref_comp_field_n = 0; + hbool_t is_ref = 0, + is_ref_vlen = 0, + is_ref_array = 0, + is_ref_comp = 0; + void *refbuf = NULL; + void *buf = NULL; + const char *refname = NULL; + unsigned *ref_comp_index = NULL; + size_t *ref_comp_size = NULL; + int ref_comp_field_n = 0; if(H5Oget_info(loc_in, &oinfo) < 0) @@ -492,7 +481,7 @@ static int copy_refs_attr(hid_t loc_in, hid_t base_type; base_type = H5Tget_super(ftype_id); - is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE); + is_ref_vlen = (H5Tget_class(base_type) == H5T_REFERENCE); msize = H5Tget_size(base_type); H5Tclose(base_type); } @@ -500,7 +489,7 @@ static int copy_refs_attr(hid_t loc_in, hid_t base_type; base_type = H5Tget_super(ftype_id); - is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE); + is_ref_array = (H5Tget_class(base_type) == H5T_REFERENCE); msize = H5Tget_size(base_type); H5Tclose(base_type); } @@ -515,9 +504,9 @@ static int copy_refs_attr(hid_t loc_in, ref_comp_field_n = 0; for (i=0; i<(unsigned)nmembers; i++) { - hid_t mtid = H5Tget_member_type( ftype_id, i ); + hid_t mtid = H5Tget_member_type(ftype_id, i); - if ((H5Tget_class(mtid)==H5T_REFERENCE)) { + if ((H5Tget_class(mtid) == H5T_REFERENCE)) { ref_comp_index[ref_comp_field_n] = i; ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid); ref_comp_field_n++; @@ -627,9 +616,9 @@ static int copy_refs_attr(hid_t loc_in, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); /*------------------------------------------------------------------------- - * create output - *------------------------------------------------------------------------- - */ + * create output + *------------------------------------------------------------------------- + */ refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { printf( "cannot allocate memory\n" ); @@ -669,7 +658,8 @@ static int copy_refs_attr(hid_t loc_in, HDmemcpy(&(ptr[j]), &ref_out, msize); } } /* for (i=0; inobjs; u++) { @@ -830,18 +817,16 @@ out: /*------------------------------------------------------------------------- * Function: Update_Ref_value * - * Purpose: Update a reference value - * - * Programmer: xcao@hdfgroup.org 9/12/2011 - * + * Purpose: Update a reference value *------------------------------------------------------------------------- */ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out, trav_table_t *travt) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - const char* ref_obj_name; - hid_t space_id=-1, ref_obj_id=-1; + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + const char *ref_obj_name; + hid_t space_id = -1; + hid_t ref_obj_id = -1; ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); if (ref_obj_id < 0) diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index e276b7b..dbe8e1a 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -39,22 +39,22 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ hid_t fidin = -1; /* file ID for input file*/ hid_t fidout = -1; /* file ID for output file*/ hid_t did = -1; /* dataset ID */ hid_t pid = -1; /* dataset creation property list ID */ hid_t sid = -1; /* space ID */ hid_t tid = -1; /* type ID */ + int ok = 1; /* step results */ unsigned int i; trav_table_t *travt = NULL; - int ok = 1; - hid_t fcpl_in = -1; /* file creation property for input file */ - hid_t fcpl_out = -1; /* file creation property for output file */ + hid_t fcpl_in = -1; /* file creation property for input file */ + hid_t fcpl_out = -1; /* file creation property for output file */ H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */ - hbool_t in_persist, out_persist; /* free-space persist status for in/output file */ - hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */ - hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */ + hbool_t in_persist, out_persist; /* free-space persist status for in/output file */ + hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */ + hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */ /* open the output file */ if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) @@ -84,7 +84,6 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options if(verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0) ok = 0; - /*------------------------------------------------------------------------- * layout check *------------------------------------------------------------------------- @@ -104,10 +103,8 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); if (H5Tclose(tid) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - } - /*------------------------------------------------------------------------- * check for the "all" objects option *------------------------------------------------------------------------- @@ -163,7 +160,6 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options ok = 0; } - /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -177,11 +173,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options if (H5Tclose(tid) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); } /* if */ - } /* i */ /* free table */ trav_table_free(travt); + travt = NULL; } /*------------------------------------------------------------------------- @@ -190,39 +186,33 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ /* open the input file */ - if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) + if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on file <%s>", in_fname); /* Get file creation property list for input file */ - if((fcpl_in = H5Fget_create_plist(fidin)) < 0) { + if((fcpl_in = H5Fget_create_plist(fidin)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); - } /* Get file space info for input file */ - if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) { + if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); - } /* Get file space page size for input file */ - if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) { + if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size"); - } /* Output file is already opened */ /* Get file creation property list for output file */ - if((fcpl_out = H5Fget_create_plist(fidout)) < 0) { + if((fcpl_out = H5Fget_create_plist(fidout)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); - } /* Get file space info for output file */ - if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0) { + if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); - } /* Get file space page size for output file */ - if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0) { + if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size"); - } /* * If -S option is set, the file space handling strategy should be set as specified. @@ -230,14 +220,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options * the same as the input file's strategy. */ if(options->fs_strategy) { - if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy)) { + if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy)) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); - } } else { - if(out_strategy != in_strategy) { + if(out_strategy != in_strategy) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); - } } /* @@ -246,14 +234,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options * the same as the input file's free-space persist status */ if(options->fs_persist) { - if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist)) { + if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist)) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected"); - } } else { - if(out_persist != in_persist) { + if(out_persist != in_persist) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected"); - } } /* @@ -262,14 +248,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options * input file's threshold size. */ if(options->fs_threshold) { - if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold)) { + if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold)) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected"); - } } else { - if(out_threshold != in_threshold) { + if(out_threshold != in_threshold) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected"); - } } /* @@ -278,27 +262,16 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options * the same as the input file's file space page size. */ if(options->fs_pagesize) { - if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize)) { + if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize)) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected"); - } } else { /* "-G" is not set */ - if(out_pagesize != in_pagesize) { + if(out_pagesize != in_pagesize) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected"); - } - } - /* Closing */ - if (H5Pclose(fcpl_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Pclose(fcpl_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Fclose(fidin) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); - if (H5Fclose(fidout) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); + } - return ok; + ret_value = ok; done: H5E_BEGIN_TRY { @@ -307,6 +280,7 @@ done: H5Pclose(pid); H5Sclose(sid); H5Dclose(did); + H5Tclose(tid); H5Fclose(fidin); H5Fclose(fidout); if (travt) @@ -319,13 +293,15 @@ done: /*------------------------------------------------------------------------- * Function: verify_layout * - * Purpose: verify which layout is present in the property list DCPL_ID - * - * H5D_COMPACT = 0 - * H5D_CONTIGUOUS = 1 - * H5D_CHUNKED = 2 + * Purpose: verify which layout is present in the property list DCPL_ID + * H5D_COMPACT = 0 + * H5D_CONTIGUOUS = 1 + * H5D_CHUNKED = 2 * - * Return: 1 has, 0 does not, -1 error + * Return: + * 1 has, + * 0 does not, + * -1 error *------------------------------------------------------------------------- */ @@ -342,7 +318,7 @@ int verify_layout(hid_t pid, pack_info_t *obj) return -1; /* a non chunked layout was requested on a filtered object */ - if (nfilters && obj->layout!=H5D_CHUNKED) + if (nfilters && obj->layout != H5D_CHUNKED) return 0; /* get layout */ @@ -353,11 +329,11 @@ int verify_layout(hid_t pid, pack_info_t *obj) return 0; if (layout==H5D_CHUNKED) { - if ((rank = H5Pget_chunk(pid,NELMTS(chsize),chsize/*out*/)) < 0) + if ((rank = H5Pget_chunk(pid, NELMTS(chsize), chsize/*out*/)) < 0) return -1; if (obj->chunk.rank != rank) return 0; - for ( i=0; ichunk.chunk_lengths[i]) return 0; } @@ -368,50 +344,40 @@ int verify_layout(hid_t pid, pack_info_t *obj) /*------------------------------------------------------------------------- * Function: h5repack_cmp_pl * - * Purpose: compare 2 files for identical property lists of all objects + * Purpose: compare 2 files for identical property lists of all objects * - * Return: 1=identical, 0=not identical, -1=error + * Return: + * 1 = identical, + * 0 = not identical, + * -1 = error *------------------------------------------------------------------------- */ int h5repack_cmp_pl(const char *fname1, const char *fname2) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t fid1=-1; /* file ID */ - hid_t fid2=-1; /* file ID */ - hid_t dset1=-1; /* dataset ID */ - hid_t dset2=-1; /* dataset ID */ - hid_t gid=-1; /* group ID */ - hid_t dcpl1=-1; /* dataset creation property list ID */ - hid_t dcpl2=-1; /* dataset creation property list ID */ - hid_t gcplid=-1; /* group creation property list */ - unsigned crt_order_flag1; /* group creation order flag */ - unsigned crt_order_flag2; /* group creation order flag */ - trav_table_t *trav=NULL; - int ret=1; + int ret_value = 1; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + hid_t fid1 =-1; /* file ID */ + hid_t fid2 =-1; /* file ID */ + hid_t dset1 =-1; /* dataset ID */ + hid_t dset2 =-1; /* dataset ID */ + hid_t gid =-1; /* group ID */ + hid_t dcpl1 =-1; /* dataset creation property list ID */ + hid_t dcpl2 =-1; /* dataset creation property list ID */ + hid_t gcplid =-1; /* group creation property list */ + unsigned crt_order_flag1; /* group creation order flag */ + unsigned crt_order_flag2; /* group creation order flag */ + trav_table_t *trav = NULL; unsigned int i; /*------------------------------------------------------------------------- * open the files *------------------------------------------------------------------------- */ - - /* disable error reporting */ - H5E_BEGIN_TRY - { - - /* Open the files */ - if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { - error_msg("<%s>: %s\n", fname1, H5FOPENERROR ); - return -1; - } - if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { - error_msg("<%s>: %s\n", fname2, H5FOPENERROR ); - H5Fclose(fid1); - return -1; - } - /* enable error reporting */ - } H5E_END_TRY; + /* Open the files */ + if ((fid1 = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR); + if ((fid2 = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR); /*------------------------------------------------------------------------- * get file table list of objects @@ -452,9 +418,8 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2) if (H5Gclose(gid) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); - if (crt_order_flag1 != crt_order_flag2) { - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name); - } + if (crt_order_flag1 != crt_order_flag2) + HGOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name); } else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) { if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) @@ -470,12 +435,11 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2) * compare the property lists *------------------------------------------------------------------------- */ - if((ret = H5Pequal(dcpl1, dcpl2)) < 0) + if((ret_value = H5Pequal(dcpl1, dcpl2)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed"); - if(ret == 0) { - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed for <%s> are different",trav->objs[i].name); - } + if(ret_value == 0) + HGOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name); /*------------------------------------------------------------------------- * close @@ -490,29 +454,8 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2) if(H5Dclose(dset2) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); } /*if*/ - } /*i*/ - - /*------------------------------------------------------------------------- - * free - *------------------------------------------------------------------------- - */ - - trav_table_free(trav); + } /*for*/ - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - H5Fclose(fid1); - H5Fclose(fid2); - - return ret; - -/*------------------------------------------------------------------------- -* error -*------------------------------------------------------------------------- -*/ done: H5E_BEGIN_TRY { @@ -524,7 +467,8 @@ done: H5Fclose(fid2); H5Pclose(gcplid); H5Gclose(gid); - trav_table_free(trav); + if(trav) + trav_table_free(trav); } H5E_END_TRY; return ret_value; @@ -534,14 +478,14 @@ done: /*------------------------------------------------------------------------- * Function: verify_filters * - * Purpose: verify if all requested filters in the array FILTER obtained - * from user input are present in the property list PID obtained from - * the output file + * Purpose: verify if all requested filters in the array FILTER obtained + * from user input are present in the property list PID obtained from + * the output file * * Return: - * 1 match - * 0 do not match - * -1 error + * 1 match + * 0 do not match + * -1 error *------------------------------------------------------------------------- */ @@ -583,6 +527,8 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) cd_values, sizeof(f_name), f_name, NULL); /* filter ID */ + if (filtn < 0) + return -1; if (filtn != filter[i].filtn) return 0; @@ -657,4 +603,3 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) return 1; } - diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index f6951a3..9a41fb3 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -19,9 +19,10 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) #add_test (NAME h5diffgentest COMMAND $) endif () - #----------------------------------------------------------------------------- - # If plugin library tests can be tested - #----------------------------------------------------------------------------- +#----------------------------------------------------------------------------- +# If plugin library tests can be tested +#----------------------------------------------------------------------------- +if (BUILD_SHARED_LIBS) set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff") set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) @@ -46,5 +47,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) "$" "${CMAKE_BINARY_DIR}/plugins/$" ) +endif () - include (CMakeTests.cmake) +include (CMakeTests.cmake) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 1c15880..d87a47f 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -501,7 +501,7 @@ add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -516,7 +516,7 @@ add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -546,7 +546,7 @@ add_test ( NAME H5DIFF_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}_ERR.out" @@ -562,7 +562,7 @@ add_test ( NAME H5DIFF_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}_ERR.out" @@ -1653,8 +1653,10 @@ ADD_H5_TEST (h5diff_v3 0 -c ${FILEV1} ${FILEV2}) ############################################################################## ### P L U G I N T E S T S ############################################################################## -ADD_H5_UD_TEST (h5diff_plugin_test 0 h5diff_ud -v tudfilter.h5 tudfilter2.h5) -ADD_H5_UD_TEST (h5diff_plugin_fail 2 h5diff_udfail -v tudfilter.h5 tudfilter2.h5) +if (BUILD_SHARED_LIBS) + ADD_H5_UD_TEST (h5diff_plugin_test 0 h5diff_ud -v tudfilter.h5 tudfilter2.h5) + ADD_H5_UD_TEST (h5diff_plugin_fail 2 h5diff_udfail -v tudfilter.h5 tudfilter2.h5) +endif () # ############################################################################## # # END diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 01f6623..0eaa2d0 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -287,9 +287,9 @@ typedef struct s1_t { #define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1) /* File 65 macros */ -#define STRATEGY H5F_FSPACE_STRATEGY_NONE /* File space handling strategy */ -#define THRESHOLD10 10 /* Free-space section threshold */ -#define FSPACE_PAGE_SIZE 8192 /* File space page size */ +#define STRATEGY H5F_FSPACE_STRATEGY_NONE /* File space handling strategy */ +#define THRESHOLD10 10 /* Free-space section threshold */ +#define FSPACE_PAGE_SIZE 8192 /* File space page size */ /* "FILE66" macros and for FILE69 */ #define F66_XDIM 8 diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index c68f18a..559dd88 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -1377,11 +1377,7 @@ ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,0,1,9) ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE) # check for no parameters - set (TESTRETVAL 255) - if (WIN32) - set (TESTRETVAL -1) - endif () - ADD_H5_UD_TEST (plugin_zero ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0,0) + ADD_H5_UD_TEST (plugin_zero 0 h5repack_layout.h5 -v -f UD=250,0,0) if (HDF5_TEST_VFD) # Run test with different Virtual File Driver diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index efce43f..ae9ce25 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -1,15 +1,15 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright by The HDF Group. * -* Copyright by the Board of Trustees of the University of Illinois. * -* All rights reserved. * -* * -* This file is part of HDF5. The full HDF5 copyright notice, including * -* terms governing use, modification, and redistribution, is contained in * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" #include "h5test.h" @@ -78,15 +78,15 @@ #define FNAME18 "h5repack_layout2.h5" /* Files for testing file space paging */ -#define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */ +#define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */ #define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */ const char *H5REPACK_FSPACE_FNAMES[] = { "h5repack_latest.h5", /* 0 */ "h5repack_default.h5", /* 1 */ - "h5repack_page_persist.h5", /* 2 */ - "h5repack_fsm_aggr_persist.h5", /* 3 */ + "h5repack_page_persist.h5", /* 2 */ + "h5repack_fsm_aggr_persist.h5", /* 3 */ "h5repack_page_threshold.h5", /* 4 */ - "h5repack_fsm_aggr_threshold.h5", /* 5 */ + "h5repack_fsm_aggr_threshold.h5", /* 5 */ "h5repack_aggr.h5", /* 6 */ "h5repack_none.h5" /* 7 */ }; @@ -126,9 +126,9 @@ const char *H5REPACK_FILENAMES[] = { #define REG_REF_DS1 "Dset_REGREF" /*------------------------------------------------------------------------- -* prototypes -*------------------------------------------------------------------------- -*/ + * prototypes + *------------------------------------------------------------------------- + */ static int make_all_objects(hid_t loc_id); static int make_attributes(hid_t loc_id); static int make_hlinks(hid_t loc_id); @@ -164,31 +164,27 @@ static int make_complex_attr_references(hid_t loc_id); /*------------------------------------------------------------------------- -* Function: main -* -* Purpose: Executes h5repack tests -* -* Return: Success: zero -* Failure: 1 -* -* Programmer: Pedro Vicente -* January, 6, 2004 -* -*------------------------------------------------------------------------- -*/ + * Function: main + * + * Purpose: Executes h5repack tests + * + * Return: Success: zero + * Failure: 1 + *------------------------------------------------------------------------- + */ int main (void) { pack_opt_t pack_options; diff_opt_t diff_options; - unsigned j; /* Local index variable for testing file space */ - const char *fname; /* File name for testing file space */ + unsigned j; /* Local index variable for testing file space */ + const char *fname; /* File name for testing file space */ - h5_stat_t file_stat; - h5_stat_size_t fsize1, fsize2; /* file sizes */ + h5_stat_t file_stat; + h5_stat_size_t fsize1, fsize2; /* file sizes */ #if defined (H5_HAVE_FILTER_SZIP) - int szip_can_encode = 0; + int szip_can_encode = 0; #endif h5tools_setprogname(PROGRAMNAME); @@ -211,28 +207,28 @@ int main (void) PASSED(); /*------------------------------------------------------------------------- - * Format of the tests: - * - * 1) make a copy of the file with h5repack - * 2) use the h5diff function to compare the input and output file - *------------------------------------------------------------------------- - */ + * Format of the tests: + * + * 1) make a copy of the file with h5repack + * 2) use the h5diff function to compare the input and output file + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- - * Testing file space info setting - *------------------------------------------------------------------------- - */ + * Testing file space info setting + *------------------------------------------------------------------------- + */ TESTING(" files with file space info setting--no options (-S, -P, -T, -G) are set"); - j = 0; /* #0 */ + j = 0; /* #0 */ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); fname = H5REPACK_FSPACE_FNAMES[j]; if(h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - + if(h5repack(fname, FSPACE_OUT, &pack_options) < 0) GOERROR; if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0) + if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) GOERROR; if(h5repack_end(&pack_options) < 0) GOERROR; @@ -240,20 +236,20 @@ int main (void) TESTING(" files with file space info setting--all options -S, -P, -T, -G are set"); - ++j; /* #1 */ + ++j; /* #1 */ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); - fname = H5REPACK_FSPACE_FNAMES[j]; + fname = H5REPACK_FSPACE_FNAMES[j]; if(h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE; pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */ - pack_options.fs_threshold = 1; + pack_options.fs_threshold = 1; pack_options.fs_pagesize = 8192; if(h5repack(fname, FSPACE_OUT, &pack_options) < 0) GOERROR; if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0) + if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) GOERROR; if(h5repack_end(&pack_options) < 0) GOERROR; @@ -261,18 +257,18 @@ int main (void) TESTING(" files with file space info setting--options -S and -T are set"); - ++j; /* #2 */ + ++j; /* #2 */ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); fname = H5REPACK_FSPACE_FNAMES[j]; if(h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - pack_options.fs_strategy = (H5F_fspace_strategy_t)-1; /* "FSM_AGGR" specified via -S FSM_AGGR */ - pack_options.fs_threshold = -1; /* "0" specified via -T 0 */ + pack_options.fs_strategy = (H5F_fspace_strategy_t)-1; /* "FSM_AGGR" specified via -S FSM_AGGR */ + pack_options.fs_threshold = -1; /* "0" specified via -T 0 */ if(h5repack(fname, FSPACE_OUT, &pack_options) < 0) GOERROR; if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0) + if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) GOERROR; if(h5repack_end(&pack_options) < 0) GOERROR; @@ -280,7 +276,7 @@ int main (void) TESTING(" files with file space info setting-- options -S and -P are set & -L"); - ++j; /* #3 */ + ++j; /* #3 */ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); fname = H5REPACK_FSPACE_FNAMES[j]; if(h5repack_init(&pack_options, 0, TRUE) < 0) @@ -291,32 +287,32 @@ int main (void) GOERROR; if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0) + if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) GOERROR; if(h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" files with file space info setting-- options -P and -T are set & -L"); - ++j; /* #4 */ + ++j; /* #4 */ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); fname = H5REPACK_FSPACE_FNAMES[j]; if(h5repack_init(&pack_options, 0, TRUE) < 0) GOERROR; - pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */ - pack_options.fs_threshold = 2; + pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */ + pack_options.fs_threshold = 2; if(h5repack(fname, FSPACE_OUT, &pack_options) < 0) GOERROR; if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0) + if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) GOERROR; if(h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" files with file space info setting-- options -S and -G are set & -L"); - ++j; /* #5 */ + ++j; /* #5 */ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); fname = H5REPACK_FSPACE_FNAMES[j]; if(h5repack_init(&pack_options, 0, TRUE) < 0) @@ -327,180 +323,179 @@ int main (void) GOERROR; if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0) + if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) GOERROR; if(h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" files with file space info setting-- options -S, -P, -T, -G are set"); - ++j; /* #6 */ + ++j; /* #6 */ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); fname = H5REPACK_FSPACE_FNAMES[j]; if(h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE; - pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */ - pack_options.fs_threshold = 1; + pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */ + pack_options.fs_threshold = 1; pack_options.fs_pagesize = 8192; if(h5repack(fname, FSPACE_OUT, &pack_options) < 0) GOERROR; if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0) + if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) GOERROR; if(h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" files with file space info setting-- options -S, -T, -G are set & -L"); - ++j; /* #7 */ + ++j; /* #7 */ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); fname = H5REPACK_FSPACE_FNAMES[j]; if(h5repack_init(&pack_options, 0, TRUE) < 0) GOERROR; pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR; - pack_options.fs_threshold = 1; + pack_options.fs_threshold = 1; pack_options.fs_pagesize = 4096; if(h5repack(fname, FSPACE_OUT, &pack_options) < 0) GOERROR; if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if(h5repack_verify(fname, FSPACE_OUT, &pack_options)<=0) + if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0) GOERROR; if(h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * file with fill values - *------------------------------------------------------------------------- - */ - + * file with fill values + *------------------------------------------------------------------------- + */ TESTING(" copy of datasets (fill values)"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME0,FNAME0OUT,&pack_options) < 0) + if (h5repack(FNAME0, FNAME0OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME0,FNAME0OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME0, FNAME0OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME0, FNAME0OUT,&pack_options)<=0) + if (h5repack_verify(FNAME0, FNAME0OUT, &pack_options) <= 0) GOERROR; - if (h5repack_cmp_pl(FNAME0,FNAME0OUT)<=0) + if (h5repack_cmp_pl(FNAME0, FNAME0OUT) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * file with all kinds of dataset datatypes - *------------------------------------------------------------------------- - */ + * file with all kinds of dataset datatypes + *------------------------------------------------------------------------- + */ TESTING(" copy of datasets (all datatypes)"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0) + if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0) + if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0) GOERROR; - if (h5repack_cmp_pl(FNAME1,FNAME1OUT)<=0) + if (h5repack_cmp_pl(FNAME1, FNAME1OUT) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * file with attributes - *------------------------------------------------------------------------- - */ + * file with attributes + *------------------------------------------------------------------------- + */ TESTING(" copy of datasets (attributes)"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME2,FNAME2OUT,&pack_options) < 0) + if (h5repack(FNAME2, FNAME2OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME2,FNAME2OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME2, FNAME2OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME2, FNAME2OUT,&pack_options)<=0) + if (h5repack_verify(FNAME2, FNAME2OUT, &pack_options) <= 0) GOERROR; - if (h5repack_cmp_pl(FNAME2,FNAME2OUT)<=0) + if (h5repack_cmp_pl(FNAME2, FNAME2OUT) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * file with hardlinks - *------------------------------------------------------------------------- - */ + * file with hardlinks + *------------------------------------------------------------------------- + */ TESTING(" copy of datasets (hardlinks)"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME3,FNAME3OUT,&pack_options) < 0) + if (h5repack(FNAME3, FNAME3OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME3,FNAME3OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME3, FNAME3OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME3, FNAME3OUT,&pack_options)<=0) + if (h5repack_verify(FNAME3, FNAME3OUT, &pack_options) <= 0) GOERROR; - if (h5repack_cmp_pl(FNAME3,FNAME3OUT)<=0) + if (h5repack_cmp_pl(FNAME3, FNAME3OUT) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * alloc early test - *------------------------------------------------------------------------- - */ + * alloc early test + *------------------------------------------------------------------------- + */ TESTING(" copy of allocation early file"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME5,FNAME5OUT,&pack_options) < 0) + if (h5repack(FNAME5, FNAME5OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME5,FNAME5OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME5, FNAME5OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME5, FNAME5OUT, &pack_options)<=0) + if (h5repack_verify(FNAME5, FNAME5OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * the remaining files differ in the dcpl's - *------------------------------------------------------------------------- - */ + * the remaining files differ in the dcpl's + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- - * deflate - *------------------------------------------------------------------------- - */ + * deflate + *------------------------------------------------------------------------- + */ TESTING(" adding deflate filter (old_format)"); #ifdef H5_HAVE_FILTER_DEFLATE /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ + * test an individual object option + *------------------------------------------------------------------------- + */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0) + if (h5repack_addfilter("dset1:GZIP=9", &pack_options) < 0) GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); #else @@ -510,24 +505,24 @@ int main (void) TESTING(" adding deflate filter (new format)"); #ifdef H5_HAVE_FILTER_DEFLATE /*------------------------------------------------------------------------- - * test an individual object option - * For new format, "dset1" should be using Fixed Array indexing - *------------------------------------------------------------------------- - */ + * test an individual object option + * For new format, "dset1" should be using Fixed Array indexing + *------------------------------------------------------------------------- + */ - if (h5repack_init (&pack_options, 0, TRUE) < 0) + if (h5repack_init(&pack_options, 0, TRUE) < 0) GOERROR; - if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0) + if (h5repack_addfilter("dset1:GZIP=9", &pack_options) < 0) GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); #else @@ -535,27 +530,27 @@ int main (void) #endif /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ + * test all objects option + *------------------------------------------------------------------------- + */ TESTING(" adding deflate filter to all"); #ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("GZIP=1",&pack_options) < 0) + if (h5repack_addfilter("GZIP=1", &pack_options) < 0) GOERROR; - if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -564,40 +559,40 @@ int main (void) #endif /*------------------------------------------------------------------------- - * SZIP - *------------------------------------------------------------------------- - */ + * SZIP + *------------------------------------------------------------------------- + */ TESTING(" adding szip filter"); #if defined (H5_HAVE_FILTER_SZIP) - if (h5tools_can_encode(H5Z_FILTER_SZIP) >0) { + if (h5tools_can_encode(H5Z_FILTER_SZIP) > 0) szip_can_encode = 1; - } /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ + * test an individual object option + *------------------------------------------------------------------------- + */ if (szip_can_encode) { if (h5repack_init (&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options) < 0) + if (h5repack_addfilter("dset2:SZIP=8,EC", &pack_options) < 0) GOERROR; - if (h5repack_addlayout("dset2:CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("dset2:CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; if (h5repack_end (&pack_options) < 0) GOERROR; PASSED(); - } else { + } + else { SKIPPED(); } #else @@ -606,28 +601,29 @@ int main (void) /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ + * test all objects option + *------------------------------------------------------------------------- + */ TESTING(" adding szip filter to all"); #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("SZIP=8,NN",&pack_options) < 0) + if (h5repack_addfilter("SZIP=8,NN", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); - } else { + } + else { SKIPPED(); } #else @@ -638,47 +634,47 @@ int main (void) TESTING(" addding shuffle filter"); /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ + * test an individual object option + *------------------------------------------------------------------------- + */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0) + if (h5repack_addfilter("dset1:SHUF", &pack_options) < 0) GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ + * test all objects option + *------------------------------------------------------------------------- + */ TESTING(" addding shuffle filter to all"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("SHUF",&pack_options) < 0) + if (h5repack_addfilter("SHUF", &pack_options) < 0) GOERROR; - if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -687,48 +683,45 @@ int main (void) TESTING(" adding checksum filter"); /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ - - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * test an individual object option + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset1:FLET",&pack_options) < 0) + if (h5repack_addfilter("dset1:FLET", &pack_options) < 0) GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ - - + * test all objects option + *------------------------------------------------------------------------- + */ TESTING(" adding checksum filter to all"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("FLET",&pack_options) < 0) + if (h5repack_addfilter("FLET", &pack_options) < 0) GOERROR; - if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -737,38 +730,38 @@ int main (void) TESTING(" filter queue fletcher, shuffle, deflate, szip"); /*------------------------------------------------------------------------- - * add some filters - *------------------------------------------------------------------------- - */ + * add some filters + *------------------------------------------------------------------------- + */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options) < 0) + if (h5repack_addlayout("dset1:CHUNK 20x10", &pack_options) < 0) GOERROR; - if (h5repack_addfilter("dset1:FLET",&pack_options) < 0) + if (h5repack_addfilter("dset1:FLET", &pack_options) < 0) GOERROR; - if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0) + if (h5repack_addfilter("dset1:SHUF", &pack_options) < 0) GOERROR; #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { - if (h5repack_addfilter("dset1:SZIP=8,NN",&pack_options) < 0) + if (h5repack_addfilter("dset1:SZIP=8,NN", &pack_options) < 0) GOERROR; } #endif #ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_addfilter("dset1:GZIP=1",&pack_options) < 0) + if (h5repack_addfilter("dset1:GZIP=1", &pack_options) < 0) GOERROR; #endif - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -777,63 +770,63 @@ int main (void) TESTING(" adding layout chunked (old format)"); /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ + * test an individual object option + *------------------------------------------------------------------------- + */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options )<= 0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options ) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" adding layout chunked (new format)"); /*------------------------------------------------------------------------- - * test an individual object option - * For new format, "dset1" should be using Fixed Array indexing - *------------------------------------------------------------------------- - */ + * test an individual object option + * For new format, "dset1" should be using Fixed Array indexing + *------------------------------------------------------------------------- + */ - if (h5repack_init (&pack_options, 0, TRUE) < 0) + if (h5repack_init(&pack_options, 0, TRUE) < 0) GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("dset1:CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options )<= 0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options ) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ + * test all objects option + *------------------------------------------------------------------------- + */ TESTING(" adding layout chunked to all"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) + if (h5repack_addlayout("CHUNK=20x10", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -841,20 +834,20 @@ int main (void) TESTING(" adding layout contiguous"); /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * test an individual object option + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset1:CONTI",&pack_options) < 0) + if (h5repack_addlayout("dset1:CONTI", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -862,37 +855,37 @@ int main (void) TESTING(" adding layout contiguous to all"); /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * test all objects option + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("CONTI",&pack_options) < 0) + if (h5repack_addlayout("CONTI", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; /*------------------------------------------------------------------------- - * do the same test for a file with filters (chunked) - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * do the same test for a file with filters (chunked) + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("CONTI",&pack_options) < 0) + if (h5repack_addlayout("CONTI", &pack_options) < 0) GOERROR; - if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) + if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0) + if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -900,42 +893,42 @@ int main (void) TESTING(" adding layout compact"); /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ + * test an individual object option + *------------------------------------------------------------------------- + */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset1:COMPA",&pack_options) < 0) + if (h5repack_addlayout("dset1:COMPA", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" adding layout compact to all"); /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ + * test all objects option + *------------------------------------------------------------------------- + */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("COMPA",&pack_options) < 0) + if (h5repack_addlayout("COMPA", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -944,210 +937,209 @@ int main (void) TESTING(" layout compact to contiguous conversion"); /*------------------------------------------------------------------------- - * layout compact to contiguous conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * layout compact to contiguous conversion + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset_compact:CONTI",&pack_options) < 0) + if (h5repack_addlayout("dset_compact:CONTI", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" layout compact to chunk conversion"); /*------------------------------------------------------------------------- - * layout compact to chunk conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * layout compact to chunk conversion + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options) < 0) + if (h5repack_addlayout("dset_compact:CHUNK=2x5", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" layout compact to compact conversion"); /*------------------------------------------------------------------------- - * layout compact to compact conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * layout compact to compact conversion + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset_compact:COMPA",&pack_options) < 0) + if (h5repack_addlayout("dset_compact:COMPA", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) >0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options)<= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" layout contiguous to compact conversion"); /*------------------------------------------------------------------------- - * layout contiguous to compact conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * layout contiguous to compact conversion + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options) < 0) + if (h5repack_addlayout("dset_contiguous:COMPA", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" layout contiguous to chunk conversion"); /*------------------------------------------------------------------------- - * layout contiguous to chunk conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * layout contiguous to chunk conversion + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options) < 0) + if (h5repack_addlayout("dset_contiguous:CHUNK=3x6", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" layout contiguous to contiguous conversion"); /*------------------------------------------------------------------------- - * layout contiguous to contiguous conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * layout contiguous to contiguous conversion + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options) < 0) + if (h5repack_addlayout("dset_contiguous:CONTI", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" layout chunked to compact conversion"); /*------------------------------------------------------------------------- - * layout chunked to compact conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * layout chunked to compact conversion + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset_chunk:COMPA",&pack_options) < 0) + if (h5repack_addlayout("dset_chunk:COMPA", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" layout chunked to contiguous conversion"); /*------------------------------------------------------------------------- - * layout chunked to contiguous conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * layout chunked to contiguous conversion + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset_chunk:CONTI",&pack_options) < 0) + if (h5repack_addlayout("dset_chunk:CONTI", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); TESTING(" layout chunked to chunk conversion"); /*------------------------------------------------------------------------- - * layout chunked to chunked conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE) < 0) + * layout chunked to chunked conversion + *------------------------------------------------------------------------- + */ + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options) < 0) + if (h5repack_addlayout("dset_chunk:CHUNK=18x13", &pack_options) < 0) GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * the following tests assume the input files have filters - * FNAME7 - * FNAME8 - * FNAME9 - * FNAME10 - * FNAME11 - *------------------------------------------------------------------------- - */ - - + * the following tests assume the input files have filters + * FNAME7 + * FNAME8 + * FNAME9 + * FNAME10 + * FNAME11 + *------------------------------------------------------------------------- + */ TESTING(" copy of szip filter"); #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0) + if (h5repack(FNAME7, FNAME7OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME7, FNAME7OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0) + if (h5repack_verify(FNAME7, FNAME7OUT, &pack_options) <= 0) GOERROR; - if (h5repack_cmp_pl(FNAME7,FNAME7OUT)<=0) + if (h5repack_cmp_pl(FNAME7, FNAME7OUT) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); - } else { + } + else { SKIPPED(); } #else @@ -1158,21 +1150,22 @@ int main (void) #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_szip:NONE",&pack_options) < 0) + if (h5repack_addfilter("dset_szip:NONE", &pack_options) < 0) GOERROR; - if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0) + if (h5repack(FNAME7, FNAME7OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME7, FNAME7OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0) + if (h5repack_verify(FNAME7, FNAME7OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); - } else { + } + else { SKIPPED(); } #else @@ -1183,15 +1176,15 @@ int main (void) TESTING(" copy of deflate filter"); #ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) + if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0) + if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1203,17 +1196,17 @@ int main (void) TESTING(" removing deflate filter"); #ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_deflate:NONE",&pack_options) < 0) + if (h5repack_addfilter("dset_deflate:NONE", &pack_options) < 0) GOERROR; - if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) + if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0) + if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1225,15 +1218,15 @@ int main (void) TESTING(" copy of shuffle filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0) + if (h5repack(FNAME9, FNAME9OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME9, FNAME9OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0) + if (h5repack_verify(FNAME9, FNAME9OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1241,17 +1234,17 @@ int main (void) TESTING(" removing shuffle filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_shuffle:NONE",&pack_options) < 0) + if (h5repack_addfilter("dset_shuffle:NONE", &pack_options) < 0) GOERROR; - if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0) + if (h5repack(FNAME9, FNAME9OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME9, FNAME9OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0) + if (h5repack_verify(FNAME9, FNAME9OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1259,15 +1252,15 @@ int main (void) TESTING(" copy of fletcher filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0) + if (h5repack(FNAME10, FNAME10OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME10, FNAME10OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0) + if (h5repack_verify(FNAME10, FNAME10OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1275,17 +1268,17 @@ int main (void) TESTING(" removing fletcher filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options) < 0) + if (h5repack_addfilter("dset_fletcher32:NONE", &pack_options) < 0) GOERROR; - if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0) + if (h5repack(FNAME10, FNAME10OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME10, FNAME10OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0) + if (h5repack_verify(FNAME10, FNAME10OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1293,15 +1286,15 @@ int main (void) TESTING(" copy of nbit filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) + if (h5repack(FNAME12, FNAME12OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME12, FNAME12OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0) + if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1309,17 +1302,17 @@ int main (void) TESTING(" removing nbit filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_nbit:NONE",&pack_options) < 0) + if (h5repack_addfilter("dset_nbit:NONE", &pack_options) < 0) GOERROR; - if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) + if (h5repack(FNAME12, FNAME12OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME12, FNAME12OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0) + if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1327,17 +1320,17 @@ int main (void) TESTING(" adding nbit filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_int31:NBIT",&pack_options) < 0) + if (h5repack_addfilter("dset_int31:NBIT", &pack_options) < 0) GOERROR; - if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) + if (h5repack(FNAME12, FNAME12OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME12, FNAME12OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0) + if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options)<= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1345,15 +1338,15 @@ int main (void) TESTING(" copy of scaleoffset filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) + if (h5repack(FNAME13, FNAME13OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME13, FNAME13OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0) + if (h5repack_verify(FNAME13, FNAME13OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1361,17 +1354,17 @@ int main (void) TESTING(" removing scaleoffset filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_scaleoffset:NONE",&pack_options) < 0) + if (h5repack_addfilter("dset_scaleoffset:NONE", &pack_options) < 0) GOERROR; - if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) + if (h5repack(FNAME13, FNAME13OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME13, FNAME13OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0) + if (h5repack_verify(FNAME13, FNAME13OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1379,53 +1372,52 @@ int main (void) TESTING(" adding scaleoffset filter"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_none:SOFF=31,IN",&pack_options) < 0) + if (h5repack_addfilter("dset_none:SOFF=31,IN", &pack_options) < 0) GOERROR; - if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) + if (h5repack(FNAME13, FNAME13OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME13, FNAME13OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0) + if (h5repack_verify(FNAME13, FNAME13OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * file with all filters - * dset_all - * dset_deflate - * dset_szip - * dset_shuffle - * dset_fletcher32 - *------------------------------------------------------------------------- - */ - - + * file with all filters + * dset_all + * dset_deflate + * dset_szip + * dset_shuffle + * dset_fletcher32 + *------------------------------------------------------------------------- + */ TESTING(" filter conversion from deflate to szip"); #if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options) < 0) + if (h5repack_addfilter("dset_deflate:SZIP=8,NN", &pack_options) < 0) GOERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) + if (h5repack(FNAME11, FNAME11OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME11, FNAME11OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0) + if (h5repack_verify(FNAME11, FNAME11OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); - } else { + } + else { SKIPPED(); } #else @@ -1437,21 +1429,22 @@ int main (void) #if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options) < 0) + if (h5repack_addfilter("dset_szip:GZIP=1", &pack_options) < 0) GOERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) + if (h5repack(FNAME11, FNAME11OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME11, FNAME11OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0) + if (h5repack_verify(FNAME11, FNAME11OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); - } else { + } + else { SKIPPED(); } #else @@ -1460,25 +1453,25 @@ int main (void) /*------------------------------------------------------------------------- - * test the NONE global option - *------------------------------------------------------------------------- - */ + * test the NONE global option + *------------------------------------------------------------------------- + */ TESTING(" removing all filters"); #if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("NONE",&pack_options) < 0) + if (h5repack_addfilter("NONE", &pack_options) < 0) GOERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) + if (h5repack(FNAME11, FNAME11OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME11, FNAME11OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0) + if (h5repack_verify(FNAME11, FNAME11OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1487,44 +1480,44 @@ int main (void) #endif /*------------------------------------------------------------------------- - * test a big file - *------------------------------------------------------------------------- - */ + * test a big file + *------------------------------------------------------------------------- + */ TESTING(" big file"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME14,FNAME14OUT,&pack_options) < 0) + if (h5repack(FNAME14, FNAME14OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME14,FNAME14OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME14, FNAME14OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME14, FNAME14OUT,&pack_options)<=0) + if (h5repack_verify(FNAME14, FNAME14OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * test external dataset - *------------------------------------------------------------------------- - */ + * test external dataset + *------------------------------------------------------------------------- + */ TESTING(" external datasets"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack(FNAME15,FNAME15OUT,&pack_options) < 0) + if (h5repack(FNAME15, FNAME15OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME15,FNAME15OUT,NULL,NULL,&diff_options) > 0) + if (h5diff(FNAME15, FNAME15OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME15, FNAME15OUT,&pack_options)<=0) + if (h5repack_verify(FNAME15, FNAME15OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * test file with userblock - *------------------------------------------------------------------------- - */ + * test file with userblock + *------------------------------------------------------------------------- + */ TESTING(" file with userblock"); if(h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; @@ -1541,53 +1534,53 @@ int main (void) PASSED(); /*------------------------------------------------------------------------- - * test --latest options - *------------------------------------------------------------------------- - */ + * test --latest options + *------------------------------------------------------------------------- + */ TESTING(" latest file format options"); - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - pack_options.latest=1; - pack_options.grp_compact=10; - pack_options.grp_indexed=5; + pack_options.latest = 1; + pack_options.grp_compact = 10; + pack_options.grp_indexed = 5; pack_options.msg_size[0] = 10; pack_options.msg_size[1] = 20; pack_options.msg_size[2] = 30; pack_options.msg_size[3] = 40; pack_options.msg_size[4] = 50; - if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0) + if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) > 0) + if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0) + if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options)<=0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); /*------------------------------------------------------------------------- - * test several global filters - *------------------------------------------------------------------------- - */ + * test several global filters + *------------------------------------------------------------------------- + */ TESTING(" several global filters"); #if defined (H5_HAVE_FILTER_DEFLATE) - if (h5repack_init (&pack_options, 0, FALSE) < 0) + if (h5repack_init(&pack_options, 0, FALSE) < 0) GOERROR; - if (h5repack_addfilter("GZIP=1",&pack_options) < 0) + if (h5repack_addfilter("GZIP=1", &pack_options) < 0) GOERROR; - if (h5repack_addfilter("SHUF",&pack_options) < 0) + if (h5repack_addfilter("SHUF", &pack_options) < 0) GOERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) + if (h5repack(FNAME11, FNAME11OUT, &pack_options) < 0) GOERROR; - if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0) + if (h5diff(FNAME11, FNAME11OUT, NULL, NULL, &diff_options) > 0) GOERROR; - if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0) + if (h5repack_verify(FNAME11, FNAME11OUT, &pack_options) <= 0) GOERROR; - if (h5repack_end (&pack_options) < 0) + if (h5repack_end(&pack_options) < 0) GOERROR; PASSED(); @@ -1597,9 +1590,9 @@ int main (void) /*------------------------------------------------------------------------- - * test file with userblock - *------------------------------------------------------------------------- - */ + * test file with userblock + *------------------------------------------------------------------------- + */ TESTING(" file with added userblock"); #ifdef H5_HAVE_FILTER_DEFLATE @@ -1630,9 +1623,9 @@ int main (void) /*------------------------------------------------------------------------- - * test file with aligment - *------------------------------------------------------------------------- - */ + * test file with aligment + *------------------------------------------------------------------------- + */ TESTING(" file with aligment"); #ifdef H5_HAVE_FILTER_DEFLATE @@ -1655,20 +1648,20 @@ int main (void) { hsize_t threshold; hsize_t alignment; - hid_t fapl; - hid_t fid; + hid_t fapl; + hid_t fid; - if (( fid = H5Fopen(FNAME8OUT, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) + if ((fid = H5Fopen(FNAME8OUT, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) GOERROR; if ((fapl = H5Fget_access_plist(fid)) < 0) GOERROR; - if ( H5Pget_alignment(fapl, &threshold, &alignment ) < 0) + if (H5Pget_alignment(fapl, &threshold, &alignment) < 0) GOERROR; - if ( threshold != 1 ) + if (threshold != 1) GOERROR; - if ( alignment != 1 ) + if (alignment != 1) GOERROR; - if ( H5Pclose(fapl) < 0) + if (H5Pclose(fapl) < 0) GOERROR; if (H5Fclose(fid) < 0) GOERROR; @@ -1686,9 +1679,9 @@ int main (void) #endif /*------------------------------------------------------------------------- - * test file with userblock - *------------------------------------------------------------------------- - */ + * test file with userblock + *------------------------------------------------------------------------- + */ TESTING(" file with committed datatypes"); if(h5repack_init(&pack_options, 0, FALSE) < 0) @@ -1707,13 +1700,13 @@ int main (void) PASSED(); /*------------------------------------------------------------------------- - * test --metadata_block_size option - * Also verify that output file using the metadata_block_size option is - * larger than the output file one not using it. - * FNAME4 is used because it is the same as the test file used for the - * shell script version of this test (h5repack.sh). - *------------------------------------------------------------------------- - */ + * test --metadata_block_size option + * Also verify that output file using the metadata_block_size option is + * larger than the output file one not using it. + * FNAME4 is used because it is the same as the test file used for the + * shell script version of this test (h5repack.sh). + *------------------------------------------------------------------------- + */ TESTING(" metadata block size option"); /* First run without metadata option. No need to verify the correctness */ /* since this has been verified by earlier tests. Just record the file */ @@ -1751,9 +1744,9 @@ int main (void) /*------------------------------------------------------------------------- - * clean temporary test files - *------------------------------------------------------------------------- - */ + * clean temporary test files + *------------------------------------------------------------------------- + */ { hid_t fapl; @@ -1778,24 +1771,24 @@ error: /*------------------------------------------------------------------------- * Function: make_testfiles * -* Purpose: make a test file with all types of HDF5 objects, -* datatypes and filters +* Purpose: make a test file with all types of HDF5 objects, +* datatypes and filters * *------------------------------------------------------------------------- */ static int make_testfiles(void) { - hid_t fid; - hid_t fcpl; /* File creation property list */ - hid_t fapl; /* File access property list */ - unsigned j; /* Local index variable */ + hid_t fid = -1; + hid_t fcpl = -1; /* File creation property list */ + hid_t fapl = -1; /* File access property list */ + unsigned j; /* Local index variable */ /*------------------------------------------------------------------------- - * create a file for general copy test - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME0,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file for general copy test + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME0, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_fill(fid) < 0) goto out; @@ -1803,10 +1796,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create another file for general copy test (all datatypes) - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create another file for general copy test (all datatypes) + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_all_objects(fid) < 0) goto out; @@ -1814,10 +1807,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file for attributes copy test - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file for attributes copy test + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_attributes(fid) < 0) goto out; @@ -1825,10 +1818,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file for hard links test - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file for hard links test + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_hlinks(fid) < 0) goto out; @@ -1836,10 +1829,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file for layouts test - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME4,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file for layouts test + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_layout(fid) < 0) goto out; @@ -1847,9 +1840,9 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file for layout conversion test - *------------------------------------------------------------------------- - */ + * create a file for layout conversion test + *------------------------------------------------------------------------- + */ if((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; @@ -1860,9 +1853,9 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * for test layout conversions form chunk with unlimited max dims - *------------------------------------------------------------------------- - */ + * for test layout conversions form chunk with unlimited max dims + *------------------------------------------------------------------------- + */ if((fid = H5Fcreate("h5repack_layout3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; @@ -1873,18 +1866,18 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file for the H5D_ALLOC_TIME_EARLY test - *------------------------------------------------------------------------- - */ + * create a file for the H5D_ALLOC_TIME_EARLY test + *------------------------------------------------------------------------- + */ if (make_early() < 0) goto out; /*------------------------------------------------------------------------- - * create a file with the SZIP filter - *------------------------------------------------------------------------- - */ + * create a file with the SZIP filter + *------------------------------------------------------------------------- + */ #ifdef H5_HAVE_FILTER_SZIP - if((fid = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(FNAME7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_szip(fid) < 0) goto out; @@ -1894,10 +1887,10 @@ int make_testfiles(void) /*------------------------------------------------------------------------- - * create a file with the deflate filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME8,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file with the deflate filter + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_deflate(fid) < 0) goto out; @@ -1905,10 +1898,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file with the shuffle filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME9,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file with the shuffle filter + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_shuffle(fid) < 0) goto out; @@ -1916,10 +1909,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file with the fletcher32 filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME10,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file with the fletcher32 filter + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME10, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_fletcher32(fid) < 0) goto out; @@ -1927,10 +1920,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file with all the filters - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME11,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file with all the filters + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME11, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_all_filters(fid) < 0) goto out; @@ -1938,10 +1931,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file with the nbit filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME12,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file with the nbit filter + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_nbit(fid) < 0) goto out; @@ -1949,10 +1942,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file with the scaleoffset filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME13,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file with the scaleoffset filter + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_scaleoffset(fid) < 0) goto out; @@ -1960,10 +1953,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a big dataset - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME14,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a big dataset + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_big(fid) < 0) goto out; @@ -1971,10 +1964,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file with external dataset - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME15,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file with external dataset + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME15, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_external(fid) < 0) goto out; @@ -1982,24 +1975,24 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file with userblock - *------------------------------------------------------------------------- - */ + * create a file with userblock + *------------------------------------------------------------------------- + */ if(make_userblock() < 0) goto out; /*------------------------------------------------------------------------- - * create a userblock file - *------------------------------------------------------------------------- - */ + * create a userblock file + *------------------------------------------------------------------------- + */ if(make_userblock_file() < 0) goto out; /*------------------------------------------------------------------------- - * create a file with named datatypes - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME17,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file with named datatypes + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_named_dtype(fid) < 0) goto out; @@ -2007,11 +2000,12 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create obj and region reference type datasets (bug1814) - * add attribute with int type (bug1726) - * add attribute with obj and region reference type (bug1726) - *-------------------------------------------------------------------------*/ - if((fid = H5Fcreate(FNAME_REF,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create obj and region reference type datasets (bug1814) + * add attribute with int type (bug1726) + * add attribute with obj and region reference type (bug1726) + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; /* create reference type datasets */ if (make_references(fid) < 0) @@ -2020,10 +2014,10 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- - * create a file with obj and region references in attribute of compound and - * vlen datatype - *-------------------------------------------------------------------------*/ - if((fid = H5Fcreate(FNAME_ATTR_REF,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) + * create a file with obj and region references in attribute of compound and + * vlen datatype + *-------------------------------------------------------------------------*/ + if((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; if (make_complex_attr_references(fid) < 0) goto out; @@ -2042,9 +2036,9 @@ int make_testfiles(void) if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) return -1; - /* - * #0 -- h5repack_latest.h5 - * default: strategy=FSM_AGGR, persist=FALSE, threshold=1 + /* + * #0 -- h5repack_latest.h5 + * default: strategy=FSM_AGGR, persist=FALSE, threshold=1 * default: inpage=4096 */ j = 0; @@ -2053,9 +2047,9 @@ int make_testfiles(void) if(H5Fclose(fid) < 0) return -1; - /* - * #1 -- h5repack_default.h5 - * default: strategy=FSM_AGGR, persist=FALSE, threshold=1 + /* + * #1 -- h5repack_default.h5 + * default: strategy=FSM_AGGR, persist=FALSE, threshold=1 * default: inpage=4096 */ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES)); @@ -2064,11 +2058,11 @@ int make_testfiles(void) if(H5Fclose(fid) < 0) return -1; - /* + /* * #2 -- h5repack_page_persist.h5 - * Setting: - * strategy=PAGE, persist=TRUE, threshold=1 - * inpage=512 + * Setting: + * strategy=PAGE, persist=TRUE, threshold=1 + * inpage=512 * latest format */ /* Create file creation property list */ @@ -2087,10 +2081,10 @@ int make_testfiles(void) return -1; - /* + /* * #3 -- h5repack_fsm_aggr_persist.h5 * Setting: - * strategy=FSM_AGGR, persist=TRUE, threshold=1 + * strategy=FSM_AGGR, persist=TRUE, threshold=1 * default: inpage=4096 */ /* Create file creation property list */ @@ -2107,10 +2101,10 @@ int make_testfiles(void) return -1; - /* + /* * #4 -- h5repack_page_threshold.h5 * Setting: - * strategy=PAGE, persist=FALSE, threshold=3 + * strategy=PAGE, persist=FALSE, threshold=3 * inpage=8192 * latest format */ @@ -2133,8 +2127,8 @@ int make_testfiles(void) /* * #5 -- h5repack_fsm_aggr_threshold.h5 * Setting: - * strategy=FSM_AGGR, persist=FALSE, threshold=3 - * inpage=4096 + * strategy=FSM_AGGR, persist=FALSE, threshold=3 + * inpage=4096 */ /* Create file creation property list */ @@ -2152,10 +2146,10 @@ int make_testfiles(void) if(H5Pclose(fcpl) < 0) return -1; - /* - * #6 -- h5repack_aggr.h5 + /* + * #6 -- h5repack_aggr.h5 * Setting: - * strategy=AGGR, persist=FALSE, threshold=1 + * strategy=AGGR, persist=FALSE, threshold=1 * latest format */ @@ -2172,11 +2166,11 @@ int make_testfiles(void) if(H5Pclose(fcpl) < 0) return -1; - /* + /* * #7 -- h5repack_none.h5 * Setting: - * strategy=NONE, persist=FALSE, threshold=1 - * inpage=8192 + * strategy=NONE, persist=FALSE, threshold=1 + * inpage=8192 */ /* Create file creation property list */ @@ -2209,20 +2203,20 @@ out: /*------------------------------------------------------------------------- * Function: make_all_objects * -* Purpose: make a test file with all types of HDF5 objects +* Purpose: make a test file with all types of HDF5 objects * *------------------------------------------------------------------------- */ static int make_all_objects(hid_t loc_id) { - hid_t did=-1; - hid_t gid=-1; - hid_t tid=-1; - hid_t rid=-1; - hid_t sid=-1; - hid_t gcplid=-1; - hsize_t dims[1]={2}; + hid_t did = -1; + hid_t gid = -1; + hid_t tid = -1; + hid_t rid = -1; + hid_t sid = -1; + hid_t gcplid = -1; + hsize_t dims[1] = {2}; /* compound datatype */ typedef struct s_t { @@ -2297,7 +2291,7 @@ int make_all_objects(hid_t loc_id) if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0) goto out; - if (write_dset_in(rid,"dset_referenced",loc_id,0) < 0) + if (write_dset_in(rid, "dset_referenced", loc_id, 0) < 0) goto out; if (H5Gclose(rid) < 0) goto out; @@ -2331,18 +2325,18 @@ out: /*------------------------------------------------------------------------- * Function: make_attributes * -* Purpose: make a test file with all types of attributes +* Purpose: make a test file with all types of attributes * *------------------------------------------------------------------------- */ static int make_attributes(hid_t loc_id) { - hid_t did=-1; - hid_t gid=-1; - hid_t rid=-1; - hid_t sid=-1; - hsize_t dims[1]={2}; + hid_t did = -1; + hid_t gid = -1; + hid_t rid = -1; + hid_t sid = -1; + hsize_t dims[1] = {2}; /*------------------------------------------------------------------------- * H5G_DATASET @@ -2367,11 +2361,11 @@ int make_attributes(hid_t loc_id) *------------------------------------------------------------------------- */ - if ( write_attr_in(did,"dset",loc_id,0) < 0) + if ( write_attr_in(did, "dset", loc_id, 0) < 0) goto out; - if (write_attr_in(gid,"dset",loc_id,0) < 0) + if (write_attr_in(gid, "dset", loc_id, 0) < 0) goto out; - if (write_attr_in(rid,"dset",loc_id,0) < 0) + if (write_attr_in(rid, "dset", loc_id, 0) < 0) goto out; /* close */ @@ -2401,18 +2395,18 @@ out: /*------------------------------------------------------------------------- * Function: make_hlinks * -* Purpose: make a test file with hard links +* Purpose: make a test file with hard links * *------------------------------------------------------------------------- */ static int make_hlinks(hid_t loc_id) { - hid_t g1id=-1; - hid_t g2id=-1; - hid_t g3id=-1; - hsize_t dims[2]={3,2}; - int buf[3][2]= {{1,1},{1,2},{2,2}}; + hid_t g1id =- 1; + hid_t g2id = -1; + hid_t g3id = -1; + hsize_t dims[2] = {3,2}; + int buf[3][2] = {{1,1}, {1,2}, {2,2}}; /*------------------------------------------------------------------------- * create a dataset and some hard links to it @@ -2471,7 +2465,7 @@ out: /*------------------------------------------------------------------------- * Function: make_szip * -* Purpose: make a dataset with the SZIP filter +* Purpose: make a dataset with the SZIP filter * *------------------------------------------------------------------------- */ @@ -2479,21 +2473,19 @@ out: static int make_szip(hid_t loc_id) { - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; - unsigned szip_pixels_per_block=8; - hsize_t dims[RANK]={DIM1,DIM2}; - hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; + hid_t dcpl = -1; /* dataset creation property list */ + hid_t sid = -1; /* dataspace ID */ + unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK; + unsigned szip_pixels_per_block = 8; + hsize_t dims[RANK] = {DIM1, DIM2}; + hsize_t chunk_dims[RANK] = {CDIM1, CDIM2}; int buf[DIM1][DIM2]; int i, j, n; int szip_can_encode = 0; - for (i=n=0; i 0) H5Sclose(sid2); return ret; - + } /*------------------------------------------------------------------------- * Function: gen_obj_ref * - * Purpose: + * Purpose: * Generate object references to objects (dataset,group and named datatype) * * Note: - * copied from h5copygentest.c and upate to create named datatype + * copied from h5copygentest.c and upate to create named datatype * * Programmer: Jonathan Kim (March 18, 2010) *------------------------------------------------------------------------*/ @@ -6478,7 +6432,7 @@ static herr_t gen_obj_ref(hid_t loc_id) /* attr with int type */ hsize_t dim_attr_int[1]={2}; - int data_attr_int[2] = {10,20}; + int data_attr_int[2] = {10,20}; /* write buffer for obj reference */ hobj_ref_t objref_buf[3]; @@ -6515,7 +6469,7 @@ static herr_t gen_obj_ref(hid_t loc_id) } /*--------------------------------------------------------- - * create dataset contain references + * create dataset contain references */ sid = H5Screate_simple (1, dims_dset_objref, NULL); if (sid < 0) @@ -6579,7 +6533,7 @@ out: * Purpose: Generate dataset region references * * Note: - * copied from h5copygentest.c + * copied from h5copygentest.c * * Programmer: Jonathan Kim (March 18, 2010) *------------------------------------------------------------------------*/ @@ -6589,11 +6543,11 @@ static herr_t gen_region_ref(hid_t loc_id) herr_t ret = SUCCEED; /* target dataset */ - hid_t sid_trg=0; + hid_t sid_trg=0; hsize_t dims_trg[2] = {3,16}; /* dset with region ref type */ - hid_t sid_ref=0, oid_ref=0; + hid_t sid_ref=0, oid_ref=0; /* region ref to target dataset */ hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} }; @@ -6606,7 +6560,7 @@ static herr_t gen_region_ref(hid_t loc_id) /* attr with int type */ hsize_t dim_attr_int[1]={2}; - int data_attr_int[2] = {10,20}; + int data_attr_int[2] = {10,20}; sid_trg = H5Screate_simple (2, dims_trg, NULL); if (sid_trg < 0) @@ -6707,7 +6661,7 @@ out: if (sid_ref > 0) H5Sclose (sid_ref); if (sid_trg > 0) - H5Sclose (sid_trg); + H5Sclose (sid_trg); return ret; } @@ -6715,7 +6669,7 @@ out: /*------------------------------------------------------------------------- * Function: make_references * -* Purpose: create a file with obj and region references +* Purpose: create a file with obj and region references * * Programmer: Jonathan Kim (March 18, 2010) *------------------------------------------------------------------------- @@ -6731,7 +6685,7 @@ static herr_t make_references(hid_t loc_id) { fprintf(stderr, "Failed to generate referenced object.\n"); ret = FAIL; - } + } /* add object reference */ status = gen_obj_ref(loc_id); @@ -6755,7 +6709,7 @@ static herr_t make_references(hid_t loc_id) /*------------------------------------------------------------------------- * Function: make_complex_attr_references * -* Purpose: +* Purpose: * create a file with : * 1. obj ref in attribute of compound type * 2. region ref in attribute of compound type @@ -6787,14 +6741,14 @@ static herr_t make_references(hid_t loc_id) /* 4. region references in vlen attr */ #define RANK_VLEN_REGREF 1 #define DIM_VLEN_REGREF 1 /* for element region */ -#define LEN0_VLEN_REGREF 1 /* element region */ +#define LEN0_VLEN_REGREF 1 /* element region */ static herr_t make_complex_attr_references(hid_t loc_id) { herr_t ret = SUCCEED; - herr_t status; - /* - * for objects + herr_t status; + /* + * for objects */ hid_t objgid=0, objdid=0, objtid=0, objsid=0; hsize_t obj_dims[RANK_OBJ] = {DIM0_OBJ, DIM1_OBJ}; @@ -6815,8 +6769,8 @@ static herr_t make_complex_attr_references(hid_t loc_id) */ hsize_t main_dset_dims[RANK_DSET] = {DIM_DSET}; hid_t main_sid=0, main_did=0; - /* - * 1. obj references in compound attr + /* + * 1. obj references in compound attr */ hid_t comp_objref_tid=0, comp_objref_aid=0; typedef struct comp_objref_t { @@ -6827,8 +6781,8 @@ static herr_t make_complex_attr_references(hid_t loc_id) hid_t comp_objref_attr_sid=0; hsize_t comp_objref_dim[RANK_COMP_OBJREF] = {DIM_COMP_OBJREF}; - /* - * 2. region references in compound attr + /* + * 2. region references in compound attr */ hid_t comp_regref_tid=0, comp_regref_aid=0; typedef struct comp_regref_t { @@ -6839,16 +6793,16 @@ static herr_t make_complex_attr_references(hid_t loc_id) hid_t comp_regref_attr_sid=0; hsize_t comp_regref_dim[RANK_COMP_REGREF] = {DIM_COMP_REGREF}; hsize_t coords[4][2] = { {0,1}, {2,3}, {3,4}, {4,5} }; - - /* - * 3. obj references in vlen attr + + /* + * 3. obj references in vlen attr */ hid_t vlen_objref_attr_tid=0, vlen_objref_attr_sid=0; hid_t vlen_objref_attr_id=0; hvl_t vlen_objref_data[DIM_VLEN_OBJREF]; hsize_t vlen_objref_dims[RANK_VLEN_OBJREF] = {DIM_VLEN_OBJREF}; - /* + /* * 4. region references in vlen attr */ hid_t vlen_regref_attr_tid=0, vlen_regref_attr_sid=0; @@ -6858,7 +6812,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) /* --------------------------------------- - * create objects which to be referenced + * create objects which to be referenced */ /* object1 group */ objgid = H5Gcreate2(loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -6886,7 +6840,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) /* --------------------------------------------- - * Put testing objs in this group + * Put testing objs in this group * create group contain dataset with attribute and the attribute has * compound type which contain obj and region reference */ main_gid = H5Gcreate2(loc_id, "group_main", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -6903,7 +6857,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) main_sid = H5Screate_simple(RANK_DSET, main_dset_dims, NULL); main_did = H5Dcreate2(main_gid, "dset_main", H5T_NATIVE_INT, main_sid, H5P_DEFAULT,H5P_DEFAULT, H5P_DEFAULT); - + status = H5Dwrite(main_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]); if (status < 0) { @@ -6916,8 +6870,8 @@ static herr_t make_complex_attr_references(hid_t loc_id) * 1. create obj references in a attribute of compound type */ - /* - * create compound type for attribute + /* + * create compound type for attribute */ comp_objref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_objref_t)); @@ -6956,8 +6910,8 @@ static herr_t make_complex_attr_references(hid_t loc_id) goto out; } comp_objref_data[2].val_int = 20; - - /* + + /* * create attribute and write the object ref */ comp_objref_attr_sid = H5Screate_simple (RANK_COMP_OBJREF, comp_objref_dim, NULL); @@ -6982,7 +6936,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) H5Tinsert(comp_regref_tid, "value_int", HOFFSET(comp_regref_t, val_int), H5T_NATIVE_INT); /* - * create the region reference + * create the region reference */ status = H5Sselect_elements (objsid, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) @@ -7027,8 +6981,8 @@ static herr_t make_complex_attr_references(hid_t loc_id) vlen_objref_data[2].len = LEN2_VLEN_OBJREF; vlen_objref_data[2].p = HDmalloc (vlen_objref_data[2].len * sizeof(hobj_ref_t)); - /* - * create obj references + /* + * create obj references */ /* reference to dataset */ status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); @@ -7039,7 +6993,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) goto out; } /* reference to group */ - status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); + status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -7054,15 +7008,15 @@ static herr_t make_complex_attr_references(hid_t loc_id) ret = FAIL; goto out; } - - /* + + /* * create vlen type with obj reference */ vlen_objref_attr_tid = H5Tvlen_create (H5T_STD_REF_OBJ); vlen_objref_attr_sid = H5Screate_simple (RANK_VLEN_OBJREF, vlen_objref_dims, NULL); /* - * create attribute and write the object reference + * create attribute and write the object reference */ vlen_objref_attr_id = H5Acreate2(main_did, "Vlen_OBJREF", vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite (vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data); @@ -7085,7 +7039,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) /*------------------------------------------------------------------- * 4. create region references in a attribute of vlen type */ - + /* * prepare vlen data */ @@ -7093,7 +7047,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) vlen_regref_data[0].p = HDmalloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t)); /* - * create region reference + * create region reference */ status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) @@ -7109,15 +7063,15 @@ static herr_t make_complex_attr_references(hid_t loc_id) ret = FAIL; goto out; } - - /* + + /* * create vlen type with region reference */ vlen_regref_attr_tid = H5Tvlen_create(H5T_STD_REF_DSETREG); vlen_regref_attr_sid = H5Screate_simple(RANK_VLEN_REGREF, vlen_regref_dim, NULL); - + /* - * create attribute and write the region reference + * create attribute and write the region reference */ vlen_regref_attr_id = H5Acreate2(main_did, "Vlen_REGREF", vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data); @@ -7127,7 +7081,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) ret = FAIL; goto out; } - + /* close resource for vlen data */ status = H5Dvlen_reclaim (vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data); if (status < 0) diff --git a/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl b/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl index 75f54fa..1dcc742 100644 --- a/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl +++ b/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl @@ -76,8 +76,8 @@ GROUP "/" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } STORAGE_LAYOUT { - CHUNKED ( 20, 10 ) - SIZE 1283 (2.494:1 COMPRESSION) + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) } FILTERS { COMPRESSION DEFLATE { LEVEL 1 } diff --git a/tools/test/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst b/tools/test/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst index 36e65b9..cb12172 100644 --- a/tools/test/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst +++ b/tools/test/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst @@ -1,7 +1,8 @@ -Objects to modify layout are... -Objects to apply filter are... +No all objects to modify layout +No all objects to apply filter with GZIP filter ...Found +Making new file ... ----------------------------------------- Type Filter (Compression) Name ----------------------------------------- diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl index a8b4562..4856f84 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl @@ -92,7 +92,7 @@ GROUP "/" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } STORAGE_LAYOUT { - CHUNKED ( 20, 10 ) + CHUNKED ( 40, 20 ) SIZE 3200 (1.000:1 COMPRESSION) } FILTERS { diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index 561ab14..283b44c 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 2 } + PARAMS { 9 1 11 0 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 2 } + PARAMS { 9 1 11 0 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 2 } + PARAMS { 9 1 11 0 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 2 } + PARAMS { 9 1 11 0 } } } FILLVALUE { @@ -92,14 +92,14 @@ GROUP "/" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } STORAGE_LAYOUT { - CHUNKED ( 20, 10 ) + CHUNKED ( 40, 20 ) SIZE 3200 (1.000:1 COMPRESSION) } FILTERS { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 2 } + PARAMS { 9 1 11 0 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 2 } + PARAMS { 9 1 11 0 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 2 } + PARAMS { 9 1 11 0 } } } FILLVALUE { diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.ddl index 97cbfc0..e4ffaf1 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.ddl @@ -1,4 +1,135 @@ HDF5 "out-plugin_zero.h5repack_layout.h5" { GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 3200 + OFFSET 2048 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATASET "dset2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 3200 + OFFSET 5248 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATASET "dset3" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 3200 + OFFSET 8448 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATASET "dset4" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 3200 + OFFSET 13696 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } + DATASET "dset_chunk" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 20, 10 ) + SIZE 3200 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_compact" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + COMPACT + SIZE 3200 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_EARLY + } + } + DATASET "dset_contiguous" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 3200 + OFFSET 26184 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + } } } diff --git a/tools/test/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst b/tools/test/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst index 4fb6906..30aa8ad 100644 --- a/tools/test/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst +++ b/tools/test/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst @@ -1,6 +1,7 @@ -Objects to modify layout are... -Objects to apply filter are... +No all objects to modify layout +All objects to apply filter are... Uncompress all +Making new file ... ----------------------------------------- Type Filter (Compression) Name ----------------------------------------- diff --git a/tools/test/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst b/tools/test/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst index 7f9bd6e..62ea1cc 100644 --- a/tools/test/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst +++ b/tools/test/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst @@ -1,6 +1,7 @@ -Objects to modify layout are... -Objects to apply filter are... +No all objects to modify layout +All objects to apply filter are... User Defined 257 +Making new file ... ----------------------------------------- Type Filter (Compression) Name ----------------------------------------- diff --git a/tools/test/h5repack/testfiles/plugin_version_test.h5repack_layout.h5.tst b/tools/test/h5repack/testfiles/plugin_version_test.h5repack_layout.h5.tst index 1a496c6..f5c4736 100644 --- a/tools/test/h5repack/testfiles/plugin_version_test.h5repack_layout.h5.tst +++ b/tools/test/h5repack/testfiles/plugin_version_test.h5repack_layout.h5.tst @@ -1,6 +1,7 @@ -Objects to modify layout are... -Objects to apply filter are... +No all objects to modify layout +All objects to apply filter are... User Defined 260 +Making new file ... ----------------------------------------- Type Filter (Compression) Name ----------------------------------------- diff --git a/tools/test/h5repack/testfiles/plugin_zero.h5repack_layout.h5.tst b/tools/test/h5repack/testfiles/plugin_zero.h5repack_layout.h5.tst index 20f8a40..54c873c 100644 --- a/tools/test/h5repack/testfiles/plugin_zero.h5repack_layout.h5.tst +++ b/tools/test/h5repack/testfiles/plugin_zero.h5repack_layout.h5.tst @@ -1,7 +1,22 @@ -Objects to modify layout are... -Objects to apply filter are... +No all objects to modify layout +All objects to apply filter are... User Defined 250 +Making new file ... ----------------------------------------- Type Filter (Compression) Name ----------------------------------------- group / + warning: could not create dataset . Applying original settings + dset /dset1 + warning: could not create dataset . Applying original settings + dset /dset2 + warning: could not create dataset . Applying original settings + dset /dset3 + warning: could not create dataset . Applying original settings + dset /dset4 + warning: could not create dataset . Applying original settings + dset /dset_chunk + warning: could not create dataset . Applying original settings + dset /dset_compact + warning: could not create dataset . Applying original settings + dset /dset_contiguous -- cgit v0.12