mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
Needs to sync with lib version and Sencode.
This commit is contained in:
parent
5c4bab04f5
commit
496af1be89
1
MANIFEST
1
MANIFEST
@ -981,6 +981,7 @@
|
||||
./test/gen_bad_ohdr.c
|
||||
./test/gen_bad_compound.c
|
||||
./test/gen_bogus.c
|
||||
./test/gen_bounds.c
|
||||
./test/gen_cross.c
|
||||
./test/gen_deflate.c
|
||||
./test/gen_file_image.c
|
||||
|
@ -27,8 +27,12 @@ macro (SET_HDF_BUILD_TYPE)
|
||||
set(HDF_BUILD_TYPE "Release")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
||||
# Set the possible values of build type for cmake-gui
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
|
||||
"MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
endmacro ()
|
||||
|
||||
|
@ -1019,7 +1019,7 @@ Java_hdf_hdf5lib_H5_H5DreadVL
|
||||
} /* end else */
|
||||
|
||||
return (jint)status;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Dread_1VLStrings */
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Dread_1VL */
|
||||
|
||||
herr_t
|
||||
H5DreadVL_asstr
|
||||
|
@ -26,6 +26,7 @@ import hdf.hdf5lib.H5;
|
||||
import hdf.hdf5lib.HDF5Constants;
|
||||
import hdf.hdf5lib.exceptions.HDF5Exception;
|
||||
import hdf.hdf5lib.exceptions.HDF5LibraryException;
|
||||
import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException;
|
||||
import hdf.hdf5lib.structs.H5AC_cache_config_t;
|
||||
|
||||
import org.junit.After;
|
||||
@ -1385,6 +1386,13 @@ public class TestH5Pfapl {
|
||||
ret_val_id = H5.H5Pget_evict_on_close(fapl_id);
|
||||
assertTrue("H5P_evict_on_close", ret_val_id);
|
||||
}
|
||||
catch (HDF5PropertyListInterfaceException err) {
|
||||
// parallel is not supported
|
||||
if (err.getMinorErrorNumber() != HDF5Constants.H5E_UNSUPPORTED) {
|
||||
err.printStackTrace();
|
||||
fail("H5P_evict_on_close: " + err);
|
||||
}
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5P_evict_on_close: " + err);
|
||||
|
@ -305,7 +305,7 @@ CONTENTS
|
||||
to enable symbolic debugging of a production version of HDF5, one
|
||||
might say:
|
||||
|
||||
$ CFLAGS=-g ./configure --enable-production
|
||||
$ CFLAGS=-g ./configure --enable-build-mode=production
|
||||
|
||||
4.3.5. Compiling HDF5 wrapper libraries
|
||||
One can optionally build the Fortran and/or C++ interfaces to the
|
||||
@ -414,35 +414,35 @@ CONTENTS
|
||||
The library can be compiled to provide symbolic debugging support
|
||||
so it can be debugged with gdb, dbx, ddd, etc., or it can be
|
||||
compiled with various optimizations. To compile for symbolic
|
||||
debugging (the default for snapshots), say `--disable-production';
|
||||
to compile with optimizations (the default for supported public
|
||||
releases), say `--enable-production'. On some systems the library
|
||||
can also be compiled for profiling with gprof by saying
|
||||
debugging (the default for snapshots), say
|
||||
`--enable-build-mode=production'; to compile with optimizations
|
||||
(the default for supported public releases),
|
||||
say `--enable-build-mode=production'. On some systems the
|
||||
library can also be compiled for profiling with gprof by saying
|
||||
`--enable-production=profile'.
|
||||
|
||||
$ ./configure --disable-production #symbolic debugging
|
||||
$ ./configure --enable-production #optimized code
|
||||
$ ./configure --enable-production=profile #for use with gprof
|
||||
$ ./configure --enable-build-mode=debug #symbolic debugging
|
||||
$ ./configure --enable-build-mode=production #optimized code
|
||||
$ ./configure --enable-production=profile #for use with gprof
|
||||
|
||||
Regardless of whether support for symbolic debugging is enabled,
|
||||
the library can also perform runtime debugging of certain packages
|
||||
(such as type conversion execution times and extensive invariant
|
||||
condition checking). To enable this debugging, supply a
|
||||
comma-separated list of package names to to the `--enable-debug'
|
||||
switch. See "Debugging HDF5 Applications" for a list of package
|
||||
names:
|
||||
condition checking). To enable this debugging, supply a
|
||||
comma-separated list of package names to the `--enable-internal-debug'
|
||||
switch. See "Debugging HDF5 Applications" for a list of package names:
|
||||
|
||||
http://www.hdfgroup.org/HDF5/doc/H5.user/Debugging.html
|
||||
|
||||
Debugging can be disabled by saying `--disable-debug'.
|
||||
Debugging can be disabled by saying `--disable-internal-debug'.
|
||||
The default debugging level for snapshots is a subset of the
|
||||
available packages; the default for supported releases is no
|
||||
debugging (debugging can incur a significant runtime penalty).
|
||||
|
||||
$ ./configure --enable-debug=s,t #debug only H5S and H5T
|
||||
$ ./configure --enable-debug #debug normal packages
|
||||
$ ./configure --enable-debug=all #debug all packages
|
||||
$ ./configure --disable-debug #no debugging
|
||||
$ ./configure --enable-internal-debug=s,t #debug only H5S and H5T
|
||||
$ ./configure --enable-internal-debug #debug normal packages
|
||||
$ ./configure --enable-internal-debug=all #debug all packages
|
||||
$ ./configure --disable-internal-debug #no debugging
|
||||
|
||||
HDF5 can also print a trace of all API function calls, their
|
||||
arguments, and the return values. To enable or disable the
|
||||
@ -466,15 +466,17 @@ CONTENTS
|
||||
http://www.hdfgroup.org/HDF5/doc/TechNotes/ThreadSafeLibrary.html
|
||||
|
||||
4.3.12. Backward compatibility
|
||||
The 1.8 version of the HDF5 Library can be configured to operate
|
||||
identically to the v1.6 library with the
|
||||
The 1.10 version of the HDF5 Library can be configured to operate
|
||||
identically to the v1.8 library with the
|
||||
--with-default-api-version=v18
|
||||
configure flag, or identically to the v1.6 library with the
|
||||
--with-default-api-version=v16
|
||||
configure flag. This allows existing code to be compiled with the
|
||||
v1.8 library without requiring immediate changes to the application
|
||||
v1.10 library without requiring immediate changes to the application
|
||||
source code. For addtional configuration options and other details,
|
||||
see "API Compatibility Macros in HDF5":
|
||||
|
||||
http://www.hdfgroup.org/HDF5/doc/RM/APICompatMacros.html
|
||||
https://support.hdfgroup.org/HDF5/doc/RM/APICompatMacros.html
|
||||
|
||||
4.4. Building
|
||||
The library, confidence tests, and programs can be built by
|
||||
|
@ -165,8 +165,9 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to:
|
||||
III. Quick Step Building HDF5 C Static Libraries and Tools with CMake
|
||||
========================================================================
|
||||
Notes: This short set of instructions is written for users who want to
|
||||
quickly build the just the HDF5 C static library and tools from
|
||||
quickly build just the HDF5 C static library and tools from
|
||||
the HDF5 source code package using the CMake command line tools.
|
||||
Avoid the use of drive letters in paths on Windows.
|
||||
|
||||
Go through these steps:
|
||||
|
||||
@ -571,7 +572,6 @@ HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols"
|
||||
HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" OFF
|
||||
HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON
|
||||
HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON
|
||||
HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON
|
||||
HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF
|
||||
HDF5_ENABLE_TRACE "Enable API tracing capability" OFF
|
||||
HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF
|
||||
|
@ -292,6 +292,12 @@ Bug Fixes since HDF5-1.10.1 release
|
||||
|
||||
(VC - 2017/11/28, HDFFV-9947)
|
||||
|
||||
- H5Pset_evict_on_close in H5Pfapl.c
|
||||
|
||||
Changed the minor error number from H5E_CANTSET to H5E_UNSUPPORTED for
|
||||
parallel library.
|
||||
(ADB - 2018/03/6, HDFFV-10414)
|
||||
|
||||
- filter plugin handling in H5PL.c and H5Z.c
|
||||
|
||||
It was discovered that the dynamic loading process used by
|
||||
@ -403,6 +409,63 @@ Bug Fixes since HDF5-1.10.1 release
|
||||
|
||||
(RAW - 2017/12/01, HDFFV-10272)
|
||||
|
||||
- If an HDF5 file contains a filter pipeline message with a 'number of
|
||||
filters' field that exceeds the maximum number of allowed filters,
|
||||
the error handling code will attempt to dereference a NULL pointer.
|
||||
|
||||
This issue was reported to The HDF Group as issue #CVE-2017-17505.
|
||||
|
||||
NOTE: The HDF5 C library cannot produce such a file. This condition
|
||||
should only occur in a corrupt (or deliberately altered) file
|
||||
or a file created by third-party software.
|
||||
|
||||
This problem arose because the error handling code assumed that
|
||||
the 'number of filters' field implied that a dynamic array of that
|
||||
size had already been created and that the cleanup code should
|
||||
iterate over that array and clean up each element's resources. If
|
||||
an error occurred before the array has been allocated, this will
|
||||
not be true.
|
||||
|
||||
This has been changed so that the number of filters is set to
|
||||
zero on errors. Additionally, the filter array traversal in the
|
||||
error handling code now requires that the filter array not be NULL.
|
||||
|
||||
(DER - 2018/02/06, HDFFV-10354)
|
||||
|
||||
- If an HDF5 file contains a filter pipeline message which contains
|
||||
a 'number of filters' field that exceeds the actual number of
|
||||
filters in the message, the HDF5 C library will read off the end of
|
||||
the read buffer.
|
||||
|
||||
This issue was reported to The HDF Group as issue #CVE-2017-17506.
|
||||
|
||||
NOTE: The HDF5 C library cannot produce such a file. This condition
|
||||
should only occur in a corrupt (or deliberately altered) file
|
||||
or a file created by third-party software.
|
||||
|
||||
The problem was fixed by passing the buffer size with the buffer
|
||||
and ensuring that the pointer cannot be incremented off the end
|
||||
of the buffer. A mismatch between the number of filters declared
|
||||
and the actual number of filters will now invoke normal HDF5
|
||||
error handling.
|
||||
|
||||
(DER - 2018/02/26, HDFFV-10355)
|
||||
|
||||
- If an HDF5 file contains a malformed compound type which contains
|
||||
a member of size zero, a division by zero error will occur while
|
||||
processing the type.
|
||||
|
||||
This issue was reported to The HDF Group as issue #CVE-2017-17508.
|
||||
|
||||
NOTE: The HDF5 C library cannot produce such a file. This condition
|
||||
should only occur in a corrupt (or deliberately altered) file
|
||||
or a file created by third-party software.
|
||||
|
||||
Checking for zero before dividing fixes the problem. Instead of the
|
||||
division by zero, the normal HDF5 error handling is invoked.
|
||||
|
||||
(DER - 2018/02/26, HDFFV-10357)
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
- CMake
|
||||
|
@ -158,7 +158,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5A__dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
|
||||
H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata)
|
||||
{
|
||||
H5A_fh_ud_cmp_t *udata = (H5A_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
|
||||
H5A_t *attr = NULL; /* Pointer to attribute created from heap object */
|
||||
@ -168,7 +168,7 @@ H5A__dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_ud
|
||||
FUNC_ENTER_STATIC
|
||||
|
||||
/* Decode attribute information */
|
||||
if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj)))
|
||||
if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute")
|
||||
|
||||
/* Compare the string values */
|
||||
|
@ -843,7 +843,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5A__dense_copy_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
|
||||
H5A__dense_copy_fh_cb(const void *obj, size_t obj_len, void *_udata)
|
||||
{
|
||||
H5A_fh_ud_cp_t *udata = (H5A_fh_ud_cp_t *)_udata; /* User data for fractal heap 'op' callback */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
@ -857,7 +857,7 @@ H5A__dense_copy_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_uda
|
||||
* HDF5 routine, it could attempt to re-protect that direct block for the
|
||||
* heap, causing the HDF5 routine called to fail)
|
||||
*/
|
||||
if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj)))
|
||||
if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, FAIL, "can't decode attribute")
|
||||
|
||||
/* Set the creation order index for the attribute */
|
||||
|
55
src/H5Aint.c
55
src/H5Aint.c
@ -102,6 +102,12 @@ static herr_t H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/* Format version bounds for attribute */
|
||||
const unsigned H5O_attr_ver_bounds[] = {
|
||||
H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
|
||||
H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
@ -209,18 +215,16 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
|
||||
if(H5T_set_loc(attr->shared->dt, loc->oloc->file, H5T_LOC_DISK) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
|
||||
|
||||
/* Set the latest format for datatype, if requested */
|
||||
if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATATYPE))
|
||||
if(H5T_set_latest_version(attr->shared->dt) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of datatype")
|
||||
/* Set the version for datatype */
|
||||
if(H5T_set_version(loc->oloc->file, attr->shared->dt) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of datatype")
|
||||
|
||||
/* Copy the dataspace for the attribute */
|
||||
attr->shared->ds = H5S_copy(space, FALSE, TRUE);
|
||||
|
||||
/* Set the latest format for dataspace, if requested */
|
||||
if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATASPACE))
|
||||
if(H5S_set_latest_version(attr->shared->ds) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of dataspace")
|
||||
/* Set the version for dataspace */
|
||||
if(H5S_set_version(loc->oloc->file, attr->shared->ds) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of dataspace")
|
||||
|
||||
/* Copy the object header information */
|
||||
if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0)
|
||||
@ -1843,11 +1847,11 @@ done:
|
||||
* Function: H5A_set_version
|
||||
*
|
||||
* Purpose: Sets the correct version to encode attribute with.
|
||||
* Chooses the oldest version possible, unless the "use the
|
||||
* latest format" flag is set.
|
||||
* Chooses the oldest version possible, unless the
|
||||
* file's low bound indicates otherwise.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@hdfgroup.org
|
||||
@ -1859,8 +1863,8 @@ herr_t
|
||||
H5A_set_version(const H5F_t *f, H5A_t *attr)
|
||||
{
|
||||
hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */
|
||||
hbool_t use_latest_format; /* Flag indicating the latest attribute version support is enabled */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
uint8_t version; /* Message version */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
@ -1868,9 +1872,6 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
|
||||
HDassert(f);
|
||||
HDassert(attr);
|
||||
|
||||
/* Get the file's 'use the latest attribute version support' flag */
|
||||
use_latest_format = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ATTRIBUTE);
|
||||
|
||||
/* Check whether datatype and dataspace are shared */
|
||||
if(H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt) > 0)
|
||||
type_shared = TRUE;
|
||||
@ -1883,14 +1884,22 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
|
||||
space_shared = FALSE;
|
||||
|
||||
/* Check which version to encode attribute with */
|
||||
if(use_latest_format)
|
||||
attr->shared->version = H5O_ATTR_VERSION_LATEST; /* Write out latest attribute version */
|
||||
else if(attr->shared->encoding != H5T_CSET_ASCII)
|
||||
attr->shared->version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
|
||||
if(attr->shared->encoding != H5T_CSET_ASCII)
|
||||
version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
|
||||
else if(type_shared || space_shared)
|
||||
attr->shared->version = H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
|
||||
version = H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
|
||||
else
|
||||
attr->shared->version = H5O_ATTR_VERSION_1; /* Write out basic version */
|
||||
version = H5O_ATTR_VERSION_1; /* Write out basic version */
|
||||
|
||||
/* Upgrade to the version indicated by the file's low bound if higher */
|
||||
version = MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]);
|
||||
|
||||
/* Version bounds check */
|
||||
if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)])
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_BADRANGE, FAIL, "attribute version out of bounds")
|
||||
|
||||
/* Set the message version */
|
||||
attr->shared->version = version;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
@ -1382,9 +1382,12 @@ H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id, hbool_t *image_generated
|
||||
* Note that under some error conditions, the superblock will be
|
||||
* undefined in this case as well -- if so, assume that the
|
||||
* superblock does not support superblock extension messages.
|
||||
* Also verify that the file's high_bound is at least release
|
||||
* 1.10.x, otherwise cancel the request for a cache image
|
||||
*/
|
||||
if((NULL == f->shared->sblock) ||
|
||||
(f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2)) {
|
||||
(f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) ||
|
||||
(f->shared->high_bound < H5F_LIBVER_V110)) {
|
||||
H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL;
|
||||
|
||||
cache_ptr->image_ctl = default_image_ctl;
|
||||
|
85
src/H5Dint.c
85
src/H5Dint.c
@ -623,10 +623,10 @@ done:
|
||||
static herr_t
|
||||
H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
|
||||
{
|
||||
htri_t relocatable; /* Flag whether the type is relocatable */
|
||||
htri_t immutable; /* Flag whether the type is immutable */
|
||||
hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
htri_t relocatable; /* Flag whether the type is relocatable */
|
||||
htri_t immutable; /* Flag whether the type is immutable */
|
||||
hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_STATIC
|
||||
|
||||
@ -643,17 +643,17 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
|
||||
if((immutable = H5T_is_immutable(type)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
|
||||
|
||||
/* Get the file's 'use the latest datatype version support' flag */
|
||||
use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE);
|
||||
/* To use at least v18 format versions or not */
|
||||
use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
|
||||
|
||||
/* Copy the datatype if it's a custom datatype or if it'll change when it's location is changed */
|
||||
if(!immutable || relocatable || use_latest_format) {
|
||||
if(!immutable || relocatable || use_at_least_v18) {
|
||||
/* Copy datatype for dataset */
|
||||
if((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype")
|
||||
|
||||
/* Convert a datatype (if committed) to a transient type if the committed datatype's file
|
||||
location is different from the file location where the dataset will be created */
|
||||
/* Convert a datatype (if committed) to a transient type if the committed datatype's file
|
||||
location is different from the file location where the dataset will be created */
|
||||
if(H5T_convert_committed_datatype(dset->shared->type, file) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
|
||||
|
||||
@ -661,14 +661,13 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
|
||||
if(H5T_set_loc(dset->shared->type, file, H5T_LOC_DISK) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location")
|
||||
|
||||
/* Set the latest format, if requested */
|
||||
if(use_latest_format)
|
||||
if(H5T_set_latest_version(dset->shared->type) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
|
||||
/* Set the version for datatype */
|
||||
if(H5T_set_version(file, dset->shared->type) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype")
|
||||
|
||||
/* Get a datatype ID for the dataset's datatype */
|
||||
if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
|
||||
if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
|
||||
} /* end if */
|
||||
/* Not a custom datatype, just use it directly */
|
||||
else {
|
||||
@ -738,7 +737,6 @@ done:
|
||||
static herr_t
|
||||
H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
|
||||
{
|
||||
hbool_t use_latest_format; /* Flag indicating the 'latest dataspace version support' is enabled */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_STATIC
|
||||
@ -748,9 +746,6 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
|
||||
HDassert(dset);
|
||||
HDassert(space);
|
||||
|
||||
/* Get the file's 'use the latest dataspace version support' flag */
|
||||
use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATASPACE);
|
||||
|
||||
/* Copy dataspace for dataset */
|
||||
if(NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE)))
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace")
|
||||
@ -759,10 +754,9 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
|
||||
if(H5D__cache_dataspace_info(dset) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info")
|
||||
|
||||
/* Set the latest format, if requested */
|
||||
if(use_latest_format)
|
||||
if(H5S_set_latest_version(dset->shared->space) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
|
||||
/* Set the version for dataspace */
|
||||
if(H5S_set_version(file, dset->shared->space) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
|
||||
|
||||
/* Set the dataset's dataspace to 'all' selection */
|
||||
if(H5S_select_all(dset->shared->space, TRUE) < 0)
|
||||
@ -794,6 +788,7 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
|
||||
H5D_fill_value_t fill_status; /* Fill value status */
|
||||
hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
|
||||
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
|
||||
hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_STATIC
|
||||
@ -808,6 +803,9 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
|
||||
type = dset->shared->type;
|
||||
fill_prop = &dset->shared->dcpl_cache.fill;
|
||||
|
||||
/* To use at least v18 format versions or not */
|
||||
use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
|
||||
|
||||
/* Retrieve "defined" status of fill value */
|
||||
if(H5P_is_fill_value_defined(fill_prop, &fill_status) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
|
||||
@ -886,8 +884,8 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message")
|
||||
|
||||
/* If there is valid information for the old fill value struct, add it */
|
||||
/* (only if we aren't trying to write the 'latest fill message version support') */
|
||||
if(fill_prop->buf && !(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))) {
|
||||
/* (only if we aren't using v18 format versions and above */
|
||||
if(fill_prop->buf && !use_at_least_v18) {
|
||||
H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */
|
||||
|
||||
/* Shallow copy the fill value property */
|
||||
@ -922,27 +920,27 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
|
||||
(H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) {
|
||||
|
||||
uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */
|
||||
unsigned bogus_id; /* "bogus" ID */
|
||||
unsigned bogus_id; /* "bogus" ID */
|
||||
|
||||
/* Retrieve "bogus" message ID */
|
||||
/* Retrieve "bogus" message ID */
|
||||
if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
|
||||
/* Retrieve "bogus" message flags */
|
||||
if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options")
|
||||
|
||||
/* Add a "bogus" message (for error testing). */
|
||||
if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
|
||||
if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message")
|
||||
} /* end if */
|
||||
}
|
||||
#endif /* H5O_ENABLE_BOGUS */
|
||||
|
||||
/* Add a modification time message, if using older format. */
|
||||
/* (If using the latest 'no modification time message' version support, the modification time is part of the object
|
||||
/* (If using v18 format versions and above, the the modification time is part of the object
|
||||
* header and doesn't use a separate message -QAK)
|
||||
*/
|
||||
if(!(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_NO_MOD_TIME_MSG)))
|
||||
if(!use_at_least_v18)
|
||||
if(H5O_touch_oh(file, dxpl_id, oh, TRUE) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message")
|
||||
|
||||
@ -1174,27 +1172,20 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation")
|
||||
} /* end if */
|
||||
|
||||
/* Set the latest version of the layout, pline & fill messages, if requested */
|
||||
if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DSET_MSG_FLAGS)) {
|
||||
/* Set the latest version for the I/O pipeline message */
|
||||
if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG))
|
||||
if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
|
||||
/* Set the version for the I/O pipeline message */
|
||||
if(H5O_pline_set_version(file, &new_dset->shared->dcpl_cache.pline) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
|
||||
|
||||
/* Set the latest version for the fill message */
|
||||
if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))
|
||||
/* Set the latest version for the fill value message */
|
||||
if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
|
||||
/* Set the version for the fill message */
|
||||
if(H5O_fill_set_version(file, &new_dset->shared->dcpl_cache.fill) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
|
||||
|
||||
/* Set the latest version for the layout message */
|
||||
if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG))
|
||||
/* Set the latest version for the layout message */
|
||||
if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
|
||||
/* Set the latest version for the layout message */
|
||||
if(H5D__layout_set_version(file, &new_dset->shared->layout) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
|
||||
} /* end if */
|
||||
else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
|
||||
/* Use latest indexing type for layout message version >= 4 */
|
||||
|
||||
if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
|
||||
/* Use latest indexing type for layout message version >= 4 */
|
||||
if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing")
|
||||
} /* end if */
|
||||
|
@ -46,6 +46,12 @@
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/* Format version bounds for layout */
|
||||
const unsigned H5O_layout_ver_bounds[] = {
|
||||
H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */
|
||||
H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
@ -57,6 +63,7 @@
|
||||
/*******************/
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D__layout_set_io_ops
|
||||
@ -277,49 +284,47 @@ done:
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D__layout_set_latest_version
|
||||
* Function: H5D__layout_set_version
|
||||
*
|
||||
* Purpose: Set the encoding for a layout to the latest version.
|
||||
* Part of the coding in this routine is moved to
|
||||
* H5D__layout_set_latest_indexing().
|
||||
* Purpose: Set the version to encode a layout with.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Thursday, January 15, 2009
|
||||
* Programmer: Vailin Choi; December 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5D__layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space,
|
||||
const H5D_dcpl_cache_t *dcpl_cache)
|
||||
H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
unsigned version; /* Message version */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(layout);
|
||||
HDassert(space);
|
||||
HDassert(dcpl_cache);
|
||||
HDassert(f);
|
||||
|
||||
/* Set encoding of layout to latest version */
|
||||
layout->version = H5O_LAYOUT_VERSION_LATEST;
|
||||
/* Upgrade to the version indicated by the file's low bound if higher */
|
||||
version = MAX(layout->version, H5O_layout_ver_bounds[H5F_LOW_BOUND(f)]);
|
||||
|
||||
/* Set the latest indexing type for the layout message */
|
||||
if(H5D__layout_set_latest_indexing(layout, space, dcpl_cache) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest indexing type")
|
||||
/* Version bounds check */
|
||||
if(version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)])
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "layout version out of bounds")
|
||||
|
||||
/* Set the message version */
|
||||
layout->version = version;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5D__layout_set_latest_version() */
|
||||
} /* end H5D__layout_set_version() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D__layout_set_latest_indexing
|
||||
*
|
||||
* Purpose: Set the latest indexing type for a layout message
|
||||
* This is moved from H5D_layout_set_latest_version().
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
|
@ -562,6 +562,9 @@ H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BT2[1];
|
||||
H5_DLLVAR const H5B2_class_t H5D_BT2[1];
|
||||
H5_DLLVAR const H5B2_class_t H5D_BT2_FILT[1];
|
||||
|
||||
/* Array of versions for Layout */
|
||||
H5_DLLVAR const unsigned H5O_layout_ver_bounds[H5F_LIBVER_NBOUNDS];
|
||||
|
||||
|
||||
/******************************/
|
||||
/* Package Private Prototypes */
|
||||
|
30
src/H5F.c
30
src/H5F.c
@ -1477,7 +1477,8 @@ H5Fstart_swmr_write(hid_t file_id)
|
||||
|
||||
if(file->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version should be at least 3")
|
||||
HDassert((file->shared->latest_flags | H5F_LATEST_LAYOUT_MSG) > 0);
|
||||
|
||||
HDassert((file->shared->low_bound == H5F_LIBVER_V110) && (file->shared->high_bound == H5F_LIBVER_V110));
|
||||
|
||||
/* Should not be marked for SWMR writing mode already */
|
||||
if(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)
|
||||
@ -1740,41 +1741,36 @@ done:
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Fset_latest_format
|
||||
* Function: H5Fset_libver_bounds
|
||||
*
|
||||
* Purpose: Enable switching the "latest format" flag while a file is open.
|
||||
* Purpose: Set to a different low and high bounds while a file is open.
|
||||
* This public routine is introduced in place of
|
||||
* H5Fset_latest_format() starting release 1.10.2.
|
||||
* See explanation for H5Fset_latest_format() in H5Fdeprec.c.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
|
||||
H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
|
||||
{
|
||||
H5F_t *f; /* File */
|
||||
unsigned latest_flags; /* Latest format flags for file */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
H5TRACE2("e", "ib", file_id, latest_format);
|
||||
H5TRACE3("e", "iFvFv", file_id, low, high);
|
||||
|
||||
/* Check args */
|
||||
if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
|
||||
|
||||
/* Check if the value is changing */
|
||||
latest_flags = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ALL_FLAGS);
|
||||
if(latest_format != (H5F_LATEST_ALL_FLAGS == latest_flags)) {
|
||||
/* Call the flush routine, for this file */
|
||||
if(H5F__flush(f, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
|
||||
|
||||
/* Toggle the 'latest format' flag */
|
||||
H5F_SET_LATEST_FLAGS(f, latest_format ? H5F_LATEST_ALL_FLAGS : 0);
|
||||
} /* end if */
|
||||
/* Call private set_libver_bounds function */
|
||||
if(H5F_set_libver_bounds(f, low, high) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Fset_latest_format() */
|
||||
} /* end H5Fset_libver_bounds() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
@ -143,5 +143,67 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Fget_info1() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Fset_latest_format
|
||||
*
|
||||
* Purpose: Enable switching between latest or non-latest format while
|
||||
* a file is open.
|
||||
* This is deprecated starting release 1.10.2 and is modified
|
||||
* to call the private H5F_set_libver_bounds() to set the
|
||||
* bounds.
|
||||
*
|
||||
* Before release 1.10.2, the library supports only two
|
||||
* combinations of low/high bounds:
|
||||
* (earliest, latest)
|
||||
* (latest, latest)
|
||||
* Thus, this public routine does the job in switching
|
||||
* between the two combinations listed above.
|
||||
*
|
||||
* Starting release 1.10.2, we add v18 to the enumerated
|
||||
* define H5F_libver_t and the library supports five combinations
|
||||
* as below:
|
||||
* (earliest, v18)
|
||||
* (earliest, v10)
|
||||
* (v18, v18)
|
||||
* (v18, v10)
|
||||
* (v10, v10)
|
||||
* So we introduce the new public routine H5Fset_libver_bounds()
|
||||
* in place of H5Fset_latest_format().
|
||||
* See also RFC: Setting Bounds for Object Creation in HDF5 1.10.0.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Vailin Choi; December 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
|
||||
{
|
||||
H5F_t *f; /* File */
|
||||
H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
|
||||
H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
H5TRACE2("e", "ib", file_id, latest_format);
|
||||
|
||||
/* Check args */
|
||||
if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
|
||||
|
||||
/* 'low' and 'high' are both initialized to LATEST.
|
||||
If latest format is not expected, set 'low' to EARLIEST */
|
||||
if(!latest_format)
|
||||
low = H5F_LIBVER_EARLIEST;
|
||||
|
||||
/* Call private set_libver_bounds function to set the bounds */
|
||||
if(H5F_set_libver_bounds(f, low, high) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Fset_latest_format() */
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
|
||||
|
@ -15,10 +15,9 @@
|
||||
|
||||
|
||||
/* Packages needed by this file... */
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Iprivate.h" /* IDs */
|
||||
#include "H5Fpkg.h" /* File access */
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Fpkg.h" /* File access */
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
|
||||
@ -41,11 +40,9 @@
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5F_t *
|
||||
H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id)
|
||||
H5F_fake_alloc(uint8_t sizeof_size)
|
||||
{
|
||||
H5F_t *f = NULL; /* Pointer to fake file struct */
|
||||
H5P_genplist_t *plist; /* Property list */
|
||||
hbool_t latest;
|
||||
H5F_t *ret_value = NULL; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(NULL)
|
||||
@ -62,16 +59,6 @@ H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id)
|
||||
else
|
||||
f->shared->sizeof_size = sizeof_size;
|
||||
|
||||
/* Activate latest version support according to the setting in fapl_id */
|
||||
/* See H5F_new() in H5Fint.c */
|
||||
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list")
|
||||
|
||||
if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'latest format' flag")
|
||||
if(latest)
|
||||
f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
|
||||
|
||||
/* Set return value */
|
||||
ret_value = f;
|
||||
|
||||
|
78
src/H5Fint.c
78
src/H5Fint.c
@ -161,10 +161,10 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size")
|
||||
if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size")
|
||||
if(f->shared->latest_flags > 0)
|
||||
latest_format = TRUE;
|
||||
if(H5P_set(new_plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'latest format' flag")
|
||||
if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions")
|
||||
if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions")
|
||||
if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'read attempts ' flag")
|
||||
if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
|
||||
@ -902,13 +902,10 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference")
|
||||
if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size")
|
||||
if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'latest format' flag")
|
||||
/* For latest format or SWMR_WRITE, activate all latest version support */
|
||||
if(latest_format)
|
||||
f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
|
||||
else if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
|
||||
f->shared->latest_flags |= H5F_LATEST_LAYOUT_MSG;
|
||||
if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &(f->shared->low_bound)) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'low' bound for library format versions")
|
||||
if(H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &(f->shared->high_bound)) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'high' bound for library format versions")
|
||||
if(H5P_get(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &(f->shared->use_mdc_logging)) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'use mdc logging' flag")
|
||||
if(H5P_get(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &(f->shared->start_mdc_log_on_access)) < 0)
|
||||
@ -2571,7 +2568,39 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* H5F_set_store_msg_crt_idx() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_set_libver_bounds()
|
||||
*
|
||||
* Purpose: Set the file's low and high bound to the input parameters
|
||||
* 'low' and 'high' respectively.
|
||||
* This is done only if the existing setting is different
|
||||
* from the inputs.
|
||||
*
|
||||
* Return: SUCCEED on success, and FAIL on failure.
|
||||
*
|
||||
* Programmer: Vailin Choi; December 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5F_set_libver_bounds(H5F_t * f, H5F_libver_t low, H5F_libver_t high)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
/* Sanity checks */
|
||||
HDassert(f);
|
||||
HDassert(f->shared);
|
||||
|
||||
/* Set the bounds only if the existing setting is different from the inputs */
|
||||
if(f->shared->low_bound != low || f->shared->high_bound != high) {
|
||||
f->shared->low_bound = low;
|
||||
f->shared->high_bound = high;
|
||||
}
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* H5F_set_libver_bounds() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_get_file_image
|
||||
*
|
||||
@ -2908,30 +2937,3 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr)
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* H5F_set_coll_md_read() */
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_set_latest_flags
|
||||
*
|
||||
* Purpose: Set the latest_flags field with a new value.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Failure: FAIL
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5F_set_latest_flags(H5F_t *f, unsigned flags)
|
||||
{
|
||||
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(f);
|
||||
HDassert(f->shared);
|
||||
HDassert(0 == ((flags) & ~H5F_LATEST_ALL_FLAGS));
|
||||
|
||||
f->shared->latest_flags = flags;
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* H5F_set_latest_flags() */
|
||||
|
||||
|
@ -300,7 +300,8 @@ struct H5F_file_t {
|
||||
hsize_t threshold; /* Threshold for alignment */
|
||||
hsize_t alignment; /* Alignment */
|
||||
unsigned gc_ref; /* Garbage-collect references? */
|
||||
unsigned latest_flags; /* The latest version support */
|
||||
H5F_libver_t low_bound; /* The 'low' bound of library format versions */
|
||||
H5F_libver_t high_bound; /* The 'high' bound of library format versions */
|
||||
hbool_t store_msg_crt_idx; /* Store creation index for object header messages? */
|
||||
unsigned ncwfs; /* Num entries on cwfs list */
|
||||
struct H5HG_heap_t **cwfs; /* Global heap cache */
|
||||
|
@ -275,6 +275,8 @@ typedef struct H5F_t H5F_t;
|
||||
|
||||
/* If the module using this macro is allowed access to the private variables, access them directly */
|
||||
#ifdef H5F_MODULE
|
||||
#define H5F_LOW_BOUND(F) ((F)->shared->low_bound)
|
||||
#define H5F_HIGH_BOUND(F) ((F)->shared->high_bound)
|
||||
#define H5F_INTENT(F) ((F)->shared->flags)
|
||||
#define H5F_OPEN_NAME(F) ((F)->open_name)
|
||||
#define H5F_ACTUAL_NAME(F) ((F)->actual_name)
|
||||
@ -311,15 +313,12 @@ typedef struct H5F_t H5F_t;
|
||||
#define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0)
|
||||
#define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size)
|
||||
#define H5F_GC_REF(F) ((F)->shared->gc_ref)
|
||||
#define H5F_USE_LATEST_FLAGS(F,FL) ((F)->shared->latest_flags & (FL))
|
||||
#define H5F_GET_LATEST_FLAGS(F) ((F)->shared->latest_flags)
|
||||
#define H5F_STORE_MSG_CRT_IDX(F) ((F)->shared->store_msg_crt_idx)
|
||||
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) ((F)->shared->store_msg_crt_idx = (FL))
|
||||
#define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
|
||||
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL)
|
||||
#define H5F_USE_TMP_SPACE(F) ((F)->shared->fs.use_tmp_space)
|
||||
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->fs.tmp_addr, (ADDR)))
|
||||
#define H5F_SET_LATEST_FLAGS(F, FL) ((F)->shared->latest_flags = (FL))
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
#define H5F_COLL_MD_READ(F) ((F)->coll_md_read)
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
@ -333,6 +332,8 @@ typedef struct H5F_t H5F_t;
|
||||
#define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc)
|
||||
#define H5F_EOA_PRE_FSM_FSALLOC(F) ((F)->shared->eoa_pre_fsm_fsalloc)
|
||||
#else /* H5F_MODULE */
|
||||
#define H5F_LOW_BOUND(F) (H5F_get_low_bound(F))
|
||||
#define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F))
|
||||
#define H5F_INTENT(F) (H5F_get_intent(F))
|
||||
#define H5F_OPEN_NAME(F) (H5F_get_open_name(F))
|
||||
#define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F))
|
||||
@ -369,15 +370,12 @@ typedef struct H5F_t H5F_t;
|
||||
#define H5F_RDCC_W0(F) (H5F_rdcc_w0(F))
|
||||
#define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F))
|
||||
#define H5F_GC_REF(F) (H5F_gc_ref(F))
|
||||
#define H5F_USE_LATEST_FLAGS(F,FL) (H5F_use_latest_flags(F,FL))
|
||||
#define H5F_GET_LATEST_FLAGS(F) (H5F_get_latest_flags(F))
|
||||
#define H5F_STORE_MSG_CRT_IDX(F) (H5F_store_msg_crt_idx(F))
|
||||
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) (H5F_set_store_msg_crt_idx((F), (FL)))
|
||||
#define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F))
|
||||
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC)))
|
||||
#define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F))
|
||||
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR)))
|
||||
#define H5F_SET_LATEST_FLAGS(F, FL) (H5F_set_latest_flags((F), (FL)))
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
#define H5F_COLL_MD_READ(F) (H5F_coll_md_read(F))
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
@ -486,7 +484,8 @@ typedef struct H5F_t H5F_t;
|
||||
#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */
|
||||
#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */
|
||||
#define H5F_ACS_MULTI_TYPE_NAME "multi_type" /* Data type in multi file driver */
|
||||
#define H5F_ACS_LATEST_FORMAT_NAME "latest_format" /* 'Use latest format version' flag */
|
||||
#define H5F_ACS_LIBVER_LOW_BOUND_NAME "libver_low_bound" /* 'low' bound of library format versions */
|
||||
#define H5F_ACS_LIBVER_HIGH_BOUND_NAME "libver_high_bound" /* 'high' bound of library format versions */
|
||||
#define H5F_ACS_WANT_POSIX_FD_NAME "want_posix_fd" /* Internal: query the file descriptor from the core VFD, instead of the memory address */
|
||||
#define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */
|
||||
#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */
|
||||
@ -631,24 +630,6 @@ typedef struct H5F_t H5F_t;
|
||||
#define H5SM_TABLE_MAGIC "SMTB" /* Shared Message Table */
|
||||
#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */
|
||||
|
||||
|
||||
/* Latest format will activate the following latest version support */
|
||||
/* "latest_flags" in H5F_file_t */
|
||||
#define H5F_LATEST_DATATYPE 0x0001
|
||||
#define H5F_LATEST_DATASPACE 0x0002
|
||||
#define H5F_LATEST_ATTRIBUTE 0x0004
|
||||
#define H5F_LATEST_FILL_MSG 0x0008
|
||||
#define H5F_LATEST_PLINE_MSG 0x0010
|
||||
#define H5F_LATEST_LAYOUT_MSG 0x0020
|
||||
#define H5F_LATEST_NO_MOD_TIME_MSG 0x0040
|
||||
#define H5F_LATEST_STYLE_GROUP 0x0080
|
||||
#define H5F_LATEST_OBJ_HEADER 0x0100
|
||||
#define H5F_LATEST_SUPERBLOCK 0x0200
|
||||
#define H5F_LATEST_DATASPACE_SELECTION 0x0400
|
||||
#define H5F_LATEST_ALL_FLAGS (H5F_LATEST_DATATYPE | H5F_LATEST_DATASPACE | H5F_LATEST_ATTRIBUTE | H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG | H5F_LATEST_NO_MOD_TIME_MSG | H5F_LATEST_STYLE_GROUP | H5F_LATEST_OBJ_HEADER | H5F_LATEST_SUPERBLOCK | H5F_LATEST_DATASPACE_SELECTION)
|
||||
|
||||
#define H5F_LATEST_DSET_MSG_FLAGS (H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG)
|
||||
|
||||
/****************************/
|
||||
/* Library Private Typedefs */
|
||||
/****************************/
|
||||
@ -739,7 +720,9 @@ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
|
||||
hid_t fapl_id, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
|
||||
|
||||
/* Functions than retrieve values from the file struct */
|
||||
/* Functions that retrieve values from the file struct */
|
||||
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
|
||||
H5_DLL H5F_libver_t H5F_get_high_bound(const H5F_t *f);
|
||||
H5_DLL unsigned H5F_get_intent(const H5F_t *f);
|
||||
H5_DLL char *H5F_get_open_name(const H5F_t *f);
|
||||
H5_DLL char *H5F_get_actual_name(const H5F_t *f);
|
||||
@ -786,11 +769,11 @@ H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
|
||||
H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl);
|
||||
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
|
||||
H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag);
|
||||
H5_DLL herr_t H5F_set_libver_bounds(H5F_t * f, H5F_libver_t low, H5F_libver_t high);
|
||||
H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f);
|
||||
H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5UC_t *rc);
|
||||
H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f);
|
||||
H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr);
|
||||
H5_DLL herr_t H5F_set_latest_flags(H5F_t *f, unsigned flags);
|
||||
H5_DLL hsize_t H5F_get_alignment(const H5F_t *f);
|
||||
H5_DLL hsize_t H5F_get_threshold(const H5F_t *f);
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
@ -844,7 +827,7 @@ H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *ad
|
||||
H5_DLL void H5F_sfile_assert_num(unsigned n);
|
||||
|
||||
/* Routines for creating & destroying "fake" file structures */
|
||||
H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id);
|
||||
H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size);
|
||||
H5_DLL herr_t H5F_fake_free(H5F_t *f);
|
||||
|
||||
/* Superblock related routines */
|
||||
|
@ -173,12 +173,17 @@ typedef struct H5F_sect_info_t {
|
||||
hsize_t size; /* Size of free space section */
|
||||
} H5F_sect_info_t;
|
||||
|
||||
/* Library's file format versions */
|
||||
/* Library's format versions */
|
||||
typedef enum H5F_libver_t {
|
||||
H5F_LIBVER_EARLIEST, /* Use the earliest possible format for storing objects */
|
||||
H5F_LIBVER_LATEST /* Use the latest possible format available for storing objects*/
|
||||
H5F_LIBVER_ERROR = -1,
|
||||
H5F_LIBVER_EARLIEST = 0, /* Use the earliest possible format for storing objects */
|
||||
H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */
|
||||
H5F_LIBVER_V110 = 2, /* Use the latest v10 format for storing objects */
|
||||
H5F_LIBVER_NBOUNDS
|
||||
} H5F_libver_t;
|
||||
|
||||
#define H5F_LIBVER_LATEST H5F_LIBVER_V110
|
||||
|
||||
/* File space handling strategy */
|
||||
typedef enum H5F_fspace_strategy_t {
|
||||
H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /* Mechanisms: free-space managers, aggregators, and virtual file drivers */
|
||||
@ -255,7 +260,7 @@ H5_DLL herr_t H5Fstart_swmr_write(hid_t file_id);
|
||||
H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type,
|
||||
size_t nsects, H5F_sect_info_t *sect_info/*out*/);
|
||||
H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id);
|
||||
H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format);
|
||||
H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
|
||||
H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id);
|
||||
H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id);
|
||||
H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id,
|
||||
@ -295,6 +300,7 @@ typedef struct H5F_info1_t {
|
||||
|
||||
/* Function prototypes */
|
||||
H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo);
|
||||
H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format);
|
||||
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
|
||||
|
109
src/H5Fquery.c
109
src/H5Fquery.c
@ -95,6 +95,56 @@ H5F_get_intent(const H5F_t *f)
|
||||
FUNC_LEAVE_NOAPI(f->shared->flags)
|
||||
} /* end H5F_get_intent() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_get_low_bound
|
||||
*
|
||||
* Purpose: Quick and dirty routine to retrieve the file's low_bound.
|
||||
* (Mainly added to stop non-file routines from poking about in the
|
||||
* H5F_t data structure)
|
||||
*
|
||||
* Return: low_bound on success/abort on failure (shouldn't fail)
|
||||
*
|
||||
* Programmer: Vailin Choi; June 2016
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5F_libver_t
|
||||
H5F_get_low_bound(const H5F_t *f)
|
||||
{
|
||||
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
HDassert(f);
|
||||
|
||||
FUNC_LEAVE_NOAPI(f->shared->low_bound)
|
||||
} /* end H5F_get_low_bound() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_get_high_bound
|
||||
*
|
||||
* Purpose: Quick and dirty routine to retrieve the file's high_bound.
|
||||
* (Mainly added to stop non-file routines from poking about in the
|
||||
* H5F_t data structure)
|
||||
*
|
||||
* Return: high_bound on success/abort on failure (shouldn't fail)
|
||||
*
|
||||
* Programmer: Vailin Choi; June 2016
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5F_libver_t
|
||||
H5F_get_high_bound(const H5F_t *f)
|
||||
{
|
||||
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
HDassert(f);
|
||||
|
||||
FUNC_LEAVE_NOAPI(f->shared->high_bound)
|
||||
} /* end H5F_get_high_bound() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_get_open_name
|
||||
@ -667,9 +717,13 @@ H5F_sieve_buf_size(const H5F_t *f)
|
||||
* references flag" now that the generic properties are being used
|
||||
* to store the values.
|
||||
*
|
||||
* Return: Success: The "garbage collect references flag"
|
||||
* is returned.
|
||||
* Failure: (should not happen)
|
||||
* Return: Success: The "garbage collect references flag" is returned.
|
||||
* Failure: (should not happen)
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Jul 8 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
unsigned
|
||||
@ -684,55 +738,6 @@ H5F_gc_ref(const H5F_t *f)
|
||||
FUNC_LEAVE_NOAPI(f->shared->gc_ref)
|
||||
} /* end H5F_gc_ref() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_use_latest_flags
|
||||
*
|
||||
* Purpose: Retrieve the requested 'latest version support' for the file.
|
||||
*
|
||||
* Return: Success: Non-negative, the requested 'version support'
|
||||
* Failure: (can't happen)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
unsigned
|
||||
H5F_use_latest_flags(const H5F_t *f, unsigned fl)
|
||||
{
|
||||
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
HDassert(f);
|
||||
HDassert(f->shared);
|
||||
|
||||
FUNC_LEAVE_NOAPI(f->shared->latest_flags & (fl))
|
||||
} /* end H5F_use_latest_flags() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_get_latest_flags
|
||||
*
|
||||
* Purpose: Retrieve the 'latest version support' setting for the file.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: (can't happen)
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@hdfgroup.org
|
||||
* Mar 5 2007
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
unsigned
|
||||
H5F_get_latest_flags(const H5F_t *f)
|
||||
{
|
||||
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
HDassert(f);
|
||||
HDassert(f->shared);
|
||||
|
||||
FUNC_LEAVE_NOAPI(f->shared->latest_flags)
|
||||
} /* end H5F_get_latest_flags() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_get_fc_degree
|
||||
|
101
src/H5Fsuper.c
101
src/H5Fsuper.c
@ -59,7 +59,6 @@ static herr_t H5F__update_super_ext_driver_msg(H5F_t *f, hid_t dxpl_id);
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
@ -72,6 +71,12 @@ H5FL_DEFINE(H5F_super_t);
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
/* Format version bounds for superblock */
|
||||
static const unsigned HDF5_superblock_ver_bounds[] = {
|
||||
HDF5_SUPERBLOCK_VERSION_DEF, /* H5F_LIBVER_EARLIEST */
|
||||
HDF5_SUPERBLOCK_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -452,13 +457,46 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
|
||||
if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, meta_dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags)))
|
||||
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")
|
||||
/*
|
||||
* When opening a file with SWMR-write access, the library will first
|
||||
* check to ensure that superblock version 3 is used. Otherwise fail
|
||||
* file open.
|
||||
*
|
||||
* Then the library will upgrade the file's low_bound depending on
|
||||
* superblock version as follows:
|
||||
* --version 0 or 1: no change to low_bound
|
||||
* --version 2: upgrade low_bound to at least V18
|
||||
* --version 3: upgrade low_bound to at least V110
|
||||
*
|
||||
* Upgrading low_bound will give the best format versions available for
|
||||
* that superblock version. Due to the possible upgrade, the fapl returned
|
||||
* from H5Fget_access_plist() might indicate a low_bound higher than what
|
||||
* the user originally set.
|
||||
*
|
||||
* After upgrading low_bound, the library will check to ensure that the
|
||||
* superblock version does not exceed the version allowed by high_bound.
|
||||
* Otherise fail file open.
|
||||
*
|
||||
* For details, please see RFC:Setting Bounds for Object Creation in HDF5 1.10.0.
|
||||
*/
|
||||
|
||||
/* Enable all latest version support when file has v3 superblock */
|
||||
/* Check to ensure that superblock version 3 is used for SWMR-write access */
|
||||
if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) {
|
||||
if(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version for SWMR is less than 3")
|
||||
}
|
||||
|
||||
/* Upgrade low_bound to at least V18 when encountering version 2 superblock */
|
||||
if(sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2)
|
||||
f->shared->low_bound = MAX(H5F_LIBVER_V18, f->shared->low_bound);
|
||||
|
||||
/* Upgrade low_bound to at least V110 when encountering version 3 superblock */
|
||||
if(sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3)
|
||||
f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
|
||||
f->shared->low_bound = MAX(H5F_LIBVER_V110, f->shared->low_bound);
|
||||
|
||||
/* Version bounds check */
|
||||
if(sblock->super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound])
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version exceeds high bound")
|
||||
|
||||
/* Pin the superblock in the cache */
|
||||
if(H5AC_pin_protected_entry(sblock) < 0)
|
||||
@ -1018,14 +1056,42 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
|
||||
f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF))
|
||||
non_default_fs_settings = TRUE;
|
||||
|
||||
/* Bump superblock version if latest superblock version support is enabled */
|
||||
if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_SUPERBLOCK))
|
||||
super_vers = HDF5_SUPERBLOCK_VERSION_LATEST;
|
||||
/* Bump superblock version to use version 3 superblock for SWMR writing */
|
||||
else if((H5F_INTENT(f) & H5F_ACC_SWMR_WRITE))
|
||||
/*
|
||||
* When creating a file with write access, the library will:
|
||||
* -- set superblock version to 0, 1 or 2 based on feature enabled
|
||||
* -- no change to low_bound
|
||||
* When creating a file with SWMR-write access, the library will:
|
||||
* (See explanation (#) below.)
|
||||
* -- set superblock version to 3
|
||||
* -- upgrade low_bound to at least V110
|
||||
*
|
||||
* Then the library will finalize superblock version to that allowed by
|
||||
* low_bound if that is higher.
|
||||
* Lastly, the library will check to ensure the superblock version does not
|
||||
* exceed the version allowed by high_bound. Otherwise fail file open.
|
||||
*
|
||||
* For details, please see RFC:Setting Bounds for Object Creation in HDF5 1.10.0.
|
||||
*
|
||||
* (#)
|
||||
* Version 3 superblock is introduced in 1.10 for SWMR due to the problem of
|
||||
* the status_flags field in the superblock. The problem is discussed in
|
||||
* jira issue SWMR-79 and also in the RFC: File Format Changes in HDF5 1.10.0.
|
||||
* The file's low_bound is upgraded for SWMR so that the library will
|
||||
* use the best format versions available in 1.10.
|
||||
* Due to the possible upgrade, the fapl returned from H5Fget_access_plist()
|
||||
* might indicate a low_bound higher than what the user originally set.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Creating a file with SWMR-write access will
|
||||
* upgrade superblock version and low_bound
|
||||
*/
|
||||
if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) {
|
||||
super_vers = HDF5_SUPERBLOCK_VERSION_3;
|
||||
f->shared->low_bound = MAX(H5F_LIBVER_V110, f->shared->low_bound);
|
||||
|
||||
/* Bump superblock version to create superblock extension for SOHM info */
|
||||
else if(f->shared->sohm_nindexes > 0)
|
||||
} else if(f->shared->sohm_nindexes > 0)
|
||||
super_vers = HDF5_SUPERBLOCK_VERSION_2;
|
||||
/*
|
||||
* Bump superblock version to create superblock extension for:
|
||||
@ -1043,6 +1109,13 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
|
||||
else if(sblock->btree_k[H5B_CHUNK_ID] != HDF5_BTREE_CHUNK_IK_DEF)
|
||||
super_vers = HDF5_SUPERBLOCK_VERSION_1;
|
||||
|
||||
/* Finalize superblock version to that allowed by the file's low bound if higher */
|
||||
super_vers = MAX(super_vers, HDF5_superblock_ver_bounds[f->shared->low_bound]);
|
||||
|
||||
/* Version bounds check */
|
||||
if(super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound])
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version out of bounds")
|
||||
|
||||
/* If a newer superblock version is required, set it here */
|
||||
if(super_vers != HDF5_SUPERBLOCK_VERSION_DEF) {
|
||||
H5P_genplist_t *c_plist; /* Property list */
|
||||
@ -1067,8 +1140,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
|
||||
|
||||
/* Sanity check the userblock size vs. the file's allocation alignment */
|
||||
if(userblock_size > 0) {
|
||||
/* Set up the alignment to use for page or aggr fs */
|
||||
hsize_t alignment = H5F_PAGED_AGGR(f) ? f->shared->fs_page_size : f->shared->alignment;
|
||||
/* Set up the alignment to use for page or aggr fs */
|
||||
hsize_t alignment = H5F_PAGED_AGGR(f) ? f->shared->fs_page_size : f->shared->alignment;
|
||||
|
||||
if(userblock_size < alignment)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be > file object alignment")
|
||||
|
@ -155,7 +155,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5G_dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
|
||||
H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata)
|
||||
{
|
||||
H5G_fh_ud_cmp_t *udata = (H5G_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
|
||||
H5O_link_t *lnk; /* Pointer to link created from heap object */
|
||||
@ -164,7 +164,7 @@ H5G_dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_uda
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
/* Decode link information */
|
||||
if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
|
||||
if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
|
||||
|
||||
/* Compare the string values */
|
||||
|
@ -599,7 +599,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
|
||||
H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
|
||||
{
|
||||
H5G_fh_ud_lbi_t *udata = (H5G_fh_ud_lbi_t *)_udata; /* User data for fractal heap 'op' callback */
|
||||
H5O_link_t *tmp_lnk = NULL; /* Temporary pointer to link */
|
||||
@ -608,7 +608,7 @@ H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, vo
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
/* Decode link information & keep a copy */
|
||||
if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
|
||||
if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
|
||||
|
||||
/* Copy link information */
|
||||
@ -889,7 +889,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5G_dense_iterate_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
|
||||
H5G_dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata)
|
||||
{
|
||||
H5G_fh_ud_it_t *udata = (H5G_fh_ud_it_t *)_udata; /* User data for fractal heap 'op' callback */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
@ -903,7 +903,7 @@ H5G_dense_iterate_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_u
|
||||
* HDF5 routine, it could attempt to re-protect that direct block for the
|
||||
* heap, causing the HDF5 routine called to fail - QAK)
|
||||
*/
|
||||
if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
|
||||
if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
|
||||
|
||||
done:
|
||||
@ -1101,7 +1101,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
|
||||
H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
|
||||
{
|
||||
H5G_fh_ud_gnbi_t *udata = (H5G_fh_ud_gnbi_t *)_udata; /* User data for fractal heap 'op' callback */
|
||||
H5O_link_t *lnk; /* Pointer to link created from heap object */
|
||||
@ -1110,7 +1110,7 @@ H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len,
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
/* Decode link information */
|
||||
if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
|
||||
if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
|
||||
|
||||
/* Get the length of the name */
|
||||
@ -1308,7 +1308,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5G_dense_remove_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
|
||||
H5G_dense_remove_fh_cb(const void *obj, size_t obj_len, void *_udata)
|
||||
{
|
||||
H5G_fh_ud_rm_t *udata = (H5G_fh_ud_rm_t *)_udata; /* User data for fractal heap 'op' callback */
|
||||
H5O_link_t *lnk = NULL; /* Pointer to link created from heap object */
|
||||
@ -1318,7 +1318,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_ud
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
/* Decode link information */
|
||||
if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
|
||||
if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
|
||||
|
||||
/* Check for removing the link from the creation order index */
|
||||
@ -1485,7 +1485,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
|
||||
H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
|
||||
{
|
||||
H5G_fh_ud_rmbi_t *udata = (H5G_fh_ud_rmbi_t *)_udata; /* User data for fractal heap 'op' callback */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
@ -1493,7 +1493,7 @@ H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, vo
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
/* Decode link information */
|
||||
if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
|
||||
if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5_ITER_ERROR, "can't decode link")
|
||||
|
||||
/* Can't operate on link here because the fractal heap block is locked */
|
||||
|
21
src/H5Gobj.c
21
src/H5Gobj.c
@ -185,7 +185,7 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
|
||||
H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc/*out*/)
|
||||
{
|
||||
size_t hdr_size; /* Size of object header to request */
|
||||
hbool_t use_latest_format; /* Flag indicating the new group format should be used */
|
||||
hbool_t use_at_least_v18; /* Flag indicating the new group format should be used */
|
||||
hid_t gcpl_id = gcrt_info->gcpl_id; /* Group creation property list ID */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
@ -202,24 +202,23 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
|
||||
|
||||
/* Check for invalid access request */
|
||||
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
|
||||
|
||||
/* Check for using the latest version of the group format */
|
||||
/* Check for using the latest version of the group format which is introduced in v18 */
|
||||
/* (add more checks for creating "new format" groups when needed) */
|
||||
if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_STYLE_GROUP) || linfo->track_corder
|
||||
|| (pline && pline->nused))
|
||||
use_latest_format = TRUE;
|
||||
if((H5F_LOW_BOUND(f) >= H5F_LIBVER_V18) || linfo->track_corder || (pline && pline->nused))
|
||||
use_at_least_v18 = TRUE;
|
||||
else
|
||||
use_latest_format = FALSE;
|
||||
use_at_least_v18 = FALSE;
|
||||
|
||||
/* Make certain that the creation order is being tracked if an index is
|
||||
* going to be built on it.
|
||||
*/
|
||||
if(linfo->index_corder && !linfo->track_corder)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "must track creation order to create index for it")
|
||||
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "must track creation order to create index for it")
|
||||
|
||||
/* Check if we should be using the latest version of the group format */
|
||||
if(use_latest_format) {
|
||||
if(use_at_least_v18) {
|
||||
H5O_link_t lnk; /* Temporary link message info for computing message size */
|
||||
char null_char = '\0'; /* Character for creating null string */
|
||||
size_t ginfo_size; /* Size of the group info message */
|
||||
@ -262,10 +261,10 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
|
||||
* incremented if the object is added to the group directed graph.
|
||||
*/
|
||||
if(H5O_create(f, dxpl_id, hdr_size, (size_t)1, gcpl_id, oloc/*out*/) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
|
||||
|
||||
/* Check for format of group to create */
|
||||
if(use_latest_format) {
|
||||
if(use_at_least_v18) {
|
||||
/* Insert link info message */
|
||||
/* (Casting away const OK - QAK) */
|
||||
if(H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, (void *)linfo, dxpl_id) < 0)
|
||||
|
@ -572,7 +572,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata,
|
||||
UINT32DECODE(image, hdr->pline_root_direct_filter_mask);
|
||||
|
||||
/* Decode I/O filter information */
|
||||
if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, udata->dxpl_id, NULL, H5O_PLINE_ID, image)))
|
||||
if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, udata->dxpl_id, NULL, H5O_PLINE_ID, len, image)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters")
|
||||
|
||||
/* Advance past filter info to checksum */
|
||||
|
@ -424,11 +424,9 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
|
||||
if(NULL == H5O_msg_copy(H5O_PLINE_ID, &(cparam->pline), &(hdr->pline)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline")
|
||||
|
||||
/* Pay attention to the latest version flag for the file */
|
||||
if(H5F_USE_LATEST_FLAGS(hdr->f, H5F_LATEST_PLINE_MSG))
|
||||
/* Set the latest version for the I/O pipeline message */
|
||||
if(H5O_pline_set_latest_version(&(hdr->pline)) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set latest version of I/O filter pipeline")
|
||||
/* Set the version for the I/O pipeline message */
|
||||
if(H5O_pline_set_version(hdr->f, &(hdr->pline)) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set version of I/O filter pipeline")
|
||||
|
||||
/* Compute the I/O filters' encoded size */
|
||||
if(0 == (hdr->filter_len = (unsigned)H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline))))
|
||||
|
@ -72,7 +72,6 @@
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Oopen
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_ainfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_ainfo_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -105,7 +105,8 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_ainfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_ainfo_t *ainfo = NULL; /* Attribute info */
|
||||
unsigned char flags; /* Flags for encoding attribute info */
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static herr_t H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg);
|
||||
static void *H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static void *H5O_attr_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_attr_size(const H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_attr_free(void *mesg);
|
||||
@ -121,7 +121,7 @@ H5FL_EXTERN(H5S_extent_t);
|
||||
--------------------------------------------------------------------------*/
|
||||
static void *
|
||||
H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
|
||||
unsigned *ioflags, const uint8_t *p)
|
||||
unsigned *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5A_t *attr = NULL;
|
||||
H5S_extent_t *extent; /*extent dimensionality information */
|
||||
@ -185,7 +185,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
|
||||
|
||||
/* Decode the attribute's datatype */
|
||||
if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, open_oh,
|
||||
((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)))
|
||||
((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->dt_size, p)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
|
||||
if(attr->shared->version < H5O_ATTR_VERSION_2)
|
||||
p += H5O_ALIGN_OLD(attr->shared->dt_size);
|
||||
@ -200,7 +200,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
|
||||
|
||||
/* Decode attribute's dataspace extent */
|
||||
if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, open_oh,
|
||||
((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
|
||||
((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->ds_size, p)) == NULL)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
|
||||
|
||||
/* Copy the extent information to the dataspace */
|
||||
@ -622,14 +622,23 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src,
|
||||
H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src,
|
||||
hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
const H5A_t *attr_src = (const H5A_t *)native_src; /* Source attribute */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
/* check args */
|
||||
HDassert(deleted);
|
||||
HDassert(cpy_info);
|
||||
HDassert(cpy_info->file_dst);
|
||||
|
||||
/* Check to ensure that the version of the message to be copied does not exceed
|
||||
the message version allowed by the destination file's high bound */
|
||||
if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds")
|
||||
|
||||
/* If we are not copying attributes into the destination file, indicate
|
||||
* that this message should be deleted.
|
||||
@ -637,7 +646,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED
|
||||
if(cpy_info->copy_without_attr)
|
||||
*deleted = TRUE;
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_attr_pre_copy_file() */
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_bogus_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static size_t H5O_bogus_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
|
||||
@ -111,7 +111,8 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
|
||||
*/
|
||||
static void *
|
||||
H5O_bogus_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_bogus_t *mesg = NULL;
|
||||
void *ret_value; /* Return value */
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
|
||||
static void *H5O_btreek_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_btreek_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_btreek_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_btreek_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -79,7 +79,8 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{
|
||||
*/
|
||||
static void *
|
||||
H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_btreek_t *mesg; /* Native message */
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
@ -1515,7 +1515,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
|
||||
H5O_cont_t *cont;
|
||||
|
||||
/* Decode continuation message */
|
||||
cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw);
|
||||
cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw_size, mesg->raw);
|
||||
H5_CHECKED_ASSIGN(cont->chunkno, unsigned, udata->cont_msg_info->nmsgs + 1, size_t); /* the next continuation message/chunk */
|
||||
|
||||
/* Save 'native' form of continuation message */
|
||||
@ -1531,7 +1531,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
|
||||
|
||||
/* Decode ref. count message */
|
||||
HDassert(oh->version > H5O_VERSION_1);
|
||||
refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw);
|
||||
refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw_size, mesg->raw);
|
||||
|
||||
/* Save 'native' form of ref. count message */
|
||||
mesg->native = refcount;
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
/* Callbacks for message class */
|
||||
static void *H5O__mdci_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O__mdci_encode(H5F_t *f, hbool_t disable_shared,
|
||||
uint8_t *p, const void *_mesg);
|
||||
static void *H5O__mdci_copy(const void *_mesg, void *_dest);
|
||||
@ -99,7 +99,7 @@ H5FL_DEFINE(H5O_mdci_t);
|
||||
static void *
|
||||
H5O__mdci_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id,
|
||||
H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
|
||||
unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_mdci_t *mesg; /* Native message */
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
static herr_t H5O_cont_free(void *mesg);
|
||||
@ -90,7 +90,8 @@ H5FL_DEFINE(H5O_cont_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_cont_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_cont_t *cont = NULL;
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
@ -415,6 +415,11 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
|
||||
|
||||
/* Initialize header information */
|
||||
oh_dst->version = oh_src->version;
|
||||
|
||||
/* Version bounds check for destination object header */
|
||||
if(oh_dst->version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(oloc_dst->file)])
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "destination object header version out of bounds")
|
||||
|
||||
oh_dst->flags = oh_src->flags;
|
||||
oh_dst->link_msgs_seen = oh_src->link_msgs_seen;
|
||||
oh_dst->attr_msgs_seen = oh_src->attr_msgs_seen;
|
||||
@ -490,6 +495,12 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
|
||||
/* Decode the message if necessary. */
|
||||
H5O_LOAD_NATIVE(oloc_src->file, dxpl_id, 0, oh_src, mesg_src, FAIL)
|
||||
|
||||
/* Save destination file pointer in cpy_info so that it can be used
|
||||
in the pre_copy_file callback to obtain the destination file's
|
||||
high bound. The high bound is used to index into the corresponding
|
||||
message's array of versions for doing version bounds check. */
|
||||
cpy_info->file_dst = oloc_dst->file;
|
||||
|
||||
/* Perform "pre copy" operation on message */
|
||||
if((copy_type->pre_copy_file)(oloc_src->file, mesg_src->native,
|
||||
&(deleted[mesgno]), cpy_info, cpy_udata) < 0)
|
||||
@ -871,12 +882,19 @@ done:
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
/* Free destination object header on failure */
|
||||
if(ret_value < 0 && oh_dst && !inserted) {
|
||||
if(H5O__free(oh_dst) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
|
||||
if(H5O_loc_reset(oloc_dst) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
|
||||
} /* end if */
|
||||
if(ret_value < 0) {
|
||||
if(oh_dst && !inserted) {
|
||||
if(H5O__free(oh_dst) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
|
||||
if(H5O_loc_reset(oloc_dst) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
|
||||
} /* end if */
|
||||
|
||||
if(addr_map == NULL && cpy_udata) {
|
||||
if(obj_class && obj_class->free_copy_file_udata)
|
||||
obj_class->free_copy_file_udata(cpy_udata);
|
||||
} /* end if */
|
||||
}
|
||||
|
||||
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
|
||||
} /* end H5O_copy_header_real() */
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
|
||||
static void *H5O_drvinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_drvinfo_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -80,7 +80,8 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{
|
||||
*/
|
||||
static void *
|
||||
H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_drvinfo_t *mesg; /* Native message */
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
@ -15,22 +15,22 @@
|
||||
#define H5T_FRIEND /*prevent warning from including H5Tpkg */
|
||||
|
||||
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Dprivate.h" /* Datasets */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Fprivate.h" /* Files */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5Gprivate.h" /* Groups */
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
#include "H5Tpkg.h" /* Datatypes */
|
||||
#include "H5VMprivate.h" /* Vectors and arrays */
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Dprivate.h" /* Datasets */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Fprivate.h" /* Files */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5Gprivate.h" /* Groups */
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
#include "H5Tpkg.h" /* Datatypes */
|
||||
#include "H5VMprivate.h" /* Vectors and arrays */
|
||||
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static herr_t H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg);
|
||||
static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static void *H5O_dtype_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_dtype_reset(void *_mesg);
|
||||
@ -1094,7 +1094,7 @@ done:
|
||||
--------------------------------------------------------------------------*/
|
||||
static void *
|
||||
H5O_dtype_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
|
||||
unsigned *ioflags/*in,out*/, const uint8_t *p)
|
||||
unsigned *ioflags/*in,out*/, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5T_t *dt = NULL;
|
||||
void *ret_value = NULL; /* Return value */
|
||||
@ -1516,7 +1516,7 @@ done:
|
||||
*/
|
||||
static herr_t
|
||||
H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
|
||||
hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info,
|
||||
hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info,
|
||||
void *_udata)
|
||||
{
|
||||
const H5T_t *dt_src = (const H5T_t *)mesg_src; /* Source datatype */
|
||||
@ -1528,6 +1528,13 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
|
||||
/* check args */
|
||||
HDassert(file_src);
|
||||
HDassert(dt_src);
|
||||
HDassert(cpy_info);
|
||||
HDassert(cpy_info->file_dst);
|
||||
|
||||
/* Check to ensure that the version of the message to be copied does not exceed
|
||||
the message version as indicated by the destination file's high bound */
|
||||
if(dt_src->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "datatype message version out of bounds")
|
||||
|
||||
/* If the user data is non-NULL, assume we are copying a dataset
|
||||
* and check if we need to make a copy of the datatype for later in
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_efl_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_efl_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_efl_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -88,7 +88,8 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{
|
||||
*/
|
||||
static void *
|
||||
H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_efl_t *mesg = NULL;
|
||||
int version;
|
||||
|
262
src/H5Ofill.c
262
src/H5Ofill.c
@ -21,28 +21,30 @@
|
||||
#include "H5Omodule.h" /* This source code file is part of the H5O module */
|
||||
|
||||
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Dprivate.h" /* Datasets */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5Iprivate.h" /* IDs */
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
#include "H5Pprivate.h" /* Property lists */
|
||||
#include "H5Sprivate.h" /* Dataspaces */
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Dprivate.h" /* Datasets */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5Iprivate.h" /* IDs */
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
#include "H5Pprivate.h" /* Property lists */
|
||||
#include "H5Sprivate.h" /* Dataspaces */
|
||||
|
||||
|
||||
static void *H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_fill_old_encode(H5F_t *f, uint8_t *p, const void *_mesg);
|
||||
static size_t H5O_fill_old_size(const H5F_t *f, const void *_mesg);
|
||||
static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg);
|
||||
static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg);
|
||||
static void *H5O_fill_copy(const void *_mesg, void *_dest);
|
||||
static herr_t H5O_fill_reset(void *_mesg);
|
||||
static herr_t H5O_fill_free(void *_mesg);
|
||||
static herr_t H5O_fill_pre_copy_file(H5F_t *file_src, const void *mesg_src,
|
||||
hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
|
||||
static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
@ -105,52 +107,59 @@ static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *s
|
||||
|
||||
/* This message derives from H5O message class, for old fill value before version 1.5 */
|
||||
const H5O_msg_class_t H5O_MSG_FILL[1] = {{
|
||||
H5O_FILL_ID, /*message id number */
|
||||
"fill", /*message name for debugging */
|
||||
sizeof(H5O_fill_t), /*native message size */
|
||||
H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
|
||||
H5O_fill_shared_decode, /*decode message */
|
||||
H5O_fill_shared_encode, /*encode message */
|
||||
H5O_fill_copy, /*copy the native value */
|
||||
H5O_fill_shared_size, /*raw message size */
|
||||
H5O_fill_reset, /*free internal memory */
|
||||
H5O_fill_free, /* free method */
|
||||
H5O_fill_shared_delete, /* file delete method */
|
||||
H5O_fill_shared_link, /* link method */
|
||||
NULL, /* set share method */
|
||||
NULL, /*can share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
H5O_fill_shared_copy_file, /* copy native value to file */
|
||||
H5O_fill_shared_post_copy_file, /* post copy native value to file */
|
||||
NULL, /* get creation index */
|
||||
NULL, /* set creation index */
|
||||
H5O_fill_shared_debug /*debug the message */
|
||||
H5O_FILL_ID, /*message id number */
|
||||
"fill", /*message name for debugging */
|
||||
sizeof(H5O_fill_t), /*native message size */
|
||||
H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
|
||||
H5O_fill_shared_decode, /*decode message */
|
||||
H5O_fill_shared_encode, /*encode message */
|
||||
H5O_fill_copy, /*copy the native value */
|
||||
H5O_fill_shared_size, /*raw message size */
|
||||
H5O_fill_reset, /*free internal memory */
|
||||
H5O_fill_free, /* free method */
|
||||
H5O_fill_shared_delete, /* file delete method */
|
||||
H5O_fill_shared_link, /* link method */
|
||||
NULL, /* set share method */
|
||||
NULL, /*can share method */
|
||||
H5O_fill_pre_copy_file, /* pre copy native value to file */
|
||||
H5O_fill_shared_copy_file, /* copy native value to file */
|
||||
H5O_fill_shared_post_copy_file, /* post copy native value to file */
|
||||
NULL, /* get creation index */
|
||||
NULL, /* set creation index */
|
||||
H5O_fill_shared_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* This message derives from H5O message class, for new fill value after version 1.4 */
|
||||
const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
|
||||
H5O_FILL_NEW_ID, /*message id number */
|
||||
"fill_new", /*message name for debugging */
|
||||
sizeof(H5O_fill_t), /*native message size */
|
||||
H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
|
||||
H5O_fill_new_shared_decode, /*decode message */
|
||||
H5O_fill_new_shared_encode, /*encode message */
|
||||
H5O_fill_copy, /*copy the native value */
|
||||
H5O_fill_new_shared_size, /*raw message size */
|
||||
H5O_fill_reset, /*free internal memory */
|
||||
H5O_fill_free, /* free method */
|
||||
H5O_fill_new_shared_delete, /* file delete method */
|
||||
H5O_fill_new_shared_link, /* link method */
|
||||
NULL, /* set share method */
|
||||
NULL, /*can share method */
|
||||
NULL, /* pre copy native value to file */
|
||||
H5O_fill_new_shared_copy_file, /* copy native value to file */
|
||||
H5O_fill_new_shared_post_copy_file, /* post copy native value to file */
|
||||
NULL, /* get creation index */
|
||||
NULL, /* set creation index */
|
||||
H5O_fill_new_shared_debug /*debug the message */
|
||||
H5O_FILL_NEW_ID, /*message id number */
|
||||
"fill_new", /*message name for debugging */
|
||||
sizeof(H5O_fill_t), /*native message size */
|
||||
H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
|
||||
H5O_fill_new_shared_decode, /*decode message */
|
||||
H5O_fill_new_shared_encode, /*encode message */
|
||||
H5O_fill_copy, /*copy the native value */
|
||||
H5O_fill_new_shared_size, /*raw message size */
|
||||
H5O_fill_reset, /*free internal memory */
|
||||
H5O_fill_free, /* free method */
|
||||
H5O_fill_new_shared_delete, /* file delete method */
|
||||
H5O_fill_new_shared_link, /* link method */
|
||||
NULL, /* set share method */
|
||||
NULL, /*can share method */
|
||||
H5O_fill_pre_copy_file, /* pre copy native value to file */
|
||||
H5O_fill_new_shared_copy_file, /* copy native value to file */
|
||||
H5O_fill_new_shared_post_copy_file, /* post copy native value to file */
|
||||
NULL, /* get creation index */
|
||||
NULL, /* set creation index */
|
||||
H5O_fill_new_shared_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* Format version bounds for fill value */
|
||||
const unsigned H5O_fill_ver_bounds[] = {
|
||||
H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_FILL_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
/* Masks, shift values & flags for fill value message */
|
||||
#define H5O_FILL_MASK_ALLOC_TIME 0x03
|
||||
#define H5O_FILL_SHIFT_ALLOC_TIME 0
|
||||
@ -171,11 +180,11 @@ H5FL_BLK_EXTERN(type_conv);
|
||||
* Function: H5O_fill_new_decode
|
||||
*
|
||||
* Purpose: Decode a new fill value message. The new fill value
|
||||
* message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
* message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
*
|
||||
* Return: Success: Ptr to new message in native struct.
|
||||
* Failure: NULL
|
||||
* Return: Success: Ptr to new message in native struct.
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* Feb 26, 2002
|
||||
@ -184,7 +193,8 @@ H5FL_BLK_EXTERN(type_conv);
|
||||
*/
|
||||
static void *
|
||||
H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_fill_t *fill = NULL;
|
||||
void *ret_value = NULL; /* Return value */
|
||||
@ -195,7 +205,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t
|
||||
HDassert(p);
|
||||
|
||||
if(NULL == (fill = H5FL_CALLOC(H5O_fill_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
|
||||
|
||||
/* Version */
|
||||
fill->version = *p++;
|
||||
@ -276,7 +286,7 @@ done:
|
||||
if(!ret_value && fill) {
|
||||
if(fill->buf)
|
||||
H5MM_xfree(fill->buf);
|
||||
fill = H5FL_FREE(H5O_fill_t, fill);
|
||||
fill = H5FL_FREE(H5O_fill_t, fill);
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -298,7 +308,8 @@ done:
|
||||
*/
|
||||
static void *
|
||||
H5O_fill_old_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_fill_t *fill = NULL; /* Decoded fill value message */
|
||||
void *ret_value = NULL; /* Return value */
|
||||
@ -336,7 +347,7 @@ done:
|
||||
if(!ret_value && fill) {
|
||||
if(fill->buf)
|
||||
H5MM_xfree(fill->buf);
|
||||
fill = H5FL_FREE(H5O_fill_t, fill);
|
||||
fill = H5FL_FREE(H5O_fill_t, fill);
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -347,8 +358,8 @@ done:
|
||||
* Function: H5O_fill_new_encode
|
||||
*
|
||||
* Purpose: Encode a new fill value message. The new fill value
|
||||
* message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
* message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
@ -481,7 +492,7 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
|
||||
* whether fill value is defined.
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
* Failure: NULL
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* Feb 26, 2002
|
||||
@ -491,16 +502,16 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
|
||||
static void *
|
||||
H5O_fill_copy(const void *_src, void *_dst)
|
||||
{
|
||||
const H5O_fill_t *src = (const H5O_fill_t *)_src;
|
||||
H5O_fill_t *dst = (H5O_fill_t *)_dst;
|
||||
void *ret_value = NULL; /* Return value */
|
||||
const H5O_fill_t *src = (const H5O_fill_t *)_src;
|
||||
H5O_fill_t *dst = (H5O_fill_t *)_dst;
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
HDassert(src);
|
||||
|
||||
if(!dst && NULL == (dst = H5FL_MALLOC(H5O_fill_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
|
||||
|
||||
/* Shallow copy basic fields */
|
||||
*dst = *src;
|
||||
@ -516,9 +527,9 @@ H5O_fill_copy(const void *_src, void *_dst)
|
||||
/* Copy fill value and its size */
|
||||
if(src->buf) {
|
||||
H5_CHECK_OVERFLOW(src->size, ssize_t, size_t);
|
||||
if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
|
||||
HDmemcpy(dst->buf, src->buf, (size_t)src->size);
|
||||
if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
|
||||
HDmemcpy(dst->buf, src->buf, (size_t)src->size);
|
||||
|
||||
/* Check for needing to convert/copy fill value */
|
||||
if(src->type) {
|
||||
@ -579,9 +590,9 @@ done:
|
||||
if(!ret_value && dst) {
|
||||
if(dst->buf)
|
||||
H5MM_xfree(dst->buf);
|
||||
if(dst->type)
|
||||
if(dst->type)
|
||||
H5T_close(dst->type);
|
||||
if(!_dst)
|
||||
if(!_dst)
|
||||
dst = H5FL_FREE(H5O_fill_t, dst);
|
||||
} /* end if */
|
||||
|
||||
@ -593,13 +604,13 @@ done:
|
||||
* Function: H5O_fill_new_size
|
||||
*
|
||||
* Purpose: Returns the size of the raw message in bytes not counting the
|
||||
* message type or size fields, but only the data fields. This
|
||||
* function doesn't take into account alignment. The new fill
|
||||
* value message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
* message type or size fields, but only the data fields. This
|
||||
* function doesn't take into account alignment. The new fill
|
||||
* value message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
*
|
||||
* Return: Success: Message data size in bytes w/o alignment.
|
||||
* Failure: 0
|
||||
* Failure: 0
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* Feb 26, 2002
|
||||
@ -609,8 +620,8 @@ done:
|
||||
static size_t
|
||||
H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill)
|
||||
{
|
||||
const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
|
||||
size_t ret_value = 0; /* Return value */
|
||||
const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
|
||||
size_t ret_value = 0; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
@ -721,8 +732,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
|
||||
} /* end if */
|
||||
fill->size = 0;
|
||||
if(fill->type) {
|
||||
H5T_close(fill->type);
|
||||
fill->type = NULL;
|
||||
H5T_close(fill->type);
|
||||
fill->type = NULL;
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
@ -790,6 +801,42 @@ H5O_fill_free(void *fill)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O_fill_free() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_pre_copy_file
|
||||
*
|
||||
* Purpose: Perform any necessary actions before copying message between
|
||||
* files.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Vailin Choi; Dec 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_fill_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
|
||||
hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
|
||||
{
|
||||
const H5O_fill_t *fill_src = (const H5O_fill_t *)mesg_src; /* Source fill value */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
/* check args */
|
||||
HDassert(cpy_info);
|
||||
HDassert(cpy_info->file_dst);
|
||||
|
||||
/* Check to ensure that the version of the message to be copied does not exceed
|
||||
the message version allowed by the destination file's high bound */
|
||||
if(fill_src->version > H5O_fill_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "fill value message version out of bounds")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_fill_pre_copy_file() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_debug
|
||||
@ -883,11 +930,11 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
|
||||
"Size:", fill->size);
|
||||
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
|
||||
if(fill->type) {
|
||||
H5T_debug(fill->type, stream);
|
||||
fprintf(stream, "\n");
|
||||
H5T_debug(fill->type, stream);
|
||||
HDfprintf(stream, "\n");
|
||||
} /* end if */
|
||||
else
|
||||
fprintf(stream, "<dataset type>\n");
|
||||
HDfprintf(stream, "<dataset type>\n");
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O_fill_debug() */
|
||||
@ -897,9 +944,9 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
|
||||
* Function: H5O_fill_convert
|
||||
*
|
||||
* Purpose: Convert a fill value from whatever data type it currently has
|
||||
* to the specified dataset type. The `type' field of the fill
|
||||
* value struct will be set to NULL to indicate that it has the
|
||||
* same type as the dataset.
|
||||
* to the specified dataset type. The `type' field of the fill
|
||||
* value struct will be set to NULL to indicate that it has the
|
||||
* same type as the dataset.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
@ -925,21 +972,21 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed, hid_
|
||||
/* No-op cases */
|
||||
if(!fill->buf || !fill->type || 0 == H5T_cmp(fill->type, dset_type, FALSE)) {
|
||||
/* Don't need datatype for fill value */
|
||||
if(fill->type)
|
||||
if(fill->type)
|
||||
H5T_close(fill->type);
|
||||
fill->type = NULL;
|
||||
fill->type = NULL;
|
||||
|
||||
/* Note that the fill value info has changed */
|
||||
*fill_changed = TRUE;
|
||||
|
||||
HGOTO_DONE(SUCCEED);
|
||||
HGOTO_DONE(SUCCEED);
|
||||
} /* end if */
|
||||
|
||||
/*
|
||||
* Can we convert between source and destination data types?
|
||||
*/
|
||||
if(NULL == (tpath = H5T_path_find(fill->type, dset_type, NULL, NULL, dxpl_id, FALSE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
|
||||
|
||||
/* Don't bother doing anything if there will be no actual conversion */
|
||||
if(!H5T_path_noop(tpath)) {
|
||||
@ -997,28 +1044,39 @@ done:
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_set_latest_version
|
||||
* Function: H5O_fill_set_version
|
||||
*
|
||||
* Purpose: Set the encoding for a fill value to the latest version.
|
||||
* Purpose: Set the version to encode a fill value with.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, July 24, 2007
|
||||
* Programmer: Vailin Choi; December 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_fill_set_latest_version(H5O_fill_t *fill)
|
||||
H5O_fill_set_version(H5F_t *f, H5O_fill_t *fill)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
unsigned version; /* Message version */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(f);
|
||||
HDassert(fill);
|
||||
|
||||
/* Set encoding of fill value to latest version */
|
||||
fill->version = H5O_FILL_VERSION_LATEST;
|
||||
/* Upgrade to the version indicated by the file's low bound if higher */
|
||||
version = MAX(fill->version, H5O_fill_ver_bounds[H5F_LOW_BOUND(f)]);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O_fill_set_latest_version() */
|
||||
/* Version bounds check */
|
||||
if(version > H5O_fill_ver_bounds[H5F_HIGH_BOUND(f)])
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds")
|
||||
|
||||
/* Set the message version */
|
||||
fill->version = version;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_fill_set_version() */
|
||||
|
||||
|
@ -32,7 +32,8 @@
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_fsinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
static void *H5O_fsinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
|
||||
unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_fsinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_fsinfo_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_fsinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -86,7 +87,8 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_fsinfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_fsinfo_t *fsinfo = NULL; /* File space info message */
|
||||
H5F_mem_page_t ptype; /* Memory type for iteration */
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_ginfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_ginfo_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_ginfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -95,7 +95,8 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */
|
||||
unsigned char flags; /* Flags for encoding group info */
|
||||
|
62
src/H5Oint.c
62
src/H5Oint.c
@ -131,6 +131,13 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
|
||||
#endif /* H5O_ENABLE_BOGUS */
|
||||
};
|
||||
|
||||
/* Format version bounds for object header */
|
||||
const unsigned H5O_obj_ver_bounds[] = {
|
||||
H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
/* Declare a free list to manage the H5O_t struct */
|
||||
H5FL_DEFINE(H5O_t);
|
||||
|
||||
@ -201,6 +208,53 @@ H5O__init_package(void)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O__init_package() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_set_version
|
||||
*
|
||||
* Purpose: Sets the correct version to encode the object header.
|
||||
* Chooses the oldest version possible, unless the file's
|
||||
* low bound indicates otherwise.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Vailin Choi; December 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx)
|
||||
{
|
||||
uint8_t version; /* Message version */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* check arguments */
|
||||
HDassert(f);
|
||||
HDassert(oh);
|
||||
|
||||
/* Set the correct version to encode object header with */
|
||||
if(store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
|
||||
version = H5O_VERSION_LATEST;
|
||||
else
|
||||
version = H5O_VERSION_1;
|
||||
|
||||
/* Upgrade to the version indicated by the file's low bound if higher */
|
||||
version = MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]);
|
||||
|
||||
/* Version bounds check */
|
||||
if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)])
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "object header version out of bounds")
|
||||
|
||||
/* Set the message version */
|
||||
oh->version = version;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_set_version() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_create
|
||||
@ -263,10 +317,10 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
|
||||
|
||||
/* Initialize file-specific information for object header */
|
||||
store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
|
||||
if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_OBJ_HEADER) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
|
||||
oh->version = H5O_VERSION_LATEST;
|
||||
else
|
||||
oh->version = H5O_VERSION_1;
|
||||
|
||||
if(H5O_set_version(f, oh, oh_flags, store_msg_crt_idx) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set version of objecdt header")
|
||||
|
||||
oh->sizeof_size = H5F_SIZEOF_SIZE(f);
|
||||
oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
|
||||
oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE);
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_linfo_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -114,7 +114,8 @@ H5FL_DEFINE_STATIC(H5O_linfo_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_linfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_linfo_t *linfo = NULL; /* Link info */
|
||||
unsigned char index_flags; /* Flags for encoding link index info */
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_link_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -118,7 +118,8 @@ H5FL_DEFINE_STATIC(H5O_link_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_link_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_link_t *lnk = NULL; /* Pointer to link message */
|
||||
size_t len = 0; /* Length of a string in the message */
|
||||
|
@ -1811,7 +1811,7 @@ done:
|
||||
*/
|
||||
void *
|
||||
H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
|
||||
const unsigned char *buf)
|
||||
size_t buf_size, const unsigned char *buf)
|
||||
{
|
||||
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
|
||||
unsigned ioflags = 0; /* Flags for decode routine */
|
||||
@ -1826,7 +1826,7 @@ H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
|
||||
HDassert(type);
|
||||
|
||||
/* decode */
|
||||
if((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf)) == NULL)
|
||||
if((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf_size, buf)) == NULL)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message")
|
||||
|
||||
done:
|
||||
|
@ -28,12 +28,12 @@
|
||||
|
||||
|
||||
static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static size_t H5O_mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
|
||||
static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_mtime_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -119,7 +119,8 @@ H5FL_DEFINE(time_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_mtime_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
time_t *mesg;
|
||||
uint32_t tmp_time; /* Temporary copy of the time */
|
||||
@ -175,7 +176,8 @@ done:
|
||||
*/
|
||||
static void *
|
||||
H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
time_t *mesg, the_time;
|
||||
struct tm tm;
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_name_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_name_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_name_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -84,7 +84,8 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{
|
||||
*/
|
||||
static void *
|
||||
H5O_name_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_name_t *mesg;
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
19
src/H5Opkg.h
19
src/H5Opkg.h
@ -63,8 +63,8 @@
|
||||
)
|
||||
#define H5O_ALIGN_OH(O, X) \
|
||||
H5O_ALIGN_VERS((O)->version, X)
|
||||
#define H5O_ALIGN_F(F, X) \
|
||||
H5O_ALIGN_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
|
||||
#define H5O_ALIGN_F(F, X) \
|
||||
H5O_ALIGN_VERS(MAX(H5O_VERSION_1, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), X)
|
||||
|
||||
/* Size of checksum (on disk) */
|
||||
#define H5O_SIZEOF_CHKSUM 4
|
||||
@ -136,7 +136,7 @@
|
||||
#define H5O_SIZEOF_MSGHDR_OH(O) \
|
||||
H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)
|
||||
#define H5O_SIZEOF_MSGHDR_F(F, C) \
|
||||
H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C))
|
||||
H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C))
|
||||
|
||||
/*
|
||||
* Size of chunk "header" for each chunk
|
||||
@ -186,7 +186,7 @@
|
||||
\
|
||||
/* Decode the message */ \
|
||||
HDassert(msg_type->decode); \
|
||||
if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw))) \
|
||||
if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw_size, (MSG)->raw))) \
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \
|
||||
\
|
||||
/* Mark the message dirty if it was changed by decoding */ \
|
||||
@ -228,7 +228,7 @@ struct H5O_msg_class_t {
|
||||
const char *name; /*for debugging */
|
||||
size_t native_size; /*size of native message */
|
||||
unsigned share_flags; /* Message sharing settings */
|
||||
void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *);
|
||||
void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, size_t, const uint8_t *);
|
||||
herr_t (*encode)(H5F_t *, hbool_t, uint8_t *, const void *);
|
||||
void *(*copy)(const void *, void *); /*copy native value */
|
||||
size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */
|
||||
@ -556,7 +556,6 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1];
|
||||
/* Datatype Object. (H5O_TYPE_NAMED_DATATYPE - 2) */
|
||||
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
|
||||
|
||||
|
||||
/* Package-local function prototypes */
|
||||
H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
|
||||
H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
|
||||
@ -642,6 +641,14 @@ H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg
|
||||
H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
|
||||
hsize_t *nattrs);
|
||||
|
||||
/* Arrays of versions for:
|
||||
Object header, Attribute/Fill value/Filter pipeline messages */
|
||||
/* Layout/Datatype/Dataspace arrays of versions are in H5Dpkg.h, H5Tpkg.h and H5Spkg.h */
|
||||
H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS];
|
||||
H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS];
|
||||
H5_DLLVAR const unsigned H5O_fill_ver_bounds[H5F_LIBVER_NBOUNDS];
|
||||
H5_DLLVAR const unsigned H5O_pline_ver_bounds[H5F_LIBVER_NBOUNDS];
|
||||
|
||||
/* Testing functions */
|
||||
#ifdef H5O_TESTING
|
||||
H5_DLL htri_t H5O_is_attr_empty_test(hid_t oid);
|
||||
|
144
src/H5Opline.c
144
src/H5Opline.c
@ -34,7 +34,7 @@
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static herr_t H5O_pline_encode(H5F_t *f, uint8_t *p, const void *mesg);
|
||||
static void *H5O_pline_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static void *H5O_pline_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_pline_size(const H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_pline_reset(void *_mesg);
|
||||
@ -89,6 +89,12 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
|
||||
H5O_pline_shared_debug /* debug the message */
|
||||
}};
|
||||
|
||||
/* Format version bounds for filter pipleline */
|
||||
const unsigned H5O_pline_ver_bounds[] = {
|
||||
H5O_PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_PLINE_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
H5O_PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
/* Declare a free list to manage the H5O_pline_t struct */
|
||||
H5FL_DEFINE(H5O_pline_t);
|
||||
@ -109,12 +115,14 @@ H5FL_DEFINE(H5O_pline_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_pline_t *pline = NULL; /* Pipeline message */
|
||||
H5Z_filter_info_t *filter; /* Filter to decode */
|
||||
size_t name_length; /* Length of filter name */
|
||||
size_t i; /* Local index variable */
|
||||
const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
@ -124,17 +132,24 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
|
||||
|
||||
/* Allocate space for I/O pipeline message */
|
||||
if(NULL == (pline = H5FL_CALLOC(H5O_pline_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
/* Version */
|
||||
pline->version = *p++;
|
||||
if(pline->version < H5O_PLINE_VERSION_1 || pline->version > H5O_PLINE_VERSION_LATEST)
|
||||
HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "bad version number for filter pipeline message")
|
||||
HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "bad version number for filter pipeline message")
|
||||
|
||||
/* Number of filters */
|
||||
pline->nused = *p++;
|
||||
if(pline->nused > H5Z_MAX_NFILTERS)
|
||||
HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter pipeline message has too many filters")
|
||||
if(pline->nused > H5Z_MAX_NFILTERS) {
|
||||
|
||||
/* Reset the number of filters used to avoid array traversal in error
|
||||
* handling code.
|
||||
*/
|
||||
pline->nused = 0;
|
||||
|
||||
HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter pipeline message has too many filters")
|
||||
}
|
||||
|
||||
/* Reserved */
|
||||
if(pline->version == H5O_PLINE_VERSION_1)
|
||||
@ -143,12 +158,12 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
|
||||
/* Allocate array for filters */
|
||||
pline->nalloc = pline->nused;
|
||||
if(NULL == (pline->filter = (H5Z_filter_info_t *)H5MM_calloc(pline->nalloc * sizeof(pline->filter[0]))))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
/* Decode filters */
|
||||
for(i = 0, filter = &pline->filter[0]; i < pline->nused; i++, filter++) {
|
||||
/* Filter ID */
|
||||
UINT16DECODE(p, filter->id);
|
||||
UINT16DECODE(p, filter->id);
|
||||
|
||||
/* Length of filter name */
|
||||
if(pline->version > H5O_PLINE_VERSION_1 && filter->id < H5Z_FILTER_RESERVED)
|
||||
@ -160,18 +175,18 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
|
||||
} /* end if */
|
||||
|
||||
/* Filter flags */
|
||||
UINT16DECODE(p, filter->flags);
|
||||
UINT16DECODE(p, filter->flags);
|
||||
|
||||
/* Number of filter parameters ("client data elements") */
|
||||
UINT16DECODE(p, filter->cd_nelmts);
|
||||
UINT16DECODE(p, filter->cd_nelmts);
|
||||
|
||||
/* Filter name, if there is one */
|
||||
if(name_length) {
|
||||
if(name_length) {
|
||||
size_t actual_name_length; /* Actual length of name */
|
||||
|
||||
/* Determine actual name length (without padding, but with null terminator) */
|
||||
actual_name_length = HDstrlen((const char *)p) + 1;
|
||||
HDassert(actual_name_length <= name_length);
|
||||
actual_name_length = HDstrlen((const char *)p) + 1;
|
||||
HDassert(actual_name_length <= name_length);
|
||||
|
||||
/* Allocate space for the filter name, or use the internal buffer */
|
||||
if(actual_name_length > H5Z_COMMON_NAME_LEN) {
|
||||
@ -182,12 +197,12 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
|
||||
else
|
||||
filter->name = filter->_name;
|
||||
|
||||
HDstrncpy(filter->name, (const char *)p, actual_name_length);
|
||||
p += name_length;
|
||||
} /* end if */
|
||||
HDstrncpy(filter->name, (const char *)p, actual_name_length);
|
||||
p += name_length;
|
||||
} /* end if */
|
||||
|
||||
/* Filter parameters */
|
||||
if(filter->cd_nelmts) {
|
||||
if(filter->cd_nelmts) {
|
||||
size_t j; /* Local index variable */
|
||||
|
||||
/* Allocate space for the client data elements, or use the internal buffer */
|
||||
@ -199,15 +214,20 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
|
||||
else
|
||||
filter->cd_values = filter->_cd_values;
|
||||
|
||||
/*
|
||||
* Read the client data values and the padding
|
||||
*/
|
||||
for(j = 0; j < filter->cd_nelmts; j++)
|
||||
UINT32DECODE(p, filter->cd_values[j]);
|
||||
/*
|
||||
* Read the client data values and the padding
|
||||
*/
|
||||
for (j = 0; j < filter->cd_nelmts; j++) {
|
||||
if (p + 4 - 1 <= p_end)
|
||||
UINT32DECODE(p, filter->cd_values[j])
|
||||
else
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "ran off the end of the buffer: current p = %p, p_size = %zu, p_end = %p", p, p_size, p_end)
|
||||
}
|
||||
|
||||
if(pline->version == H5O_PLINE_VERSION_1)
|
||||
if(filter->cd_nelmts % 2)
|
||||
p += 4; /*padding*/
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
|
||||
/* Set return value */
|
||||
@ -496,23 +516,30 @@ H5O_pline_reset(void *mesg)
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
/* NOTE: This function can be called during error processing from
|
||||
* other API calls so DO NOT ASSUME THAT ANY VALUES ARE SANE.
|
||||
*/
|
||||
|
||||
HDassert(pline);
|
||||
|
||||
/* Free information for each filter */
|
||||
for(i = 0; i < pline->nused; i++) {
|
||||
if(pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name)
|
||||
HDassert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN);
|
||||
if(pline->filter[i].name != pline->filter[i]._name)
|
||||
pline->filter[i].name = (char *)H5MM_xfree(pline->filter[i].name);
|
||||
if(pline->filter[i].cd_values && pline->filter[i].cd_values != pline->filter[i]._cd_values)
|
||||
HDassert(pline->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES);
|
||||
if(pline->filter[i].cd_values != pline->filter[i]._cd_values)
|
||||
pline->filter[i].cd_values = (unsigned *)H5MM_xfree(pline->filter[i].cd_values);
|
||||
} /* end for */
|
||||
/* Free the filter information and array */
|
||||
if (pline->filter) {
|
||||
|
||||
/* Free filter array */
|
||||
if(pline->filter)
|
||||
/* Free information for each filter */
|
||||
for(i = 0; i < pline->nused; i++) {
|
||||
if(pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name)
|
||||
HDassert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN);
|
||||
if(pline->filter[i].name != pline->filter[i]._name)
|
||||
pline->filter[i].name = (char *)H5MM_xfree(pline->filter[i].name);
|
||||
if(pline->filter[i].cd_values && pline->filter[i].cd_values != pline->filter[i]._cd_values)
|
||||
HDassert(pline->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES);
|
||||
if(pline->filter[i].cd_values != pline->filter[i]._cd_values)
|
||||
pline->filter[i].cd_values = (unsigned *)H5MM_xfree(pline->filter[i].cd_values);
|
||||
} /* end for */
|
||||
|
||||
/* Free filter array */
|
||||
pline->filter = (H5Z_filter_info_t *)H5MM_xfree(pline->filter);
|
||||
}
|
||||
|
||||
/* Reset # of filters */
|
||||
pline->nused = pline->nalloc = 0;
|
||||
@ -566,16 +593,23 @@ H5O_pline_free(void *mesg)
|
||||
*/
|
||||
static herr_t
|
||||
H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
|
||||
hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void *_udata)
|
||||
hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata)
|
||||
{
|
||||
const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source datatype */
|
||||
const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source pline */
|
||||
H5O_copy_file_ud_common_t *udata = (H5O_copy_file_ud_common_t *)_udata; /* Object copying user data */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
|
||||
/* check args */
|
||||
HDassert(pline_src);
|
||||
HDassert(cpy_info);
|
||||
HDassert(cpy_info->file_dst);
|
||||
|
||||
/* Check to ensure that the version of the message to be copied does not exceed
|
||||
the message version allowed by the destination file's high bound */
|
||||
if(pline_src->version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "pline message version out of bounds")
|
||||
|
||||
/* If the user data is non-NULL, assume we are copying a dataset or group
|
||||
* and make a copy of the filter pipeline for later in
|
||||
@ -664,28 +698,38 @@ H5O_pline_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const voi
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_pline_set_latest_version
|
||||
* Function: H5O_pline_set_version
|
||||
*
|
||||
* Purpose: Set the encoding for a I/O filter pipeline to the latest version.
|
||||
* Purpose: Set the version to encode an I/O filter pipeline with.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, July 24, 2007
|
||||
* Programmer: Vailin Choi; December 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_pline_set_latest_version(H5O_pline_t *pline)
|
||||
H5O_pline_set_version(H5F_t *f, H5O_pline_t *pline)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
unsigned version; /* Message version */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(f);
|
||||
HDassert(pline);
|
||||
|
||||
/* Set encoding of I/O pipeline to latest version */
|
||||
pline->version = H5O_PLINE_VERSION_LATEST;
|
||||
/* Upgrade to the version indicated by the file's low bound if higher */
|
||||
version = MAX(pline->version, H5O_pline_ver_bounds[H5F_LOW_BOUND(f)]);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O_pline_set_latest_version() */
|
||||
/* Version bounds check */
|
||||
if(version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(f)])
|
||||
HGOTO_ERROR(H5E_PLINE, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds")
|
||||
|
||||
/* Set the message version */
|
||||
pline->version = version;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_pline_set_version() */
|
||||
|
@ -177,7 +177,12 @@ typedef struct H5O_copy_t {
|
||||
H5SL_t *dst_dt_list; /* Skip list to hold committed datatypes in dest file */
|
||||
hbool_t dst_dt_list_complete; /* Whether the destination datatype list is complete (i.e. not only populated with "suggestions" from H5Padd_merge_committed_dtype_path) */
|
||||
H5O_t *oh_dst; /* The destination object header */
|
||||
void *shared_fo; /* The shared pointer for the object */
|
||||
H5F_t *file_dst; /* The destination file pointer */
|
||||
/* This is used in the pre_copy_file callback to obtain
|
||||
the destination file's high bound. The high bound
|
||||
is used to index into the corresponding message's
|
||||
array of versions for doing version bounds check. */
|
||||
void *shared_fo; /* The shared pointer for the src object */
|
||||
H5O_mcdt_search_cb_t mcdt_cb; /* The callback to invoke before searching the global list of committed datatypes at destination */
|
||||
void *mcdt_ud; /* User data passed to callback */
|
||||
} H5O_copy_t;
|
||||
@ -930,7 +935,7 @@ H5_DLL herr_t H5O_msg_get_crt_index(unsigned type_id, const void *mesg,
|
||||
H5_DLL herr_t H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared,
|
||||
unsigned char *buf, const void *obj);
|
||||
H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned type_id, const unsigned char *buf);
|
||||
unsigned type_id, size_t buf_size, const unsigned char *buf);
|
||||
H5_DLL herr_t H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned type_id, void *mesg);
|
||||
H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id, uint8_t *flags);
|
||||
@ -967,14 +972,14 @@ H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl);
|
||||
/* Fill value operators */
|
||||
H5_DLL herr_t H5O_fill_reset_dyn(H5O_fill_t *fill);
|
||||
H5_DLL herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *type, hbool_t *fill_changed, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5O_fill_set_latest_version(H5O_fill_t *fill);
|
||||
H5_DLL herr_t H5O_fill_set_version(H5F_t * f, H5O_fill_t *fill);
|
||||
|
||||
/* Link operators */
|
||||
H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
void *_mesg);
|
||||
|
||||
/* Filter pipeline operators */
|
||||
H5_DLL herr_t H5O_pline_set_latest_version(H5O_pline_t *pline);
|
||||
H5_DLL herr_t H5O_pline_set_version(H5F_t *f, H5O_pline_t *pline);
|
||||
|
||||
/* Shared message operators */
|
||||
H5_DLL herr_t H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src);
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_refcount_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_refcount_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_refcount_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_refcount_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -90,7 +90,8 @@ H5FL_DEFINE_STATIC(H5O_refcount_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_refcount_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_refcount_t *refcount = NULL; /* Reference count */
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_sdspace_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg);
|
||||
@ -110,7 +110,8 @@ H5FL_ARR_EXTERN(hsize_t);
|
||||
--------------------------------------------------------------------------*/
|
||||
static void *
|
||||
H5O_sdspace_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5S_extent_t *sdim = NULL;/* New extent dimensionality structure */
|
||||
unsigned flags, version;
|
||||
@ -441,7 +442,7 @@ H5O_sdspace_free(void *mesg)
|
||||
*/
|
||||
static herr_t
|
||||
H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
|
||||
hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void *_udata)
|
||||
hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata)
|
||||
{
|
||||
const H5S_extent_t *src_space_extent = (const H5S_extent_t *)mesg_src; /* Source dataspace extent */
|
||||
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
|
||||
@ -452,6 +453,13 @@ H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
|
||||
/* check args */
|
||||
HDassert(file_src);
|
||||
HDassert(src_space_extent);
|
||||
HDassert(cpy_info);
|
||||
HDassert(cpy_info->file_dst);
|
||||
|
||||
/* Check to ensure that the version of the message to be copied does not exceed
|
||||
the message version allowed by the destination file's high bound */
|
||||
if(src_space_extent->version > H5O_sdspace_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "dataspace message version out of bounds")
|
||||
|
||||
/* If the user data is non-NULL, assume we are copying a dataset
|
||||
* and make a copy of the dataspace extent for later in the object copying
|
||||
|
@ -156,7 +156,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "can't read message from fractal heap.")
|
||||
|
||||
/* Decode the message */
|
||||
if(NULL == (ret_value = (type->decode)(f, dxpl_id, open_oh, 0, ioflags, mesg_ptr)))
|
||||
if(NULL == (ret_value = (type->decode)(f, dxpl_id, open_oh, 0, ioflags, mesg_size, mesg_ptr)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message.")
|
||||
} /* end if */
|
||||
else {
|
||||
|
@ -47,7 +47,7 @@
|
||||
*/
|
||||
static H5_INLINE void *
|
||||
H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
|
||||
unsigned *ioflags, const uint8_t *p)
|
||||
unsigned *ioflags, size_t p_size, const uint8_t *p)
|
||||
{
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
||||
@ -67,7 +67,7 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
|
||||
if(mesg_flags & H5O_MSG_FLAG_SHARED) {
|
||||
/* Retrieve native message info indirectly through shared message */
|
||||
if(NULL == (ret_value = H5O_shared_decode(f, dxpl_id, open_oh, ioflags, p, H5O_SHARED_TYPE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
|
||||
|
||||
/* We currently do not support automatically fixing shared messages */
|
||||
#ifdef H5_STRICT_FORMAT_CHECKS
|
||||
@ -79,8 +79,8 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
|
||||
} /* end if */
|
||||
else {
|
||||
/* Decode native message directly */
|
||||
if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, open_oh, mesg_flags, ioflags, p)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message")
|
||||
if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, open_oh, mesg_flags, ioflags, p_size, p)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message")
|
||||
} /* end else */
|
||||
|
||||
done:
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
|
||||
static void *H5O_shmesg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_shmesg_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_shmesg_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -76,7 +76,8 @@ const H5O_msg_class_t H5O_MSG_SHMESG[1] = {{
|
||||
*/
|
||||
static void *
|
||||
H5O_shmesg_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_shmesg_table_t *mesg; /* Native message */
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
|
||||
unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
|
||||
static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_stab_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
||||
@ -97,7 +97,8 @@ H5FL_DEFINE_STATIC(H5O_stab_t);
|
||||
*/
|
||||
static void *
|
||||
H5O_stab_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
|
||||
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
|
||||
size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
|
||||
{
|
||||
H5O_stab_t *stab = NULL;
|
||||
void *ret_value = NULL; /* Return value */
|
||||
|
@ -1116,7 +1116,7 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value)
|
||||
dt_size = (size_t)enc_value;
|
||||
|
||||
/* Decode type */
|
||||
if(NULL == (fill->type = H5T_decode(*pp)))
|
||||
if(NULL == (fill->type = H5T_decode(dt_size, *pp)))
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode fill value datatype")
|
||||
*pp += dt_size;
|
||||
} /* end if */
|
||||
|
355
src/H5Pfapl.c
355
src/H5Pfapl.c
@ -140,11 +140,19 @@
|
||||
#define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT
|
||||
#define H5F_ACS_MULTI_TYPE_ENC H5P__facc_multi_type_enc
|
||||
#define H5F_ACS_MULTI_TYPE_DEC H5P__facc_multi_type_dec
|
||||
/* Definition for 'use latest format version' flag */
|
||||
#define H5F_ACS_LATEST_FORMAT_SIZE sizeof(hbool_t)
|
||||
#define H5F_ACS_LATEST_FORMAT_DEF FALSE
|
||||
#define H5F_ACS_LATEST_FORMAT_ENC H5P__encode_hbool_t
|
||||
#define H5F_ACS_LATEST_FORMAT_DEC H5P__decode_hbool_t
|
||||
|
||||
/* Definition for "low" bound of library format versions */
|
||||
#define H5F_ACS_LIBVER_LOW_BOUND_SIZE sizeof(H5F_libver_t)
|
||||
#define H5F_ACS_LIBVER_LOW_BOUND_DEF H5F_LIBVER_EARLIEST
|
||||
#define H5F_ACS_LIBVER_LOW_BOUND_ENC H5P__facc_libver_type_enc
|
||||
#define H5F_ACS_LIBVER_LOW_BOUND_DEC H5P__facc_libver_type_dec
|
||||
|
||||
/* Definition for "high" bound of library format versions */
|
||||
#define H5F_ACS_LIBVER_HIGH_BOUND_SIZE sizeof(H5F_libver_t)
|
||||
#define H5F_ACS_LIBVER_HIGH_BOUND_DEF H5F_LIBVER_LATEST
|
||||
#define H5F_ACS_LIBVER_HIGH_BOUND_ENC H5P__facc_libver_type_enc
|
||||
#define H5F_ACS_LIBVER_HIGH_BOUND_DEC H5P__facc_libver_type_dec
|
||||
|
||||
/* Definition for whether to query the file descriptor from the core VFD
|
||||
* instead of the memory address. (Private to library)
|
||||
*/
|
||||
@ -288,6 +296,8 @@ static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t
|
||||
static herr_t H5P__facc_fclose_degree_dec(const void **pp, void *value);
|
||||
static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void *udata);
|
||||
static herr_t H5P__facc_multi_type_dec(const void **_pp, void *value);
|
||||
static herr_t H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size);
|
||||
static herr_t H5P__facc_libver_type_dec(const void **_pp, void *value);
|
||||
|
||||
/* Metadata cache log location property callbacks */
|
||||
static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void *udata);
|
||||
@ -352,7 +362,10 @@ static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF;
|
||||
static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */
|
||||
static const hbool_t H5F_def_family_to_sec2_g = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */
|
||||
static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */
|
||||
static const hbool_t H5F_def_latest_format_g = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */
|
||||
|
||||
static const H5F_libver_t H5F_def_libver_low_bound_g = H5F_ACS_LIBVER_LOW_BOUND_DEF; /* Default setting for "low" bound of format version */
|
||||
static const H5F_libver_t H5F_def_libver_high_bound_g = H5F_ACS_LIBVER_HIGH_BOUND_DEF; /* Default setting for "high" bound of format version */
|
||||
|
||||
static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */
|
||||
static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */
|
||||
static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */
|
||||
@ -374,7 +387,7 @@ static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF;
|
||||
static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */
|
||||
static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer minumum raw data size */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_reg_prop
|
||||
*
|
||||
@ -491,9 +504,15 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
|
||||
NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
/* Register the 'use the latest version of the format' flag */
|
||||
if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g,
|
||||
NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC,
|
||||
/* Register the 'low' bound of library format versions */
|
||||
if(H5P_register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g,
|
||||
NULL, NULL, NULL, H5F_ACS_LIBVER_LOW_BOUND_ENC, H5F_ACS_LIBVER_LOW_BOUND_DEC,
|
||||
NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
/* Register the 'high' bound of library format versions */
|
||||
if(H5P_register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g,
|
||||
NULL, NULL, NULL, H5F_ACS_LIBVER_HIGH_BOUND_ENC, H5F_ACS_LIBVER_HIGH_BOUND_DEC,
|
||||
NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
@ -608,7 +627,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_reg_prop() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_alignment
|
||||
*
|
||||
@ -666,7 +685,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_alignment
|
||||
*
|
||||
@ -707,7 +726,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_alignment() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_set_driver
|
||||
*
|
||||
@ -755,7 +774,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P_set_driver() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_driver
|
||||
*
|
||||
@ -798,7 +817,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_driver() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_peek_driver
|
||||
*
|
||||
@ -842,7 +861,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P_peek_driver() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_driver
|
||||
*
|
||||
@ -883,7 +902,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_driver() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_peek_driver_info
|
||||
*
|
||||
@ -925,7 +944,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P_peek_driver_info() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_driver_info
|
||||
*
|
||||
@ -965,7 +984,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_driver_info() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__file_driver_copy
|
||||
*
|
||||
@ -1031,7 +1050,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__file_driver_copy() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__file_driver_free
|
||||
*
|
||||
@ -1083,7 +1102,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__file_driver_free() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_driver_create
|
||||
*
|
||||
@ -1112,7 +1131,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_driver_create() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_driver_set
|
||||
*
|
||||
@ -1145,7 +1164,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_driver_set() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_driver_get
|
||||
*
|
||||
@ -1178,7 +1197,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_driver_get() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_driver_del
|
||||
*
|
||||
@ -1207,7 +1226,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_driver_del() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_driver_copy
|
||||
*
|
||||
@ -1236,7 +1255,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_driver_copy() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_driver_cmp
|
||||
*
|
||||
@ -1295,7 +1314,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_driver_cmp() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_driver_close
|
||||
*
|
||||
@ -1324,7 +1343,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_driver_close() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_family_offset
|
||||
*
|
||||
@ -1363,7 +1382,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_family_offset() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_family_offset
|
||||
*
|
||||
@ -1404,7 +1423,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_family_offset() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_multi_type
|
||||
*
|
||||
@ -1443,7 +1462,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_multi_type() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_multi_type
|
||||
*
|
||||
@ -1484,7 +1503,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_multi_type() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_cache
|
||||
*
|
||||
@ -1538,7 +1557,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_cache() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_cache
|
||||
*
|
||||
@ -1590,7 +1609,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_cache() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_mdc_image_config
|
||||
*
|
||||
@ -1634,7 +1653,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Pset_mdc_image_config() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_mdc_image_config
|
||||
*
|
||||
@ -1685,7 +1704,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Pget_mdc_image_config() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_mdc_config
|
||||
*
|
||||
@ -1729,7 +1748,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Pset_mdc_config() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_mdc_config
|
||||
*
|
||||
@ -1780,7 +1799,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Pget_mdc_config() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_gc_references
|
||||
*
|
||||
@ -1833,7 +1852,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_gc_references
|
||||
*
|
||||
@ -1876,7 +1895,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fclose_degree
|
||||
*
|
||||
@ -1912,7 +1931,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_fclose_degree() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_fclose_degree
|
||||
*
|
||||
@ -1947,7 +1966,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_fclose_degree() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_meta_block_size
|
||||
*
|
||||
@ -1998,7 +2017,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_meta_block_size
|
||||
*
|
||||
@ -2042,7 +2061,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_sieve_buf_size
|
||||
*
|
||||
@ -2093,7 +2112,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_sieve_buf_size() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_sieve_buf_size
|
||||
*
|
||||
@ -2136,7 +2155,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_sieve_buf_size() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_small_data_block_size
|
||||
*
|
||||
@ -2182,7 +2201,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_small_data_block_size() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_small_data_block_size
|
||||
*
|
||||
@ -2221,7 +2240,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_small_data_block_size() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_libver_bounds
|
||||
*
|
||||
@ -2301,6 +2320,24 @@ done:
|
||||
* releases and then map down to the previous actual library release which
|
||||
* had a format change.
|
||||
*
|
||||
* Note #3: The enumerated define for H5F_libver_t in 1.10 is:
|
||||
* typedef enum H5F_libver_t {
|
||||
* H5F_LIBVER_ERROR = -1,
|
||||
* H5F_LIBVER_EARLIEST = 0,
|
||||
* H5F_LIBVER_V18 = 1,
|
||||
* H5F_LIBVER_V110 = 2,
|
||||
* H5F_LIBVER_NBOUNDS
|
||||
* } H5F_libver_t;
|
||||
* #define H5F_LIBVER_LATEST H5F_LIBVER_V110
|
||||
*
|
||||
* The library supports five pairs of (low, high) combinations via H5Pset_libver_bounds():
|
||||
* 1) H5F_LIBVER_EARLIEST, H5F_LIBVER_V18
|
||||
* 2) H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST
|
||||
* 4) H5F_LIBVER_V18, H5F_LIBVER_V18
|
||||
* 4) H5F_LIBVER_V18, H5F_LIBVER_LATEST
|
||||
* 5) H5F_LIBVER_LATEST, H5F_LIBVER_LATEST
|
||||
* See detailed description in the RFC: Setting Bounds for Object Creation in HDF5 1.10.0.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
@ -2309,42 +2346,48 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low,
|
||||
H5F_libver_t high)
|
||||
H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high)
|
||||
{
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
hbool_t latest; /* Whether to use the latest version or not */
|
||||
herr_t ret_value = SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
H5TRACE3("e", "iFvFv", plist_id, low, high);
|
||||
|
||||
/* Check args */
|
||||
/* (Note that this is _really_ restricted right now, we'll want to loosen
|
||||
* this up more as we add features - QAK)
|
||||
*/
|
||||
if(high != H5F_LIBVER_LATEST)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid high library version bound")
|
||||
if(low < 0 || low > H5F_LIBVER_LATEST)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "low bound is not valid")
|
||||
|
||||
if(high < 0 || high > H5F_LIBVER_LATEST)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "high bound is not valid")
|
||||
|
||||
/* (earliest, earliest), (latest, earliest), (v18, earliest) are not valid combinations */
|
||||
if(high == H5F_LIBVER_EARLIEST)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound")
|
||||
|
||||
/* (latest, v18) is not valid combination */
|
||||
if(high < low)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound")
|
||||
|
||||
/* Get the plist structure */
|
||||
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
|
||||
|
||||
/* Set values */
|
||||
latest = (hbool_t)((low == H5F_LIBVER_LATEST) ? TRUE : FALSE);
|
||||
if(H5P_set(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set library version bounds")
|
||||
|
||||
if(H5P_set(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set low bound for library format versions")
|
||||
if(H5P_set(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set high bound for library format versions")
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_libver_bounds() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_libver_bounds
|
||||
*
|
||||
* Purpose: Returns the current settings for the library version format bounds
|
||||
* from a file access property list.
|
||||
* from a file access property list.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
@ -2358,7 +2401,6 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low/*out*/,
|
||||
H5F_libver_t *high/*out*/)
|
||||
{
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
hbool_t latest; /* Whether to use the latest version or not */
|
||||
herr_t ret_value = SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
@ -2368,22 +2410,22 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low/*out*/,
|
||||
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
|
||||
|
||||
/* Get value */
|
||||
if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get library version bounds")
|
||||
/* Get values */
|
||||
if(low) {
|
||||
if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, low) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get low bound for library format versions")
|
||||
}
|
||||
|
||||
/* Check for setting values to return */
|
||||
/* (Again, this is restricted now, we'll need to open it up later -QAK) */
|
||||
if(low)
|
||||
*low = latest ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST;
|
||||
if(high)
|
||||
*high = H5F_LIBVER_LATEST;
|
||||
if(high) {
|
||||
if(H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get high bound for library format versions")
|
||||
}
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_libver_bounds() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_elink_file_cache_size
|
||||
*
|
||||
@ -2421,7 +2463,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_elink_file_cache_size() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_elink_file_cache_size
|
||||
*
|
||||
@ -2460,7 +2502,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_elink_file_cache_size() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_file_image
|
||||
*
|
||||
@ -2541,7 +2583,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_file_image() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_file_image
|
||||
*
|
||||
@ -2630,7 +2672,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_file_image */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_file_image_callbacks
|
||||
*
|
||||
@ -2707,7 +2749,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_file_image_callbacks() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_file_image_callbacks
|
||||
*
|
||||
@ -2763,7 +2805,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_file_image_callbacks() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__file_image_info_copy
|
||||
*
|
||||
@ -2841,7 +2883,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__file_image_info_copy() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__file_image_info_free
|
||||
*
|
||||
@ -2896,7 +2938,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__file_image_info_free() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_cache_image_config_cmp
|
||||
*
|
||||
@ -2939,7 +2981,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_cache_image_config_cmp() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_cache_image_config_enc
|
||||
*
|
||||
@ -2985,7 +3027,7 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size, vo
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__facc_cache_image_config_enc() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_cache_image_config_dec
|
||||
*
|
||||
@ -3037,7 +3079,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_cache_image_config_dec() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_image_info_set
|
||||
*
|
||||
@ -3070,7 +3112,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_image_info_set() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_image_info_get
|
||||
*
|
||||
@ -3103,7 +3145,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_image_info_get() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_image_info_del
|
||||
*
|
||||
@ -3134,7 +3176,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_image_info_del() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_image_info_copy
|
||||
*
|
||||
@ -3164,7 +3206,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_image_info_copy() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_image_info_cmp
|
||||
*
|
||||
@ -3223,7 +3265,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_image_info_cmp() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_file_image_info_close
|
||||
*
|
||||
@ -3253,7 +3295,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_file_image_info_close() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_cache_config_cmp
|
||||
*
|
||||
@ -3365,7 +3407,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_cache_config_cmp() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_cache_config_enc
|
||||
*
|
||||
@ -3510,7 +3552,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size, void H5_
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__facc_cache_config_enc() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_cache_config_dec
|
||||
*
|
||||
@ -3645,7 +3687,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__facc_cache_config_dec() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_fclose_degree_enc
|
||||
*
|
||||
@ -3683,7 +3725,7 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size, void H5
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__facc_fclose_degree_enc() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_fclose_degree_dec
|
||||
*
|
||||
@ -3718,7 +3760,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__facc_fclose_degree_dec() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_multi_type_enc
|
||||
*
|
||||
@ -3756,7 +3798,7 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void H5_AT
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__facc_multi_type_enc() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_multi_type_dec
|
||||
*
|
||||
@ -3791,7 +3833,78 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__facc_multi_type_dec() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_libver_type_enc
|
||||
*
|
||||
* Purpose: Callback routine which is called whenever the 'low' or
|
||||
* 'high' bound of library format versions property in the
|
||||
* file access property list is encoded.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size)
|
||||
{
|
||||
const H5F_libver_t *type = (const H5F_libver_t *)value; /* Create local alias for values */
|
||||
uint8_t **pp = (uint8_t **)_pp;
|
||||
|
||||
FUNC_ENTER_STATIC_NOERR
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(type);
|
||||
HDassert(size);
|
||||
|
||||
/* Encode */
|
||||
if(NULL != *pp)
|
||||
*(*pp)++ = (uint8_t)*type;
|
||||
|
||||
/* Size */
|
||||
(*size)++;
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__facc_libver_type_enc() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__facc_libver_type_dec
|
||||
*
|
||||
* Purpose: Callback routine which is called whenever the 'low' or
|
||||
* 'high' bound of library format versions property in the
|
||||
* file access property list is decoded.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5P__facc_libver_type_dec(const void **_pp, void *_value)
|
||||
{
|
||||
H5F_libver_t *type = (H5F_libver_t *)_value;
|
||||
const uint8_t **pp = (const uint8_t **)_pp;
|
||||
|
||||
FUNC_ENTER_STATIC_NOERR
|
||||
|
||||
/* Sanity checks */
|
||||
HDassert(pp);
|
||||
HDassert(*pp);
|
||||
HDassert(type);
|
||||
|
||||
/* Decode */
|
||||
*type = (H5F_libver_t)*(*pp)++;
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__facc_libver_type_dec() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_core_write_tracking
|
||||
*
|
||||
@ -3832,7 +3945,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_core_write_tracking() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_core_write_tracking
|
||||
*
|
||||
@ -3874,7 +3987,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_core_write_tracking() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_metadata_read_attempts
|
||||
*
|
||||
@ -3917,7 +4030,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Pset_metadata_read_attempts() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_metadata_read_attempts
|
||||
*
|
||||
@ -3958,7 +4071,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_metadata_read_attempts() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_obj_flush_cb
|
||||
*
|
||||
@ -4002,7 +4115,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Pset_obj_flush_cb() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_obj_flush_cb
|
||||
*
|
||||
@ -4043,7 +4156,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Pget_obj_flush_cb() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_mdc_log_options
|
||||
*
|
||||
@ -4095,7 +4208,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_mdc_log_options() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_mdc_log_options
|
||||
*
|
||||
@ -4150,7 +4263,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pget_mdc_log_options() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_facc_mdc_log_location_enc
|
||||
*
|
||||
@ -4203,7 +4316,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P_facc_mdc_log_location_enc() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_facc_mdc_log_location_dec
|
||||
*
|
||||
@ -4257,7 +4370,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P_facc_mdc_log_location_dec() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_facc_mdc_log_location_del
|
||||
*
|
||||
@ -4280,7 +4393,7 @@ H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P_facc_mdc_log_location_del() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_facc_mdc_log_location_copy
|
||||
*
|
||||
@ -4302,7 +4415,7 @@ H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P_facc_mdc_log_location_copy() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_facc_mdc_log_location_cmp
|
||||
*
|
||||
@ -4334,7 +4447,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P_facc_mdc_log_location_cmp() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_facc_mdc_log_location_close
|
||||
*
|
||||
@ -4357,7 +4470,7 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P_facc_mdc_log_location_close() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_evict_on_close
|
||||
*
|
||||
@ -4398,14 +4511,14 @@ H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close)
|
||||
if(H5P_set(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set evict on close property")
|
||||
#else
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "evict on close is currently not supported in parallel HDF5")
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "evict on close is currently not supported in parallel HDF5")
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_evict_on_close() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_evict_on_close
|
||||
*
|
||||
@ -4449,7 +4562,7 @@ done:
|
||||
} /* end H5Pget_evict_on_close() */
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__encode_coll_md_read_flag_t
|
||||
*
|
||||
@ -4487,7 +4600,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size, voi
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__encode_coll_md_read_flag_t() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__decode_coll_md_read_flag_t
|
||||
*
|
||||
@ -4521,7 +4634,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__decode_coll_md_read_flag_t() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_all_coll_metadata_ops
|
||||
*
|
||||
@ -4580,7 +4693,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_all_coll_metadata_ops() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_all_coll_metadata_ops
|
||||
*
|
||||
@ -4638,7 +4751,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Pget_all_coll_metadata_ops */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_coll_metadata_write
|
||||
*
|
||||
@ -4677,7 +4790,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_coll_metadata_write() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_coll_metadata_write
|
||||
*
|
||||
@ -4715,7 +4828,7 @@ done:
|
||||
} /* end H5Pget_coll_metadata_write() */
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_page_buffer_size
|
||||
*
|
||||
@ -4763,7 +4876,7 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Pset_page_buffer_size() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_page_buffer_size
|
||||
*
|
||||
|
45
src/H5S.c
45
src/H5S.c
@ -57,6 +57,12 @@ static htri_t H5S_is_simple(const H5S_t *sdim);
|
||||
/* Package initialization variable */
|
||||
hbool_t H5_PKG_INIT_VAR = FALSE;
|
||||
|
||||
/* Format version bounds for dataspace */
|
||||
const unsigned H5O_sdspace_ver_bounds[] = {
|
||||
H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
@ -84,6 +90,7 @@ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
|
||||
(H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
|
||||
}};
|
||||
|
||||
|
||||
/* Flag indicating "top" of interface has been initialized */
|
||||
static hbool_t H5S_top_package_initialize_s = FALSE;
|
||||
|
||||
@ -1723,8 +1730,8 @@ H5S_decode(const unsigned char **p)
|
||||
|
||||
/* Decode the extent part of dataspace */
|
||||
/* (pass mostly bogus file pointer and bogus DXPL) */
|
||||
if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, pp))==NULL)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
|
||||
if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, extent_size, pp)) == NULL)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
|
||||
pp += extent_size;
|
||||
|
||||
/* Copy the extent into dataspace structure */
|
||||
@ -2167,30 +2174,42 @@ H5S_extent_nelem(const H5S_extent_t *ext)
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5S_set_latest_version
|
||||
* Function: H5S_set_version
|
||||
*
|
||||
* Purpose: Set the encoding for a dataspace to the latest version.
|
||||
* Purpose: Set the version to encode a dataspace with.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, July 24, 2007
|
||||
* Programmer: Vailin Choi; December 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5S_set_latest_version(H5S_t *ds)
|
||||
H5S_set_version(H5F_t *f, H5S_t *ds)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
unsigned version; /* Message version */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(f);
|
||||
HDassert(ds);
|
||||
|
||||
/* Set encoding of extent to latest version */
|
||||
ds->extent.version = H5O_SDSPACE_VERSION_LATEST;
|
||||
/* Upgrade to the version indicated by the file's low bound if higher */
|
||||
version = MAX(ds->extent.version, H5O_sdspace_ver_bounds[H5F_LOW_BOUND(f)]);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5S_set_latest_version() */
|
||||
/* Version bounds check */
|
||||
if(version > H5O_sdspace_ver_bounds[H5F_HIGH_BOUND(f)])
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "Dataspace version out of bounds")
|
||||
|
||||
/* Set the message version */
|
||||
ds->extent.version = version;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
||||
} /* end H5S_set_version() */
|
||||
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
|
||||
|
16
src/H5SM.c
16
src/H5SM.c
@ -70,7 +70,7 @@ static herr_t H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
static herr_t H5SM_decr_ref(void *record, void *op_data, hbool_t *changed);
|
||||
static herr_t H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
H5SM_index_header_t *header, const H5O_shared_t * mesg,
|
||||
unsigned *cache_flags, void ** /*out*/ encoded_mesg);
|
||||
unsigned *cache_flags, size_t * /*out*/ mesg_size, void ** /*out*/ encoded_mesg);
|
||||
static herr_t H5SM_type_to_flag(unsigned type_id, unsigned *type_flag);
|
||||
static herr_t H5SM_read_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence,
|
||||
unsigned *oh_modified, void *_udata);
|
||||
@ -1549,6 +1549,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
|
||||
unsigned cache_flags = H5AC__NO_FLAGS_SET;
|
||||
H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
|
||||
ssize_t index_num;
|
||||
size_t mesg_size = 0;
|
||||
void *mesg_buf = NULL;
|
||||
void *native_mesg = NULL;
|
||||
unsigned type_id; /* Message type ID to operate on */
|
||||
@ -1578,8 +1579,8 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
|
||||
* zero and any file space it uses needs to be freed. mesg_buf holds the
|
||||
* serialized form of the message.
|
||||
*/
|
||||
if(H5SM_delete_from_index(f, dxpl_id, open_oh, &(table->indexes[index_num]), sh_mesg, &cache_flags, &mesg_buf) < 0)
|
||||
HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete mesage from SOHM index")
|
||||
if(H5SM_delete_from_index(f, dxpl_id, open_oh, &(table->indexes[index_num]), sh_mesg, &cache_flags, &mesg_size, &mesg_buf) < 0)
|
||||
HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete mesage from SOHM index")
|
||||
|
||||
/* Release the master SOHM table */
|
||||
if(H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0)
|
||||
@ -1591,7 +1592,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
|
||||
* master table needs to be unprotected when we do this.
|
||||
*/
|
||||
if(mesg_buf) {
|
||||
if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, open_oh, type_id, (const unsigned char *)mesg_buf)))
|
||||
if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, open_oh, type_id, mesg_size, (const unsigned char *)mesg_buf)))
|
||||
HGOTO_ERROR(H5E_SOHM, H5E_CANTDECODE, FAIL, "can't decode shared message.")
|
||||
|
||||
if(H5O_msg_delete(f, dxpl_id, open_oh, type_id, native_mesg) < 0)
|
||||
@ -1778,7 +1779,7 @@ H5SM_decr_ref(void *record, void *op_data, hbool_t *changed)
|
||||
static herr_t
|
||||
H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
H5SM_index_header_t *header, const H5O_shared_t *mesg,
|
||||
unsigned *cache_flags, void ** /*out*/ encoded_mesg)
|
||||
unsigned *cache_flags, size_t * /*out*/ mesg_size, void ** /*out*/ encoded_mesg)
|
||||
{
|
||||
H5SM_list_t *list = NULL;
|
||||
H5SM_mesg_key_t key;
|
||||
@ -1910,6 +1911,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
|
||||
/* Return the message's encoding so anything it references can be freed */
|
||||
*encoded_mesg = encoding_buf;
|
||||
*mesg_size = buf_size;
|
||||
|
||||
/* If there are no messages left in the index, delete it */
|
||||
if(header->num_messages == 0) {
|
||||
@ -1951,8 +1953,10 @@ done:
|
||||
/* Free the message encoding, if we're not returning it in encoded_mesg
|
||||
* or if there's been an error.
|
||||
*/
|
||||
if(encoding_buf && (NULL == *encoded_mesg || ret_value < 0))
|
||||
if(encoding_buf && (NULL == *encoded_mesg || ret_value < 0)) {
|
||||
encoding_buf = H5MM_xfree(encoding_buf);
|
||||
*mesg_size = 0;
|
||||
}
|
||||
|
||||
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
|
||||
} /* end H5SM_delete_from_index() */
|
||||
|
@ -282,6 +282,9 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_none[1];
|
||||
*/
|
||||
H5_DLLVAR const H5S_select_class_t H5S_sel_point[1];
|
||||
|
||||
/* Array of versions for Dataspace */
|
||||
H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS];
|
||||
|
||||
/* Extent functions */
|
||||
H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent);
|
||||
H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
|
||||
|
@ -219,7 +219,7 @@ H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank,
|
||||
H5_DLL H5S_t *H5S_create(H5S_class_t type);
|
||||
H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/],
|
||||
const hsize_t maxdims[/*rank*/]);
|
||||
H5_DLL herr_t H5S_set_latest_version(H5S_t *ds);
|
||||
H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds);
|
||||
H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id);
|
||||
H5_DLL H5S_t *H5S_decode(const unsigned char **p);
|
||||
H5_DLL herr_t H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
|
||||
|
55
src/H5T.c
55
src/H5T.c
@ -510,6 +510,12 @@ double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f;
|
||||
H5FL_DEFINE(H5T_t);
|
||||
H5FL_DEFINE(H5T_shared_t);
|
||||
|
||||
/* Format version bounds for datatype */
|
||||
const unsigned H5O_dtype_ver_bounds[] = {
|
||||
H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */
|
||||
H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
@ -539,6 +545,7 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{
|
||||
(H5I_free_t)H5T_close /* Callback routine for closing objects of this class */
|
||||
}};
|
||||
|
||||
|
||||
/* Flag indicating "top" of interface has been initialized */
|
||||
static hbool_t H5T_top_package_initialize_s = FALSE;
|
||||
|
||||
@ -2815,8 +2822,13 @@ H5Tdecode(const void *buf)
|
||||
if(buf == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
|
||||
|
||||
/* Create datatype by decoding buffer */
|
||||
if(NULL == (dt = H5T_decode((const unsigned char *)buf)))
|
||||
/* Create datatype by decoding buffer
|
||||
* There is no way to get the size of the buffer, so we pass in
|
||||
* SIZE_MAX and assume the caller knows what they are doing.
|
||||
* Really fixing this will require an H5Tdecode2() call that
|
||||
* takes a size parameter.
|
||||
*/
|
||||
if(NULL == (dt = H5T_decode(SIZE_MAX, (const unsigned char *)buf)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object")
|
||||
|
||||
/* Register the type and return the ID */
|
||||
@ -2905,7 +2917,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5T_t *
|
||||
H5T_decode(const unsigned char *buf)
|
||||
H5T_decode(size_t buf_size, const unsigned char *buf)
|
||||
{
|
||||
H5F_t *f = NULL; /* Fake file structure*/
|
||||
H5T_t *ret_value = NULL; /* Return value */
|
||||
@ -2925,7 +2937,7 @@ H5T_decode(const unsigned char *buf)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype")
|
||||
|
||||
/* Decode the serialized datatype message */
|
||||
if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_noio_dxpl_id, NULL, H5O_DTYPE_ID, buf)))
|
||||
if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_noio_dxpl_id, NULL, H5O_DTYPE_ID, buf_size, buf)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object")
|
||||
|
||||
/* Mark datatype as being in memory now */
|
||||
@ -5204,6 +5216,11 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
|
||||
|
||||
/* Check if the field changed size */
|
||||
if(old_size != memb_type->shared->size) {
|
||||
|
||||
/* Fail if the old_size is zero */
|
||||
if (0 == old_size)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero");
|
||||
|
||||
/* Adjust the size of the member */
|
||||
dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size;
|
||||
|
||||
@ -5403,34 +5420,44 @@ done:
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T_set_latest_version
|
||||
* Function: H5T_set_version
|
||||
*
|
||||
* Purpose: Set the encoding for a datatype to the latest version.
|
||||
* Purpose: Set the encoding for a datatype to the version indicated by
|
||||
* the file's low bound if that is higher than the datatype's
|
||||
* version.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Thursday, July 19, 2007
|
||||
* Programmer: Vailin Choi; December 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5T_set_latest_version(H5T_t *dt)
|
||||
H5T_set_version(H5F_t *f, H5T_t *dt)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
unsigned vers; /* The version */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(f);
|
||||
HDassert(dt);
|
||||
|
||||
/* Upgrade the format version for the datatype to the latest */
|
||||
if(H5T__upgrade_version(dt, H5O_DTYPE_VERSION_LATEST) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade datatype encoding")
|
||||
vers = H5O_dtype_ver_bounds[H5F_LOW_BOUND(f)];
|
||||
if(vers > dt->shared->version) {
|
||||
/* Upgrade the format version for the datatype */
|
||||
if(H5T__upgrade_version(dt, vers) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade datatype encoding")
|
||||
}
|
||||
|
||||
/* Version bounds check */
|
||||
if(dt->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(f)])
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "Datatype version out of bounds")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5T_set_latest_version() */
|
||||
} /* end H5T_set_version() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
@ -328,9 +328,9 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
|
||||
* a named type should always succeed.
|
||||
*/
|
||||
if(H5T_STATE_NAMED == type->shared->state || H5T_STATE_OPEN == type->shared->state)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed")
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed")
|
||||
if(H5T_STATE_IMMUTABLE == type->shared->state)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable")
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable")
|
||||
|
||||
/* Check for a "sensible" datatype to store on disk */
|
||||
if(H5T_is_sensible(type) <= 0)
|
||||
@ -344,15 +344,14 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
|
||||
|
||||
/* Reset datatype location and path */
|
||||
if(H5O_loc_reset(&temp_oloc) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize location")
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize location")
|
||||
if(H5G_name_reset(&temp_path) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize path")
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize path")
|
||||
loc_init = TRUE;
|
||||
|
||||
/* Set the latest format, if requested */
|
||||
if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE))
|
||||
if(H5T_set_latest_version(type) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
|
||||
/* Set the version for datatype */
|
||||
if(H5T_set_version(file, type) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype")
|
||||
|
||||
/* Calculate message size infomation, for creating object header */
|
||||
dtype_size = H5O_msg_size_f(file, tcpl_id, H5O_DTYPE_ID, type, (size_t)0);
|
||||
@ -363,15 +362,15 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
|
||||
* type message and then give the object header a name.
|
||||
*/
|
||||
if(H5O_create(file, dxpl_id, dtype_size, (size_t)1, tcpl_id, &temp_oloc) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
|
||||
if(H5O_msg_create(&temp_oloc, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, type, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
|
||||
|
||||
/* Copy the new object header's location into the datatype, taking ownership of it */
|
||||
if(H5O_loc_copy(&(type->oloc), &temp_oloc, H5_COPY_SHALLOW) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
|
||||
if(H5G_name_copy(&(type->path), &temp_path, H5_COPY_SHALLOW) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
|
||||
loc_init = FALSE;
|
||||
|
||||
/* Set the shared info fields */
|
||||
@ -400,12 +399,12 @@ done:
|
||||
if((type->shared->state == H5T_STATE_TRANSIENT || type->shared->state == H5T_STATE_RDONLY) && (type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED)) {
|
||||
if(H5O_dec_rc_by_loc(&(type->oloc), dxpl_id) < 0)
|
||||
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
|
||||
if(H5O_close(&(type->oloc), NULL) < 0)
|
||||
if(H5O_close(&(type->oloc), NULL) < 0)
|
||||
HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header")
|
||||
if(H5O_delete(file, dxpl_id, type->sh_loc.u.loc.oh_addr) < 0)
|
||||
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header")
|
||||
type->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
|
||||
} /* end if */
|
||||
type->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
@ -332,6 +332,9 @@ typedef struct {
|
||||
/* Typedef for datatype iteration operations */
|
||||
typedef herr_t (*H5T_operator_t)(H5T_t *dt, void *op_data/*in,out*/);
|
||||
|
||||
/* Array of versions for Datatype */
|
||||
H5_DLLVAR const unsigned H5O_dtype_ver_bounds[H5F_LIBVER_NBOUNDS];
|
||||
|
||||
/*
|
||||
* Alignment information for native types. A value of N indicates that the
|
||||
* data must be aligned on an address ADDR such that 0 == ADDR mod N. When
|
||||
|
@ -114,7 +114,7 @@ H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_ap
|
||||
H5_DLL size_t H5T_get_size(const H5T_t *dt);
|
||||
H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset);
|
||||
H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
|
||||
H5_DLL H5T_t *H5T_decode(const unsigned char *buf);
|
||||
H5_DLL H5T_t *H5T_decode(size_t buf_size, const unsigned char *buf);
|
||||
H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream);
|
||||
H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt);
|
||||
H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt);
|
||||
@ -136,7 +136,7 @@ H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_
|
||||
H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
|
||||
H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
|
||||
H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt);
|
||||
H5_DLL herr_t H5T_set_latest_version(H5T_t *dt);
|
||||
H5_DLL herr_t H5T_set_version(H5F_t *f, H5T_t *dt);
|
||||
H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f);
|
||||
H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f);
|
||||
H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt);
|
||||
|
1045
src/H5trace.c
1045
src/H5trace.c
File diff suppressed because it is too large
Load Diff
@ -1018,6 +1018,7 @@ if (HDF5_BUILD_GENERATORS)
|
||||
gen_bad_offset
|
||||
gen_bad_ohdr
|
||||
gen_bogus
|
||||
gen_bounds
|
||||
gen_cross
|
||||
gen_deflate
|
||||
gen_filters
|
||||
|
@ -32,8 +32,12 @@ endif ()
|
||||
|
||||
foreach (vfdtest ${VFD_LIST})
|
||||
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}")
|
||||
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles")
|
||||
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared")
|
||||
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles")
|
||||
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
@ -64,6 +68,17 @@ foreach (vfdtest ${VFD_LIST})
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
|
||||
foreach (vfdtest ${VFD_LIST})
|
||||
foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
|
||||
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIB_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIB_files")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIBSH_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIBSH_files")
|
||||
endif ()
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
|
||||
add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIB tests" DEPENDS ${HDF5_VFDTEST_LIB_files_list})
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_custom_target(HDF5_VFDTEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIBSH tests" DEPENDS ${HDF5_VFDTEST_LIBSH_files_list})
|
||||
|
@ -95,7 +95,7 @@ endif
|
||||
BUILD_ALL_PROGS=gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_new_array \
|
||||
gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \
|
||||
gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread \
|
||||
gen_sizes_lheap gen_file_image gen_plist gen_bad_offset
|
||||
gen_sizes_lheap gen_file_image gen_plist gen_bad_offset gen_bounds
|
||||
|
||||
if BUILD_ALL_CONDITIONAL
|
||||
noinst_PROGRAMS=$(BUILD_ALL_PROGS)
|
||||
|
100
test/dangle.c
100
test/dangle.c
@ -31,17 +31,17 @@ const char *FILENAME[] = {
|
||||
#define TYPENAME "Type"
|
||||
#define ATTRNAME "Attribute"
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_dangle_dataset
|
||||
* Function: test_dangle_dataset
|
||||
*
|
||||
* Purpose: Check for dangling dataset IDs causing problems on library
|
||||
* Purpose: Check for dangling dataset IDs causing problems on library
|
||||
* shutdown
|
||||
*
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, May 13, 2003
|
||||
*
|
||||
* Modifications:
|
||||
@ -51,7 +51,7 @@ const char *FILENAME[] = {
|
||||
static int
|
||||
test_dangle_dataset(H5F_close_degree_t degree)
|
||||
{
|
||||
char filename[1024];
|
||||
char filename[1024];
|
||||
hid_t fid; /* File ID */
|
||||
hid_t fapl; /* File access property list */
|
||||
hid_t dsid; /* Dataset ID */
|
||||
@ -127,17 +127,17 @@ error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_dangle_group
|
||||
* Function: test_dangle_group
|
||||
*
|
||||
* Purpose: Check for dangling group IDs causing problems on library
|
||||
* Purpose: Check for dangling group IDs causing problems on library
|
||||
* shutdown
|
||||
*
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, May 13, 2003
|
||||
*
|
||||
* Modifications:
|
||||
@ -147,7 +147,7 @@ error:
|
||||
static int
|
||||
test_dangle_group(H5F_close_degree_t degree)
|
||||
{
|
||||
char filename[1024];
|
||||
char filename[1024];
|
||||
hid_t fid; /* File ID */
|
||||
hid_t fapl; /* File access property list */
|
||||
hid_t gid; /* Group ID */
|
||||
@ -218,17 +218,17 @@ error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_dangle_datatype1
|
||||
* Function: test_dangle_datatype1
|
||||
*
|
||||
* Purpose: Check for dangling datatype IDs causing problems on library
|
||||
* Purpose: Check for dangling datatype IDs causing problems on library
|
||||
* shutdown
|
||||
*
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, May 13, 2003
|
||||
*
|
||||
* Modifications:
|
||||
@ -238,7 +238,7 @@ error:
|
||||
static int
|
||||
test_dangle_datatype1(H5F_close_degree_t degree)
|
||||
{
|
||||
char filename[1024];
|
||||
char filename[1024];
|
||||
hid_t fid; /* File ID */
|
||||
hid_t fapl; /* File access property list */
|
||||
hid_t tid; /* Datatype ID */
|
||||
@ -314,17 +314,17 @@ error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_dangle_datatype2
|
||||
* Function: test_dangle_datatype2
|
||||
*
|
||||
* Purpose: Check for dangling datatype IDs causing problems on library
|
||||
* Purpose: Check for dangling datatype IDs causing problems on library
|
||||
* shutdown
|
||||
*
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Programmer: Quincey Koziol
|
||||
* Thursday, August 25, 2005
|
||||
*
|
||||
* Modifications:
|
||||
@ -334,7 +334,7 @@ error:
|
||||
static int
|
||||
test_dangle_datatype2(H5F_close_degree_t degree)
|
||||
{
|
||||
char filename[1024];
|
||||
char filename[1024];
|
||||
hid_t fid; /* File ID */
|
||||
hid_t fapl; /* File access property list */
|
||||
hid_t did; /* Dataset ID */
|
||||
@ -401,17 +401,17 @@ error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_dangle_attribute
|
||||
* Function: test_dangle_attribute
|
||||
*
|
||||
* Purpose: Check for dangling attribute IDs causing problems on library
|
||||
* Purpose: Check for dangling attribute IDs causing problems on library
|
||||
* shutdown
|
||||
*
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, June 18, 2003
|
||||
*
|
||||
* Modifications:
|
||||
@ -421,7 +421,7 @@ error:
|
||||
static int
|
||||
test_dangle_attribute(H5F_close_degree_t degree)
|
||||
{
|
||||
char filename[1024];
|
||||
char filename[1024];
|
||||
hid_t fid; /* File ID */
|
||||
hid_t fapl; /* File access property list */
|
||||
hid_t dsid; /* Dataset ID */
|
||||
@ -508,17 +508,17 @@ error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_dangle_force
|
||||
* Function: test_dangle_force
|
||||
*
|
||||
* Purpose: Shut down all danging IDs with generic file & ID routines,
|
||||
* Purpose: Shut down all danging IDs with generic file & ID routines,
|
||||
* instead of letting library shut then down.
|
||||
*
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Programmer: Quincey Koziol
|
||||
* Friday, October 29, 2010
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
@ -526,7 +526,7 @@ error:
|
||||
static int
|
||||
test_dangle_force(void)
|
||||
{
|
||||
char filename[1024];
|
||||
char filename[1024];
|
||||
hid_t fid; /* File ID */
|
||||
hid_t gid, gid2; /* Group IDs */
|
||||
hid_t dsid, dsid2; /* Dataset IDs */
|
||||
@ -624,7 +624,7 @@ test_dangle_force(void)
|
||||
|
||||
/* Release object ID array */
|
||||
HDfree(objs);
|
||||
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
|
||||
@ -634,16 +634,16 @@ error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
* Function: main
|
||||
*
|
||||
* Purpose: Executes dangling ID tests
|
||||
* Purpose: Executes dangling ID tests
|
||||
*
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
* Return: Success: zero
|
||||
* Failure: non-zero
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, May 13, 2003
|
||||
*
|
||||
* Modifications:
|
||||
@ -653,7 +653,7 @@ error:
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int nerrors=0;
|
||||
int nerrors=0;
|
||||
|
||||
/* Run tests w/weak file close */
|
||||
puts("Testing dangling objects with weak file close:");
|
||||
|
566
test/dsets.c
566
test/dsets.c
File diff suppressed because it is too large
Load Diff
27
test/fheap.c
27
test/fheap.c
@ -16458,6 +16458,33 @@ main(void)
|
||||
if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
|
||||
TEST_ERROR
|
||||
fapl = def_fapl;
|
||||
/* This is a fix for the daily test failure from the checkin for libver bounds. */
|
||||
/*
|
||||
* Many tests failed the file size check when comparing (a) and (b) as below:
|
||||
* --Create a file and close the file. Got the initial file size (a).
|
||||
* --Reopen the file, perform fractal heap operations, and close the file.
|
||||
* Got the file size (b).
|
||||
* The cause for the file size differences:
|
||||
* When the file is initially created with persisting free-space and with
|
||||
* (earliest, latest) libver bounds, the file will have version 2 superblock
|
||||
* due to non-default free-space handling. As the low bound is earliest,
|
||||
* the library uses version 1 object header when creating the superblock
|
||||
* extension message.
|
||||
* When the file is reopened with the same libver bounds, the file's low
|
||||
* bound is upgraded to v18 because the file has version 2 superblock.
|
||||
* When the library creates the superblock extension message on file close,
|
||||
* the library uses version 2 object header for the superblock extension
|
||||
* message since the low bound is v18.
|
||||
* This leads to the discrepancy in file sizes as the file is persisting
|
||||
* free-space and there is object header version differences.
|
||||
* The fix:
|
||||
* Set libver bounds in fapl to (v18, latest) so that the file created in the
|
||||
* test routines will have low bound set to v18. This will cause the
|
||||
* library to use version 2 object header for the superblock extension
|
||||
* message.
|
||||
*/
|
||||
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
|
||||
TEST_ERROR
|
||||
break;
|
||||
case 2:
|
||||
if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
|
||||
|
606
test/gen_bounds.c
Normal file
606
test/gen_bounds.c
Normal file
@ -0,0 +1,606 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Purpose: This program is to generate HDF5 data files used to test
|
||||
* version bounds.
|
||||
*
|
||||
* Description
|
||||
* ===========
|
||||
* gen_bounds.c will generate the following files:
|
||||
* - bounds_earliest_latest.h5
|
||||
* - bounds_earliest_v18.h5
|
||||
* - bounds_latest_latest.h5
|
||||
* - bounds_v18_latest.h5
|
||||
* - bounds_v18_v18.h5
|
||||
* These files are copied to 1.6 and 1.8 libraries for verifying
|
||||
* that they can or cannot read particular file format.
|
||||
*/
|
||||
|
||||
#include "h5test.h"
|
||||
|
||||
/***********************************************************************
|
||||
* gen_earliest_latest() creates file "bounds_earliest_latest.h5"
|
||||
*
|
||||
* File contents:
|
||||
* - Version 0 superblock (default)
|
||||
* - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
|
||||
* - A chunked dataset with layout version 4, "DS_chunked_layout_4". (H5Pset_chunk_opts)
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
/* File names for different file format */
|
||||
#define FILENAME_E_L "bounds_earliest_latest.h5"
|
||||
#define FILENAME_E_18 "bounds_earliest_v18.h5"
|
||||
#define FILENAME_L_L "bounds_latest_latest.h5"
|
||||
#define FILENAME_18_L "bounds_v18_latest.h5"
|
||||
#define FILENAME_18_18 "bounds_v18_v18.h5"
|
||||
|
||||
/* 2-D dataset with fixed dimensions */
|
||||
#define RANK 2
|
||||
#define DIM1 100
|
||||
#define DIM2 200
|
||||
#define CHK_DIM1 50
|
||||
#define CHK_DIM2 50
|
||||
|
||||
static herr_t gen_earliest_latest(void)
|
||||
{
|
||||
hid_t fid = -1; /* File ID */
|
||||
hid_t fapl = -1; /* File access property list ID */
|
||||
hid_t fcpl = -1; /* File creation property list ID */
|
||||
hid_t dcpl = -1; /* Dataset creation property list ID */
|
||||
hid_t space = -1; /* Dataspace ID */
|
||||
hid_t dset = -1; /* Dataset ID */
|
||||
float *buf = NULL; /* Buffer for writing data */
|
||||
float *bufp = NULL; /* Pointer to data buffer */
|
||||
hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
|
||||
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
|
||||
int i, j;
|
||||
herr_t ret = SUCCEED; /* Generic return value */
|
||||
|
||||
/* Create file creation property list */
|
||||
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Create file access property list */
|
||||
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set the "use the earliest/latest version of the format" bounds
|
||||
for creating objects in the file */
|
||||
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Create file */
|
||||
if((fid = H5Fcreate(FILENAME_E_L, H5F_ACC_TRUNC, fcpl, fapl)) <0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Close file property lists */
|
||||
if(H5Pclose(fapl) < 0) TEST_ERROR;
|
||||
if(H5Pclose(fcpl) < 0) TEST_ERROR;
|
||||
|
||||
/*
|
||||
* Add a chunked dataset with layout version 3 (default)
|
||||
*/
|
||||
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
|
||||
if (buf == NULL) TEST_ERROR;
|
||||
|
||||
/* Fill sample data */
|
||||
bufp = buf;
|
||||
for (i = 0; i < DIM1; i++)
|
||||
for (j = 0; j < DIM2; j++)
|
||||
*bufp = 100.0F;
|
||||
|
||||
/* Create the dataspace */
|
||||
if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
|
||||
|
||||
/* Create the dataset creation property list */
|
||||
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set up for chunked data */
|
||||
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
|
||||
|
||||
/* Create and write the dataset */
|
||||
dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
|
||||
if (dset < 0) TEST_ERROR;
|
||||
|
||||
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
|
||||
if (ret < 0) TEST_ERROR;
|
||||
|
||||
/* Close property list and dataset, will reuse dataspace */
|
||||
if(H5Pclose(dcpl) < 0) TEST_ERROR;
|
||||
if(H5Dclose(dset) < 0) TEST_ERROR;
|
||||
|
||||
/*
|
||||
* Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
|
||||
*/
|
||||
|
||||
/* Create the dataset creation property list */
|
||||
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set up for chunked data */
|
||||
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
|
||||
|
||||
/* Disable partial chunk filters, triggers layout version 4 */
|
||||
if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Create and write the dataset */
|
||||
dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
|
||||
if (dset < 0) TEST_ERROR;
|
||||
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
|
||||
if (ret < 0) TEST_ERROR;
|
||||
|
||||
/* Release allocated buffer */
|
||||
HDfree(buf);
|
||||
bufp = buf = NULL;
|
||||
|
||||
/* Close everything */
|
||||
if(H5Pclose(dcpl) < 0) TEST_ERROR;
|
||||
if(H5Dclose(dset) < 0) TEST_ERROR;
|
||||
if(H5Sclose(space) < 0) TEST_ERROR;
|
||||
if(H5Fclose(fid) < 0) TEST_ERROR;
|
||||
|
||||
return SUCCEED;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Dclose(dset);
|
||||
H5Sclose(space);
|
||||
H5Pclose(dcpl);
|
||||
H5Pclose(fcpl);
|
||||
H5Pclose(fapl);
|
||||
H5Fclose(fid);
|
||||
HDfree(buf);
|
||||
} H5E_END_TRY;
|
||||
return FAIL;
|
||||
} /* gen_earliest_latest */
|
||||
|
||||
/***********************************************************************
|
||||
* gen_earliest_v18() creates file "bounds_earliest_v18.h5"
|
||||
*
|
||||
* File contents:
|
||||
* - Version 0 superblock (default)
|
||||
* - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
***********************************************************************/
|
||||
static herr_t gen_earliest_v18(void)
|
||||
{
|
||||
hid_t fid = -1; /* File ID */
|
||||
hid_t fapl = -1; /* File access property list ID */
|
||||
hid_t fcpl = -1; /* File creation property list ID */
|
||||
hid_t dcpl = -1; /* Dataset creation property list ID */
|
||||
hid_t space = -1; /* Dataspace ID */
|
||||
hid_t dset = -1; /* Dataset ID */
|
||||
float *buf = NULL; /* Buffer for writing data */
|
||||
float *bufp = NULL; /* Pointer to data buffer */
|
||||
hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
|
||||
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
|
||||
int i, j;
|
||||
herr_t ret = SUCCEED; /* Generic return value */
|
||||
|
||||
/* Create file creation property list */
|
||||
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Create file access property list */
|
||||
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set the "use the earliest/v18 version of the format" bounds
|
||||
for creating objects in the file */
|
||||
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Create file */
|
||||
if((fid = H5Fcreate(FILENAME_E_18, H5F_ACC_TRUNC, fcpl, fapl)) <0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Close file property lists */
|
||||
if(H5Pclose(fapl) < 0) TEST_ERROR;
|
||||
if(H5Pclose(fcpl) < 0) TEST_ERROR;
|
||||
|
||||
/*
|
||||
* Add a chunked dataset with layout version 3 (default)
|
||||
*/
|
||||
|
||||
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
|
||||
if (buf == NULL) TEST_ERROR;
|
||||
|
||||
/* Fill sample data */
|
||||
bufp = buf;
|
||||
for (i = 0; i < DIM1; i++)
|
||||
for (j = 0; j < DIM2; j++)
|
||||
*bufp = 100.0F;
|
||||
|
||||
/* Create the dataspace */
|
||||
if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
|
||||
|
||||
/* Create the dataset creation property list */
|
||||
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set up for chunked data */
|
||||
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
|
||||
|
||||
/* Create and write the dataset */
|
||||
dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
|
||||
if (dset < 0) TEST_ERROR;
|
||||
|
||||
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
|
||||
if (ret < 0) TEST_ERROR;
|
||||
|
||||
/* Release allocated buffer */
|
||||
HDfree(buf);
|
||||
bufp = buf = NULL;
|
||||
|
||||
/* Close everything */
|
||||
if(H5Pclose(dcpl) < 0) TEST_ERROR;
|
||||
if(H5Dclose(dset) < 0) TEST_ERROR;
|
||||
if(H5Sclose(space) < 0) TEST_ERROR;
|
||||
if(H5Fclose(fid) < 0) TEST_ERROR;
|
||||
|
||||
return SUCCEED;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Dclose(dset);
|
||||
H5Sclose(space);
|
||||
H5Pclose(dcpl);
|
||||
H5Pclose(fcpl);
|
||||
H5Pclose(fapl);
|
||||
H5Fclose(fid);
|
||||
HDfree(buf);
|
||||
} H5E_END_TRY;
|
||||
return FAIL;
|
||||
} /* gen_earliest_v18 */
|
||||
|
||||
/***********************************************************************
|
||||
* gen_latest_latest() creates file "bounds_latest_latest.h5"
|
||||
*
|
||||
* File contents:
|
||||
* - Version 3 superblock (triggered by H5Fcreate with H5F_ACC_SWMR_WRITE)
|
||||
* - A chunked dataset with layout version 4, "DS_chunked_layout_4". (H5Pset_chunk_opts)
|
||||
*
|
||||
* NOTE: As of Feb 2018, latest is 1.10.
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
***********************************************************************/
|
||||
static herr_t gen_latest_latest(void)
|
||||
{
|
||||
hid_t fid = -1; /* File ID */
|
||||
hid_t dcpl = -1; /* Dataset creation property list ID */
|
||||
hid_t space = -1; /* Dataspace ID */
|
||||
hid_t dset = -1; /* Dataset ID */
|
||||
float *buf = NULL; /* Buffer for writing data */
|
||||
float *bufp = NULL; /* Pointer to data buffer */
|
||||
hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
|
||||
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
|
||||
int i, j;
|
||||
herr_t ret = SUCCEED; /* Generic return value */
|
||||
|
||||
/* Create file with H5F_ACC_SWMR_WRITE, triggers version 3 superblock */
|
||||
fid = H5Fcreate(FILENAME_L_L, H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT);
|
||||
if (fid < 0) TEST_ERROR;
|
||||
|
||||
/*
|
||||
* Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
|
||||
*/
|
||||
|
||||
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
|
||||
if (buf == NULL) TEST_ERROR;
|
||||
|
||||
/* Fill sample data */
|
||||
bufp = buf;
|
||||
for (i = 0; i < DIM1; i++)
|
||||
for (j = 0; j < DIM2; j++)
|
||||
*bufp = 100.0F;
|
||||
|
||||
/* Create the dataspace */
|
||||
if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
|
||||
|
||||
/* Create the dataset creation property list */
|
||||
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set up for chunked data */
|
||||
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
|
||||
|
||||
/* Disable partial chunk filters, triggers layout version 4 */
|
||||
if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Create and write the dataset */
|
||||
dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
|
||||
if (dset < 0) TEST_ERROR;
|
||||
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
|
||||
if (ret < 0) TEST_ERROR;
|
||||
|
||||
/* Release allocated buffer */
|
||||
HDfree(buf);
|
||||
bufp = buf = NULL;
|
||||
|
||||
/* Close everything */
|
||||
if(H5Pclose(dcpl) < 0) TEST_ERROR;
|
||||
if(H5Dclose(dset) < 0) TEST_ERROR;
|
||||
if(H5Sclose(space) < 0) TEST_ERROR;
|
||||
if(H5Fclose(fid) < 0) TEST_ERROR;
|
||||
|
||||
return SUCCEED;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Dclose(dset);
|
||||
H5Sclose(space);
|
||||
H5Pclose(dcpl);
|
||||
H5Fclose(fid);
|
||||
HDfree(buf);
|
||||
} H5E_END_TRY;
|
||||
return FAIL;
|
||||
} /* gen_latest_latest */
|
||||
|
||||
/***********************************************************************
|
||||
* gen_v18_latest() creates file "bounds_v18_latest.h5"
|
||||
*
|
||||
* File contents:
|
||||
* - Version 2 superblock
|
||||
* - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
***********************************************************************/
|
||||
static herr_t gen_v18_latest(void)
|
||||
{
|
||||
hid_t fid = -1; /* File ID */
|
||||
hid_t fapl = -1; /* File access property list ID */
|
||||
hid_t fcpl = -1; /* File creation property list ID */
|
||||
hid_t dcpl = -1; /* Dataset creation property list ID */
|
||||
hid_t space = -1; /* Dataspace ID */
|
||||
hid_t dset = -1; /* Dataset ID */
|
||||
float *buf = NULL; /* Buffer for writing data */
|
||||
float *bufp = NULL; /* Pointer to data buffer */
|
||||
hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
|
||||
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
|
||||
int i, j;
|
||||
herr_t ret = SUCCEED; /* Generic return value */
|
||||
|
||||
/* Create file creation property list */
|
||||
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Create file access property list */
|
||||
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set the "use the v18/latest version of the format" bounds
|
||||
for creating objects in the file, also trigger version 2 superblock */
|
||||
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Create file */
|
||||
if((fid = H5Fcreate(FILENAME_18_L, H5F_ACC_TRUNC, fcpl, fapl)) <0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Close file property lists */
|
||||
if(H5Pclose(fapl) < 0) TEST_ERROR;
|
||||
if(H5Pclose(fcpl) < 0) TEST_ERROR;
|
||||
|
||||
/*
|
||||
* Add a chunked dataset with layout version 3 (default)
|
||||
*/
|
||||
|
||||
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
|
||||
if (buf == NULL) TEST_ERROR;
|
||||
|
||||
/* Fill sample data */
|
||||
bufp = buf;
|
||||
for (i = 0; i < DIM1; i++)
|
||||
for (j = 0; j < DIM2; j++)
|
||||
*bufp = 100.0F;
|
||||
|
||||
/* Create the dataspace */
|
||||
if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
|
||||
|
||||
/* Create the dataset creation property list */
|
||||
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set up for chunked data */
|
||||
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
|
||||
|
||||
/* Create and write the dataset */
|
||||
dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
|
||||
if (dset < 0) TEST_ERROR;
|
||||
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
|
||||
if (ret < 0) TEST_ERROR;
|
||||
|
||||
/* Release allocated buffer */
|
||||
HDfree(buf);
|
||||
bufp = buf = NULL;
|
||||
|
||||
/* Close property list and dataset, will reuse dataspace */
|
||||
if(H5Pclose(dcpl) < 0) TEST_ERROR;
|
||||
if(H5Dclose(dset) < 0) TEST_ERROR;
|
||||
if(H5Sclose(space) < 0) TEST_ERROR;
|
||||
if(H5Fclose(fid) < 0) TEST_ERROR;
|
||||
|
||||
return SUCCEED;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Dclose(dset);
|
||||
H5Sclose(space);
|
||||
H5Pclose(dcpl);
|
||||
H5Pclose(fcpl);
|
||||
H5Pclose(fapl);
|
||||
H5Fclose(fid);
|
||||
HDfree(buf);
|
||||
} H5E_END_TRY;
|
||||
return FAIL;
|
||||
} /* gen_v18_latest */
|
||||
|
||||
/***********************************************************************
|
||||
* gen_v18_v18() creates file "bounds_v18_v18.h5"
|
||||
*
|
||||
* File contents:
|
||||
* - Version 2 superblock (H5Pset_libver_bounds(v18, v18)
|
||||
* - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
|
||||
* - A chunked dataset with layout version 4, "DS_chunked_layout_4". (H5Pset_chunk_opts)
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
***********************************************************************/
|
||||
static herr_t gen_v18_v18(void)
|
||||
{
|
||||
hid_t fid = -1; /* File ID */
|
||||
hid_t fapl = -1; /* File access property list ID */
|
||||
hid_t fcpl = -1; /* File creation property list ID */
|
||||
hid_t dcpl = -1; /* Dataset creation property list ID */
|
||||
hid_t space = -1; /* Dataspace ID */
|
||||
hid_t dset = -1; /* Dataset ID */
|
||||
float *buf = NULL; /* Buffer for writing data */
|
||||
float *bufp = NULL; /* Pointer to data buffer */
|
||||
hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
|
||||
hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
|
||||
int i, j;
|
||||
herr_t ret = SUCCEED; /* Generic return value */
|
||||
|
||||
/* Create file creation property list */
|
||||
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Create file access property list */
|
||||
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set the "use the v18 version of the format" bounds
|
||||
for creating objects in the file */
|
||||
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Create file */
|
||||
if((fid = H5Fcreate(FILENAME_18_18, H5F_ACC_TRUNC, fcpl, fapl)) <0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Close file property lists */
|
||||
if(H5Pclose(fapl) < 0) TEST_ERROR;
|
||||
if(H5Pclose(fcpl) < 0) TEST_ERROR;
|
||||
|
||||
/*
|
||||
* Add a chunked dataset with layout version 3 (default)
|
||||
*/
|
||||
|
||||
buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
|
||||
if (buf == NULL) TEST_ERROR;
|
||||
|
||||
/* Fill sample data */
|
||||
bufp = buf;
|
||||
for (i = 0; i < DIM1; i++)
|
||||
for (j = 0; j < DIM2; j++)
|
||||
*bufp = 100.0F;
|
||||
|
||||
/* Create the dataspace */
|
||||
if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
|
||||
|
||||
/* Create the dataset creation property list */
|
||||
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set up for chunked data */
|
||||
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
|
||||
|
||||
/* Create and write the dataset */
|
||||
dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
|
||||
if (dset < 0) TEST_ERROR;
|
||||
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
|
||||
if (ret < 0) TEST_ERROR;
|
||||
|
||||
/* Close property list and dataset, will reuse dataspace */
|
||||
if(H5Pclose(dcpl) < 0) TEST_ERROR;
|
||||
if(H5Dclose(dset) < 0) TEST_ERROR;
|
||||
|
||||
/* Close the file, then reopen it with the latest version */
|
||||
if(H5Fclose(fid) < 0) TEST_ERROR;
|
||||
|
||||
/* Create file access property list */
|
||||
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set the "use the v18/latest version of the format" bounds
|
||||
for creating a layout version 4 object in the file */
|
||||
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
if((fid = H5Fopen(FILENAME_18_18, H5F_ACC_RDWR, fapl)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/*
|
||||
* Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
|
||||
*/
|
||||
|
||||
/* Create the dataset creation property list */
|
||||
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
|
||||
|
||||
/* Set up for chunked data */
|
||||
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
|
||||
|
||||
/* Disable partial chunk filters */
|
||||
if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Create and write the dataset */
|
||||
dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
|
||||
if (dset < 0) TEST_ERROR;
|
||||
ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
|
||||
if (ret < 0) TEST_ERROR;
|
||||
|
||||
/* Release allocated buffer */
|
||||
HDfree(buf);
|
||||
bufp = buf = NULL;
|
||||
|
||||
/* Close everything */
|
||||
if(H5Pclose(dcpl) < 0) TEST_ERROR;
|
||||
if(H5Pclose(fapl) < 0) TEST_ERROR;
|
||||
if(H5Dclose(dset) < 0) TEST_ERROR;
|
||||
if(H5Sclose(space) < 0) TEST_ERROR;
|
||||
if(H5Fclose(fid) < 0) TEST_ERROR;
|
||||
return SUCCEED;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Dclose(dset);
|
||||
H5Sclose(space);
|
||||
H5Pclose(dcpl);
|
||||
H5Pclose(fcpl);
|
||||
H5Pclose(fapl);
|
||||
H5Fclose(fid);
|
||||
HDfree(buf);
|
||||
} H5E_END_TRY;
|
||||
return FAIL;
|
||||
} /* gen_v18_v18 */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Generate file bounds_earliest_latest.h5 */
|
||||
if (gen_earliest_latest() < 0) TEST_ERROR;
|
||||
|
||||
/* Generate file bounds_earliest_v18.h5 */
|
||||
if (gen_earliest_v18() < 0) TEST_ERROR;
|
||||
|
||||
/* Generate file bounds_latest_latest.h5 */
|
||||
if (gen_latest_latest() < 0) TEST_ERROR;
|
||||
|
||||
/* Generate file bounds_v18_latest.h5 */
|
||||
if (gen_v18_latest() < 0) TEST_ERROR;
|
||||
|
||||
/* Generate file bounds_v18_v18.h5 */
|
||||
if (gen_v18_v18() < 0) TEST_ERROR;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
error:
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ int create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
|
||||
int create_shuffle_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
|
||||
int create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_normal_dset
|
||||
*
|
||||
@ -107,8 +107,8 @@ create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
|
||||
* Data and output buffer initialization.
|
||||
*/
|
||||
for (j = 0; j < NX; j++) {
|
||||
for (i = 0; i < NY; i++)
|
||||
data[j][i] = ((float)(i + j + 1)) / 3;
|
||||
for (i = 0; i < NY; i++)
|
||||
data[j][i] = ((float)(i + j + 1)) / 3;
|
||||
}
|
||||
/*
|
||||
* 1/3 2/3 3/3 4/3 5/3 6/3
|
||||
@ -142,7 +142,7 @@ create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
|
||||
if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
|
||||
TEST_ERROR
|
||||
|
||||
/*
|
||||
/*
|
||||
* Close dataset
|
||||
*/
|
||||
if(H5Dclose(dataset) < 0)
|
||||
@ -162,7 +162,7 @@ create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
|
||||
if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
|
||||
TEST_ERROR
|
||||
|
||||
/*
|
||||
/*
|
||||
* Close dataset
|
||||
*/
|
||||
if(H5Dclose(dataset) < 0)
|
||||
@ -185,7 +185,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_scale_offset_dsets_float
|
||||
*
|
||||
@ -276,7 +276,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_scale_offset_dsets_double
|
||||
*
|
||||
@ -306,8 +306,8 @@ create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid)
|
||||
* Data and output buffer initialization.
|
||||
*/
|
||||
for (j = 0; j < NX; j++) {
|
||||
for (i = 0; i < NY; i++)
|
||||
data[j][i] = ((double)(i + j + 1))/3;
|
||||
for (i = 0; i < NY; i++)
|
||||
data[j][i] = ((double)(i + j + 1))/3;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -367,7 +367,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_scale_offset_dset_char
|
||||
*
|
||||
@ -466,7 +466,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_scale_offset_dset_short
|
||||
*
|
||||
@ -565,7 +565,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_scale_offset_dset_int
|
||||
*
|
||||
@ -595,8 +595,8 @@ create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid)
|
||||
* Data and output buffer initialization.
|
||||
*/
|
||||
for (j = 0; j < NX; j++) {
|
||||
for (i = 0; i < NY; i++)
|
||||
data[j][i] = i + j;
|
||||
for (i = 0; i < NY; i++)
|
||||
data[j][i] = i + j;
|
||||
}
|
||||
/*
|
||||
* 0 1 2 3 4 5
|
||||
@ -664,7 +664,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_scale_offset_dset_long_long
|
||||
*
|
||||
@ -764,7 +764,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_fletcher_dsets_float
|
||||
*
|
||||
@ -855,7 +855,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_deflate_dsets_float
|
||||
*
|
||||
@ -956,7 +956,7 @@ error:
|
||||
}
|
||||
|
||||
#ifdef H5_HAVE_FILTER_SZIP
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_szip_dsets_float
|
||||
*
|
||||
@ -1048,7 +1048,7 @@ error:
|
||||
}
|
||||
#endif /* H5_HAVE_FILTER_SZIP */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_shuffle_dsets_float
|
||||
*
|
||||
@ -1139,7 +1139,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: create_nbit_dsets_float
|
||||
*
|
||||
@ -1224,7 +1224,7 @@ create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
|
||||
TEST_ERROR
|
||||
|
||||
/* Now create a dataset with a big-endian type */
|
||||
if(H5Tset_order(datatype, H5T_ORDER_BE) < 0)
|
||||
if(H5Tset_order(datatype, H5T_ORDER_BE) < 0)
|
||||
TEST_ERROR
|
||||
if((dataset = H5Dcreate2(fid, DATASETNAME23, datatype, fsid,
|
||||
H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
||||
@ -1251,7 +1251,7 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
*
|
||||
|
131
test/genall5.c
131
test/genall5.c
@ -1248,18 +1248,44 @@ void
|
||||
os_grp_0(hid_t fid, const char *group_name)
|
||||
{
|
||||
hid_t gid = -1;
|
||||
hid_t fapl = -1;
|
||||
H5F_libver_t low, high;
|
||||
|
||||
herr_t ret;
|
||||
|
||||
if ( pass ) { /* get the file's file access property list */
|
||||
|
||||
fapl = H5Fget_access_plist(fid);
|
||||
if ( fapl <= 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Fget_access_plist() failed.";
|
||||
}
|
||||
HDassert(fapl > 0);
|
||||
}
|
||||
|
||||
if ( pass ) { /* get low and high bounds from fapl */
|
||||
|
||||
ret = H5Pget_libver_bounds(fapl, &low, &high);
|
||||
if ( ret < 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
}
|
||||
|
||||
if ( pass ) { /* turn file format latest off */
|
||||
|
||||
ret = H5Fset_latest_format(fid, FALSE);
|
||||
if(low >= H5F_LIBVER_V18) {
|
||||
ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high);
|
||||
if ( ret < 0 ) {
|
||||
|
||||
if ( ret < 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Fset_latest_format() failed(1).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
if ( pass ) {
|
||||
@ -1268,9 +1294,9 @@ os_grp_0(hid_t fid, const char *group_name)
|
||||
H5P_DEFAULT);
|
||||
if ( gid <= 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Gcreate2() failed.";
|
||||
}
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Gcreate2() failed.";
|
||||
}
|
||||
HDassert(gid > 0);
|
||||
}
|
||||
|
||||
@ -1278,24 +1304,25 @@ os_grp_0(hid_t fid, const char *group_name)
|
||||
|
||||
ret = H5Gclose(gid);
|
||||
|
||||
if ( ret < 0 ) {
|
||||
if ( ret < 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Gclose() failed.";
|
||||
}
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Gclose() failed.";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
}
|
||||
|
||||
if ( pass ) { /* turn file format latest on */
|
||||
if ( pass ) { /* restore low and high bounds */
|
||||
|
||||
ret = H5Fset_latest_format(fid, TRUE);
|
||||
if(low >= H5F_LIBVER_V18) {
|
||||
ret = H5Fset_libver_bounds(fid, low, high);
|
||||
if ( ret < 0 ) {
|
||||
|
||||
if ( ret < 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Fset_latest_format() failed(2).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
@ -1462,18 +1489,43 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
|
||||
{
|
||||
hid_t gid = -1;
|
||||
unsigned u;
|
||||
hid_t fapl = -1;
|
||||
H5F_libver_t low, high;
|
||||
herr_t ret;
|
||||
|
||||
if ( pass ) { /* get the file's file access property list */
|
||||
|
||||
fapl = H5Fget_access_plist(fid);
|
||||
if ( fapl <= 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_n: H5Fget_access_plist() failed.";
|
||||
}
|
||||
HDassert(fapl > 0);
|
||||
}
|
||||
|
||||
if ( pass ) { /* get low and high bounds from fapl */
|
||||
|
||||
ret = H5Pget_libver_bounds(fapl, &low, &high);
|
||||
if ( ret < 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
}
|
||||
|
||||
if ( pass ) { /* turn file format latest off */
|
||||
|
||||
ret = H5Fset_latest_format(fid, FALSE);
|
||||
if(low >= H5F_LIBVER_V18) {
|
||||
ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high);
|
||||
if ( ret < 0 ) {
|
||||
|
||||
if ( ret < 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_n: H5Fset_latest_format() failed(1).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
if ( pass ) {
|
||||
@ -1482,8 +1534,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
|
||||
H5P_DEFAULT);
|
||||
if ( gid <= 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_n: H5Gcreate2() failed.";
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_n: H5Gcreate2() failed.";
|
||||
}
|
||||
HDassert(gid > 0);
|
||||
}
|
||||
@ -1538,16 +1590,17 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
|
||||
assert(ret >= 0);
|
||||
}
|
||||
|
||||
if ( pass ) { /* turn file format latest on */
|
||||
if ( pass ) { /* restore low and high bounds */
|
||||
|
||||
ret = H5Fset_latest_format(fid, TRUE);
|
||||
if(low >= H5F_LIBVER_V18) {
|
||||
ret = H5Fset_libver_bounds(fid, low, high);
|
||||
if ( ret < 0 ) {
|
||||
|
||||
if ( ret < 0 ) {
|
||||
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_n: H5Fset_latest_format() failed(2).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
pass = FALSE;
|
||||
failure_mssg = "os_grp_n: H5Fset_libver_bounds() failed(2).";
|
||||
}
|
||||
HDassert(ret >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
392
test/gheap.c
392
test/gheap.c
@ -15,9 +15,9 @@
|
||||
* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Tuesday, March 31, 1998
|
||||
*
|
||||
* Purpose: Tests the global heap. The global heap is the set of all
|
||||
* collections but the collections are not related to one
|
||||
* another by anything that appears in the file format.
|
||||
* Purpose: Tests the global heap. The global heap is the set of all
|
||||
* collections but the collections are not related to one
|
||||
* another by anything that appears in the file format.
|
||||
*/
|
||||
#include "h5test.h"
|
||||
#include "H5ACprivate.h"
|
||||
@ -54,18 +54,18 @@ const char *FILENAME[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_1
|
||||
* Function: test_1
|
||||
*
|
||||
* Purpose: Writes a sequence of objects to the global heap where each
|
||||
* object is larger than the one before.
|
||||
* Purpose: Writes a sequence of objects to the global heap where each
|
||||
* object is larger than the one before.
|
||||
*
|
||||
* Return: Success: 0
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: number of errors
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, March 31, 1998
|
||||
*
|
||||
* Modifications:
|
||||
@ -75,16 +75,16 @@ const char *FILENAME[] = {
|
||||
static int
|
||||
test_1 (hid_t fapl)
|
||||
{
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
H5HG_t *obj = NULL;
|
||||
uint8_t out[GHEAP_TEST_NOBJS];
|
||||
uint8_t in[GHEAP_TEST_NOBJS];
|
||||
size_t u;
|
||||
size_t size;
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
char filename[1024];
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
H5HG_t *obj = NULL;
|
||||
uint8_t out[GHEAP_TEST_NOBJS];
|
||||
uint8_t in[GHEAP_TEST_NOBJS];
|
||||
size_t u;
|
||||
size_t size;
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
char filename[1024];
|
||||
|
||||
TESTING("monotonically increasing lengths");
|
||||
|
||||
@ -95,11 +95,11 @@ test_1 (hid_t fapl)
|
||||
/* Open a clean file */
|
||||
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
|
||||
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
||||
goto error;
|
||||
goto error;
|
||||
if(NULL == (f = (H5F_t *)H5I_object(file))) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to create file");
|
||||
goto error;
|
||||
H5_FAILED();
|
||||
puts(" Unable to create file");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -108,37 +108,37 @@ test_1 (hid_t fapl)
|
||||
* be monotonically increasing.
|
||||
*/
|
||||
for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
|
||||
size = u + 1;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + u);
|
||||
if(status < 0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to insert object into global heap");
|
||||
nerrors++;
|
||||
} else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) {
|
||||
H5_FAILED();
|
||||
puts(" Collection addresses are not monotonically increasing");
|
||||
nerrors++;
|
||||
}
|
||||
size = u + 1;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + u);
|
||||
if(status < 0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to insert object into global heap");
|
||||
nerrors++;
|
||||
} else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) {
|
||||
H5_FAILED();
|
||||
puts(" Collection addresses are not monotonically increasing");
|
||||
nerrors++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now try to read each object back.
|
||||
*/
|
||||
for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
|
||||
size = u + 1;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to read object");
|
||||
nerrors++;
|
||||
} else if(HDmemcmp(in, out, size)) {
|
||||
H5_FAILED();
|
||||
puts(" Value read doesn't match value written");
|
||||
nerrors++;
|
||||
}
|
||||
size = u + 1;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to read object");
|
||||
nerrors++;
|
||||
} else if(HDmemcmp(in, out, size)) {
|
||||
H5_FAILED();
|
||||
puts(" Value read doesn't match value written");
|
||||
nerrors++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release buffer */
|
||||
@ -153,25 +153,25 @@ test_1 (hid_t fapl)
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Fclose(file);
|
||||
H5Fclose(file);
|
||||
} H5E_END_TRY;
|
||||
if(obj)
|
||||
HDfree(obj);
|
||||
return MAX(1, nerrors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_2
|
||||
* Function: test_2
|
||||
*
|
||||
* Purpose: Writes a sequence of objects to the global heap where each
|
||||
* object is smaller than the one before.
|
||||
* Purpose: Writes a sequence of objects to the global heap where each
|
||||
* object is smaller than the one before.
|
||||
*
|
||||
* Return: Success: 0
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: number of errors
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, March 31, 1998
|
||||
*
|
||||
* Modifications:
|
||||
@ -181,15 +181,15 @@ error:
|
||||
static int
|
||||
test_2 (hid_t fapl)
|
||||
{
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
H5HG_t *obj = NULL;
|
||||
uint8_t out[GHEAP_TEST_NOBJS];
|
||||
uint8_t in[GHEAP_TEST_NOBJS];
|
||||
size_t u;
|
||||
size_t size;
|
||||
int nerrors = 0;
|
||||
char filename[1024];
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
H5HG_t *obj = NULL;
|
||||
uint8_t out[GHEAP_TEST_NOBJS];
|
||||
uint8_t in[GHEAP_TEST_NOBJS];
|
||||
size_t u;
|
||||
size_t size;
|
||||
int nerrors = 0;
|
||||
char filename[1024];
|
||||
|
||||
TESTING("monotonically decreasing lengths");
|
||||
|
||||
@ -200,43 +200,43 @@ test_2 (hid_t fapl)
|
||||
/* Open a clean file */
|
||||
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
|
||||
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
||||
goto error;
|
||||
goto error;
|
||||
if(NULL == (f = (H5F_t *)H5I_object(file))) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to create file");
|
||||
goto error;
|
||||
H5_FAILED();
|
||||
puts(" Unable to create file");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the objects, monotonically decreasing in length.
|
||||
*/
|
||||
for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
|
||||
size = GHEAP_TEST_NOBJS - u;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u) < 0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to insert object into global heap");
|
||||
nerrors++;
|
||||
}
|
||||
size = GHEAP_TEST_NOBJS - u;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u) < 0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to insert object into global heap");
|
||||
nerrors++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now try to read each object back.
|
||||
*/
|
||||
for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
|
||||
size = GHEAP_TEST_NOBJS - u;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to read object");
|
||||
nerrors++;
|
||||
} else if (memcmp (in, out, size)) {
|
||||
H5_FAILED();
|
||||
puts(" Value read doesn't match value written");
|
||||
nerrors++;
|
||||
}
|
||||
size = GHEAP_TEST_NOBJS - u;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to read object");
|
||||
nerrors++;
|
||||
} else if (memcmp (in, out, size)) {
|
||||
H5_FAILED();
|
||||
puts(" Value read doesn't match value written");
|
||||
nerrors++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release buffer */
|
||||
@ -251,25 +251,25 @@ test_2 (hid_t fapl)
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Fclose(file);
|
||||
H5Fclose(file);
|
||||
} H5E_END_TRY;
|
||||
if(obj)
|
||||
HDfree(obj);
|
||||
return MAX(1, nerrors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_3
|
||||
* Function: test_3
|
||||
*
|
||||
* Purpose: Creates a few global heap objects and then removes them all.
|
||||
* The collection should also be removed.
|
||||
* Purpose: Creates a few global heap objects and then removes them all.
|
||||
* The collection should also be removed.
|
||||
*
|
||||
* Return: Success: 0
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: number of errors
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, March 31, 1998
|
||||
*
|
||||
* Modifications:
|
||||
@ -279,15 +279,15 @@ test_2 (hid_t fapl)
|
||||
static int
|
||||
test_3 (hid_t fapl)
|
||||
{
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
H5HG_t *obj = NULL;
|
||||
uint8_t out[GHEAP_TEST_NOBJS];
|
||||
size_t u;
|
||||
size_t size;
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
char filename[1024];
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
H5HG_t *obj = NULL;
|
||||
uint8_t out[GHEAP_TEST_NOBJS];
|
||||
size_t u;
|
||||
size_t size;
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
char filename[1024];
|
||||
|
||||
TESTING("complete object removal");
|
||||
|
||||
@ -298,34 +298,34 @@ test_3 (hid_t fapl)
|
||||
/* Open a clean file */
|
||||
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
|
||||
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
||||
goto error;
|
||||
goto error;
|
||||
if(NULL == (f = (H5F_t *)H5I_object(file))) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to create file");
|
||||
goto error;
|
||||
H5_FAILED();
|
||||
puts(" Unable to create file");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Create some stuff */
|
||||
for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
|
||||
size = u % 30 + 100;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u);
|
||||
if (status<0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to insert object into global heap");
|
||||
nerrors++;
|
||||
}
|
||||
size = u % 30 + 100;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u);
|
||||
if (status<0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to insert object into global heap");
|
||||
nerrors++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove everything */
|
||||
for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
|
||||
status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u);
|
||||
if (status<0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to remove object");
|
||||
nerrors++;
|
||||
}
|
||||
status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u);
|
||||
if (status<0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to remove object");
|
||||
nerrors++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release buffer */
|
||||
@ -340,26 +340,26 @@ test_3 (hid_t fapl)
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Fclose(file);
|
||||
H5Fclose(file);
|
||||
} H5E_END_TRY;
|
||||
if(obj)
|
||||
HDfree(obj);
|
||||
return MAX(1, nerrors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_4
|
||||
* Function: test_4
|
||||
*
|
||||
* Purpose: Tests the H5HG_remove() feature by writing lots of objects
|
||||
* and occassionally removing some. When we're done they're all
|
||||
* removed.
|
||||
* Purpose: Tests the H5HG_remove() feature by writing lots of objects
|
||||
* and occassionally removing some. When we're done they're all
|
||||
* removed.
|
||||
*
|
||||
* Return: Success: 0
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: number of errors
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, March 31, 1998
|
||||
*
|
||||
* Modifications:
|
||||
@ -369,15 +369,15 @@ test_3 (hid_t fapl)
|
||||
static int
|
||||
test_4 (hid_t fapl)
|
||||
{
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
H5HG_t *obj = NULL;
|
||||
uint8_t out[GHEAP_TEST_NOBJS];
|
||||
size_t u;
|
||||
size_t size;
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
char filename[1024];
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
H5HG_t *obj = NULL;
|
||||
uint8_t out[GHEAP_TEST_NOBJS];
|
||||
size_t u;
|
||||
size_t size;
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
char filename[1024];
|
||||
|
||||
TESTING("partial object removal");
|
||||
|
||||
@ -388,40 +388,40 @@ test_4 (hid_t fapl)
|
||||
/* Open a clean file */
|
||||
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
|
||||
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
||||
goto error;
|
||||
goto error;
|
||||
if(NULL == (f = (H5F_t *)H5I_object(file))) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to create file");
|
||||
goto error;
|
||||
H5_FAILED();
|
||||
puts(" Unable to create file");
|
||||
goto error;
|
||||
}
|
||||
|
||||
for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
|
||||
/* Insert */
|
||||
size = u % 30 + 100;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u);
|
||||
if (status<0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to insert object into global heap");
|
||||
nerrors++;
|
||||
}
|
||||
/* Insert */
|
||||
size = u % 30 + 100;
|
||||
HDmemset(out, (int)('A' + u % 26), size);
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u);
|
||||
if (status<0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to insert object into global heap");
|
||||
nerrors++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove every third one beginning with the second, but after the
|
||||
* next one has already been inserted. That is, insert A, B, C;
|
||||
* remove B, insert D, E, F; remove E; etc.
|
||||
*/
|
||||
if(1 == (u % 3)) {
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u - 1);
|
||||
if (status<0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to remove object");
|
||||
nerrors++;
|
||||
}
|
||||
HDmemset(obj + u - 1, 0, sizeof *obj);
|
||||
}
|
||||
/*
|
||||
* Remove every third one beginning with the second, but after the
|
||||
* next one has already been inserted. That is, insert A, B, C;
|
||||
* remove B, insert D, E, F; remove E; etc.
|
||||
*/
|
||||
if(1 == (u % 3)) {
|
||||
H5Eclear2(H5E_DEFAULT);
|
||||
status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u - 1);
|
||||
if (status<0) {
|
||||
H5_FAILED();
|
||||
puts(" Unable to remove object");
|
||||
nerrors++;
|
||||
}
|
||||
HDmemset(obj + u - 1, 0, sizeof *obj);
|
||||
}
|
||||
}
|
||||
|
||||
/* Release buffer */
|
||||
@ -436,27 +436,27 @@ test_4 (hid_t fapl)
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Fclose(file);
|
||||
H5Fclose(file);
|
||||
} H5E_END_TRY;
|
||||
if(obj)
|
||||
HDfree(obj);
|
||||
return MAX(1, nerrors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_ooo_indices
|
||||
* Function: test_ooo_indices
|
||||
*
|
||||
* Purpose: Tests that indices can be stored out of order. This can
|
||||
* Purpose: Tests that indices can be stored out of order. This can
|
||||
* happen when the indices "wrap around" due to many
|
||||
* insertions and deletions (for example, from rewriting a
|
||||
* VL dataset).
|
||||
*
|
||||
* Return: Success: 0
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: number of errors
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Neil Fortner
|
||||
* Programmer: Neil Fortner
|
||||
* Monday, October 26, 2009
|
||||
*
|
||||
* Modifications:
|
||||
@ -466,13 +466,13 @@ test_4 (hid_t fapl)
|
||||
static int
|
||||
test_ooo_indices(hid_t fapl)
|
||||
{
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
unsigned i, j;
|
||||
H5HG_t *obj = NULL;
|
||||
herr_t status;
|
||||
int nerrors=0;
|
||||
char filename[1024];
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
unsigned i, j;
|
||||
H5HG_t *obj = NULL;
|
||||
herr_t status;
|
||||
int nerrors=0;
|
||||
char filename[1024];
|
||||
|
||||
TESTING("out of order indices");
|
||||
|
||||
@ -550,24 +550,24 @@ test_ooo_indices(hid_t fapl)
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Fclose(file);
|
||||
H5Fclose(file);
|
||||
} H5E_END_TRY;
|
||||
if(obj)
|
||||
HDfree(obj);
|
||||
return MAX(1, nerrors);
|
||||
} /* end test_ooo_indices */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
* Function: main
|
||||
*
|
||||
* Purpose: Tests global heap.
|
||||
* Purpose: Tests global heap.
|
||||
*
|
||||
* Return: Success: zero
|
||||
* Return: Success: zero
|
||||
*
|
||||
* Failure: non-zero
|
||||
* Failure: non-zero
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, March 31, 1998
|
||||
*
|
||||
* Modifications:
|
||||
@ -577,8 +577,8 @@ test_ooo_indices(hid_t fapl)
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int nerrors=0;
|
||||
hid_t fapl;
|
||||
int nerrors=0;
|
||||
hid_t fapl;
|
||||
|
||||
h5_reset();
|
||||
fapl = h5_fileaccess();
|
||||
|
408
test/hyperslab.c
408
test/hyperslab.c
@ -11,108 +11,108 @@
|
||||
* help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Friday, October 10, 1997
|
||||
/* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Friday, October 10, 1997
|
||||
*
|
||||
* Purpose: Hyperslab operations are rather complex, so this file
|
||||
* attempts to test them extensively so we can be relatively
|
||||
* sure they really work. We only test 1d, 2d, and 3d cases
|
||||
* because testing general dimensionalities would require us to
|
||||
* rewrite much of the hyperslab stuff.
|
||||
* Purpose: Hyperslab operations are rather complex, so this file
|
||||
* attempts to test them extensively so we can be relatively
|
||||
* sure they really work. We only test 1d, 2d, and 3d cases
|
||||
* because testing general dimensionalities would require us to
|
||||
* rewrite much of the hyperslab stuff.
|
||||
*/
|
||||
#include "h5test.h"
|
||||
#include "H5VMprivate.h"
|
||||
|
||||
#define TEST_SMALL 0x0001
|
||||
#define TEST_MEDIUM 0x0002
|
||||
#define TEST_SMALL 0x0001
|
||||
#define TEST_MEDIUM 0x0002
|
||||
|
||||
#define VARIABLE_SRC 0
|
||||
#define VARIABLE_DST 1
|
||||
#define VARIABLE_BOTH 2
|
||||
#define VARIABLE_SRC 0
|
||||
#define VARIABLE_DST 1
|
||||
#define VARIABLE_BOTH 2
|
||||
|
||||
#define ARRAY_FILL_SIZE 4
|
||||
#define ARRAY_OFFSET_NDIMS 3
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: init_full
|
||||
* Function: init_full
|
||||
*
|
||||
* Purpose: Initialize full array.
|
||||
* Purpose: Initialize full array.
|
||||
*
|
||||
* Return: void
|
||||
* Return: void
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static unsigned
|
||||
init_full(uint8_t *array, size_t nx, size_t ny, size_t nz)
|
||||
{
|
||||
uint8_t acc = 128;
|
||||
unsigned total = 0;
|
||||
size_t i, j, k;
|
||||
uint8_t acc = 128;
|
||||
unsigned total = 0;
|
||||
size_t i, j, k;
|
||||
|
||||
for(i = 0; i < nx; i++)
|
||||
for(j = 0; j < ny; j++)
|
||||
for(k = 0; k < nz; k++) {
|
||||
total += acc;
|
||||
*array = acc;
|
||||
acc++;
|
||||
array++;
|
||||
} /* end for */
|
||||
for(j = 0; j < ny; j++)
|
||||
for(k = 0; k < nz; k++) {
|
||||
total += acc;
|
||||
*array = acc;
|
||||
acc++;
|
||||
array++;
|
||||
} /* end for */
|
||||
|
||||
return total;
|
||||
} /* end init_full() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: print_array
|
||||
* Function: print_array
|
||||
*
|
||||
* Purpose: Prints the values in an array
|
||||
* Purpose: Prints the values in an array
|
||||
*
|
||||
* Return: void
|
||||
* Return: void
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
|
||||
{
|
||||
size_t i, j, k;
|
||||
size_t i, j, k;
|
||||
|
||||
for(i = 0; i < nx; i++) {
|
||||
if(nz > 1)
|
||||
printf("i=%lu:\n", (unsigned long)i);
|
||||
else
|
||||
printf("%03lu:", (unsigned long)i);
|
||||
if(nz > 1)
|
||||
printf("i=%lu:\n", (unsigned long)i);
|
||||
else
|
||||
printf("%03lu:", (unsigned long)i);
|
||||
|
||||
for(j = 0; j < ny; j++) {
|
||||
if(nz > 1)
|
||||
printf("%03lu:", (unsigned long)j);
|
||||
for(k = 0; k < nz; k++)
|
||||
printf(" %3d", *array++);
|
||||
if(nz > 1)
|
||||
printf("\n");
|
||||
} /* end for */
|
||||
printf("\n");
|
||||
for(j = 0; j < ny; j++) {
|
||||
if(nz > 1)
|
||||
printf("%03lu:", (unsigned long)j);
|
||||
for(k = 0; k < nz; k++)
|
||||
printf(" %3d", *array++);
|
||||
if(nz > 1)
|
||||
printf("\n");
|
||||
} /* end for */
|
||||
printf("\n");
|
||||
} /* end for */
|
||||
} /* end print_array() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: print_ref
|
||||
* Function: print_ref
|
||||
*
|
||||
* Purpose: Prints the reference value
|
||||
* Purpose: Prints the reference value
|
||||
*
|
||||
* Return: Success: 0
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure:
|
||||
* Failure:
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -129,37 +129,37 @@ print_ref(size_t nx, size_t ny, size_t nz)
|
||||
} /* end if */
|
||||
} /* end print_ref() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_fill
|
||||
* Function: test_fill
|
||||
*
|
||||
* Purpose: Tests the H5VM_hyper_fill() function.
|
||||
* Purpose: Tests the H5VM_hyper_fill() function.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Saturday, October 11, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Saturday, October 11, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
test_fill(size_t nx, size_t ny, size_t nz,
|
||||
size_t di, size_t dj, size_t dk,
|
||||
size_t ddx, size_t ddy, size_t ddz)
|
||||
size_t di, size_t dj, size_t dk,
|
||||
size_t ddx, size_t ddy, size_t ddz)
|
||||
{
|
||||
uint8_t *dst = NULL; /*destination array */
|
||||
hsize_t hs_size[3]; /*hyperslab size */
|
||||
hsize_t dst_size[3]; /*destination total size */
|
||||
uint8_t *dst = NULL; /*destination array */
|
||||
hsize_t hs_size[3]; /*hyperslab size */
|
||||
hsize_t dst_size[3]; /*destination total size */
|
||||
hsize_t dst_offset[3]; /*offset of hyperslab in dest */
|
||||
unsigned ref_value; /*reference value */
|
||||
unsigned acc; /*accumulator */
|
||||
size_t i, j, k, dx, dy, dz; /*counters */
|
||||
unsigned ref_value; /*reference value */
|
||||
unsigned acc; /*accumulator */
|
||||
size_t i, j, k, dx, dy, dz; /*counters */
|
||||
size_t u, v, w;
|
||||
unsigned ndims; /*hyperslab dimensionality */
|
||||
char dim[64], s[256]; /*temp string */
|
||||
unsigned fill_value; /*fill value */
|
||||
unsigned ndims; /*hyperslab dimensionality */
|
||||
char dim[64], s[256]; /*temp string */
|
||||
unsigned fill_value; /*fill value */
|
||||
|
||||
/*
|
||||
* Dimensionality.
|
||||
@ -188,7 +188,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
|
||||
/* Allocate array */
|
||||
if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
|
||||
TEST_ERROR
|
||||
|
||||
|
||||
init_full(dst, nx, ny, nz);
|
||||
|
||||
for(i = 0; i < nx; i += di) {
|
||||
@ -277,52 +277,52 @@ error:
|
||||
return FAIL;
|
||||
} /* end test_fill() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_copy
|
||||
* Function: test_copy
|
||||
*
|
||||
* Purpose: Tests H5VM_hyper_copy().
|
||||
* Purpose: Tests H5VM_hyper_copy().
|
||||
*
|
||||
* The NX, NY, and NZ arguments are the size for the source and
|
||||
* destination arrays. You may pass zero for NZ or for NY and
|
||||
* NZ to test the 2-d and 1-d cases respectively.
|
||||
* The NX, NY, and NZ arguments are the size for the source and
|
||||
* destination arrays. You may pass zero for NZ or for NY and
|
||||
* NZ to test the 2-d and 1-d cases respectively.
|
||||
*
|
||||
* A hyperslab is copied from/to (depending on MODE) various
|
||||
* places in SRC and DST beginning at 0,0,0 and increasing
|
||||
* location by DI,DJ,DK in the x, y, and z directions.
|
||||
* A hyperslab is copied from/to (depending on MODE) various
|
||||
* places in SRC and DST beginning at 0,0,0 and increasing
|
||||
* location by DI,DJ,DK in the x, y, and z directions.
|
||||
*
|
||||
* For each hyperslab location, various sizes of hyperslabs are
|
||||
* tried beginning with 1x1x1 and increasing the size in each
|
||||
* dimension by DDX,DDY,DDZ.
|
||||
* For each hyperslab location, various sizes of hyperslabs are
|
||||
* tried beginning with 1x1x1 and increasing the size in each
|
||||
* dimension by DDX,DDY,DDZ.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
test_copy(int mode,
|
||||
size_t nx, size_t ny, size_t nz,
|
||||
size_t di, size_t dj, size_t dk,
|
||||
size_t ddx, size_t ddy, size_t ddz)
|
||||
size_t nx, size_t ny, size_t nz,
|
||||
size_t di, size_t dj, size_t dk,
|
||||
size_t ddx, size_t ddy, size_t ddz)
|
||||
{
|
||||
uint8_t *src = NULL; /*source array */
|
||||
uint8_t *dst = NULL; /*destination array */
|
||||
hsize_t hs_size[3]; /*hyperslab size */
|
||||
hsize_t dst_size[3]; /*destination total size */
|
||||
hsize_t src_size[3]; /*source total size */
|
||||
hsize_t dst_offset[3]; /*offset of hyperslab in dest */
|
||||
uint8_t *src = NULL; /*source array */
|
||||
uint8_t *dst = NULL; /*destination array */
|
||||
hsize_t hs_size[3]; /*hyperslab size */
|
||||
hsize_t dst_size[3]; /*destination total size */
|
||||
hsize_t src_size[3]; /*source total size */
|
||||
hsize_t dst_offset[3]; /*offset of hyperslab in dest */
|
||||
hsize_t src_offset[3]; /*offset of hyperslab in source */
|
||||
unsigned ref_value; /*reference value */
|
||||
unsigned acc; /*accumulator */
|
||||
hsize_t i, j, k, dx, dy, dz; /*counters */
|
||||
unsigned ref_value; /*reference value */
|
||||
unsigned acc; /*accumulator */
|
||||
hsize_t i, j, k, dx, dy, dz; /*counters */
|
||||
hsize_t u, v, w;
|
||||
unsigned ndims; /*hyperslab dimensionality */
|
||||
char dim[64], s[256]; /*temp string */
|
||||
unsigned ndims; /*hyperslab dimensionality */
|
||||
char dim[64], s[256]; /*temp string */
|
||||
const char *sub;
|
||||
|
||||
/*
|
||||
@ -491,7 +491,7 @@ test_copy(int mode,
|
||||
(unsigned long)dy,
|
||||
(unsigned long)dz);
|
||||
print_ref(nx, ny, nz);
|
||||
printf("\n Destination array is:\n");
|
||||
printf("\n Destination array is:\n");
|
||||
print_array(dst, nx, ny, nz);
|
||||
} /* end if */
|
||||
goto error;
|
||||
@ -533,7 +533,7 @@ test_copy(int mode,
|
||||
(unsigned long)dy,
|
||||
(unsigned long)dz);
|
||||
print_ref(nx, ny, nz);
|
||||
printf("\n Destination array is:\n");
|
||||
printf("\n Destination array is:\n");
|
||||
print_array(dst, nx, ny, nz);
|
||||
} /* end if */
|
||||
goto error;
|
||||
@ -561,38 +561,38 @@ error:
|
||||
return FAIL;
|
||||
} /* end test_copy() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_multifill
|
||||
* Function: test_multifill
|
||||
*
|
||||
* Purpose: Tests the H5VM_stride_copy() function by using it to fill a
|
||||
* hyperslab by replicating a multi-byte sequence. This might
|
||||
* be useful to initialize an array of structs with a default
|
||||
* struct value, or to initialize an array of floating-point
|
||||
* values with a default bit-pattern.
|
||||
* Purpose: Tests the H5VM_stride_copy() function by using it to fill a
|
||||
* hyperslab by replicating a multi-byte sequence. This might
|
||||
* be useful to initialize an array of structs with a default
|
||||
* struct value, or to initialize an array of floating-point
|
||||
* values with a default bit-pattern.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Saturday, October 11, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Saturday, October 11, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
test_multifill(size_t nx)
|
||||
{
|
||||
hsize_t size;
|
||||
hsize_t src_stride;
|
||||
hsize_t dst_stride;
|
||||
char s[64];
|
||||
hsize_t size;
|
||||
hsize_t src_stride;
|
||||
hsize_t dst_stride;
|
||||
char s[64];
|
||||
struct a_struct {
|
||||
int left;
|
||||
double mid;
|
||||
int right;
|
||||
} fill, *src = NULL, *dst = NULL;
|
||||
hsize_t i, j;
|
||||
hsize_t i, j;
|
||||
|
||||
printf("%-70s", "Testing multi-byte fill value");
|
||||
fflush(stdout);
|
||||
@ -613,7 +613,7 @@ test_multifill(size_t nx)
|
||||
} /* end for */
|
||||
|
||||
/*
|
||||
* Describe the fill value. The zero stride says to read the same thing
|
||||
* Describe the fill value. The zero stride says to read the same thing
|
||||
* over and over again.
|
||||
*/
|
||||
fill.left = 55555555;
|
||||
@ -682,32 +682,32 @@ error:
|
||||
return FAIL;
|
||||
} /* end test_multifill() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_endian
|
||||
* Function: test_endian
|
||||
*
|
||||
* Purpose: Tests the H5VM_stride_copy() function by using it to copy an
|
||||
* array of integers and swap the byte ordering from little
|
||||
* endian to big endian or vice versa depending on the hardware.
|
||||
* Purpose: Tests the H5VM_stride_copy() function by using it to copy an
|
||||
* array of integers and swap the byte ordering from little
|
||||
* endian to big endian or vice versa depending on the hardware.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Saturday, October 11, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Saturday, October 11, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
test_endian(size_t nx)
|
||||
{
|
||||
uint8_t *src = NULL; /*source array */
|
||||
uint8_t *dst = NULL; /*destination array */
|
||||
hssize_t src_stride[2]; /*source strides */
|
||||
hssize_t dst_stride[2]; /*destination strides */
|
||||
hsize_t size[2]; /*size vector */
|
||||
hsize_t i, j;
|
||||
uint8_t *src = NULL; /*source array */
|
||||
uint8_t *dst = NULL; /*destination array */
|
||||
hssize_t src_stride[2]; /*source strides */
|
||||
hssize_t dst_stride[2]; /*destination strides */
|
||||
hsize_t size[2]; /*size vector */
|
||||
hsize_t i, j;
|
||||
|
||||
printf("%-70s", "Testing endian conversion by stride");
|
||||
fflush(stdout);
|
||||
@ -745,7 +745,7 @@ test_endian(size_t nx)
|
||||
printf(" i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j);
|
||||
printf(" Source array is:\n");
|
||||
print_array(src, nx, (size_t)4, (size_t)1);
|
||||
printf("\n Result is:\n");
|
||||
printf("\n Result is:\n");
|
||||
print_array(dst, nx, (size_t)4, (size_t)1);
|
||||
} /* end if */
|
||||
goto error;
|
||||
@ -769,31 +769,31 @@ error:
|
||||
return FAIL;
|
||||
} /* end test_endian() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_transpose
|
||||
* Function: test_transpose
|
||||
*
|
||||
* Purpose: Copy a 2d array from here to there and transpose the elements
|
||||
* as it's copied.
|
||||
* Purpose: Copy a 2d array from here to there and transpose the elements
|
||||
* as it's copied.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Saturday, October 11, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Saturday, October 11, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
test_transpose(size_t nx, size_t ny)
|
||||
{
|
||||
int *src = NULL;
|
||||
int *dst = NULL;
|
||||
hsize_t src_stride[2], dst_stride[2];
|
||||
hsize_t size[2];
|
||||
char s[256];
|
||||
hsize_t i, j;
|
||||
int *src = NULL;
|
||||
int *dst = NULL;
|
||||
hsize_t src_stride[2], dst_stride[2];
|
||||
hsize_t size[2];
|
||||
char s[256];
|
||||
hsize_t i, j;
|
||||
|
||||
sprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx,
|
||||
(unsigned long)ny);
|
||||
@ -841,7 +841,7 @@ test_transpose(size_t nx, size_t ny)
|
||||
printf(" %6d", src[i * ny + j]);
|
||||
printf("\n");
|
||||
} /* end for */
|
||||
printf("\n Destination is:\n");
|
||||
printf("\n Destination is:\n");
|
||||
for (i = 0; i < ny; i++) {
|
||||
printf("%3lu:", (unsigned long)i);
|
||||
for(j = 0; j < nx; j++)
|
||||
@ -870,35 +870,35 @@ error:
|
||||
return FAIL;
|
||||
} /* end test_transpose() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_sub_super
|
||||
* Function: test_sub_super
|
||||
*
|
||||
* Purpose: Tests H5VM_stride_copy() to reduce the resolution of an image
|
||||
* by copying half the pixels in the X and Y directions. Then
|
||||
* we use the small image and duplicate every pixel to result in
|
||||
* a 2x2 square.
|
||||
* Purpose: Tests H5VM_stride_copy() to reduce the resolution of an image
|
||||
* by copying half the pixels in the X and Y directions. Then
|
||||
* we use the small image and duplicate every pixel to result in
|
||||
* a 2x2 square.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, October 13, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, October 13, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
test_sub_super(size_t nx, size_t ny)
|
||||
{
|
||||
uint8_t *full = NULL; /*original image */
|
||||
uint8_t *half = NULL; /*image at 1/2 resolution */
|
||||
uint8_t *twice = NULL; /*2x2 pixels */
|
||||
hsize_t src_stride[4]; /*source stride info */
|
||||
hsize_t dst_stride[4]; /*destination stride info */
|
||||
hsize_t size[4]; /*number of sample points */
|
||||
hsize_t i, j;
|
||||
char s[256];
|
||||
uint8_t *full = NULL; /*original image */
|
||||
uint8_t *half = NULL; /*image at 1/2 resolution */
|
||||
uint8_t *twice = NULL; /*2x2 pixels */
|
||||
hsize_t src_stride[4]; /*source stride info */
|
||||
hsize_t dst_stride[4]; /*destination stride info */
|
||||
hsize_t size[4]; /*number of sample points */
|
||||
hsize_t i, j;
|
||||
char s[256];
|
||||
|
||||
sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
|
||||
(unsigned long)(2 * nx), (unsigned long)(2 * ny),
|
||||
@ -940,7 +940,7 @@ test_sub_super(size_t nx, size_t ny)
|
||||
(unsigned long)i, (unsigned long)j);
|
||||
printf(" full is:\n");
|
||||
print_array(full, 2 * nx, 2 * ny, (size_t)1);
|
||||
printf("\n half is:\n");
|
||||
printf("\n half is:\n");
|
||||
print_array(half, nx, ny, (size_t)1);
|
||||
} /* end if */
|
||||
goto error;
|
||||
@ -1003,7 +1003,7 @@ test_sub_super(size_t nx, size_t ny)
|
||||
AT();
|
||||
printf(" %s\n Half is:\n", s);
|
||||
print_array(half, nx, ny, (size_t)1);
|
||||
printf("\n Twice is:\n");
|
||||
printf("\n Twice is:\n");
|
||||
print_array(twice, 2 * nx, 2 * ny, (size_t)1);
|
||||
} /* end if */
|
||||
goto error;
|
||||
@ -1030,20 +1030,20 @@ error:
|
||||
return FAIL;
|
||||
} /* test_sub_super() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_fill
|
||||
* Function: test_array_fill
|
||||
*
|
||||
* Purpose: Tests H5VM_array_fill routine by copying a multibyte value
|
||||
* Purpose: Tests H5VM_array_fill routine by copying a multibyte value
|
||||
* (an array of ints, in our case) into all the elements of an
|
||||
* array.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, April 21, 2003
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, April 21, 2003
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1052,8 +1052,8 @@ test_array_fill(size_t lo, size_t hi)
|
||||
{
|
||||
int *dst = NULL; /* Destination */
|
||||
int src[ARRAY_FILL_SIZE]; /* Source to duplicate */
|
||||
size_t u, v, w; /* Local index variables */
|
||||
char s[256];
|
||||
size_t u, v, w; /* Local index variables */
|
||||
char s[256];
|
||||
|
||||
sprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo,(unsigned long)hi);
|
||||
TESTING(s);
|
||||
@ -1091,20 +1091,20 @@ error:
|
||||
return FAIL;
|
||||
} /* end test_array_fill() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_offset_n_calc
|
||||
* Function: test_array_offset_n_calc
|
||||
*
|
||||
* Purpose: Tests H5VM_array_offset and H5VM_array_calc routines by comparing
|
||||
* Purpose: Tests H5VM_array_offset and H5VM_array_calc routines by comparing
|
||||
* computed array offsets against calculated ones and then going
|
||||
* back to the coordinates from the offset and checking those.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, April 21, 2003
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, April 21, 2003
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1114,11 +1114,11 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
|
||||
hsize_t *a = NULL;
|
||||
hsize_t *temp_a; /* Array for stored calculated offsets */
|
||||
hsize_t off; /* Offset in array */
|
||||
size_t u, v, w; /* Local index variables */
|
||||
size_t u, v, w; /* Local index variables */
|
||||
hsize_t dims[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of array to check */
|
||||
hsize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */
|
||||
hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */
|
||||
char s[256];
|
||||
char s[256];
|
||||
|
||||
sprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x);
|
||||
TESTING(s);
|
||||
@ -1176,29 +1176,29 @@ error:
|
||||
return FAIL;
|
||||
} /* end test_array_offset_n_calc() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
* Function: main
|
||||
*
|
||||
* Purpose: Test various hyperslab operations. Give the words
|
||||
* `small' and/or `medium' on the command line or only `small'
|
||||
* is assumed.
|
||||
* Purpose: Test various hyperslab operations. Give the words
|
||||
* `small' and/or `medium' on the command line or only `small'
|
||||
* is assumed.
|
||||
*
|
||||
* Return: Success: exit(EXIT_SUCCESS)
|
||||
* Return: Success: exit(EXIT_SUCCESS)
|
||||
*
|
||||
* Failure: exit(EXIT_FAILURE)
|
||||
* Failure: exit(EXIT_FAILURE)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
unsigned size_of_test;
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
unsigned size_of_test;
|
||||
|
||||
/* Parse arguments or assume `small' & `medium' */
|
||||
if(1 == argc)
|
||||
|
490
test/istore.c
490
test/istore.c
@ -11,13 +11,13 @@
|
||||
* help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Wednesday, October 15, 1997
|
||||
/* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Wednesday, October 15, 1997
|
||||
*
|
||||
* Purpose: Tests various aspects of indexed raw data storage.
|
||||
* Purpose: Tests various aspects of indexed raw data storage.
|
||||
*/
|
||||
|
||||
#define H5F_FRIEND /*suppress error about including H5Fpkg */
|
||||
#define H5F_FRIEND /*suppress error about including H5Fpkg */
|
||||
|
||||
#include "h5test.h"
|
||||
|
||||
@ -35,9 +35,9 @@ const char *FILENAME[] = {
|
||||
};
|
||||
|
||||
|
||||
#define TEST_SMALL 0x0001
|
||||
#define TEST_MEDIUM 0x0002
|
||||
#define TEST_LARGE 0x0004
|
||||
#define TEST_SMALL 0x0001
|
||||
#define TEST_MEDIUM 0x0002
|
||||
#define TEST_LARGE 0x0004
|
||||
|
||||
/* The datatype of the dataset operated on by this test */
|
||||
#define TEST_DATATYPE H5T_NATIVE_UCHAR
|
||||
@ -48,19 +48,19 @@ const char *FILENAME[] = {
|
||||
hsize_t chunk_dims[H5O_LAYOUT_NDIMS];
|
||||
hsize_t zero[H5O_LAYOUT_NDIMS];
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: is_sparse
|
||||
* Function: is_sparse
|
||||
*
|
||||
* Purpose: Determines if the file system of the current working
|
||||
* directory supports holes.
|
||||
* Purpose: Determines if the file system of the current working
|
||||
* directory supports holes.
|
||||
*
|
||||
* Return: Success: Non-zero if holes are supported; zero
|
||||
* otherwise.
|
||||
* Return: Success: Non-zero if holes are supported; zero
|
||||
* otherwise.
|
||||
*
|
||||
* Failure: zero
|
||||
* Failure: zero
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, July 15, 1998
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
@ -68,8 +68,8 @@ hsize_t zero[H5O_LAYOUT_NDIMS];
|
||||
static int
|
||||
is_sparse(void)
|
||||
{
|
||||
int fd;
|
||||
h5_stat_t sb;
|
||||
int fd;
|
||||
h5_stat_t sb;
|
||||
|
||||
if ((fd = HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) return 0;
|
||||
if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
|
||||
@ -84,16 +84,16 @@ is_sparse(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: print_array
|
||||
* Function: print_array
|
||||
*
|
||||
* Purpose: Prints the values in an array
|
||||
* Purpose: Prints the values in an array
|
||||
*
|
||||
* Return: void
|
||||
* Return: void
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, October 10, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -102,41 +102,41 @@ is_sparse(void)
|
||||
static void
|
||||
print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
|
||||
{
|
||||
size_t i, j, k;
|
||||
size_t i, j, k;
|
||||
|
||||
for (i = 0; i < nx; i++) {
|
||||
if (nz > 1) {
|
||||
fprintf(stderr,"i=%lu:\n", (unsigned long)i);
|
||||
} else {
|
||||
fprintf(stderr,"%03lu:", (unsigned long)i);
|
||||
}
|
||||
if (nz > 1) {
|
||||
fprintf(stderr,"i=%lu:\n", (unsigned long)i);
|
||||
} else {
|
||||
fprintf(stderr,"%03lu:", (unsigned long)i);
|
||||
}
|
||||
|
||||
for (j = 0; j < ny; j++) {
|
||||
if (nz > 1)
|
||||
fprintf(stderr,"%03lu:", (unsigned long)j);
|
||||
for (k = 0; k < nz; k++) {
|
||||
fprintf(stderr," %3d", *array++);
|
||||
}
|
||||
if (nz > 1)
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
for (j = 0; j < ny; j++) {
|
||||
if (nz > 1)
|
||||
fprintf(stderr,"%03lu:", (unsigned long)j);
|
||||
for (k = 0; k < nz; k++) {
|
||||
fprintf(stderr," %3d", *array++);
|
||||
}
|
||||
if (nz > 1)
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: new_object
|
||||
* Function: new_object
|
||||
*
|
||||
* Purpose: Creates a new object that refers to a indexed storage of raw
|
||||
* data. No raw data is stored.
|
||||
* Purpose: Creates a new object that refers to a indexed storage of raw
|
||||
* data. No raw data is stored.
|
||||
*
|
||||
* Return: Success: ID of dataset
|
||||
* Return: Success: ID of dataset
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: -1
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 15, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 15, 1997
|
||||
*
|
||||
* Modifications:
|
||||
* Converted to use datasets instead of directly messing with
|
||||
@ -180,19 +180,19 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_create
|
||||
* Function: test_create
|
||||
*
|
||||
* Purpose: Creates a named object that refers to indexed storage of raw
|
||||
* data. No raw data is stored.
|
||||
* Purpose: Creates a named object that refers to indexed storage of raw
|
||||
* data. No raw data is stored.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 15, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 15, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -215,9 +215,9 @@ test_create(hid_t f, const char *prefix)
|
||||
dims[u] = my_chunk_dims[u] = 2;
|
||||
|
||||
/* Create chunked dataset of this dimensionality */
|
||||
HDsnprintf(name, sizeof name, "%s_%02u", prefix, u);
|
||||
if ((dataset=new_object(f, name, (int)u, dims, my_chunk_dims)) < 0)
|
||||
return FAIL;
|
||||
HDsnprintf(name, sizeof name, "%s_%02u", prefix, u);
|
||||
if ((dataset=new_object(f, name, (int)u, dims, my_chunk_dims)) < 0)
|
||||
return FAIL;
|
||||
|
||||
/* Close dataset created */
|
||||
if(H5Dclose(dataset) < 0)
|
||||
@ -228,20 +228,20 @@ test_create(hid_t f, const char *prefix)
|
||||
return SUCCEED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_extend
|
||||
* Function: test_extend
|
||||
*
|
||||
* Purpose: Creates an empty object and then writes to it in such a way
|
||||
* as to always extend the object's domain without creating
|
||||
* holes and without causing the object to become concave.
|
||||
* Purpose: Creates an empty object and then writes to it in such a way
|
||||
* as to always extend the object's domain without creating
|
||||
* holes and without causing the object to become concave.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 15, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 15, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -249,35 +249,35 @@ test_create(hid_t f, const char *prefix)
|
||||
*/
|
||||
static herr_t
|
||||
test_extend(hid_t f, const char *prefix,
|
||||
size_t nx, size_t ny, size_t nz)
|
||||
size_t nx, size_t ny, size_t nz)
|
||||
{
|
||||
hid_t dataset; /* Dataset ID */
|
||||
hid_t fspace; /* Dataset's file dataspace */
|
||||
hid_t mspace; /* Dataset's memory dataspace */
|
||||
size_t i, j, k, ctr;
|
||||
int ndims;
|
||||
uint8_t *buf = NULL, *check = NULL, *whole = NULL;
|
||||
char dims[64], s[256], name[256];
|
||||
hsize_t offset[3];
|
||||
hsize_t max_corner[3];
|
||||
hsize_t size[3];
|
||||
hsize_t whole_size[3];
|
||||
hsize_t nelmts;
|
||||
size_t i, j, k, ctr;
|
||||
int ndims;
|
||||
uint8_t *buf = NULL, *check = NULL, *whole = NULL;
|
||||
char dims[64], s[256], name[256];
|
||||
hsize_t offset[3];
|
||||
hsize_t max_corner[3];
|
||||
hsize_t size[3];
|
||||
hsize_t whole_size[3];
|
||||
hsize_t nelmts;
|
||||
|
||||
if (!nz) {
|
||||
if (!ny) {
|
||||
ndims = 1;
|
||||
ny = nz = 1;
|
||||
sprintf(dims, "%lu", (unsigned long) nx);
|
||||
} else {
|
||||
ndims = 2;
|
||||
nz = 1;
|
||||
sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
|
||||
}
|
||||
if (!ny) {
|
||||
ndims = 1;
|
||||
ny = nz = 1;
|
||||
sprintf(dims, "%lu", (unsigned long) nx);
|
||||
} else {
|
||||
ndims = 3;
|
||||
sprintf(dims, "%lux%lux%lu",
|
||||
(unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
|
||||
ndims = 2;
|
||||
nz = 1;
|
||||
sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
|
||||
}
|
||||
} else {
|
||||
ndims = 3;
|
||||
sprintf(dims, "%lux%lux%lu",
|
||||
(unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
|
||||
}
|
||||
|
||||
sprintf(s, "istore extend: %s", dims);
|
||||
@ -296,57 +296,57 @@ test_extend(hid_t f, const char *prefix,
|
||||
/* Build the new empty object */
|
||||
sprintf(name, "%s_%s", prefix, dims);
|
||||
if ((dataset=new_object(f, name, ndims, whole_size, whole_size)) < 0) {
|
||||
fprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name);
|
||||
goto error;
|
||||
fprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Get dataset's dataspace */
|
||||
if((fspace=H5Dget_space(dataset)) < 0) TEST_ERROR;
|
||||
|
||||
for (ctr = 0;
|
||||
H5VM_vector_lt_u((unsigned)ndims, max_corner, whole_size);
|
||||
ctr++) {
|
||||
H5VM_vector_lt_u((unsigned)ndims, max_corner, whole_size);
|
||||
ctr++) {
|
||||
|
||||
/* Size and location */
|
||||
if (0 == ctr) {
|
||||
offset[0] = offset[1] = offset[2] = 0;
|
||||
size[0] = size[1] = size[2] = 1;
|
||||
nelmts = 1;
|
||||
} else {
|
||||
for (i=0, nelmts=1; i<(size_t)ndims; i++) {
|
||||
if (ctr % (size_t)ndims == i) {
|
||||
offset[i] = max_corner[i];
|
||||
size[i] = MIN(1, whole_size[i] - offset[i]);
|
||||
} else {
|
||||
offset[i] = 0;
|
||||
size[i] = max_corner[i];
|
||||
}
|
||||
nelmts *= size[i];
|
||||
}
|
||||
}
|
||||
/* Size and location */
|
||||
if (0 == ctr) {
|
||||
offset[0] = offset[1] = offset[2] = 0;
|
||||
size[0] = size[1] = size[2] = 1;
|
||||
nelmts = 1;
|
||||
} else {
|
||||
for (i=0, nelmts=1; i<(size_t)ndims; i++) {
|
||||
if (ctr % (size_t)ndims == i) {
|
||||
offset[i] = max_corner[i];
|
||||
size[i] = MIN(1, whole_size[i] - offset[i]);
|
||||
} else {
|
||||
offset[i] = 0;
|
||||
size[i] = max_corner[i];
|
||||
}
|
||||
nelmts *= size[i];
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (0 == ctr)
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," Insert: ctr=%lu, corner=(%ld", (unsigned long)ctr, (long)offset[0]);
|
||||
if (ndims > 1)
|
||||
fprintf(stderr,",%ld", (long)offset[1]);
|
||||
if (ndims > 2)
|
||||
fprintf(stderr,",%ld", (long)offset[2]);
|
||||
fprintf(stderr,"), size=(%lu", (unsigned long)size[0]);
|
||||
if (ndims > 1)
|
||||
fprintf(stderr,",%lu", (unsigned long)size[1]);
|
||||
if (ndims > 2)
|
||||
fprintf(stderr,",%lu", (unsigned long)size[2]);
|
||||
fprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s");
|
||||
if (0 == nelmts)
|
||||
fprintf(stderr," *SKIPPED*");
|
||||
fprintf(stderr,"\n");
|
||||
if (0 == ctr)
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," Insert: ctr=%lu, corner=(%ld", (unsigned long)ctr, (long)offset[0]);
|
||||
if (ndims > 1)
|
||||
fprintf(stderr,",%ld", (long)offset[1]);
|
||||
if (ndims > 2)
|
||||
fprintf(stderr,",%ld", (long)offset[2]);
|
||||
fprintf(stderr,"), size=(%lu", (unsigned long)size[0]);
|
||||
if (ndims > 1)
|
||||
fprintf(stderr,",%lu", (unsigned long)size[1]);
|
||||
if (ndims > 2)
|
||||
fprintf(stderr,",%lu", (unsigned long)size[2]);
|
||||
fprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s");
|
||||
if (0 == nelmts)
|
||||
fprintf(stderr," *SKIPPED*");
|
||||
fprintf(stderr,"\n");
|
||||
#endif
|
||||
|
||||
/* Fill the source array */
|
||||
if (0 == nelmts) continue;
|
||||
HDmemset(buf, (signed)(128+ctr), (size_t)nelmts);
|
||||
/* Fill the source array */
|
||||
if (0 == nelmts) continue;
|
||||
HDmemset(buf, (signed)(128+ctr), (size_t)nelmts);
|
||||
|
||||
/* Create dataspace for selection in memory */
|
||||
if((mspace=H5Screate_simple(1,&nelmts,NULL)) < 0) TEST_ERROR;
|
||||
@ -354,72 +354,72 @@ test_extend(hid_t f, const char *prefix,
|
||||
/* Select region in file dataspace */
|
||||
if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL) < 0) TEST_ERROR;
|
||||
|
||||
/* Write to disk */
|
||||
if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr);
|
||||
goto error;
|
||||
}
|
||||
/* Write to disk */
|
||||
if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Read from disk */
|
||||
HDmemset(check, 0xff, (size_t)nelmts);
|
||||
if (H5Dread(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, check) < 0) {
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr);
|
||||
goto error;
|
||||
}
|
||||
if (HDmemcmp(buf, check, (size_t)nelmts)) {
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr);
|
||||
fprintf(stderr," Wrote:\n");
|
||||
print_array(buf, (size_t)size[0], (size_t)size[1],
|
||||
(size_t)size[2]);
|
||||
fprintf(stderr," Read:\n");
|
||||
print_array(check, (size_t)size[0], (size_t)size[1],
|
||||
(size_t)size[2]);
|
||||
goto error;
|
||||
}
|
||||
/* Read from disk */
|
||||
HDmemset(check, 0xff, (size_t)nelmts);
|
||||
if (H5Dread(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, check) < 0) {
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr);
|
||||
goto error;
|
||||
}
|
||||
if (HDmemcmp(buf, check, (size_t)nelmts)) {
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr);
|
||||
fprintf(stderr," Wrote:\n");
|
||||
print_array(buf, (size_t)size[0], (size_t)size[1],
|
||||
(size_t)size[2]);
|
||||
fprintf(stderr," Read:\n");
|
||||
print_array(check, (size_t)size[0], (size_t)size[1],
|
||||
(size_t)size[2]);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Close memory dataspace */
|
||||
if(H5Sclose(mspace) < 0) TEST_ERROR;
|
||||
|
||||
/* Write to `whole' buffer for later checking */
|
||||
H5VM_hyper_copy((unsigned)ndims, size,
|
||||
whole_size, offset, whole, /*dst*/
|
||||
size, H5VM_ZERO, buf); /*src*/
|
||||
/* Write to `whole' buffer for later checking */
|
||||
H5VM_hyper_copy((unsigned)ndims, size,
|
||||
whole_size, offset, whole, /*dst*/
|
||||
size, H5VM_ZERO, buf); /*src*/
|
||||
|
||||
/* Update max corner */
|
||||
for (i=0; i<(size_t)ndims; i++)
|
||||
max_corner[i] = MAX(max_corner[i], offset[i]+size[i]);
|
||||
/* Update max corner */
|
||||
for (i=0; i<(size_t)ndims; i++)
|
||||
max_corner[i] = MAX(max_corner[i], offset[i]+size[i]);
|
||||
}
|
||||
|
||||
/* Now read the entire array back out and check it */
|
||||
HDmemset(buf, 0xff, nx * ny * nz);
|
||||
if (H5Dread(dataset, TEST_DATATYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Read failed for whole array.\n");
|
||||
goto error;
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Read failed for whole array.\n");
|
||||
goto error;
|
||||
}
|
||||
for (i=0; i<nx; i++) {
|
||||
for (j=0; j<ny; j++) {
|
||||
for (k=0; k<nz; k++) {
|
||||
if (whole[i*ny*nz + j*nz + k] != buf[i*ny*nz + j*nz + k]) {
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Check failed at i=%lu", (unsigned long)i);
|
||||
if (ndims > 1) {
|
||||
fprintf(stderr,", j=%lu", (unsigned long)j);
|
||||
}
|
||||
if (ndims > 2) {
|
||||
fprintf(stderr,", k=%lu", (unsigned long)k);
|
||||
}
|
||||
fprintf(stderr,"\n Check array is:\n");
|
||||
print_array(whole, nx, ny, nz);
|
||||
fprintf(stderr," Value read is:\n");
|
||||
print_array(buf, nx, ny, nz);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j=0; j<ny; j++) {
|
||||
for (k=0; k<nz; k++) {
|
||||
if (whole[i*ny*nz + j*nz + k] != buf[i*ny*nz + j*nz + k]) {
|
||||
H5_FAILED();
|
||||
fprintf(stderr," Check failed at i=%lu", (unsigned long)i);
|
||||
if (ndims > 1) {
|
||||
fprintf(stderr,", j=%lu", (unsigned long)j);
|
||||
}
|
||||
if (ndims > 2) {
|
||||
fprintf(stderr,", k=%lu", (unsigned long)k);
|
||||
}
|
||||
fprintf(stderr,"\n Check array is:\n");
|
||||
print_array(whole, nx, ny, nz);
|
||||
fprintf(stderr," Value read is:\n");
|
||||
print_array(buf, nx, ny, nz);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Close dataset's dataspace */
|
||||
@ -443,19 +443,19 @@ error:
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_sparse
|
||||
* Function: test_sparse
|
||||
*
|
||||
* Purpose: Creates a sparse matrix consisting of NBLOCKS randomly placed
|
||||
* blocks each of size NX,NY,NZ.
|
||||
* Purpose: Creates a sparse matrix consisting of NBLOCKS randomly placed
|
||||
* blocks each of size NX,NY,NZ.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 22, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 22, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -463,34 +463,34 @@ error:
|
||||
*/
|
||||
static herr_t
|
||||
test_sparse(hid_t f, const char *prefix, size_t nblocks,
|
||||
size_t nx, size_t ny, size_t nz, int skip_test)
|
||||
size_t nx, size_t ny, size_t nz, int skip_test)
|
||||
{
|
||||
hid_t dataset; /* Dataset ID */
|
||||
hid_t fspace; /* Dataset's file dataspace */
|
||||
hid_t mspace; /* Dataset's memory dataspace */
|
||||
int ndims;
|
||||
hsize_t ctr;
|
||||
char dims[64], s[256], name[256];
|
||||
hsize_t offset[3];
|
||||
hsize_t size[3], total = 0;
|
||||
uint8_t *buf = NULL;
|
||||
hsize_t whole_size[3]; /* Size of dataset's dataspace */
|
||||
int ndims;
|
||||
hsize_t ctr;
|
||||
char dims[64], s[256], name[256];
|
||||
hsize_t offset[3];
|
||||
hsize_t size[3], total = 0;
|
||||
uint8_t *buf = NULL;
|
||||
hsize_t whole_size[3]; /* Size of dataset's dataspace */
|
||||
size_t u; /* Local index variable */
|
||||
|
||||
if (!nz) {
|
||||
if (!ny) {
|
||||
ndims = 1;
|
||||
ny = nz = 1;
|
||||
sprintf(dims, "%lu", (unsigned long) nx);
|
||||
} else {
|
||||
ndims = 2;
|
||||
nz = 1;
|
||||
sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
|
||||
}
|
||||
if (!ny) {
|
||||
ndims = 1;
|
||||
ny = nz = 1;
|
||||
sprintf(dims, "%lu", (unsigned long) nx);
|
||||
} else {
|
||||
ndims = 3;
|
||||
sprintf(dims, "%lux%lux%lu",
|
||||
(unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
|
||||
ndims = 2;
|
||||
nz = 1;
|
||||
sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
|
||||
}
|
||||
} else {
|
||||
ndims = 3;
|
||||
sprintf(dims, "%lux%lux%lu",
|
||||
(unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
|
||||
}
|
||||
|
||||
sprintf(s, "istore sparse: %s", dims);
|
||||
@ -514,8 +514,8 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
|
||||
/* Build the new empty object */
|
||||
sprintf(name, "%s_%s", prefix, dims);
|
||||
if ((dataset=new_object(f, name, ndims, whole_size, chunk_dims)) < 0) {
|
||||
printf(" Cannot create %u-d object `%s'\n", ndims, name);
|
||||
goto error;
|
||||
printf(" Cannot create %u-d object `%s'\n", ndims, name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Get dataset's dataspace */
|
||||
@ -532,29 +532,29 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
|
||||
/* Select region in file dataspace */
|
||||
if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL) < 0) TEST_ERROR;
|
||||
|
||||
/* write to disk */
|
||||
if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
|
||||
H5_FAILED();
|
||||
printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
|
||||
printf(" offset=(%lu", (unsigned long) (offset[0]));
|
||||
if (ndims > 1)
|
||||
printf(",%lu", (unsigned long) (offset[1]));
|
||||
if (ndims > 2)
|
||||
printf(",%lu", (unsigned long) (offset[2]));
|
||||
printf("), size=(%lu", (unsigned long) (size[0]));
|
||||
if (ndims > 1)
|
||||
printf(",%lu", (unsigned long) (size[1]));
|
||||
if (ndims > 2)
|
||||
printf(",%lu", (unsigned long) (size[2]));
|
||||
printf(")\n");
|
||||
goto error;
|
||||
}
|
||||
total += nx * ny * nz;
|
||||
/* write to disk */
|
||||
if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
|
||||
H5_FAILED();
|
||||
printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
|
||||
printf(" offset=(%lu", (unsigned long) (offset[0]));
|
||||
if (ndims > 1)
|
||||
printf(",%lu", (unsigned long) (offset[1]));
|
||||
if (ndims > 2)
|
||||
printf(",%lu", (unsigned long) (offset[2]));
|
||||
printf("), size=(%lu", (unsigned long) (size[0]));
|
||||
if (ndims > 1)
|
||||
printf(",%lu", (unsigned long) (size[1]));
|
||||
if (ndims > 2)
|
||||
printf(",%lu", (unsigned long) (size[2]));
|
||||
printf(")\n");
|
||||
goto error;
|
||||
}
|
||||
total += nx * ny * nz;
|
||||
#if 0
|
||||
HDfprintf(stderr,"ctr: ctr=%Zu, total=%Zu\n", ctr, total);
|
||||
HDfprintf(stderr,"ctr: ctr=%Zu, total=%Zu\n", ctr, total);
|
||||
#endif
|
||||
|
||||
/* We don't test reading yet.... */
|
||||
/* We don't test reading yet.... */
|
||||
}
|
||||
|
||||
/* Close memory dataspace */
|
||||
@ -575,18 +575,18 @@ error:
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
* Function: main
|
||||
*
|
||||
* Purpose: Tests indexed storage stuff.
|
||||
* Purpose: Tests indexed storage stuff.
|
||||
*
|
||||
* Return: Success: exit(EXIT_SUCCESS)
|
||||
* Return: Success: exit(EXIT_SUCCESS)
|
||||
*
|
||||
* Failure: exit(EXIT_FAILURE)
|
||||
* Failure: exit(EXIT_FAILURE)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 15, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, October 15, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -595,12 +595,12 @@ error:
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
hid_t fapl=-1, file=-1, fcpl=-1;
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
unsigned size_of_test;
|
||||
hid_t fapl=-1, file=-1, fcpl=-1;
|
||||
herr_t status;
|
||||
int nerrors = 0;
|
||||
unsigned size_of_test;
|
||||
unsigned u; /* Local index variable */
|
||||
char filename[1024];
|
||||
char filename[1024];
|
||||
int skip_test = 0;
|
||||
int has_sparse_support = 0;
|
||||
|
||||
@ -608,7 +608,7 @@ main(int argc, char *argv[])
|
||||
if (1 == argc) {
|
||||
size_of_test = TEST_SMALL | TEST_MEDIUM | TEST_LARGE;
|
||||
} else {
|
||||
int i;
|
||||
int i;
|
||||
for (i = 1, size_of_test = 0; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "small")) {
|
||||
size_of_test |= TEST_SMALL;
|
||||
|
@ -6920,6 +6920,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
|
||||
H5FD_mem_t type; /* File allocation type */
|
||||
H5FS_stat_t fs_stat; /* Information for free-space manager */
|
||||
haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
|
||||
haddr_t addrx;
|
||||
H5FD_mem_t fs_type;
|
||||
hbool_t contig_addr_vfd;
|
||||
hbool_t ran_H5MF_tidy_self_referential_fsm_hack = FALSE;
|
||||
@ -7054,6 +7055,12 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
|
||||
if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr4, (hsize_t)TBLOCK_SIZE4) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if(!new_format) {
|
||||
/* Need to take up this space so that the free-space manager will go away */
|
||||
if(HADDR_UNDEF == (addrx = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)103)))
|
||||
FAIL_STACK_ERROR
|
||||
}
|
||||
|
||||
/* The H5FD_MEM_SUPER free-space manager will go away at H5MF_close() */
|
||||
if(H5Fclose(file) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
@ -7065,7 +7072,6 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
|
||||
/* Get a pointer to the internal file object */
|
||||
if(NULL == (f = (H5F_t *)H5I_object(file)))
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
/* Verify that the H5FD_MEM_SUPER free-space manager is not there */
|
||||
if(H5F_addr_defined(f->shared->fs_addr[fs_type]))
|
||||
TEST_ERROR
|
||||
|
1790
test/objcopy.c
1790
test/objcopy.c
File diff suppressed because it is too large
Load Diff
97
test/ohdr.c
97
test/ohdr.c
@ -738,49 +738,100 @@ error:
|
||||
return FAIL;
|
||||
} /* test_unknown() */
|
||||
|
||||
#define STR_EARLIEST "earliest"
|
||||
#define STR_V18 "v18"
|
||||
#define STR_LATEST "latest"
|
||||
char *version_string(H5F_libver_t libver)
|
||||
{
|
||||
char *str = NULL;
|
||||
|
||||
str = (char *) HDmalloc(20);
|
||||
if (str == NULL)
|
||||
{
|
||||
fprintf(stderr, "Allocation failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
switch(libver) {
|
||||
case H5F_LIBVER_EARLIEST:
|
||||
strcpy(str, STR_EARLIEST);
|
||||
break;
|
||||
|
||||
case H5F_LIBVER_V18:
|
||||
strcpy(str, STR_V18);
|
||||
break;
|
||||
|
||||
case H5F_LIBVER_V110:
|
||||
HDassert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
|
||||
strcpy(str, STR_LATEST);
|
||||
break;
|
||||
|
||||
case H5F_LIBVER_ERROR:
|
||||
case H5F_LIBVER_NBOUNDS:
|
||||
default:
|
||||
sprintf(str, "%ld", (long)libver);
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
/* Return the formed version bound string */
|
||||
return(str);
|
||||
} /* end of version_string */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
*
|
||||
* Purpose: Exercise private object header behavior and routines
|
||||
*
|
||||
* Return: Success: 0
|
||||
* Failure: 1
|
||||
* Return: Success: 0
|
||||
* Failure: 1
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 24, 1998
|
||||
*
|
||||
* Modification:
|
||||
* - Added loop of combinations of low/high library format bounds
|
||||
* (BMR, Feb 2018)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
hid_t fapl = -1, file = -1;
|
||||
H5F_t *f = NULL;
|
||||
char filename[1024];
|
||||
H5O_hdr_info_t hdr_info; /* Object info */
|
||||
H5O_loc_t oh_loc; /* Object header locations */
|
||||
time_t time_new, ro;
|
||||
int i; /* Local index variable */
|
||||
unsigned b; /* Index for "new format" loop */
|
||||
herr_t ret; /* Generic return value */
|
||||
hid_t fapl = -1;
|
||||
hid_t file = -1;
|
||||
H5F_t *f = NULL;
|
||||
char filename[1024];
|
||||
H5O_hdr_info_t hdr_info; /* Object info */
|
||||
H5O_loc_t oh_loc; /* Object header locations */
|
||||
H5F_libver_t low, high; /* File format bounds */
|
||||
time_t time_new, ro;
|
||||
unsigned b; /* Index for "new format" loop */
|
||||
char msg[80]; /* Message for file format version */
|
||||
int i; /* Local index variable */
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
/* Reset library */
|
||||
h5_reset();
|
||||
fapl = h5_fileaccess();
|
||||
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
|
||||
|
||||
/* Loop over old & new formats */
|
||||
for(b = FALSE; b <= TRUE; b++) {
|
||||
/* Display info about testing */
|
||||
if(b)
|
||||
HDputs("Using new file format:");
|
||||
else
|
||||
HDputs("Using default file format:");
|
||||
/* Loop through all the combinations of low/high library format bounds */
|
||||
for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
|
||||
for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
|
||||
|
||||
/* Set the format to use for the file */
|
||||
if(H5Pset_libver_bounds(fapl, (b ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
/* Set version bounds before opening the file */
|
||||
H5E_BEGIN_TRY {
|
||||
ret = H5Pset_libver_bounds(fapl, low, high);
|
||||
} H5E_END_TRY;
|
||||
|
||||
if (ret < 0) /* Invalid low/high combinations */
|
||||
continue;
|
||||
|
||||
/* Display info about testing */
|
||||
sprintf(msg, "Using file format version: (%s, %s)", version_string(low),
|
||||
version_string(high));
|
||||
HDputs(msg);
|
||||
|
||||
/* test on object continuation block */
|
||||
if(test_cont(filename, fapl) < 0)
|
||||
@ -977,7 +1028,9 @@ main(void)
|
||||
/* Test object header creation metadata cache issues */
|
||||
if(test_ohdr_cache(filename, fapl) < 0)
|
||||
TEST_ERROR
|
||||
} /* end for */
|
||||
|
||||
} /* high */
|
||||
} /* low */
|
||||
|
||||
/* Verify symbol table messages are cached */
|
||||
if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
|
||||
|
@ -427,20 +427,50 @@ error:
|
||||
*/
|
||||
static int do_layouts( hid_t fapl )
|
||||
{
|
||||
hid_t new_fapl = -1;
|
||||
H5F_libver_t low, high; /* Low and high bounds */
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
TESTING("storage layout use");
|
||||
TESTING("storage layout use - tested with all low/high library format bounds");
|
||||
/* Loop through all the combinations of low/high library format bounds */
|
||||
for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
|
||||
for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
|
||||
|
||||
if (test_layouts( H5D_COMPACT, fapl ) < 0)
|
||||
goto error;
|
||||
/* Copy plist to use locally to avoid modifying the original */
|
||||
new_fapl = H5Pcopy(fapl);
|
||||
|
||||
if (test_layouts( H5D_CONTIGUOUS, fapl ) < 0)
|
||||
goto error;
|
||||
/* Set version bounds */
|
||||
H5E_BEGIN_TRY {
|
||||
ret = H5Pset_libver_bounds(new_fapl, low, high);
|
||||
} H5E_END_TRY;
|
||||
|
||||
if (ret < 0) /* Invalid low/high combinations */
|
||||
{
|
||||
if (H5Pclose(new_fapl) < 0)
|
||||
goto error;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (test_layouts( H5D_COMPACT, new_fapl ) < 0)
|
||||
goto error;
|
||||
|
||||
if (test_layouts( H5D_CONTIGUOUS, new_fapl ) < 0)
|
||||
goto error;
|
||||
|
||||
if (H5Pclose(new_fapl) < 0)
|
||||
goto error;
|
||||
} /* end for high */
|
||||
} /* end for low */
|
||||
|
||||
PASSED();
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5Pclose(new_fapl);
|
||||
} H5E_END_TRY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/***********************************************************
|
||||
*
|
||||
* Test program: tarray
|
||||
* Test program: tarray
|
||||
*
|
||||
* Test the Array Datatype functionality
|
||||
*
|
||||
@ -26,7 +26,7 @@
|
||||
#define TESTFILE "tarrold.h5"
|
||||
|
||||
/* 1-D array datatype */
|
||||
#define ARRAY1_RANK 1
|
||||
#define ARRAY1_RANK 1
|
||||
#define ARRAY1_DIM1 4
|
||||
|
||||
/* 3-D array datatype */
|
||||
@ -65,7 +65,7 @@ typedef struct
|
||||
void *test_array_alloc_custom(size_t size, void *info);
|
||||
void test_array_free_custom(void *mem, void *info);
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_atomic_1d
|
||||
*
|
||||
@ -189,7 +189,7 @@ test_array_atomic_1d(void)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* end test_array_atomic_1d() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_funcs
|
||||
*
|
||||
@ -252,7 +252,7 @@ test_array_funcs(void)
|
||||
CHECK(ret, FAIL, "H5Tclose");
|
||||
} /* end test_array_funcs() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_atomic_3d
|
||||
*
|
||||
@ -381,7 +381,7 @@ test_array_atomic_3d(void)
|
||||
|
||||
} /* end test_array_atomic_3d() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_array_atomic
|
||||
*
|
||||
@ -540,7 +540,7 @@ test_array_array_atomic(void)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* end test_array_array_atomic() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_compound_atomic
|
||||
*
|
||||
@ -747,7 +747,7 @@ test_array_compound_atomic(void)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* end test_array_compound_atomic() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_compound_array
|
||||
*
|
||||
@ -1006,7 +1006,7 @@ test_array_compound_array(void)
|
||||
** allocated.
|
||||
**
|
||||
****************************************************************/
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_alloc_custom
|
||||
*
|
||||
@ -1045,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info)
|
||||
return ret_value;
|
||||
} /* end test_array_alloc_custom() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_free_custom
|
||||
*
|
||||
@ -1081,7 +1081,7 @@ test_array_free_custom(void *_mem, void *info)
|
||||
return;
|
||||
} /* end test_array_free_custom() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_vlen_atomic
|
||||
*
|
||||
@ -1296,7 +1296,7 @@ test_array_vlen_atomic(void)
|
||||
|
||||
} /* end test_array_vlen_atomic() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_vlen_array
|
||||
*
|
||||
@ -1551,7 +1551,7 @@ test_array_vlen_array(void)
|
||||
|
||||
} /* end test_array_vlen_array() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_bkg
|
||||
*
|
||||
@ -1580,9 +1580,9 @@ test_array_bkg(void)
|
||||
unsigned ndims[3] = {1,1,1};
|
||||
|
||||
typedef struct {
|
||||
int a[ALEN];
|
||||
float b[ALEN];
|
||||
double c[ALEN];
|
||||
int a[ALEN];
|
||||
float b[ALEN];
|
||||
double c[ALEN];
|
||||
} CmpField;
|
||||
|
||||
CmpField cf[LENGTH];
|
||||
@ -1855,7 +1855,7 @@ test_array_bkg(void)
|
||||
HDfree(dtsinfo);
|
||||
} /* end test_array_bkg() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_compat
|
||||
*
|
||||
@ -2150,7 +2150,7 @@ test_compat(void)
|
||||
|
||||
} /* end test_compat() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array
|
||||
*
|
||||
@ -2183,7 +2183,7 @@ test_array(void)
|
||||
|
||||
} /* end test_array() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: cleanup_array
|
||||
*
|
||||
|
94
test/tattr.c
94
test/tattr.c
@ -151,7 +151,7 @@ static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo,
|
||||
void *op_data);
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_basic_write(): Test basic H5A (attribute) code.
|
||||
@ -391,7 +391,7 @@ test_attr_basic_write(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_basic_write() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_basic_read(): Test basic H5A (attribute) code.
|
||||
@ -482,7 +482,7 @@ test_attr_basic_read(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_basic_read() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_flush(): Test H5A (attribute) code for performing
|
||||
@ -549,7 +549,7 @@ test_attr_flush(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_flush() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_plist(): Test Attribute Creation Property Lists
|
||||
@ -662,7 +662,7 @@ test_attr_plist(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_plist() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_compound_write(): Test H5A (attribute) code.
|
||||
@ -751,7 +751,7 @@ test_attr_compound_write(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_compound_write() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_compound_read(): Test basic H5A (attribute) code.
|
||||
@ -901,7 +901,7 @@ test_attr_compound_read(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_compound_read() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_scalar_write(): Test scalar H5A (attribute) writing code.
|
||||
@ -967,7 +967,7 @@ test_attr_scalar_write(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_scalar_write() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_scalar_read(): Test scalar H5A (attribute) reading code.
|
||||
@ -1038,7 +1038,7 @@ test_attr_scalar_read(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_scalar_read() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_mult_write(): Test basic H5A (attribute) code.
|
||||
@ -1159,7 +1159,7 @@ test_attr_mult_write(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_mult_write() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_mult_read(): Test basic H5A (attribute) code.
|
||||
@ -1381,7 +1381,7 @@ test_attr_mult_read(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_mult_read() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** attr_op1(): Attribute operator
|
||||
@ -1421,7 +1421,7 @@ attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR
|
||||
return(ret);
|
||||
} /* end attr_op1() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_iterate(): Test H5A (attribute) iterator code.
|
||||
@ -1493,7 +1493,7 @@ test_attr_iterate(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_iterate() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_delete(): Test H5A (attribute) code for deleting objects.
|
||||
@ -1613,7 +1613,7 @@ test_attr_delete(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_delete() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_dtype_shared(): Test H5A (attribute) code for using
|
||||
@ -1790,7 +1790,7 @@ test_attr_dtype_shared(hid_t fapl)
|
||||
VERIFY(filesize, empty_filesize, "h5_get_file_size");
|
||||
} /* test_attr_dtype_shared() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_duplicate_ids(): Test operations with more than
|
||||
@ -2035,7 +2035,7 @@ test_attr_duplicate_ids(hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_duplicate_ids() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_dense_verify(): Test basic H5A (attribute) code.
|
||||
@ -2105,7 +2105,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
|
||||
return(-1);
|
||||
} /* test_attr_dense_verify() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_dense_create(): Test basic H5A (attribute) code.
|
||||
@ -2236,7 +2236,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
|
||||
VERIFY(filesize, empty_filesize, "h5_get_file_size");
|
||||
} /* test_attr_dense_create() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_dense_open(): Test basic H5A (attribute) code.
|
||||
@ -2375,7 +2375,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
|
||||
VERIFY(filesize, empty_filesize, "h5_get_file_size");
|
||||
} /* test_attr_dense_open() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_dense_delete(): Test basic H5A (attribute) code.
|
||||
@ -2553,7 +2553,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
|
||||
VERIFY(filesize, empty_filesize, "h5_get_file_size");
|
||||
} /* test_attr_dense_delete() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_dense_rename(): Test basic H5A (attribute) code.
|
||||
@ -2712,7 +2712,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
|
||||
VERIFY(filesize, empty_filesize, "h5_get_file_size");
|
||||
} /* test_attr_dense_rename() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_dense_unlink(): Test basic H5A (attribute) code.
|
||||
@ -2842,7 +2842,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
|
||||
VERIFY(filesize, empty_filesize, "h5_get_file_size");
|
||||
} /* test_attr_dense_unlink() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_dense_limits(): Test basic H5A (attribute) code.
|
||||
@ -3007,7 +3007,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
|
||||
VERIFY(filesize, empty_filesize, "h5_get_file_size");
|
||||
} /* test_attr_dense_limits() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_dense_dup_ids(): Test operations with multiple ID
|
||||
@ -3530,7 +3530,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_dense_dup_ids() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_big(): Test basic H5A (attribute) code.
|
||||
@ -3800,7 +3800,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
|
||||
VERIFY(filesize, empty_filesize, "h5_get_file_size");
|
||||
} /* test_attr_big() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_null_space(): Test basic H5A (attribute) code.
|
||||
@ -4018,7 +4018,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
|
||||
VERIFY(filesize, empty_filesize, "h5_get_file_size");
|
||||
} /* test_attr_null_space() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_deprec(): Test basic H5A (attribute) code.
|
||||
@ -4127,7 +4127,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
} /* test_attr_deprec() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_many(): Test basic H5A (attribute) code.
|
||||
@ -4256,7 +4256,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
} /* test_attr_many() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_corder_create_empty(): Test basic H5A (attribute) code.
|
||||
@ -4372,7 +4372,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_corder_create_basic() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_corder_create_compact(): Test basic H5A (attribute) code.
|
||||
@ -4570,7 +4570,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_corder_create_compact() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_corder_create_dense(): Test basic H5A (attribute) code.
|
||||
@ -4797,7 +4797,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_attr_corder_create_dense() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_corder_create_reopen(): Test basic H5A (attribute) code.
|
||||
@ -4905,7 +4905,7 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
} /* test_attr_corder_create_reopen() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_corder_transition(): Test basic H5A (attribute) code.
|
||||
@ -5311,7 +5311,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
} /* test_attr_corder_transition() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_corder_delete(): Test basic H5A (attribute) code.
|
||||
@ -5512,7 +5512,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
} /* test_attr_corder_delete() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: attr_info_by_idx_check
|
||||
*
|
||||
@ -5659,7 +5659,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
|
||||
return(-1);
|
||||
} /* end attr_info_by_idx_check() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_info_by_idx(): Test basic H5A (attribute) code.
|
||||
@ -5869,7 +5869,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
} /* test_attr_info_by_idx() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_delete_by_idx(): Test basic H5A (attribute) code.
|
||||
@ -6401,7 +6401,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
} /* test_attr_delete_by_idx() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** attr_iterate2_cb(): Revised attribute operator
|
||||
@ -6475,7 +6475,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr);
|
||||
} /* end attr_iterate2_cb() */
|
||||
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** attr_iterate1_cb(): Attribute operator
|
||||
@ -6488,7 +6488,7 @@ attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data)
|
||||
} /* end attr_iterate1_cb() */
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: attr_iterate2_fail_cb
|
||||
*
|
||||
@ -6510,7 +6510,7 @@ attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *
|
||||
return(H5_ITER_ERROR);
|
||||
} /* end attr_iterate2_fail_cb() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: attr_iterate_check
|
||||
*
|
||||
@ -6810,7 +6810,7 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id,
|
||||
return(-1);
|
||||
} /* end attr_iterate_check() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_iterate2(): Test basic H5A (attribute) code.
|
||||
@ -7114,7 +7114,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
|
||||
HDfree(visited);
|
||||
} /* test_attr_iterate2() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: attr_open_by_idx_check
|
||||
*
|
||||
@ -7174,7 +7174,7 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
|
||||
return(-1);
|
||||
} /* end attr_open_by_idx_check() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_open_by_idx(): Test basic H5A (attribute) code.
|
||||
@ -7436,7 +7436,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
} /* test_attr_open_by_idx() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: attr_open_check
|
||||
*
|
||||
@ -7522,7 +7522,7 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
|
||||
return(-1);
|
||||
} /* end attr_open_check() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_open_by_name(): Test basic H5A (attribute) code.
|
||||
@ -7777,7 +7777,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
} /* test_attr_open_by_name() */
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_attr_create_by_name(): Test basic H5A (attribute) code.
|
||||
@ -10864,7 +10864,7 @@ test_attr(void)
|
||||
CHECK(ret, FAIL, "H5Pclose");
|
||||
} /* test_attr() */
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: cleanup_attr
|
||||
*
|
||||
|
@ -39,22 +39,22 @@
|
||||
/* Needs this extra step so that we can print the macro name. */
|
||||
#define vrfy_macrosize(type, macro, macroname) \
|
||||
if (sizeof(type) != macro) \
|
||||
TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", \
|
||||
#type, sizeof(type), macroname, (int)macro);
|
||||
TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", \
|
||||
#type, sizeof(type), macroname, (int)macro);
|
||||
|
||||
/* local routine prototypes */
|
||||
void test_config_ctypes(void);
|
||||
void test_exit_definitions(void);
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_configure
|
||||
* Function: test_configure
|
||||
*
|
||||
* Purpose: Main configure definitions testing routine
|
||||
* Purpose: Main configure definitions testing routine
|
||||
*
|
||||
* Return: none (error is fed back via global variable num_errs)
|
||||
* Return: none (error is fed back via global variable num_errs)
|
||||
*
|
||||
* Programmer: Albert Cheng
|
||||
* Programmer: Albert Cheng
|
||||
* September 25, 2001
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
@ -68,15 +68,15 @@ test_configure(void)
|
||||
test_exit_definitions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: cleanup_configure
|
||||
* Function: cleanup_configure
|
||||
*
|
||||
* Purpose: Cleanup temporary test files
|
||||
* Purpose: Cleanup temporary test files
|
||||
*
|
||||
* Return: none
|
||||
* Return: none
|
||||
*
|
||||
* Programmer: Albert Cheng
|
||||
* Programmer: Albert Cheng
|
||||
* September 25, 2001
|
||||
*
|
||||
* Modifications:
|
||||
@ -89,20 +89,20 @@ cleanup_configure(void)
|
||||
/* no file to clean */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_config_ctypes
|
||||
* Function: test_config_ctypes
|
||||
*
|
||||
* Purpose: test C language data type sizes
|
||||
* Purpose: test C language data type sizes
|
||||
*
|
||||
* Return: none (error is fed back via global variable num_errs)
|
||||
* Return: none (error is fed back via global variable num_errs)
|
||||
*
|
||||
* Programmer: Albert Cheng
|
||||
* Programmer: Albert Cheng
|
||||
* September 25, 2001
|
||||
*
|
||||
* Modifications:
|
||||
* Albert Cheng, 2004/10/14
|
||||
* Verified both signed and unsigned int types.
|
||||
* Albert Cheng, 2004/10/14
|
||||
* Verified both signed and unsigned int types.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -200,15 +200,15 @@ test_config_ctypes(void)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_exit_definitions
|
||||
* Function: test_exit_definitions
|
||||
*
|
||||
* Purpose: test the exit macros values
|
||||
* Purpose: test the exit macros values
|
||||
*
|
||||
* Return: none (error is fed back via global variable num_errs)
|
||||
* Return: none (error is fed back via global variable num_errs)
|
||||
*
|
||||
* Programmer: Albert Cheng
|
||||
* Programmer: Albert Cheng
|
||||
* October 12, 2009
|
||||
*
|
||||
* Modifications:
|
||||
@ -221,9 +221,9 @@ test_exit_definitions(void)
|
||||
/* Verify the EXIT_SUCCESS and EXIT_FAILURE are 0 and 1 respectively. */
|
||||
/* This should be true for POSIX compliant systems. */
|
||||
if (EXIT_SUCCESS != 0) \
|
||||
TestErrPrintf("Error: EXIT_SUCCESS is %d, should be %d\n", \
|
||||
EXIT_SUCCESS, 0);
|
||||
TestErrPrintf("Error: EXIT_SUCCESS is %d, should be %d\n", \
|
||||
EXIT_SUCCESS, 0);
|
||||
if (EXIT_FAILURE != 1) \
|
||||
TestErrPrintf("Error: EXIT_FAILURE is %d, should be %d\n", \
|
||||
EXIT_FAILURE, 1);
|
||||
TestErrPrintf("Error: EXIT_FAILURE is %d, should be %d\n", \
|
||||
EXIT_FAILURE, 1);
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user