summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Warren <Richard.Warren@hdfgroup.org>2017-10-17 20:20:12 (GMT)
committerRichard Warren <Richard.Warren@hdfgroup.org>2017-10-17 20:20:12 (GMT)
commit8f4d69dcf56b21b6f70159af4b936b76b67a2512 (patch)
tree8cb858355dceffefc201f5dd1d35c0f9b9b7801e
parentcb09092d9aec8f327cf6de9bf57890ab18f6e9b0 (diff)
parent0c207cd2f84021526690bcbc4e0a8a49ea4cb8a4 (diff)
downloadhdf5-8f4d69dcf56b21b6f70159af4b936b76b67a2512.zip
hdf5-8f4d69dcf56b21b6f70159af4b936b76b67a2512.tar.gz
hdf5-8f4d69dcf56b21b6f70159af4b936b76b67a2512.tar.bz2
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into optimize_superblock_read
-rw-r--r--MANIFEST1
-rw-r--r--configure.ac1
-rw-r--r--release_docs/RELEASE.txt59
-rw-r--r--src/H5FDmpio.h21
-rw-r--r--src/H5Fsuper.c133
-rw-r--r--src/H5Pocpl.c440
-rw-r--r--src/H5Z.c16
-rw-r--r--test/CMakeTests.cmake2
-rw-r--r--test/Makefile.am30
-rw-r--r--test/dsets.c2879
-rw-r--r--testpar/t_pread.c1074
-rw-r--r--testpar/t_shapesame.c4
-rw-r--r--tools/lib/h5diff_attr.c4
-rw-r--r--tools/lib/h5diff_dset.c108
-rw-r--r--tools/lib/h5tools_filters.c202
-rw-r--r--tools/src/h5repack/h5repack.c201
-rw-r--r--tools/src/h5repack/h5repack.h106
-rw-r--r--tools/src/h5repack/h5repack_copy.c183
-rw-r--r--tools/src/h5repack/h5repack_filters.c270
-rw-r--r--tools/src/h5repack/h5repack_main.c10
-rw-r--r--tools/src/h5repack/h5repack_opttable.c3
-rw-r--r--tools/src/h5repack/h5repack_parse.c13
-rw-r--r--tools/src/h5repack/h5repack_refs.c259
-rw-r--r--tools/src/h5repack/h5repack_verify.c205
-rw-r--r--tools/test/h5diff/CMakeLists.txt10
-rw-r--r--tools/test/h5diff/CMakeTests.cmake14
-rw-r--r--tools/test/h5diff/Makefile.am9
-rw-r--r--tools/test/h5dump/Makefile.am9
-rw-r--r--tools/test/h5ls/Makefile.am9
-rw-r--r--tools/test/h5repack/CMakeTests.cmake6
-rw-r--r--tools/test/h5repack/Makefile.am13
-rw-r--r--tools/test/h5repack/h5repacktst.c1692
-rw-r--r--tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl4
-rw-r--r--tools/test/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst5
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl2
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl2
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.ddl131
-rw-r--r--tools/test/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst5
-rw-r--r--tools/test/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst5
-rw-r--r--tools/test/h5repack/testfiles/plugin_version_test.h5repack_layout.h5.tst5
-rw-r--r--tools/test/h5repack/testfiles/plugin_zero.h5repack_layout.h5.tst19
41 files changed, 4417 insertions, 3747 deletions
diff --git a/MANIFEST b/MANIFEST
index f194f72..e0e30c7 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1244,6 +1244,7 @@
./testpar/t_ph5basic.c
./testpar/t_pflush1.c
./testpar/t_pflush2.c
+./testpar/t_pread.c
./testpar/t_prop.c
./testpar/t_shapesame.c
./testpar/t_pshutdown.c
diff --git a/configure.ac b/configure.ac
index 07d8b15..ed7727b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1062,6 +1062,7 @@ esac
case "`uname`" in
CYGWIN*)
AC_CHECK_HEADERS([io.h sys/timeb.h])
+ UNAME_CYGWIN="yes"
;;
MINGW*)
AC_CHECK_HEADERS([io.h winsock2.h sys/timeb.h])
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index d0de3ee..db3e4e0 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -62,6 +62,31 @@ New Features
Parallel Library:
-----------------
+ - Optimize parallel open/location of the HDF5 super-block
+
+ Previous releases of PHDF5 required all parallel ranks to
+ search for the HDF5 superblock signature when opening the
+ file. As this is accomplished more or less as a synchronous
+ operation, a large number of processes can experience a
+ slowdown in the file open due to filesystem contention.
+
+ As a first step in improving the startup/file-open performance,
+ we allow MPI rank 0 of the associated MPI communicator to locate
+ the base offset of the super-block and then broadcast that result
+ to the remaining ranks in the parallel group. Note that this
+ approach is utilized ONLY during file opens which employ the MPIO
+ file driver in HDF5 by previously having called H5Pset_fapl_mpio().
+
+ HDF5 parallel file operations which do not employ multiple ranks
+ e.g. specifiying MPI_COMM_SELF (whose MPI_Comm_size == 1)
+ as opposed to MPI_COMM_WORLD, will not be affected by this
+ optimization. Conversely, parallel file operations on subgroups
+ of MPI_COMM_WORLD are allowed to be run in parallel with each
+ subgroup operating as an independant collection of processes.
+
+ (RAW – 2017/10/10, HDFFV-10294)
+
+
- Large MPI-IO transfers
Previous releases of PHDF5 would fail when attempting to
@@ -132,7 +157,16 @@ Bug Fixes since HDF5-1.10.1 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)
Configuration
-------------
@@ -158,6 +192,18 @@ Bug Fixes since HDF5-1.10.1 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
@@ -291,15 +337,20 @@ Supported Platforms
Windows 7 Visual Studio 2012 w/ Intel Fortran 15 (cmake)
Visual Studio 2013 w/ Intel Fortran 15 (cmake)
Visual Studio 2015 w/ Intel Fortran 16 (cmake)
- Cygwin(CYGWIN_NT-6.1 2.2.1(0.289/5/3) gcc(4.9.3) compiler and gfortran)
- (cmake and autotools)
Windows 7 x64 Visual Studio 2012 w/ Intel Fortran 15 (cmake)
Visual Studio 2013 w/ Intel Fortran 15 (cmake)
Visual Studio 2015 w/ Intel Fortran 16 (cmake)
- Visual Studio 2015 w/ Intel Parallel Studio 2017 (cmake)
+ Visual Studio 2015 w/ Intel C, Fortran 2017 (cmake)
+ Visual Studio 2015 w/ MSMPI 8 (cmake)
+ Cygwin(CYGWIN_NT-6.1 2.8.0(0.309/5/3)
+ gcc and gfortran compilers (GCC 5.4.0)
+ (cmake and autotools)
Windows 10 Visual Studio 2015 w/ Intel Fortran 16 (cmake)
+ Cygwin(CYGWIN_NT-6.1 2.8.0(0.309/5/3)
+ gcc and gfortran compilers (GCC 5.4.0)
+ (cmake and autotools)
Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 16 (cmake)
diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h
index 9bcc182..6ee0a1a 100644
--- a/src/H5FDmpio.h
+++ b/src/H5FDmpio.h
@@ -29,27 +29,6 @@
#endif /* H5_HAVE_PARALLEL */
#ifdef H5_HAVE_PARALLEL
-#define H5FD_GET_MPI_RANK_AND_SIZE(rank,size, f) { \
- (rank) = 0; (size) = 1; \
- if (H5F_HAS_FEATURE((f), H5FD_FEAT_HAS_MPI)) { \
- (rank) = H5F_mpi_get_rank((f)); \
- (size) = H5F_mpi_get_size((f)); \
- } else { \
- int mpi_initialized = 0, mpi_finalized = 0; \
- MPI_Initialized(&mpi_initialized); \
- MPI_Finalized(&mpi_finalized); \
- if (mpi_initialized && !mpi_finalized) { \
- MPI_Comm_rank(MPI_COMM_WORLD, &(rank)); \
- MPI_Comm_size(MPI_COMM_WORLD, &(size)); \
- } \
- }}
-
-#define H5FD_GET_MPI_COMM(comm, f) { \
- if (H5F_HAS_FEATURE((f), H5FD_FEAT_HAS_MPI)) \
- (comm) = H5F_mpi_get_comm((f)); \
- else (comm) = MPI_COMM_WORLD; \
- }
-
/*Turn on H5FDmpio_debug if H5F_DEBUG is on */
#ifdef H5F_DEBUG
#ifndef H5FDmpio_DEBUG
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 4750223..0c6f9cd 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -21,15 +21,15 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
+#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
#include "H5SMprivate.h" /* Shared Object Header Messages */
@@ -158,7 +158,7 @@ H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr)
/* Open the superblock extension object header */
if(H5O_open(ext_ptr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open superblock extension")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open superblock extension")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -224,12 +224,12 @@ done:
/*-------------------------------------------------------------------------
* Function: H5F__update_super_ext_driver_msg
*
- * Purpose: Update the superblock extension file driver info message if
- * we are using a V 2 superblock. Observe that the function
- * is a NO-OP if the file driver info message does not exist.
+ * Purpose: Update the superblock extension file driver info message if
+ * we are using a V 2 superblock. Observe that the function
+ * is a NO-OP if the file driver info message does not exist.
* This is necessary, as the function is called whenever the
- * EOA is updated, and were it to create the file driver info
- * message, it would find itself in an infinite recursion.
+ * EOA is updated, and were it to create the file driver info
+ * message, it would find itself in an infinite recursion.
*
* Return: Success: SUCCEED
* Failure: FAIL
@@ -267,7 +267,7 @@ H5F__update_super_ext_driver_msg(H5F_t *f, hid_t dxpl_id)
/* Check for driver info */
H5_CHECKED_ASSIGN(driver_size, size_t, H5FD_sb_size(f->shared->lf), hsize_t);
- /* Nothing to do unless there is both driver info and
+ /* Nothing to do unless there is both driver info and
* the driver info superblock extension message has
* already been created.
*/
@@ -330,10 +330,13 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
unsigned sblock_flags = H5AC__NO_FLAGS_SET; /* flags used in superblock unprotect call */
haddr_t super_addr; /* Absolute address of superblock */
haddr_t eof; /* End of file address */
- unsigned rw_flags; /* Read/write permissions for file */
- hbool_t skip_eof_check = FALSE; /* Whether to skip checking the EOF value */
+ unsigned rw_flags; /* Read/write permissions for file */
+ hbool_t skip_eof_check = FALSE; /* Whether to skip checking the EOF value */
herr_t ret_value = SUCCEED; /* Return value */
+#ifdef H5_HAVE_PARALLEL
int mpi_rank = 0, mpi_size = 1;
+ int mpi_result;
+#endif /* H5_HAVE_PARALLEL */
FUNC_ENTER_PACKAGE_TAG(meta_dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL)
@@ -356,32 +359,50 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
/* Find the superblock */
#ifdef H5_HAVE_PARALLEL
- H5FD_GET_MPI_RANK_AND_SIZE(mpi_rank, mpi_size, f);
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+
+ if((mpi_rank = H5F_mpi_get_rank(f)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Can't get MPI rank")
+
+ if((mpi_size = H5F_mpi_get_size(f)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size")
+ }
+
/* If we are an MPI application with at least two processes, the
* following superblock signature location optimization is applicable.
+ *
+ * Note:: For parallel applications which don't setup for using the
+ * HDF5 MPIO driver, we will arrive here with mpi_size == 1.
+ * This occurs because of the variable initialization (above) and the
+ * fact that we have skipped actually calling MPI functions to determine
+ * our MPI rank and size.
*/
if ( mpi_size > 1 ) {
- MPI_Comm this_comm = MPI_COMM_NULL;
-
- if ( mpi_rank == 0 ) {
- if(H5FD_locate_signature(&fdio_info, &super_addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
- }
- H5FD_GET_MPI_COMM(this_comm, f);
- if (( this_comm == MPI_COMM_NULL ) ||
- ( MPI_Bcast(&super_addr,sizeof(super_addr), MPI_BYTE, 0, this_comm) != MPI_SUCCESS))
- HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
+ MPI_Comm this_comm = MPI_COMM_NULL;
+
+ if ( mpi_rank == 0 ) {
+ if (H5FD_locate_signature(&fdio_info, &super_addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
+ }
+ HDassert(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI));
+
+ if ( MPI_COMM_NULL == (this_comm = H5F_mpi_get_comm(f)) )
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator")
+
+ if ( MPI_SUCCESS !=
+ (mpi_result = MPI_Bcast(&super_addr,sizeof(super_addr), MPI_BYTE, 0, this_comm)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
}
else {
/* Locate the signature as per per the serial library */
-#endif /* H5_HAVE_PARALLEL */
+#endif /* H5_HAVE_PARALLEL */
- if(H5FD_locate_signature(&fdio_info, &super_addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
+ if (H5FD_locate_signature(&fdio_info, &super_addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
#ifdef H5_HAVE_PARALLEL
}
-#endif
+#endif /* H5_HAVE_PARALLEL */
if(HADDR_UNDEF == super_addr)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "file signature not found")
@@ -432,12 +453,12 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock")
if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
- if(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
- HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "invalid superblock version for SWMR_WRITE")
+ if(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "invalid superblock version for SWMR_WRITE")
/* Enable all latest version support when file has v3 superblock */
if(sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3)
- f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
+ f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
/* Pin the superblock in the cache */
if(H5AC_pin_protected_entry(sblock) < 0)
@@ -537,15 +558,15 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
* been flushed to disk by the SWMR writer process.
*/
if(H5F_INTENT(f) & H5F_ACC_SWMR_READ) {
- /*
- * When the file is opened for SWMR read access, skip the check if:
- * --the file is already marked for SWMR writing and
- * --the file has version 3 superblock for SWMR support
- */
- if((sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS) &&
+ /*
+ * When the file is opened for SWMR read access, skip the check if:
+ * --the file is already marked for SWMR writing and
+ * --the file has version 3 superblock for SWMR support
+ */
+ if((sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS) &&
(sblock->status_flags & H5F_SUPER_WRITE_ACCESS) &&
sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3)
- skip_eof_check = TRUE;
+ skip_eof_check = TRUE;
} /* end if */
if(!skip_eof_check && initial_read) {
if(HADDR_UNDEF == (eof = H5FD_get_eof(f->shared->lf, H5FD_MEM_DEFAULT)))
@@ -619,7 +640,7 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
H5O_loc_t ext_loc; /* "Object location" for superblock extension */
H5O_btreek_t btreek; /* v1 B-tree 'K' value message from superblock extension */
H5O_drvinfo_t drvinfo; /* Driver info message from superblock extension */
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
htri_t status; /* Status for message existing */
/* Sanity check - superblock extension should only be defined for
@@ -640,7 +661,7 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
} /* end if */
/* Open the superblock extension */
- if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
+ if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
/* Check for the extension having a 'driver info' message */
@@ -663,8 +684,8 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
/* Reset driver info message */
H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo);
- HDassert(FALSE == f->shared->drvinfo_sb_msg_exists);
- f->shared->drvinfo_sb_msg_exists = TRUE;
+ HDassert(FALSE == f->shared->drvinfo_sb_msg_exists);
+ f->shared->drvinfo_sb_msg_exists = TRUE;
} /* end else */
} /* end if */
@@ -790,37 +811,37 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
} /* end if not marked "unknown" */
} /* end if */
- /* Check for the extension having a 'metadata cache image' message */
+ /* Check for the extension having a 'metadata cache image' message */
if((status = H5O_msg_exists(&ext_loc, H5O_MDCI_MSG_ID, meta_dxpl_id)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header")
if(status) {
- hbool_t rw = ((rw_flags & H5AC__READ_ONLY_FLAG) == 0);
- H5O_mdci_t mdci_msg;
+ hbool_t rw = ((rw_flags & H5AC__READ_ONLY_FLAG) == 0);
+ H5O_mdci_t mdci_msg;
- /* if the metadata cache image superblock extension message exists,
+ /* if the metadata cache image superblock extension message exists,
* read its contents and pass the data on to the metadata cache.
* Given this data, the cache will load and decode the metadata
- * cache image block, decoded it and load its contents into the
- * the cache on the test protect call.
+ * cache image block, decoded it and load its contents into the
+ * the cache on the test protect call.
*
* Further, if the file is opened R/W, the metadata cache will
- * delete the metadata cache image superblock extension and free
- * the cache image block. Don't do this now as f->shared
- * is not fully setup, which complicates matters.
+ * delete the metadata cache image superblock extension and free
+ * the cache image block. Don't do this now as f->shared
+ * is not fully setup, which complicates matters.
*/
/* Retrieve the 'metadata cache image message' structure */
- if(NULL == H5O_msg_read(&ext_loc, H5O_MDCI_MSG_ID, &mdci_msg, meta_dxpl_id))
+ if(NULL == H5O_msg_read(&ext_loc, H5O_MDCI_MSG_ID, &mdci_msg, meta_dxpl_id))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache image message")
/* Indicate to the cache that there's an image to load on first protect call */
if(H5AC_load_cache_image_on_next_protect(f, mdci_msg.addr, mdci_msg.size, rw) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTLOAD, FAIL, "call to H5AC_load_cache_image_on_next_protect failed");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTLOAD, FAIL, "call to H5AC_load_cache_image_on_next_protect failed");
} /* end if */
/* Close superblock extension */
if(H5F_super_ext_close(f, &ext_loc, meta_dxpl_id, FALSE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension")
} /* end if */
/* Update the driver info if VFD indicated to do so */
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 <koziol@hdfgroup.org>
+ * Created: H5Pocpl.c
+ * Nov 28 2006
+ * Quincey Koziol <koziol@hdfgroup.org>
*
- * 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 1dc93d8..1d023b5 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -609,12 +609,6 @@ H5Zfilter_avail(H5Z_filter_t id)
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 */
done:
FUNC_LEAVE_API(ret_value)
@@ -633,6 +627,7 @@ 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)
@@ -640,8 +635,13 @@ H5Z_filter_avail(H5Z_filter_t id)
/* Is the filter already registered? */
for(i = 0; i < H5Z_table_used_g; i++)
if(H5Z_table_g[i].id == id)
- HGOTO_DONE(TRUE)
+ 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() */
@@ -1136,7 +1136,7 @@ H5Z_find(H5Z_filter_t id)
/* Get the index in the global table */
if((idx=H5Z_find_idx(id))<0)
- HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "required filter is not registered")
+ HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "required filter %d is not registered", id)
/* Set return value */
ret_value=H5Z_table_g+idx;
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index f4c52b6..61ac3d2 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -268,6 +268,7 @@ add_test (NAME H5TEST-clear-testhdf5-objects
tfile5.h5
tfile6.h5
tfile7.h5
+ tfilespace.h5
th5o_file
th5s1.h5
tselect.h5
@@ -334,6 +335,7 @@ else ()
tfile5.h5
tfile6.h5
tfile7.h5
+ tfilespace.h5
th5o_file
th5s1.h5
tselect.h5
diff --git a/test/Makefile.am b/test/Makefile.am
index 53dbf0d..ba2d79b 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -100,36 +100,34 @@ if BUILD_ALL_CONDITIONAL
noinst_PROGRAMS=$(BUILD_ALL_PROGS)
endif
-# The libh5test library provides common support code for the tests.
-noinst_LTLIBRARIES=libh5test.la
-
if HAVE_SHARED_CONDITIONAL
+ # The libh5test library provides common support code for the tests.
# The libdynlib1, libdynlib2, libdynlib3, and libdynlib4 library for testing plugin module plugin.c.
- # Build it as shared library if configure is enabled for shared library.
- dyn_LTLIBRARIES=libdynlib1.la libdynlib2.la libdynlib3.la libdynlib4.la
+ # Build them as shared libraries if configure is enabled for shared library.
+ noinst_LTLIBRARIES=libh5test.la libdynlib1.la libdynlib2.la libdynlib3.la libdynlib4.la
libdynlib1_la_SOURCES=dynlib1.c
libdynlib2_la_SOURCES=dynlib2.c
libdynlib3_la_SOURCES=dynlib3.c
libdynlib4_la_SOURCES=dynlib4.c
- libdynlib1_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
- libdynlib2_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
- libdynlib3_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
- libdynlib4_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+ libdynlib1_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
+ libdynlib2_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
+ libdynlib3_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
+ libdynlib4_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-libdynlib1.la: $(libdynlib1_la_OBJECTS) $(libdynlib1_la_DEPENDENCIES) $(EXTRA_libdynlib1_la_DEPENDENCIES)
+ libdynlib1.la: $(libdynlib1_la_OBJECTS) $(libdynlib1_la_DEPENDENCIES) $(EXTRA_libdynlib1_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdynlib1_la_LINK) $(am_libdynlib1_la_rpath) $(libdynlib1_la_OBJECTS) $(libdynlib1_la_LIBADD)
-libdynlib2.la: $(libdynlib2_la_OBJECTS) $(libdynlib2_la_DEPENDENCIES) $(EXTRA_libdynlib2_la_DEPENDENCIES)
+ libdynlib2.la: $(libdynlib2_la_OBJECTS) $(libdynlib2_la_DEPENDENCIES) $(EXTRA_libdynlib2_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdynlib2_la_LINK) $(am_libdynlib2_la_rpath) $(libdynlib2_la_OBJECTS) $(libdynlib2_la_LIBADD)
-libdynlib3.la: $(libdynlib3_la_OBJECTS) $(libdynlib3_la_DEPENDENCIES) $(EXTRA_libdynlib3_la_DEPENDENCIES)
+ libdynlib3.la: $(libdynlib3_la_OBJECTS) $(libdynlib3_la_DEPENDENCIES) $(EXTRA_libdynlib3_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdynlib3_la_LINK) $(am_libdynlib3_la_rpath) $(libdynlib3_la_OBJECTS) $(libdynlib3_la_LIBADD)
-libdynlib4.la: $(libdynlib4_la_OBJECTS) $(libdynlib4_la_DEPENDENCIES) $(EXTRA_libdynlib4_la_DEPENDENCIES)
+ libdynlib4.la: $(libdynlib4_la_OBJECTS) $(libdynlib4_la_DEPENDENCIES) $(EXTRA_libdynlib4_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdynlib4_la_LINK) $(am_libdynlib4_la_rpath) $(libdynlib4_la_OBJECTS) $(libdynlib4_la_LIBADD)
-
-#install-exec-hook:
-# $(RM) $(DESTDIR)$(dyndir)/*dynlib*
+else
+ # The libh5test library provides common support code for the tests.
+ noinst_LTLIBRARIES=libh5test.la
endif
libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c
diff --git a/test/dsets.c b/test/dsets.c
index 0ca08e4..4088304 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -12,17 +12,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Tuesday, December 9, 1997
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * 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<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- points[i][j] = (int)(n++);
- }
+ for(j=0; j<size[1]; j++) {
+ points[i][j] = (int)(n++);
+ }
}
if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
- TEST_ERROR;
+ TEST_ERROR;
if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR;
@@ -1789,22 +1708,23 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
} H5E_END_TRY;
if(status>=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<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- fprintf(stderr," At original: %d\n", (int)points[i][j]);
- fprintf(stderr," At returned: %d\n", (int)check[i][j]);
- goto error;
- }
- }
+ for(j=0; j<size[1]; j++) {
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ fprintf(stderr," Read different values than written.\n");
+ fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ fprintf(stderr," At original: %d\n", (int)points[i][j]);
+ fprintf(stderr," At returned: %d\n", (int)check[i][j]);
+ goto error;
+ }
+ }
}
}
@@ -1820,12 +1740,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
TESTING(" filters (modify)");
for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]/2; j++) {
- points[i][j] = (int)HDrandom ();
- }
+ for(j=0; j<size[1]/2; j++) {
+ points[i][j] = (int)HDrandom ();
+ }
}
if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
- TEST_ERROR;
+ TEST_ERROR;
if(corrupted) {
/* Default behavior is failure when data is corrupted. */
@@ -1847,22 +1767,23 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
} H5E_END_TRY;
if(status>=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<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if(points[i][j] != check[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[1]; j++) {
+ if(points[i][j] != check[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;
+ }
+ }
}
}
@@ -1908,14 +1829,14 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
/* Check that the values read are the same as the values written */
for(i = 0; i < size[0]; i++)
- for(j = 0; j < size[1]; j++)
- if(points[i][j] != check[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;
- } /* end if */
+ for(j = 0; j < size[1]; j++)
+ if(points[i][j] != check[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;
+ } /* end if */
} /* end else */
PASSED();
@@ -1930,15 +1851,15 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
TESTING(" filters (partial I/O)");
for(i=0; i<(size_t)hs_size[0]; i++) {
- for(j=0; j<(size_t)hs_size[1]; j++) {
- points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] = (int)HDrandom();
- }
+ for(j=0; j<(size_t)hs_size[1]; j++) {
+ points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] = (int)HDrandom();
+ }
}
if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size,
- NULL) < 0) TEST_ERROR;
+ NULL) < 0) TEST_ERROR;
/* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */
if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points) < 0)
- TEST_ERROR;
+ TEST_ERROR;
if(corrupted) {
/* Default behavior is failure when data is corrupted. */
@@ -1960,27 +1881,28 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
} H5E_END_TRY;
if(status>=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<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i;
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto error;
+ goto error;
if(H5Sclose(space) < 0) goto error;
if(H5Tclose(type) < 0) goto error;
@@ -5270,12 +5151,12 @@ test_types(hid_t file)
/* bitfield_2 */
nelmts = sizeof(buf)/2;
if((type=H5Tcopy(H5T_STD_B16LE)) < 0 ||
- (space=H5Screate_simple(1, &nelmts, NULL)) < 0 ||
- (dset=H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ (space=H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset=H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i;
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto error;
+ goto error;
if(H5Sclose(space) < 0) goto error;
if(H5Tclose(type) < 0) goto error;
if(H5Dclose(dset) < 0) goto error;
@@ -5286,7 +5167,7 @@ test_types(hid_t file)
H5Tset_tag(type, "testing 1-byte opaque type") < 0 ||
(space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
(dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
for(i = 0; i < sizeof buf; i++)
buf[i] = (unsigned char)0xff ^ (unsigned char)i;
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error;
@@ -5300,7 +5181,7 @@ test_types(hid_t file)
H5Tset_tag(type, "testing 4-byte opaque type") < 0 ||
(space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
(dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
for(i = 0; i < sizeof buf; i++)
buf[i] = (unsigned char)0xff ^ (unsigned char)i;
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error;
@@ -5315,10 +5196,10 @@ test_types(hid_t file)
error:
H5E_BEGIN_TRY {
- H5Gclose(grp);
- H5Tclose(type);
- H5Sclose(space);
- H5Dclose(dset);
+ H5Gclose(grp);
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Dclose(dset);
} H5E_END_TRY;
return -1;
}
@@ -5326,27 +5207,27 @@ test_types(hid_t file)
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
H5Z_CLASS_T_VERS,
- H5Z_FILTER_CAN_APPLY_TEST, /* Filter id number */
+ H5Z_FILTER_CAN_APPLY_TEST, /* Filter id number */
1, 1,
- "can_apply_test", /* Filter name for debugging */
+ "can_apply_test", /* Filter name for debugging */
can_apply_bogus, /* The "can apply" callback */
NULL, /* The "set local" callback */
- filter_bogus, /* The actual filter function */
+ filter_bogus, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
- * Function: test_can_apply
+ * Function: test_can_apply
*
- * Purpose: Tests library behavior when filter indicates it can't
+ * Purpose: Tests library behavior when filter indicates it can't
* apply to certain combinations of creation parameters.
* The filter is mandate. If the CAN_APPLY callback function
* indicates wrong datatype, the dataset creation should fail.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, April 5, 2003
*
*-------------------------------------------------------------------------
@@ -5395,7 +5276,7 @@ test_can_apply(hid_t file)
} /* end if */
/* Create new dataset */
- /* (Should fail because the 'can apply' function should indicate inappropriate
+ /* (Should fail because the 'can apply' function should indicate inappropriate
* combination. And the filter is mandate.) */
H5E_BEGIN_TRY {
dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
@@ -5463,16 +5344,16 @@ test_can_apply(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 */
@@ -5507,29 +5388,29 @@ error:
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CAN_APPLY_TEST2[1] = {{
H5Z_CLASS_T_VERS,
- H5Z_FILTER_CAN_APPLY_TEST2, /* Filter id number */
+ H5Z_FILTER_CAN_APPLY_TEST2, /* Filter id number */
1, 1,
- "can_apply_test", /* Filter name for debugging */
+ "can_apply_test", /* Filter name for debugging */
can_apply_bogus, /* The "can apply" callback */
NULL, /* The "set local" callback */
- filter_bogus3, /* The actual filter function */
+ filter_bogus3, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
- * Function: test_can_apply2
+ * Function: test_can_apply2
*
- * Purpose: Tests library behavior when an optional filter indicates
- * it can't apply to certain combinations of creation
+ * Purpose: Tests library behavior when an optional filter indicates
+ * it can't apply to certain combinations of creation
* parameters. The filter function FILTER_BOGUS3 does nothing
- * than returning a failure. Because the filter is optional,
+ * than returning a failure. Because the filter is optional,
* the library skips the filter even though the CAN_APPLY_BOGUS
- * indicates the datatype DOUBLE can't apply to the dataset.
+ * indicates the datatype DOUBLE can't apply to the dataset.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 4 August 2010
*
*-------------------------------------------------------------------------
@@ -5622,16 +5503,16 @@ test_can_apply2(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 */
@@ -5666,15 +5547,15 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_can_apply_szip
+ * Function: test_can_apply_szip
*
- * Purpose: Tests library behavior when szip filter indicates it can't
+ * Purpose: Tests library behavior when szip filter indicates it can't
* apply to certain combinations of creation parameters
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, April 7, 2003
*
*-------------------------------------------------------------------------
@@ -5861,24 +5742,24 @@ error:
/* This message derives from H5Z */
const H5Z_class2_t H5Z_SET_LOCAL_TEST[1] = {{
H5Z_CLASS_T_VERS,
- H5Z_FILTER_SET_LOCAL_TEST, /* Filter id number */
+ H5Z_FILTER_SET_LOCAL_TEST, /* Filter id number */
1, 1,
- "set_local_test", /* Filter name for debugging */
+ "set_local_test", /* Filter name for debugging */
NULL, /* The "can apply" callback */
set_local_bogus2, /* The "set local" callback */
- filter_bogus2, /* The actual filter function */
+ filter_bogus2, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
- * Function: test_set_local
+ * Function: test_set_local
*
- * Purpose: Tests library behavior for "set local" filter callback
+ * Purpose: Tests library behavior for "set local" filter callback
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, April 7, 2003
*
*-------------------------------------------------------------------------
@@ -5905,16 +5786,16 @@ test_set_local(hid_t fapl)
/* Initialize the integer & floating-point dataset */
n=1.0F;
for(i = 0; i < DSET_DIM1; i++)
- for(j = 0; j < DSET_DIM2; j++) {
- points[i][j] = (int)n++;
- points_dbl[i][j] = (double)1.5F*n++;
- }
+ for(j = 0; j < DSET_DIM2; j++) {
+ points[i][j] = (int)n++;
+ points_dbl[i][j] = (double)1.5F*n++;
+ }
/* Open file */
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
H5_FAILED();
printf(" Line %d: Can't open file\n",__LINE__);
- goto error;
+ goto error;
}
/* Create dcpl with special filter */
@@ -6048,16 +5929,16 @@ test_set_local(hid_t fapl)
/* Compare data */
/* Check that the values read are the modified version of what was written */
for(i=0; i<dims[0]; i++) {
- for(j=0; j<dims[1]; j++) {
- if((points[i][j]+(int)sizeof(int)) != 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<dims[1]; j++) {
+ if((points[i][j]+(int)sizeof(int)) != 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 */
@@ -6098,18 +5979,18 @@ test_set_local(hid_t fapl)
/* Compare data */
/* Check that the values read are the modified version of what was written */
for(i=0; i<dims[0]; i++) {
- for(j=0; j<dims[1]; j++) {
- /* If the difference between two values is greater than 0.001%, they're
+ for(j=0; j<dims[1]; j++) {
+ /* If the difference between two values is greater than 0.001%, they're
* considered not equal. */
if(!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], (double)0.00001F)) {
- 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: %f\n",points_dbl[i][j]);
- printf(" At returned: %f\n",check_dbl[i][j]);
- goto error;
- } /* end if */
- } /* end for */
+ 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: %f\n",points_dbl[i][j]);
+ printf(" At returned: %f\n",check_dbl[i][j]);
+ goto error;
+ } /* end if */
+ } /* end for */
} /* end for */
/* Close dataset */
@@ -6136,16 +6017,16 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_compare_dcpl
+ * Function: test_compare_dcpl
*
- * Purpose: Verifies that if the same DCPL was used to create two
+ * Purpose: Verifies that if the same DCPL was used to create two
* datasets, the DCPLs retrieved from each dataset should
* compare equal.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Wednesday, January 7, 2004
*
*-------------------------------------------------------------------------
@@ -6221,17 +6102,17 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_copy_dcpl
+ * Function: test_copy_dcpl
*
- * Purpose: Verifies whether the copy of dataset creation property
+ * Purpose: Verifies whether the copy of dataset creation property
* list works. It tests the DCPL for chunked layout with
* filter and for contiguous layout with external storage.
* (Please see #1608 in Bugzilla)
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 28 January 2010
*
*-------------------------------------------------------------------------
@@ -6247,7 +6128,7 @@ test_copy_dcpl(hid_t file, hid_t fapl)
hid_t dcpl1_copy=(-1),dcpl2_copy=(-1);/* Copies of creation property list IDs */
const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
- char filename[FILENAME_BUF_SIZE];
+ char filename[FILENAME_BUF_SIZE];
hid_t new_file=(-1);
TESTING("copying dataset creation property lists");
@@ -6309,10 +6190,10 @@ test_copy_dcpl(hid_t file, hid_t fapl)
TEST_ERROR
if((new_dsid1 = H5Dcreate2(new_file, DSET_COPY_DCPL_NAME_1, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, dcpl1_copy, H5P_DEFAULT)) < 0) TEST_ERROR
+ H5P_DEFAULT, dcpl1_copy, H5P_DEFAULT)) < 0) TEST_ERROR
if((new_dsid2 = H5Dcreate2(new_file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, dcpl2_copy, H5P_DEFAULT)) < 0) TEST_ERROR
+ H5P_DEFAULT, dcpl2_copy, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close dataspace */
if(H5Sclose(sid) < 0) TEST_ERROR
@@ -6653,9 +6534,9 @@ test_zero_dims(hid_t file)
hid_t s2 = -1, d2 = -1, dcpl2 = -1;
hsize_t dzero = 0, dmax = H5S_UNLIMITED, csize = 5;
hsize_t dzero2[2] = {0, 0};
- hsize_t dmax2[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t csize2[2] = {5, 5};
- hid_t fapl; /* File access property list */
+ hsize_t dmax2[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t csize2[2] = {5, 5};
+ hid_t fapl; /* File access property list */
H5D_chunk_index_t idx_type; /* Dataset chunk index type */
H5F_libver_t low; /* File format low bound */
herr_t ret;
@@ -6671,8 +6552,8 @@ test_zero_dims(hid_t file)
/* Close FAPL */
if(H5Pclose(fapl) < 0) TEST_ERROR
- /*
- * One-dimensional dataset
+ /*
+ * One-dimensional dataset
*/
if((s = H5Screate_simple(1, &dzero, &dmax)) < 0) FAIL_STACK_ERROR
@@ -6707,10 +6588,10 @@ test_zero_dims(hid_t file)
/* Verify index type */
if(low == H5F_LIBVER_LATEST) {
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
- FAIL_PUTS_ERROR("should be using extensible array as index");
+ if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("should be using extensible array as index");
} else if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("should be using v1 B-tree as index");
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
/* Various no-op writes */
if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
@@ -6728,8 +6609,8 @@ test_zero_dims(hid_t file)
if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
if(H5Sclose(s) < 0) FAIL_STACK_ERROR
- /*
- * Two-dimensional dataset
+ /*
+ * Two-dimensional dataset
*/
if((s2 = H5Screate_simple(2, dzero2, dmax2)) < 0) FAIL_STACK_ERROR
@@ -6766,10 +6647,10 @@ test_zero_dims(hid_t file)
/* Verify index type */
if(low == H5F_LIBVER_LATEST) {
- if(idx_type != H5D_CHUNK_IDX_BT2)
- FAIL_PUTS_ERROR("should be using v2 B-tree as index");
+ 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");
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
/* Just a no-op */
if(H5Dwrite(d2, H5T_NATIVE_INT, s2, s2, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
@@ -6815,11 +6696,11 @@ error:
static herr_t
test_missing_chunk(hid_t file)
{
- hid_t d = -1, did2 = -1; /* Dataset IDs */
- hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property IDs */
- hid_t s = -1, sid2 = -1; /* Dataspace ID */
- hsize_t hs_start[1], hs_stride[1], hs_count[1], hs_block[1]; /* Hyperslab setting */
- hsize_t hs_start2[2], hs_stride2[2], hs_count2[2], hs_block2[2];/* Hyperslab setting */
+ hid_t d = -1, did2 = -1; /* Dataset IDs */
+ hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property IDs */
+ hid_t s = -1, sid2 = -1; /* Dataspace ID */
+ hsize_t hs_start[1], hs_stride[1], hs_count[1], hs_block[1]; /* Hyperslab setting */
+ hsize_t hs_start2[2], hs_stride2[2], hs_count2[2], hs_block2[2];/* Hyperslab setting */
/* Buffers for reading/writing dataset */
int wdata[MISSING_CHUNK_DIM],
@@ -6829,16 +6710,16 @@ test_missing_chunk(hid_t file)
/* Setting for 1-D dataset */
hsize_t dsize=100, dmax=H5S_UNLIMITED;
- hsize_t csize=5;
+ hsize_t csize=5;
/* Setting for 2-D dataset */
hsize_t dsize2[2] = {100, 100}, dmax2[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t csize2[2] = {5, 5};
- size_t u, i, j; /* Local Index variable */
+ hsize_t csize2[2] = {5, 5};
+ size_t u, i, j; /* Local Index variable */
- hid_t fapl; /* File access property list */
- H5F_libver_t low; /* File format low bound */
- H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index types */
+ hid_t fapl; /* File access property list */
+ H5F_libver_t low; /* File format low bound */
+ H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index types */
TESTING("Read dataset with unwritten chunk & undefined fill value");
@@ -6859,10 +6740,10 @@ test_missing_chunk(hid_t file)
/* Initialize data for 2-D dataset */
for(i = 0; i < MISSING_CHUNK_DIM; i++) {
- for(j = 0; j < MISSING_CHUNK_DIM; j++) {
- wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
- rdata2[i][j] = 911;
- }
+ for(j = 0; j < MISSING_CHUNK_DIM; j++) {
+ wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
+ rdata2[i][j] = 911;
+ }
} /* end for */
/* Create dataspace */
@@ -6895,11 +6776,11 @@ test_missing_chunk(hid_t file)
FAIL_PUTS_ERROR("should be using Extensible Array as index");
if(idx_type2 != 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(idx_type2 != 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");
+ if(idx_type2 != H5D_CHUNK_IDX_BTREE)
+ FAIL_PUTS_ERROR("should be using v1 B-tree as index");
}
/* Select elements in every other chunk for 1-D dataset */
@@ -6908,7 +6789,7 @@ test_missing_chunk(hid_t file)
hs_count[0]=10;
hs_block[0]=5;
if(H5Sselect_hyperslab(s, H5S_SELECT_SET, hs_start, hs_stride, hs_count,
- hs_block) < 0) TEST_ERROR;
+ hs_block) < 0) TEST_ERROR;
/* Select elements in every other chunk for 2-D dataset */
hs_start2[0] = hs_start2[1] = 0;
@@ -6916,7 +6797,7 @@ test_missing_chunk(hid_t file)
hs_count2[0] = hs_count2[1] = 10;
hs_block2[0] = hs_block2[1] = 5;
if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_start2, hs_stride2, hs_count2,
- hs_block2) < 0) TEST_ERROR;
+ hs_block2) < 0) TEST_ERROR;
/* Write selected data to the datasets */
if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
@@ -6944,23 +6825,23 @@ test_missing_chunk(hid_t file)
/* Validata values read for the 2-D dataset */
for(i = 0; i < MISSING_CHUNK_DIM; i++) {
- 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 */
+ 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/testpar/t_pread.c b/testpar/t_pread.c
index 4512185..7f23b9b 100644
--- a/testpar/t_pread.c
+++ b/testpar/t_pread.c
@@ -1,196 +1,904 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "mpi.h"
-#include "hdf5.h"
+/*
+ * Collective file open optimization tests
+ *
+ */
-static char *random_hdf5_text =
- "Now is the time for all first-time-users of HDF5 to read their manual or go thru the tutorials!\n\
-While you\'re at it, now is also the time to read up on MPI-IO.";
+#include "h5test.h"
+#include "testpar.h"
+
+/* The collection of files is included below to aid
+ * an external "cleanup" process if required.
+ *
+ * Note that the code below relies on the ordering of this array
+ * since each set of three is used by the tests either to construct
+ * or to read and validate.
+ */
+#define NFILENAME 9
+const char *FILENAMES[NFILENAME + 1]={"t_pread_data_file",
+ "reloc_t_pread_data_file",
+ "prefix_file",
+ "t_pread_group_0_file",
+ "reloc_t_pread_group_0_file",
+ "prefix_file_0",
+ "t_pread_group_1_file",
+ "reloc_t_pread_group_1_file",
+ "prefix_file_1",
+ NULL};
+#define FILENAME_BUF_SIZE 1024
+
+#define COUNT 1000
-static char *datafile_relocated = "relocated_super.h5";
hbool_t pass = true;
+static const char *random_hdf5_text =
+"Now is the time for all first-time-users of HDF5 to read their \
+manual or go thru the tutorials!\n\
+While you\'re at it, now is also the time to read up on MPI-IO.";
+static const char *hitchhiker_quote =
+"A common mistake that people make when trying to design something\n\
+completely foolproof is to underestimate the ingenuity of complete\n\
+fools.\n";
-static void
-generate_test_file( int mpi_rank, int mpi_size )
+static int generate_test_file(MPI_Comm comm, int mpi_rank, int group);
+static int test_parallel_read(MPI_Comm comm, int mpi_rank, int group);
+
+
+/*-------------------------------------------------------------------------
+ * Function: generate_test_file
+ *
+ * Purpose: This function is called to produce an HDF5 data file
+ * whose superblock is relocated to a non-zero offset by
+ * utilizing the 'h5jam' utility to write random text
+ * at the start of the file. Unlike simple concatenation
+ * of files, h5jam is used to place the superblock on a
+ * power-of-2 boundary.
+ *
+ * Since data will be read back and validated, we generate
+ * data in a predictable manner rather than randomly.
+ * For now, we simply use the global mpi_rank of the writing
+ * process as a starting component for the data generation.
+ * Subsequent writes are increments from the initial start
+ * value.
+ *
+ * In the overall scheme of running the test, we'll call
+ * this function twice: first as a collection of all MPI
+ * processes and then a second time with the processes split
+ * more or less in half. Each sub group will operate
+ * collectively on their assigned file. This split into
+ * subgroups validates that parallel groups can successfully
+ * open and read data independantly from the other parallel
+ * operations taking place.
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Richard Warren
+ * 10/1/17
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
{
- FILE *header;
- char *datafile_base = "mytestfile.h5";
- char *prologue_file = "hdf5_readme.txt";
- hid_t file_id, memspace, filespace, attr_id, fapl_id, dxpl_id, dset_id;
- hsize_t i, offset, count = 1000;
- hsize_t dims[1] = {0};
- float nextValue, data_slice[count];
-
- pass = true;
-
- nextValue = (float)(mpi_rank * count);
- for(i=0; i<count; i++) {
- data_slice[i] = nextValue;
- nextValue += 1;
- }
-
- /* create the file (parallel) */
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- H5Pset_fapl_mpio(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL);
- file_id = H5Fcreate(datafile_base, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if ( file_id < 0 ) {
- pass = false;
- HDfprintf(stderr, "FATAL: H5Fcreate failed!\n");
- }
-
- if ( pass ) {
- dxpl_id = H5Pcreate(H5P_DATASET_XFER);
- H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE);
- }
-
- dims[0] = count;
- memspace = H5Screate_simple(1, dims, NULL);
- dims[0] *= mpi_size;
- filespace = H5Screate_simple(1, dims, NULL);
- offset = mpi_rank * count;
- H5Sselect_hyperslab(filespace, H5S_SELECT_SET, &offset, NULL, &count, NULL);
-
- dset_id = H5Dcreate2(file_id, "dataset0", H5T_NATIVE_FLOAT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if ( dset_id < 0 ) {
- pass = false;
- HDfprintf(stderr, "FATAL: H5Dcreate2 failed!\n");
- }
-
- if ( pass ) {
- H5Dwrite(dset_id, H5T_NATIVE_FLOAT, memspace, filespace, dxpl_id, data_slice);
- }
- H5Dclose(dset_id);
- H5Sclose(memspace);
- H5Sclose(filespace);
-
- /* finished creating a data file */
- H5Fclose(file_id);
- H5Pclose(dxpl_id);
-
- if ( mpi_rank > 0 ) return;
-
- /* ---- mpi_rank 0 ------*/
- header = fopen( prologue_file, "w+");
- if (header == NULL) {
- pass = false;
- HDfprintf(stderr, "FATAL: Unable to create a simple txt file\n");
- return;
- }
- else {
- size_t bytes_written, bytes_to_write = strlen(random_hdf5_text);
- bytes_written = fwrite( random_hdf5_text, 1, bytes_to_write , header);
- if (bytes_written == 0) {
- pass = false;
- HDfprintf(stderr, "FATAL: Unable to write a simple txt file\n");
- }
- fclose(header);
- }
-
- if ( pass ) {
- char cmd[256];
- sprintf(cmd, "../tools/src/h5jam/h5jam -i %s -u %s -o %s",
- datafile_base, prologue_file, datafile_relocated);
- system(cmd);
- unlink(datafile_base);
- unlink(prologue_file);
- }
-}
-
-
-static void
-test_parallel_read( int mpi_rank, int mpi_size )
+ FILE *header = NULL;
+ const char *fcn_name = "generate_test_file()";
+ const char *failure_mssg = NULL;
+ const char *group_filename = NULL;
+ char data_filename[FILENAME_BUF_SIZE];
+ char reloc_data_filename[FILENAME_BUF_SIZE];
+ char prolog_filename[FILENAME_BUF_SIZE];
+ int file_index;
+ int group_size;
+ int group_rank;
+ int local_failure = 0;
+ int global_failures = 0;
+ hsize_t count = COUNT;
+ hsize_t i;
+ hsize_t offset;
+ hsize_t dims[1] = {0};
+ hid_t file_id = -1;
+ hid_t memspace = -1;
+ hid_t filespace = -1;
+ hid_t fapl_id = -1;
+ hid_t dxpl_id = -1;
+ hid_t dset_id = -1;
+ float nextValue;
+ float *data_slice = NULL;
+
+ pass = true;
+
+ HDassert(comm != MPI_COMM_NULL);
+
+ if ( (MPI_Comm_rank(comm, &group_rank)) != MPI_SUCCESS) {
+ pass = FALSE;
+ failure_mssg = "generate_test_file: MPI_Comm_rank failed.\n";
+ }
+
+ if ( (MPI_Comm_size(comm, &group_size)) != MPI_SUCCESS) {
+ pass = FALSE;
+ failure_mssg = "generate_test_file: MPI_Comm_size failed.\n";
+ }
+
+ if ( mpi_rank == 0 ) {
+
+ HDfprintf(stdout, "Constructing test files...");
+ }
+
+ /* Setup the file names
+ * The test specfic filenames are stored as consecutive
+ * array entries in the global 'FILENAMES' array above.
+ * Here, we simply decide on the starting index for
+ * file construction. The reading portion of the test
+ * will have a similar setup process...
+ */
+ if ( pass ) {
+ if ( comm == MPI_COMM_WORLD ) { /* Test 1 */
+ file_index = 0;
+ }
+ else if ( group_id == 0 ) { /* Test 2 group 0 */
+ file_index = 3;
+ }
+ else { /* Test 2 group 1 */
+ file_index = 6;
+ }
+
+ /* The 'group_filename' is just a temp variable and
+ * is used to call into the h5_fixname function. No
+ * need to worry that we reassign it for each file!
+ */
+ HDassert((group_filename = FILENAMES[file_index]));
+
+ /* Assign the 'data_filename' */
+ if ( h5_fixname(group_filename, H5P_DEFAULT, data_filename,
+ sizeof(data_filename)) == NULL ) {
+ pass = FALSE;
+ failure_mssg = "h5_fixname(0) failed.\n";
+ }
+ }
+
+ if ( pass ) {
+
+ HDassert( (group_filename = FILENAMES[file_index+1]) );
+
+ /* Assign the 'reloc_data_filename' */
+ if ( h5_fixname(group_filename, H5P_DEFAULT, reloc_data_filename,
+ sizeof(reloc_data_filename)) == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "h5_fixname(1) failed.\n";
+ }
+ }
+
+ if ( pass ) {
+
+ HDassert( (group_filename = FILENAMES[file_index+2]) );
+
+ /* Assign the 'prolog_filename' */
+ if ( h5_fixname(group_filename, H5P_DEFAULT, prolog_filename,
+ sizeof(prolog_filename)) == NULL ) {
+ pass = FALSE;
+ failure_mssg = "h5_fixname(2) failed.\n";
+ }
+ }
+
+ /* setup data to write */
+ if ( pass ) {
+ if ( (data_slice = (float *)HDmalloc(COUNT * sizeof(float))) == NULL ) {
+ pass = FALSE;
+ failure_mssg = "malloc of data_slice failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ nextValue = (float)(mpi_rank * COUNT);
+
+ for(i=0; i<COUNT; i++) {
+ data_slice[i] = nextValue;
+ nextValue += 1;
+ }
+ }
+
+ /* setup FAPL */
+ if ( pass ) {
+ if ( (fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ if ( (H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Pset_fapl_mpio() failed\n";
+ }
+ }
+
+ /* create the data file */
+ if ( pass ) {
+ if ( (file_id = H5Fcreate(data_filename, H5F_ACC_TRUNC,
+ H5P_DEFAULT, fapl_id)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Fcreate() failed.\n";
+ }
+ }
+
+ /* create and write the dataset */
+ if ( pass ) {
+ if ( (dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Pcreate(H5P_DATASET_XFER) failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ if ( (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Pset_dxpl_mpio() failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ dims[0] = COUNT;
+ if ( (memspace = H5Screate_simple(1, dims, NULL)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Screate_simple(1, dims, NULL) failed (1).\n";
+ }
+ }
+
+ if ( pass ) {
+ dims[0] *= (hsize_t)group_size;
+ if ( (filespace = H5Screate_simple(1, dims, NULL)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Screate_simple(1, dims, NULL) failed (2).\n";
+ }
+ }
+
+ if ( pass ) {
+ offset = (hsize_t)group_rank * (hsize_t)COUNT;
+ if ( (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, &offset,
+ NULL, &count, NULL)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Sselect_hyperslab() failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ if ( (dset_id = H5Dcreate2(file_id, "dataset0", H5T_NATIVE_FLOAT,
+ filespace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Dcreate2() failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ if ( (H5Dwrite(dset_id, H5T_NATIVE_FLOAT, memspace,
+ filespace, dxpl_id, data_slice)) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Dwrite() failed.\n";
+ }
+ }
+
+ /* close file, etc. */
+ if ( pass || (dset_id != -1)) {
+ if ( H5Dclose(dset_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Dclose(dset_id) failed.\n";
+ }
+ }
+
+ if ( pass || (memspace != -1) ) {
+ if ( H5Sclose(memspace) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Sclose(memspace) failed.\n";
+ }
+ }
+
+ if ( pass || (filespace != -1) ) {
+ if ( H5Sclose(filespace) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Sclose(filespace) failed.\n";
+ }
+ }
+
+ if ( pass || (file_id != -1) ) {
+ if ( H5Fclose(file_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Fclose(file_id) failed.\n";
+ }
+ }
+
+ if ( pass || (dxpl_id != -1) ) {
+ if ( H5Pclose(dxpl_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Pclose(dxpl_id) failed.\n";
+ }
+ }
+
+ if ( pass || (fapl_id != -1) ) {
+ if ( H5Pclose(fapl_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Pclose(fapl_id) failed.\n";
+ }
+ }
+
+ /* Add a userblock to the head of the datafile.
+ * We will use this to for a functional test of the
+ * file open optimization. This is superblock
+ * relocation is done by the rank 0 process associated
+ * with the communicator being used. For test 1, we
+ * utilize MPI_COMM_WORLD, so group_rank 0 is the
+ * same as mpi_rank 0. For test 2 which utilizes
+ * two groups resulting from an MPI_Comm_split, we
+ * will have parallel groups and hence two
+ * group_rank(0) processes. Each parallel group
+ * will create a unique file with different text
+ * headers and different data.
+ *
+ * We also delete files that are no longer needed.
+ */
+ if ( group_rank == 0 ) {
+
+ const char *text_to_write;
+ size_t bytes_to_write;
+
+ if (group_id == 0)
+ text_to_write = random_hdf5_text;
+ else
+ text_to_write = hitchhiker_quote;
+
+ bytes_to_write = strlen(text_to_write);
+
+ if ( pass ) {
+ if ( (header = HDfopen(prolog_filename, "w+")) == NULL ) {
+ pass = FALSE;
+ failure_mssg = "HDfopen(prolog_filename, \"w+\") failed.\n";
+ }
+ }
+
+ if ( pass ) {
+
+ if ( HDfwrite(text_to_write, 1, bytes_to_write, header) !=
+ bytes_to_write ) {
+ pass = FALSE;
+ failure_mssg = "Unable to write header file.\n";
+ }
+ }
+
+ if ( pass || (header != NULL) ) {
+ if ( HDfclose(header) != 0 ) {
+ pass = FALSE;
+ failure_mssg = "HDfclose() failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ char cmd[256];
+
+ HDsprintf(cmd, "../tools/src/h5jam/h5jam -i %s -u %s -o %s",
+ data_filename, prolog_filename, reloc_data_filename);
+
+ if ( system(cmd) != 0 ) {
+ pass = FALSE;
+ failure_mssg = "invocation of h5jam failed.\n";
+ }
+ }
+
+ HDremove(prolog_filename);
+ HDremove(data_filename);
+ }
+
+ /* collect results from other processes.
+ * Only overwrite the failure message if no preveious error
+ * has been detected
+ */
+ local_failure = ( pass ? 0 : 1 );
+
+ /* This is a global all reduce (NOT group specific) */
+ if ( MPI_Allreduce(&local_failure, &global_failures, 1,
+ MPI_INT, MPI_SUM, MPI_COMM_WORLD) != MPI_SUCCESS ) {
+ if ( pass ) {
+ pass = FALSE;
+ failure_mssg = "MPI_Allreduce() failed.\n";
+ }
+ } else if ( ( pass ) && ( global_failures > 0 ) ) {
+ pass = FALSE;
+ failure_mssg = "One or more processes report failure.\n";
+ }
+
+ /* report results */
+ if ( mpi_rank == 0 ) {
+ if ( pass ) {
+ HDfprintf(stdout, "Done.\n");
+ } else {
+ HDfprintf(stdout, "FAILED.\n");
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n",
+ fcn_name, failure_mssg);
+ }
+ }
+
+ /* free data_slice if it has been allocated */
+ if ( data_slice != NULL ) {
+ HDfree(data_slice);
+ data_slice = NULL;
+ }
+
+ return(! pass);
+
+} /* generate_test_file() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_parallel_read
+ *
+ * Purpose: This actually tests the superblock optimization
+ * and covers the two primary cases we're interested in.
+ * 1). That HDF5 files can be opened in parallel by
+ * the rank 0 process and that the superblock
+ * offset is correctly broadcast to the other
+ * parallel file readers.
+ * 2). That a parallel application can correctly
+ * handle reading multiple files by using
+ * subgroups of MPI_COMM_WORLD and that each
+ * subgroup operates as described in (1) to
+ * collectively read the data.
+ *
+ * The global MPI rank is used for reading and
+ * writing data for process specific data in the
+ * dataset. We do this rather simplisticly, i.e.
+ * rank 0: writes/reads 0-9999
+ * rank 1: writes/reads 1000-1999
+ * rank 2: writes/reads 2000-2999
+ * ...
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Richard Warren
+ * 10/1/17
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id)
{
- int status, errors = 0;
- hid_t access_plist = -1, dataset = -1;
- hid_t file_id = -1, memspace = -1, dataspace = -1;
- hsize_t i, offset, count = 1000;
- hsize_t dims[1] = {0};
- float nextValue, data_slice[count];
- herr_t ret;
-
- access_plist = H5Pcreate(H5P_FILE_ACCESS);
- if (access_plist >= 0) {
- ret = H5Pset_fapl_mpio(access_plist, MPI_COMM_WORLD, MPI_INFO_NULL);
- } else pass = false;
- if (ret >= 0) {
- file_id = H5Fopen(datafile_relocated,H5F_ACC_RDONLY,access_plist);
- } else pass = false;
- if (file_id >= 0) {
- dataset = H5Dopen2(file_id, "dataset0", H5P_DEFAULT);
- } else pass = false;
- if (dataset >= 0) {
- dims[0] = count;
- memspace = H5Screate_simple(1, dims, NULL);
- } else pass = false;
- if ( memspace >= 0 ) {
- dataspace = H5Dget_space(dataset);
- } else pass = false;
- if ( dataspace >= 0 ) {
- offset = mpi_rank * count;
- ret = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, &offset, NULL, &count, NULL);
- } else pass = false;
- if ( ret >= 0 ) {
- ret = H5Dread(dataset, H5T_NATIVE_FLOAT, memspace, dataspace, H5P_DEFAULT, data_slice);
- } else pass = false;
- if (ret >= 0) {
- nextValue = (float)(mpi_rank * count);
- for (i=0; i < count; i++) {
- if (data_slice[i] != nextValue) pass = false;
- nextValue += 1;
- }
- } else pass = false;
-
- status = ( pass ? 0 : -1 );
- MPI_Allreduce( &status, &errors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
-
- if ( mpi_rank == 0)
- HDfprintf(stderr, "H5Fopen/H5Dread/data_validation %s\n", ((errors == 0) ? "succeeded" : "FAILED"));
-
- H5Pclose(access_plist);
- H5Dclose(dataset);
- H5Fclose(file_id);
-
- /* Cleanup */
- unlink(datafile_relocated);
-
- return;
-}
+ const char *failure_mssg;
+ const char *fcn_name = "test_parallel_read()";
+ const char *group_filename = NULL;
+ char reloc_data_filename[FILENAME_BUF_SIZE];
+ int local_failure = 0;
+ int global_failures = 0;
+ int group_size;
+ int group_rank;
+ hid_t fapl_id = -1;
+ hid_t file_id = -1;
+ hid_t dset_id = -1;
+ hid_t memspace = -1;
+ hid_t filespace = -1;
+ hsize_t i;
+ hsize_t offset;
+ hsize_t count = COUNT;
+ hsize_t dims[1] = {0};
+ float nextValue;
+ float *data_slice = NULL;
+
+ pass = TRUE;
+
+ HDassert(comm != MPI_COMM_NULL);
+ if ( (MPI_Comm_rank(comm, &group_rank)) != MPI_SUCCESS) {
+ pass = FALSE;
+ failure_mssg = "test_parallel_read: MPI_Comm_rank failed.\n";
+ }
+
+ if ( (MPI_Comm_size(comm, &group_size)) != MPI_SUCCESS) {
+ pass = FALSE;
+ failure_mssg = "test_parallel_read: MPI_Comm_size failed.\n";
+ }
+
+ if ( mpi_rank == 0 ) {
+ if ( comm == MPI_COMM_WORLD ) {
+ TESTING("parallel file open test 1");
+ }
+ else {
+ TESTING("parallel file open test 2");
+ }
+ }
+
+ /* allocate space for the data_slice array */
+ if ( pass ) {
+ if ( (data_slice = (float *)HDmalloc(COUNT * sizeof(float))) == NULL ) {
+ pass = FALSE;
+ failure_mssg = "malloc of data_slice failed.\n";
+ }
+ }
+
+
+ /* Select the file file name to read
+ * Please see the comments in the 'generate_test_file' function
+ * for more details...
+ */
+ if ( pass ) {
+
+ if ( comm == MPI_COMM_WORLD ) /* test 1 */
+ group_filename = FILENAMES[1];
+ else if ( group_id == 0 ) /* test 2 group 0 */
+ group_filename = FILENAMES[4];
+ else /* test 2 group 1 */
+ group_filename = FILENAMES[7];
+
+ HDassert(group_filename);
+ if ( h5_fixname(group_filename, H5P_DEFAULT, reloc_data_filename,
+ sizeof(reloc_data_filename)) == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "h5_fixname(1) failed.\n";
+ }
+ }
+
+ /* setup FAPL */
+ if ( pass ) {
+ if ( (fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ if ( (H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Pset_fapl_mpio() failed\n";
+ }
+ }
+
+ /* open the file -- should have user block, exercising the optimization */
+ if ( pass ) {
+ if ( (file_id = H5Fopen(reloc_data_filename,
+ H5F_ACC_RDONLY, fapl_id)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Fopen() failed\n";
+ }
+ }
+
+ /* open the data set */
+ if ( pass ) {
+ if ( (dset_id = H5Dopen2(file_id, "dataset0", H5P_DEFAULT)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Dopen2() failed\n";
+ }
+ }
+
+ /* setup memspace */
+ if ( pass ) {
+ dims[0] = count;
+ if ( (memspace = H5Screate_simple(1, dims, NULL)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Screate_simple(1, dims, NULL) failed\n";
+ }
+ }
+
+ /* setup filespace */
+ if ( pass ) {
+ if ( (filespace = H5Dget_space(dset_id)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Dget_space(dataset) failed\n";
+ }
+ }
+
+ if ( pass ) {
+ offset = (hsize_t)group_rank * count;
+ if ( (H5Sselect_hyperslab(filespace, H5S_SELECT_SET,
+ &offset, NULL, &count, NULL)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Sselect_hyperslab() failed\n";
+ }
+ }
+
+ /* read this processes section of the data */
+ if ( pass ) {
+ if ( (H5Dread(dset_id, H5T_NATIVE_FLOAT, memspace,
+ filespace, H5P_DEFAULT, data_slice)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Dread() failed\n";
+ }
+ }
+
+ /* verify the data */
+ if ( pass ) {
+ nextValue = (float)((hsize_t)mpi_rank * count);
+ i = 0;
+ while ( ( pass ) && ( i < count ) ) {
+ /* what we really want is data_slice[i] != nextValue --
+ * the following is a circumlocution to shut up the
+ * the compiler.
+ */
+ if ( ( data_slice[i] > nextValue ) ||
+ ( data_slice[i] < nextValue ) ) {
+ pass = FALSE;
+ failure_mssg = "Unexpected dset contents.\n";
+ }
+ nextValue += 1;
+ i++;
+ }
+ }
+
+ /* close file, etc. */
+ if ( pass || (dset_id != -1) ) {
+ if ( H5Dclose(dset_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Dclose(dset_id) failed.\n";
+ }
+ }
+
+ if ( pass || (memspace != -1) ) {
+ if ( H5Sclose(memspace) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Sclose(memspace) failed.\n";
+ }
+ }
+
+ if ( pass || (filespace != -1) ) {
+ if ( H5Sclose(filespace) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Sclose(filespace) failed.\n";
+ }
+ }
+
+ if ( pass || (file_id != -1) ) {
+ if ( H5Fclose(file_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Fclose(file_id) failed.\n";
+ }
+ }
+
+ if ( pass || (fapl_id != -1) ) {
+ if ( H5Pclose(fapl_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Pclose(fapl_id) failed.\n";
+ }
+ }
+
+ /* collect results from other processes.
+ * Only overwrite the failure message if no preveious error
+ * has been detected
+ */
+ local_failure = ( pass ? 0 : 1 );
+
+ if ( MPI_Allreduce( &local_failure, &global_failures, 1,
+ MPI_INT, MPI_SUM, MPI_COMM_WORLD) != MPI_SUCCESS ) {
+ if ( pass ) {
+ pass = FALSE;
+ failure_mssg = "MPI_Allreduce() failed.\n";
+ }
+ } else if ( ( pass ) && ( global_failures > 0 ) ) {
+ pass = FALSE;
+ failure_mssg = "One or more processes report failure.\n";
+ }
+
+ /* report results and finish cleanup */
+ if ( group_rank == 0 ) {
+ if ( pass ) {
+ PASSED();
+ } else {
+ H5_FAILED();
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n",
+ fcn_name, failure_mssg);
+ }
+
+ HDremove(reloc_data_filename);
+ }
+
+ /* free data_slice if it has been allocated */
+ if ( data_slice != NULL ) {
+ HDfree(data_slice);
+ data_slice = NULL;
+ }
+
+
+ return( ! pass );
+
+} /* test_parallel_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: To implement a parallel test which validates whether the
+ * new superblock lookup functionality is working correctly.
+ *
+ * The test consists of creating two seperate HDF datasets
+ * in which random text is inserted at the start of each
+ * file using the 'j5jam' application. This forces the
+ * HDF5 file superblock to a non-zero offset.
+ * Having created the two independant files, we create two
+ * non-overlapping MPI groups, each of which is then tasked
+ * with the opening and validation of the data contained
+ * therein.
+ *
+ * WARNING: This test uses fork() and execve(), and
+ * therefore will not run on Windows.
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Richard Warren
+ * 10/1/17
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
int
main( int argc, char **argv)
{
- int status, errors, mpi_rank, mpi_size;
-
- if ((status = MPI_Init(&argc, &argv)) != MPI_SUCCESS) {
- HDfprintf(stderr, "FATAL: Unable to initialize MPI\n");
- exit(1);
- }
- if ((status = MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank)) != MPI_SUCCESS) {
- HDfprintf(stderr, "FATAL: MPI_Comm_rank returned an error\n");
- exit(2);
- }
- if ((status = MPI_Comm_size(MPI_COMM_WORLD, &mpi_size)) != MPI_SUCCESS) {
- HDfprintf(stderr, "FATAL: MPI_Comm_size returned an error\n");
- exit(2);
- }
-
- generate_test_file( mpi_rank, mpi_size );
- status = ( pass ? 0 : -1 );
-
- /* Synch all ranks before attempting the parallel read */
- if ( MPI_Allreduce( &status, &errors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ) != MPI_SUCCESS) {
- pass = false;
- if (mpi_rank == 0) HDfprintf(stderr, "FATAL: MPI_Allreduce returned an error\n");
- }
-
- if ( errors == 0 ) {
- test_parallel_read( mpi_rank, mpi_size );
- }
-
- MPI_Finalize();
- return 0;
-}
+ int nerrs = 0;
+ int which_group = 0;
+ int mpi_rank;
+ int mpi_size;
+ int split_size;
+ MPI_Comm group_comm = MPI_COMM_WORLD;
+
+ if ( (MPI_Init(&argc, &argv)) != MPI_SUCCESS) {
+ HDfprintf(stderr, "FATAL: Unable to initialize MPI\n");
+ HDexit(EXIT_FAILURE);
+ }
+
+ if ( (MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank)) != MPI_SUCCESS) {
+ HDfprintf(stderr, "FATAL: MPI_Comm_rank returned an error\n");
+ HDexit(EXIT_FAILURE);
+ }
+
+ if ( (MPI_Comm_size(MPI_COMM_WORLD, &mpi_size)) != MPI_SUCCESS) {
+ HDfprintf(stderr, "FATAL: MPI_Comm_size returned an error\n");
+ HDexit(EXIT_FAILURE);
+ }
+
+ H5open();
+
+ if ( mpi_rank == 0 ) {
+ HDfprintf(stdout, "========================================\n");
+ HDfprintf(stdout, "Collective file open optimization tests\n");
+ HDfprintf(stdout, " mpi_size = %d\n", mpi_size);
+ HDfprintf(stdout, "========================================\n");
+ }
+
+ if ( mpi_size < 4 ) {
+
+ if ( mpi_rank == 0 ) {
+
+ HDprintf(" Need at least 4 processes. Exiting.\n");
+ }
+ goto finish;
+ }
+
+ /* ------ Create two (2) MPI groups ------
+ *
+ * We split MPI_COMM_WORLD into 2 more or less equal sized
+ * groups. The resulting communicators will be used to generate
+ * two HDF files which in turn will be opened in parallel and the
+ * contents verified in the second read test below.
+ */
+ split_size = mpi_size / 2;
+ which_group = (mpi_rank < split_size ? 0 : 1);
+
+ if ( (MPI_Comm_split(MPI_COMM_WORLD,
+ which_group,
+ 0,
+ &group_comm)) != MPI_SUCCESS) {
+
+ HDfprintf(stderr, "FATAL: MPI_Comm_split returned an error\n");
+ HDexit(EXIT_FAILURE);
+ }
+
+ /* ------ Generate all files ------ */
+
+ /* We generate the file used for test 1 */
+ nerrs += generate_test_file( MPI_COMM_WORLD, mpi_rank, which_group );
+
+ if ( nerrs > 0 ) {
+ if ( mpi_rank == 0 ) {
+ HDprintf(" Test(1) file construction failed -- skipping tests.\n");
+ }
+ goto finish;
+ }
+
+ /* We generate the file used for test 2 */
+ nerrs += generate_test_file( group_comm, mpi_rank, which_group );
+
+ if ( nerrs > 0 ) {
+ if ( mpi_rank == 0 ) {
+ HDprintf(" Test(2) file construction failed -- skipping tests.\n");
+ }
+ goto finish;
+ }
+
+ /* Now read the generated test file (stil using MPI_COMM_WORLD) */
+ nerrs += test_parallel_read( MPI_COMM_WORLD, mpi_rank, which_group);
+
+ if ( nerrs > 0 ) {
+ if ( mpi_rank == 0 ) {
+ HDprintf(" Parallel read test(1) failed -- skipping tests.\n");
+ }
+ goto finish;
+ }
+
+ /* Update the user on our progress so far. */
+ if ( mpi_rank == 0 ) {
+ HDprintf(" Test 1 of 2 succeeded\n");
+ HDprintf(" -- Starting multi-group parallel read test.\n");
+ }
+
+ /* run the 2nd set of tests */
+ nerrs += test_parallel_read(group_comm, mpi_rank, which_group);
+
+ if ( nerrs > 0 ) {
+ if ( mpi_rank == 0 ) {
+ HDprintf(" Multi-group read test(2) failed\n");
+ }
+ goto finish;
+ }
+
+ if ( mpi_rank == 0 ) {
+ HDprintf(" Test 2 of 2 succeeded\n");
+ }
+
+finish:
+
+ if ((group_comm != MPI_COMM_NULL) &&
+ (MPI_Comm_free(&group_comm)) != MPI_SUCCESS) {
+ HDfprintf(stderr, "MPI_Comm_free failed!\n");
+ }
+
+
+ /* make sure all processes are finished before final report, cleanup
+ * and exit.
+ */
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ if ( mpi_rank == 0 ) { /* only process 0 reports */
+ const char *header = "Collective file open optimization tests";
+
+ HDfprintf(stdout, "===================================\n");
+ if ( nerrs > 0 ) {
+
+ HDfprintf(stdout, "***%s detected %d failures***\n", header, nerrs);
+ }
+ else {
+ HDfprintf(stdout, "%s finished with no failures\n", header);
+ }
+ HDfprintf(stdout, "===================================\n");
+ }
+
+ /* close HDF5 library */
+ if (H5close() != SUCCEED) {
+ HDfprintf(stdout, "H5close() failed. (Ignoring)\n");
+ }
+
+ /* MPI_Finalize must be called AFTER H5close which may use MPI calls */
+ MPI_Finalize();
+
+ /* cannot just return (nerrs) because exit code is limited to 1byte */
+ return((nerrs > 0) ? EXIT_FAILURE : EXIT_SUCCESS );
+
+} /* main() */
diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c
index d81d2be..1052a69 100644
--- a/testpar/t_shapesame.c
+++ b/testpar/t_shapesame.c
@@ -2229,7 +2229,7 @@ contig_hs_dr_pio_test__run_test(const int test_num,
#define CONTIG_HS_DR_PIO_TEST__DEBUG 0
-void
+static void
contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
{
int express_test;
@@ -5074,7 +5074,6 @@ int main(int argc, char **argv)
TestInit(argv[0], usage, parse_options);
/* Shape Same tests using contigous hyperslab */
-#if 1
AddTest("sscontig1", sscontig1, NULL,
"Cntg hslab, ind IO, cntg dsets", PARATESTFILE);
AddTest("sscontig2", sscontig2, NULL,
@@ -5083,7 +5082,6 @@ int main(int argc, char **argv)
"Cntg hslab, ind IO, chnk dsets", PARATESTFILE);
AddTest("sscontig4", sscontig4, NULL,
"Cntg hslab, col IO, chnk dsets", PARATESTFILE);
-#endif
/* Shape Same tests using checker board hyperslab */
AddTest("sschecker1", sschecker1, NULL,
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 74607da..9bebcbe 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -472,8 +472,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 a4f7863..998a8ca 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 */
@@ -399,6 +401,7 @@ hsize_t diff_datasetid( hid_t did1,
name1 = diff_basename(obj1_name);
if(obj2_name)
name2 = diff_basename(obj2_name);
+ h5diffdebug3("obj_names: %s - %s\n", name1, name2);
/*----------------------------------------------------------------
@@ -413,20 +416,30 @@ 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,
options, name1, name2, dam_tid, did1, did2);
+ h5diffdebug2("diff_array nfound:%d\n", nfound);
/* reclaim any VL memory, if necessary */
if(vl_data) {
+ h5difftrace("check vl_data\n");
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 */
@@ -469,9 +482,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);
@@ -488,19 +501,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 */
@@ -522,6 +535,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 */
@@ -532,40 +553,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) {
@@ -607,7 +599,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(" <warning: SZIP settins, chunk size is smaller than pixels per block>\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(" <warning: SZIP settings, chunk size is smaller than pixels per block>\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 47cad13..9fcf218 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:
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; i<nelems; i++) */
- } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) {
+ }
+ else if (H5R_DSET_REG_REF_BUF_SIZE == msize) {
hdset_reg_ref_t ref_out;
for (i=0; i<(unsigned)nelmts; i++) {
@@ -689,8 +679,7 @@ static int copy_refs_attr(hid_t loc_in,
buf = HDmalloc((unsigned)(nelmts * msize));
refbuf = buf; /* reuse the read buffer for write */
- if(buf == NULL)
- {
+ if(buf == NULL) {
printf( "cannot read into memory\n" );
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
@@ -767,8 +756,6 @@ static int copy_refs_attr(hid_t loc_in,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
} /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */
- return ret_value;
-
done:
if(refbuf)
HDfree(refbuf);
@@ -795,7 +782,7 @@ done:
/*-------------------------------------------------------------------------
* Function: MapIdToName
*
- * Purpose: map a ID from a reference to a dataset name
+ * Purpose: map a ID from a reference to a dataset name
*
*-------------------------------------------------------------------------
*/
@@ -803,7 +790,7 @@ static const char*
MapIdToName(hid_t refobj_id, trav_table_t *travt)
{
unsigned int u;
- const char* ret = NULL;
+ const char *ret = NULL;
/* linear search */
for(u = 0; u < travt->nobjs; 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; i<rank; i++)
+ for (i = 0; i < rank; i++)
if (chsize[i] != obj->chunk.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 $<TARGET_FILE:h5diffgentest>)
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)
"$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
"${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
)
+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=$<TARGET_FILE:h5diff>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>"
-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=$<TARGET_FILE:h5diff>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>"
-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=$<TARGET_FILE:h5diff>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>"
-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=$<TARGET_FILE:h5diff>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>"
-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/h5diff/Makefile.am b/tools/test/h5diff/Makefile.am
index 5721aaa..d2b5ebb 100644
--- a/tools/test/h5diff/Makefile.am
+++ b/tools/test/h5diff/Makefile.am
@@ -50,15 +50,12 @@ LDADD=$(LIBH5TOOLS) $(LIBHDF5)
if HAVE_SHARED_CONDITIONAL
# Build it as shared library if configure is enabled for shared library.
- dyn_LTLIBRARIES=libdynlibdiff.la
+ noinst_LTLIBRARIES=libdynlibdiff.la
libdynlibdiff_la_SOURCES=dynlib_diff.c
- libdynlibdiff_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+ libdynlibdiff_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-libdynlibdiff.la: $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_DEPENDENCIES) $(EXTRA_libdynlibdiff_la_DEPENDENCIES)
+ libdynlibdiff.la: $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_DEPENDENCIES) $(EXTRA_libdynlibdiff_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdynlibdiff_la_LINK) $(am_libdynlibdiff_la_rpath) $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_LIBADD)
-
-#install-exec-hook:
-# $(RM) $(DESTDIR)$(dyndir)/*dynlib*
endif
# Temporary files. *.h5 are generated by h5diff. They should
diff --git a/tools/test/h5dump/Makefile.am b/tools/test/h5dump/Makefile.am
index df97396..1454987 100644
--- a/tools/test/h5dump/Makefile.am
+++ b/tools/test/h5dump/Makefile.am
@@ -39,15 +39,12 @@ LDADD=$(LIBH5TOOLS) $(LIBHDF5)
if HAVE_SHARED_CONDITIONAL
# Build it as shared library if configure is enabled for shared library.
- dyn_LTLIBRARIES=libdynlibdump.la
+ noinst_LTLIBRARIES=libdynlibdump.la
libdynlibdump_la_SOURCES=dynlib_dump.c
- libdynlibdump_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+ libdynlibdump_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-libdynlibdump.la: $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_DEPENDENCIES) $(EXTRA_libdynlibdump_la_DEPENDENCIES)
+ libdynlibdump.la: $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_DEPENDENCIES) $(EXTRA_libdynlibdump_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdynlibdump_la_LINK) $(am_libdynlibdump_la_rpath) $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_LIBADD)
-
-#install-exec-hook:
-# $(RM) $(DESTDIR)$(dyndir)/*dynlib*
endif
# Temporary files. *.h5 are generated by h5dumpgentest. They should
diff --git a/tools/test/h5ls/Makefile.am b/tools/test/h5ls/Makefile.am
index 8ace14d..ec8b8c3 100644
--- a/tools/test/h5ls/Makefile.am
+++ b/tools/test/h5ls/Makefile.am
@@ -36,15 +36,12 @@ LDADD=$(LIBH5TOOLS) $(LIBHDF5)
if HAVE_SHARED_CONDITIONAL
# Build it as shared library if configure is enabled for shared library.
- dyn_LTLIBRARIES=libdynlibls.la
+ noinst_LTLIBRARIES=libdynlibls.la
libdynlibls_la_SOURCES=dynlib_ls.c
- libdynlibls_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+ libdynlibls_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES)
+ libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdynlibls_la_LINK) $(am_libdynlibls_la_rpath) $(libdynlibls_la_OBJECTS) $(libdynlibls_la_LIBADD)
-
-#install-exec-hook:
-# $(RM) $(DESTDIR)$(dyndir)/*dynlib*
endif
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/Makefile.am b/tools/test/h5repack/Makefile.am
index da2a3c3..d4dc843 100644
--- a/tools/test/h5repack/Makefile.am
+++ b/tools/test/h5repack/Makefile.am
@@ -45,19 +45,16 @@ h5repacktst_SOURCES=h5repacktst.c
if HAVE_SHARED_CONDITIONAL
# Build it as shared library if configure is enabled for shared library.
- dyn_LTLIBRARIES=libdynlibadd.la libdynlibvers.la
+ noinst_LTLIBRARIES=libdynlibadd.la libdynlibvers.la
libdynlibadd_la_SOURCES=dynlib_rpk.c
libdynlibvers_la_SOURCES=dynlib_vrpk.c
- libdynlibadd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
- libdynlibvers_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+ libdynlibadd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
+ libdynlibvers_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-libdynlibadd.la: $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_DEPENDENCIES) $(EXTRA_libdynlibadd_la_DEPENDENCIES)
+ libdynlibadd.la: $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_DEPENDENCIES) $(EXTRA_libdynlibadd_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdynlibadd_la_LINK) $(am_libdynlibadd_la_rpath) $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_LIBADD)
-libdynlibvers.la: $(libdynlibvers_la_OBJECTS) $(libdynlibvers_la_DEPENDENCIES) $(EXTRA_libdynlibvers_la_DEPENDENCIES)
+ libdynlibvers.la: $(libdynlibvers_la_OBJECTS) $(libdynlibvers_la_DEPENDENCIES) $(EXTRA_libdynlibvers_la_DEPENDENCIES)
$(AM_V_CCLD)$(libdynlibvers_la_LINK) $(am_libdynlibvers_la_rpath) $(libdynlibvers_la_OBJECTS) $(libdynlibvers_la_LIBADD)
-
-#install-exec-hook:
-# $(RM) $(DESTDIR)$(dyndir)/*dynlib*
endif
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index 6449844..264550e 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 <pvn@ncsa.uiuc.edu>
-* 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<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
/* create a space */
@@ -2512,21 +2504,17 @@ int make_szip(hid_t loc_id)
*/
/* Make sure encoding is enabled */
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
- {
szip_can_encode = 1;
- }
- if (szip_can_encode)
- {
+
+ if (szip_can_encode) {
/* set szip data */
- if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
+ if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0)
goto out;
- if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0)
+ if (make_dset(loc_id, "dset_szip", sid, dcpl, buf) < 0)
goto out;
}
else
- {
/* WARNING? SZIP is decoder only, can't generate test files */
- }
if(H5Sclose(sid) < 0)
goto out;
@@ -2556,20 +2544,18 @@ out:
static
int make_deflate(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- 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 */
+ hsize_t dims[RANK] = {DIM1,DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
int buf[DIM1][DIM2];
hobj_ref_t bufref[1]; /* reference */
- hsize_t dims1r[1]={1};
+ hsize_t dims1r[1] = {1};
int i, j, n;
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
@@ -2591,14 +2577,14 @@ int make_deflate(hid_t loc_id)
/* set deflate data */
if(H5Pset_deflate(dcpl, 9) < 0)
goto out;
- if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0)
+ if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf) < 0)
goto out;
/* create a reference to the dataset, test second seeep of file for references */
- if (H5Rcreate(&bufref[0],loc_id,"dset_deflate",H5R_OBJECT,(hid_t)-1) < 0)
+ if (H5Rcreate(&bufref[0], loc_id, "dset_deflate", H5R_OBJECT, (hid_t)-1) < 0)
goto out;
- if (write_dset(loc_id,1,dims1r,"ref",H5T_STD_REF_OBJ,bufref) < 0)
+ if (write_dset(loc_id, 1, dims1r, "ref", H5T_STD_REF_OBJ, bufref) < 0)
goto out;
#endif
@@ -2698,18 +2684,16 @@ out:
static
int make_fletcher32(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t sid = -1; /* dataspace ID */
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
/* create a space */
@@ -2767,20 +2751,18 @@ out:
static
int make_nbit(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hid_t dtid;
- hid_t dsid;
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t sid = -1; /* dataspace ID */
+ hid_t dtid = -1;
+ hid_t dsid = -1;
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
/* create a space */
@@ -2795,43 +2777,25 @@ int make_nbit(hid_t loc_id)
dtid = H5Tcopy(H5T_NATIVE_INT);
if (H5Tset_precision(dtid,(H5Tget_precision(dtid) - 1)) < 0)
- {
- H5Tclose(dtid);
goto out;
- }
/* remove the filters from the dcpl */
if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- {
- H5Tclose(dtid);
goto out;
- }
- if(H5Pset_nbit(dcpl) < 0) {
- H5Tclose(dtid);
+ if(H5Pset_nbit(dcpl) < 0)
goto out;
- }
- if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
- H5Tclose(dtid);
+ if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- }
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5Tclose(dtid);
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
- }
H5Dclose(dsid);
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) {
- H5Tclose(dtid);
+ if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto out;
- }
- if((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
- H5Tclose(dtid);
+ if((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- }
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5Tclose(dtid);
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
- }
H5Dclose(dsid);
/*-------------------------------------------------------------------------
@@ -2849,8 +2813,10 @@ int make_nbit(hid_t loc_id)
out:
H5E_BEGIN_TRY {
+ H5Tclose(dtid);
H5Pclose(dcpl);
H5Sclose(sid);
+ H5Dclose(dsid);
} H5E_END_TRY;
return -1;
}
@@ -2866,20 +2832,18 @@ out:
static
int make_scaleoffset(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hid_t dtid;
- hid_t dsid;
- 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 */
+ hid_t dtid = -1;
+ hid_t dsid = -1;
+ hsize_t dims[RANK] = {DIM1,DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
int buf[DIM1][DIM2];
int i, j, n;
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf[i][j] = n++;
}
}
/* create a space */
@@ -2895,31 +2859,19 @@ int make_scaleoffset(hid_t loc_id)
dtid = H5Tcopy(H5T_NATIVE_INT);
/* remove the filters from the dcpl */
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) {
- H5Tclose(dtid);
+ if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto out;
- }
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0) {
- H5Tclose(dtid);
+ if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0)
goto out;
- }
- if((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
- H5Tclose(dtid);
+ if((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- }
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5Tclose(dtid);
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
- }
H5Dclose(dsid);
- if((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5Tclose(dtid);
+ if((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- }
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5Tclose(dtid);
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
- }
H5Tclose(dtid);
H5Dclose(dsid);
@@ -2936,6 +2888,8 @@ int make_scaleoffset(hid_t loc_id)
out:
H5E_BEGIN_TRY {
+ H5Dclose(dsid);
+ H5Tclose(dtid);
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
@@ -2946,7 +2900,7 @@ out:
/*-------------------------------------------------------------------------
* Function: make_all_filters
*
-* Purpose: make a file with all filters
+* Purpose: make a file with all filters
*
*-------------------------------------------------------------------------
*/
@@ -3374,7 +3328,7 @@ out:
H5E_BEGIN_TRY {
H5Pclose(contig_dcpl);
H5Pclose(chunked_dcpl);
-
+
H5Sclose(s_sid);
} H5E_END_TRY;
@@ -3389,9 +3343,9 @@ out:
* Purpose: make chunked datasets with unlimited max dim and chunk dim is
* bigger than current dim. (HDFFV-7933)
* Test for converting chunk to chunk , chunk to conti and chunk
-* to compact.
-* - The chunk to chunk changes layout bigger than any current dim
-* again.
+* to compact.
+* - The chunk to chunk changes layout bigger than any current dim
+* again.
* - The chunk to compact test dataset bigger than 64K, should
* remain original layout.*
*
@@ -4449,7 +4403,7 @@ int write_dset_in(hid_t loc_id,
for(k = 0; k < 2; k++) {
if(make_diffs)
buf23[i][j][k] = 0;
- else
+ else
buf23[i][j][k] = (char)(n++);
}
}
@@ -6195,9 +6149,9 @@ out:
/*-------------------------------------------------------------------------
* Function: add_attr_with_objref
*
- * Purpose:
+ * Purpose:
* Create attributes with object reference to objects (dset,
- * group, datatype).
+ * group, datatype).
*
* Note:
* this function depends on locally created objects, however can be modified
@@ -6215,7 +6169,7 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id)
/* --------------------------------
* add attribute with obj ref type
- */
+ */
/* ref to dset */
status = H5Rcreate(&data_attr_objref[0],file_id,NAME_OBJ_DS1,H5R_OBJECT,(hid_t)-1);
if (status < 0)
@@ -6261,7 +6215,7 @@ out:
/*-------------------------------------------------------------------------
* Function: add_attr_with_regref
*
- * Purpose:
+ * Purpose:
* Create attributes with region reference to dset
*
* Note:
@@ -6332,11 +6286,11 @@ out:
/*-------------------------------------------------------------------------
* Function: gen_refered_objs
*
- * Purpose:
+ * Purpose:
* Create objects (dataset, group, datatype) to be referenced
*
* Note:
- * This function is to use along with gen_obj_ref() gen_region_ref()
+ * This function is to use along with gen_obj_ref() gen_region_ref()
*
* Programmer: Jonathan Kim (March 23, 2010)
*------------------------------------------------------------------------*/
@@ -6351,12 +6305,12 @@ static herr_t gen_refered_objs(hid_t loc_id)
int data[3] = {10,20,30};
/* Dset2 */
- hid_t sid2=0, did2=0;
+ hid_t sid2=0, did2=0;
hsize_t dims2[2] = {3,16};
char data2[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
/*-----------------------
- * add short dataset
+ * add short dataset
* (define NAME_OBJ_DS1)
*/
sid = H5Screate_simple(1, dims1, NULL);
@@ -6384,7 +6338,7 @@ static herr_t gen_refered_objs(hid_t loc_id)
}
/*--------------
- * add group
+ * add group
* (define NAME_OBJ_GRP)
*/
gid = H5Gcreate2 (loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -6454,17 +6408,17 @@ out:
if(sid2 > 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
</dset_deflate> with GZIP filter
</dset_deflate>...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 a951638..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
@@ -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_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 </dset1>. Applying original settings
+ dset /dset1
+ warning: could not create dataset </dset2>. Applying original settings
+ dset /dset2
+ warning: could not create dataset </dset3>. Applying original settings
+ dset /dset3
+ warning: could not create dataset </dset4>. Applying original settings
+ dset /dset4
+ warning: could not create dataset </dset_chunk>. Applying original settings
+ dset /dset_chunk
+ warning: could not create dataset </dset_compact>. Applying original settings
+ dset /dset_compact
+ warning: could not create dataset </dset_contiguous>. Applying original settings
+ dset /dset_contiguous