Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
hdf5.34207
Fixes-for-file-format-security-issues.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File Fixes-for-file-format-security-issues.patch of Package hdf5.34207
From: Egbert Eich <eich@suse.com> Date: Mon May 27 19:17:51 2024 +0200 Subject: Fixes for file format security issues Patch-mainline: Upstream Git-repo: https://github.com/HDFGroup/hdf5 Git-commit: 3ded20acdead217cff59f4ad0b639d71d534132e References: bsc#1224158 Signed-off-by: Egbert Eich <eich@suse.de> --- src/H5Dcompact.c | 60 +++- src/H5Dcontig.c | 88 ++++-- src/H5Defl.c | 63 +++- src/H5Dint.c | 63 ++-- src/H5Dpkg.h | 2 + src/H5Edefin.h | 221 +++++++------- src/H5Einit.h | 849 +++++++++++++++++++++++++++--------------------------- src/H5Epubgen.h | 398 ++++++++++++------------- src/H5Eterm.h | 227 +++++++-------- src/H5Gent.c | 210 +++++--------- src/H5Glink.c | 200 ++++++++----- src/H5Gloc.c | 64 +++- src/H5Gnode.c | 124 ++++---- src/H5Gobj.c | 15 +- src/H5Gpkg.h | 29 +- src/H5Gprivate.h | 4 +- src/H5Gstab.c | 68 +++-- src/H5Gtest.c | 8 +- src/H5HG.c | 20 ++ src/H5HL.c | 50 +++- src/H5HLcache.c | 2 +- src/H5HLprivate.h | 1 + src/H5L.c | 4 +- src/H5Ocache.c | 4 + src/H5Ocopy.c | 6 + src/H5Odtype.c | 22 ++ src/H5Oefl.c | 39 +-- src/H5Olayout.c | 33 ++- src/H5Opkg.h | 4 +- src/H5Oprivate.h | 2 +- src/H5Osdspace.c | 13 +- src/H5Oshared.c | 26 +- src/H5Oshared.h | 2 +- src/H5Ostab.c | 19 +- src/H5S.c | 26 ++ src/H5Spoint.c | 16 +- src/H5Sprivate.h | 18 +- src/H5T.c | 127 +++++++- src/H5Tprivate.h | 1 + src/H5Znbit.c | 15 +- src/H5err.txt | 1 + 41 files changed, 1850 insertions(+), 1294 deletions(-) diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 3b1c309124..d145cc95cf 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -52,6 +52,7 @@ /* Layout operation callbacks */ static herr_t H5D__compact_construct(H5F_t *f, H5D_t *dset); +static herr_t H5D__compact_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id); static hbool_t H5D__compact_is_space_alloc(const H5O_storage_t *storage); static herr_t H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm); @@ -71,7 +72,7 @@ static herr_t H5D__compact_dest(H5D_t *dset); /* Compact storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{ H5D__compact_construct, /* construct */ - NULL, /* init */ + H5D__compact_init, /* init */ H5D__compact_is_space_alloc, /* is_space_alloc */ NULL, /* is_data_cached */ H5D__compact_io_init, /* io_init */ @@ -199,6 +200,63 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__compact_construct() */ +/*------------------------------------------------------------------------- + * Function: H5D__compact_init + * + * Purpose: Initialize the info for a compact dataset. This is + * called when the dataset is initialized. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__compact_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset, hid_t H5_ATTR_UNUSED dapl_id) +{ + hssize_t snelmts; /* Temporary holder for number of elements in dataspace */ + hsize_t nelmts; /* Number of elements in dataspace */ + size_t dt_size; /* Size of datatype */ + hsize_t data_size; /* Dataset size, in bytes */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + assert(dset); + assert(H5D_COMPACT == dset->shared->layout.storage.type); + + /* + * Now that we've read the dataset's datatype, dataspace and + * layout information, perform a quick check for compact datasets + * to ensure that the size of the internal buffer that was + * allocated for the dataset's raw data matches the size of + * the data. A corrupted file can cause a mismatch between the + * two, which might result in buffer overflows during future + * I/O to the dataset. + */ + if (0 == (dt_size = H5T_GET_SIZE(dset->shared->type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size"); + if ((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of elements in dataset's dataspace"); + nelmts = (hsize_t)snelmts; + + /* Compute the size of the dataset's contiguous storage */ + data_size = nelmts * dt_size; + + /* Check for overflow during multiplication */ + if (nelmts != (data_size / dt_size)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed"); + + /* Check for mismatch */ + if (dset->shared->layout.storage.u.compact.size != data_size) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, + "bad value from dataset header - size of compact dataset's data buffer doesn't match " + "size of dataset data"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__compact_init() */ + /*------------------------------------------------------------------------- * Function: H5D__compact_is_space_alloc * diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 30044e8847..e4b6b1a83b 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -356,6 +356,65 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__contig_delete */ +/*------------------------------------------------------------------------- + * Function: H5D__contig_check + * + * Purpose: Sanity check the contiguous info for a dataset. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__contig_check(const H5F_t *f, const H5O_layout_t *layout, const H5S_extent_t *extent, const H5T_t *dt) +{ + hsize_t nelmts; /* Number of elements in dataspace */ + size_t dt_size; /* Size of datatype */ + hsize_t data_size; /* Raw data size */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + assert(f); + assert(layout); + assert(extent); + assert(dt); + + /* Retrieve the number of elements in the dataspace */ + nelmts = H5S_extent_nelem(extent); + + /* Get the datatype's size */ + if (0 == (dt_size = H5T_GET_SIZE(dt))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype"); + + /* Compute the size of the dataset's contiguous storage */ + data_size = nelmts * dt_size; + + /* Check for overflow during multiplication */ + if (nelmts != (data_size / dt_size)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed"); + + /* Check for invalid (corrupted in the file, probably) dimensions */ + if (H5F_addr_defined(layout->storage.u.contig.addr)) { + haddr_t rel_eoa; /* Relative end of file address */ + + if (HADDR_UNDEF == (rel_eoa = H5F_get_eoa(f, H5FD_MEM_DRAW))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size"); + + /* Check for invalid dataset size (from bad dimensions) putting the + * dataset elements off the end of the file + */ + if (H5F_addr_le((layout->storage.u.contig.addr + data_size), layout->storage.u.contig.addr)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "invalid dataset size, likely file corruption"); + if (H5F_addr_gt((layout->storage.u.contig.addr + data_size), rel_eoa)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "invalid dataset size, likely file corruption"); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__contig_check() */ + /*------------------------------------------------------------------------- * Function: H5D__contig_construct * @@ -444,11 +503,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset, hid_t H5_ATTR_UNUSED dapl_id) +H5D__contig_init(H5F_t *f, const H5D_t *dset, hid_t H5_ATTR_UNUSED dapl_id) { - hsize_t tmp_size; /* Temporary holder for raw data size */ - size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */ - herr_t ret_value = SUCCEED; /* Return value */ + size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -456,6 +514,11 @@ H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset, hid_t H5_ATTR_UNUSE HDassert(f); HDassert(dset); + /* Sanity check the dataset's info */ + if (H5D__contig_check(f, &dset->shared->layout, H5S_GET_EXTENT(dset->shared->space), dset->shared->type) < + 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "invalid dataset info"); + /* Compute the size of the contiguous storage for versions of the * layout message less than version 3 because versions 1 & 2 would * truncate the dimension sizes to 32-bits of information. - QAK 5/26/04 @@ -475,25 +538,16 @@ H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset, hid_t H5_ATTR_UNUSE HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype") /* Compute the size of the dataset's contiguous storage */ - tmp_size = nelmts * dt_size; - - /* Check for overflow during multiplication */ - if (nelmts != (tmp_size / dt_size)) - HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") - - /* Assign the dataset's contiguous storage size */ - dset->shared->layout.storage.u.contig.size = tmp_size; - } /* end if */ - else - tmp_size = dset->shared->layout.storage.u.contig.size; + dset->shared->layout.storage.u.contig.size = nelmts * dt_size; + } /* Get the sieve buffer size for the file */ tmp_sieve_buf_size = H5F_SIEVE_BUF_SIZE(dset->oloc.file); /* Adjust the sieve buffer size to the smaller one between the dataset size and the buffer size * from the file access property. (SLU - 2012/3/30) */ - if (tmp_size < tmp_sieve_buf_size) - dset->shared->cache.contig.sieve_buf_size = tmp_size; + if (dset->shared->layout.storage.u.contig.size < tmp_sieve_buf_size) + dset->shared->cache.contig.sieve_buf_size = dset->shared->layout.storage.u.contig.size; else dset->shared->cache.contig.sieve_buf_size = tmp_sieve_buf_size; diff --git a/src/H5Defl.c b/src/H5Defl.c index 67416ff9c3..1fd93296cc 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -60,6 +60,7 @@ typedef struct H5D_efl_writevv_ud_t { /* Layout operation callbacks */ static herr_t H5D__efl_construct(H5F_t *f, H5D_t *dset); +static herr_t H5D__efl_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id); static herr_t H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm); static ssize_t H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, @@ -81,7 +82,7 @@ static herr_t H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t ad /* External File List (EFL) storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ H5D__efl_construct, /* construct */ - NULL, /* init */ + H5D__efl_init, /* init */ H5D__efl_is_space_alloc, /* is_space_alloc */ NULL, /* is_data_cached */ H5D__efl_io_init, /* io_init */ @@ -147,8 +148,9 @@ H5D__efl_construct(H5F_t *f, H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") /* Check for storage overflows */ - max_points = H5S_get_npoints_max(dset->shared->space); - max_storage = H5O_efl_total_size(&dset->shared->dcpl_cache.efl); + max_points = H5S_get_npoints_max(dset->shared->space); + if (H5O_efl_total_size(&dset->shared->dcpl_cache.efl, &max_storage) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of external file"); if (H5S_UNLIMITED == max_points) { if (H5O_EFL_UNLIMITED != max_storage) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unlimited dataspace but finite storage") @@ -159,8 +161,8 @@ H5D__efl_construct(H5F_t *f, H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataspace size exceeds external storage size") /* Compute the total size of dataset */ - stmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space); - HDassert(stmp_size >= 0); + if ((stmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace"); tmp_size = (hsize_t)stmp_size * dt_size; H5_CHECKED_ASSIGN(dset->shared->layout.storage.u.contig.size, hsize_t, tmp_size, hssize_t); @@ -171,6 +173,57 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__efl_construct() */ +/*------------------------------------------------------------------------- + * Function: H5D__efl_init + * + * Purpose: Initialize the info for a EFL dataset. This is + * called when the dataset is initialized. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__efl_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset, hid_t H5_ATTR_UNUSED dapl_id) +{ + size_t dt_size; /* Size of datatype */ + hssize_t snelmts; /* Temporary holder for number of elements in dataspace */ + hsize_t nelmts; /* Number of elements in dataspace */ + hsize_t data_size; /* Raw data size */ + hsize_t max_storage; /* Maximum storage size */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + assert(dset); + + /* Retrieve the size of the dataset's datatype */ + if (0 == (dt_size = H5T_get_size(dset->shared->type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size"); + + /* Retrieve the number of elements in the dataspace */ + if ((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace"); + nelmts = (hsize_t)snelmts; + + /* Compute the size of the dataset's contiguous storage */ + data_size = nelmts * dt_size; + + /* Check for overflow during multiplication */ + if (nelmts != (data_size / dt_size)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed"); + + /* Check for storage overflows */ + if (H5O_efl_total_size(&dset->shared->dcpl_cache.efl, &max_storage) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of external file"); + if (H5O_EFL_UNLIMITED != max_storage && data_size > max_storage) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataspace size exceeds external storage size"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__efl_init() */ + /*------------------------------------------------------------------------- * Function: H5D__efl_is_space_alloc * diff --git a/src/H5Dint.c b/src/H5Dint.c index ae62ce5416..58ebbc3c74 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1659,6 +1659,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) htri_t msg_exists; /* Whether a particular type of message exists */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ hbool_t must_init_storage = FALSE; + bool fill_init = false; /* Flag to indicate that fill information was initialized */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dataset->oloc.addr) @@ -1703,33 +1704,6 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) /* Indicate that the layout information was initialized */ layout_init = TRUE; - /* - * Now that we've read the dataset's datatype, dataspace and - * layout information, perform a quick check for compact datasets - * to ensure that the size of the internal buffer that was - * allocated for the dataset's raw data matches the size of - * the data. A corrupted file can cause a mismatch between the - * two, which might result in buffer overflows during future - * I/O to the dataset. - */ - if (H5D_COMPACT == dataset->shared->layout.type) { - hssize_t dset_nelemts = 0; - size_t dset_type_size = H5T_GET_SIZE(dataset->shared->type); - size_t dset_data_size = 0; - - HDassert(H5D_COMPACT == dataset->shared->layout.storage.type); - - if ((dset_nelemts = H5S_GET_EXTENT_NPOINTS(dataset->shared->space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of elements in dataset's dataspace") - - dset_data_size = (size_t)dset_nelemts * dset_type_size; - - if (dataset->shared->layout.storage.u.compact.size != dset_data_size) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, - "bad value from dataset header - size of compact dataset's data buffer doesn't match " - "size of dataset data"); - } - /* Set up flush append property */ if (H5D__append_flush_setup(dataset, dapl_id)) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property") @@ -1743,6 +1717,9 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) if (msg_exists) { if (NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, fill_prop)) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") + + /* Indicate that the fill information was initialized */ + fill_init = true; } /* end if */ else { /* For backward compatibility, try to retrieve the old fill value message */ @@ -1751,6 +1728,9 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) if (msg_exists) { if (NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, fill_prop)) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") + + /* Indicate that the fill information was initialized */ + fill_init = true; } /* end if */ else { /* Set the space allocation time appropriately, based on the type of dataset storage */ @@ -1789,6 +1769,33 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) (dataset->shared->layout.type == H5D_VIRTUAL && fill_prop->alloc_time == H5D_ALLOC_TIME_INCR)) alloc_time_state = 1; + /* Check if there is a fill value, but no type yet */ + if (fill_prop->buf != NULL && fill_prop->type == NULL) { + H5T_t *tmp_type; /* Temporary pointer to dataset's datatype */ + + /* Copy the dataset type into the fill value message */ + if (NULL == (tmp_type = H5T_copy(dataset->shared->type, H5T_COPY_TRANSIENT))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy dataset datatype for fill value"); + + /* Check if conversion is necessary on fill buffer, and if fill-value + * buffer is too small to hold the result. + */ + if (!H5T_noop_conv(dataset->shared->type, tmp_type)) { + size_t bkg_size = MAX(H5T_GET_SIZE(tmp_type), H5T_GET_SIZE(dataset->shared->type)); + + assert(fill_prop->size >= 0); + if ((size_t)fill_prop->size < bkg_size) { + if (H5T_close_real(tmp_type) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't free temporary datatype"); + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, + "fill value size doesn't match dataset's datatype size"); + } + } + + if (H5T_close_real(tmp_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't free temporary datatype"); + } + /* Set revised fill value properties, if they are different from the defaults */ if (H5P_fill_value_cmp(&H5D_def_dset.dcpl_cache.fill, fill_prop, sizeof(H5O_fill_t))) { if (H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0) @@ -1831,6 +1838,8 @@ done: if (H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc), NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") if (dataset->shared) { + if (fill_init) + H5O_msg_reset(H5O_FILL_ID, fill_prop); if (layout_init) if (dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index b881924f72..60de9642c4 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -633,6 +633,8 @@ H5_DLL herr_t H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t * H5_DLL herr_t H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f_dst, H5O_storage_contig_t *storage_dst, H5T_t *src_dtype, H5O_copy_t *cpy_info); H5_DLL herr_t H5D__contig_delete(H5F_t *f, const H5O_storage_t *store); +H5_DLL herr_t H5D__contig_check(const H5F_t *f, const H5O_layout_t *layout, const H5S_extent_t *extent, + const H5T_t *dt); /* Functions that operate on chunked dataset storage */ H5_DLL htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_op); diff --git a/src/H5Edefin.h b/src/H5Edefin.h index d723222700..a60976ca97 100644 --- a/src/H5Edefin.h +++ b/src/H5Edefin.h @@ -18,88 +18,44 @@ #define H5Edefin_H /* Major error IDs */ -hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */ -hid_t H5E_FILE_g = FAIL; /* File accessibility */ -hid_t H5E_SOHM_g = FAIL; /* Shared Object Header Messages */ -hid_t H5E_SYM_g = FAIL; /* Symbol table */ -hid_t H5E_PLUGIN_g = FAIL; /* Plugin for dynamically loaded library */ hid_t H5E_VFL_g = FAIL; /* Virtual File Layer */ -hid_t H5E_INTERNAL_g = FAIL; /* Internal error (too specific to document in detail) */ -hid_t H5E_BTREE_g = FAIL; /* B-Tree node */ -hid_t H5E_REFERENCE_g = FAIL; /* References */ -hid_t H5E_DATASPACE_g = FAIL; /* Dataspace */ -hid_t H5E_RESOURCE_g = FAIL; /* Resource unavailable */ -hid_t H5E_RS_g = FAIL; /* Reference Counted Strings */ -hid_t H5E_FARRAY_g = FAIL; /* Fixed Array */ -hid_t H5E_HEAP_g = FAIL; /* Heap */ -hid_t H5E_ATTR_g = FAIL; /* Attribute */ -hid_t H5E_IO_g = FAIL; /* Low-level I/O */ -hid_t H5E_EFL_g = FAIL; /* External file list */ +hid_t H5E_CACHE_g = FAIL; /* Object cache */ +hid_t H5E_OHDR_g = FAIL; /* Object header */ +hid_t H5E_SLIST_g = FAIL; /* Skip Lists */ hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */ +hid_t H5E_STORAGE_g = FAIL; /* Data storage */ hid_t H5E_PAGEBUF_g = FAIL; /* Page Buffering */ +hid_t H5E_SOHM_g = FAIL; /* Shared Object Header Messages */ +hid_t H5E_SYM_g = FAIL; /* Symbol table */ +hid_t H5E_PLIST_g = FAIL; /* Property lists */ +hid_t H5E_IO_g = FAIL; /* Low-level I/O */ hid_t H5E_FSPACE_g = FAIL; /* Free Space Manager */ +hid_t H5E_FILE_g = FAIL; /* File accessibility */ +hid_t H5E_ATTR_g = FAIL; /* Attribute */ +hid_t H5E_REFERENCE_g = FAIL; /* References */ +hid_t H5E_INTERNAL_g = FAIL; /* Internal error (too specific to document in detail) */ hid_t H5E_DATASET_g = FAIL; /* Dataset */ -hid_t H5E_STORAGE_g = FAIL; /* Data storage */ -hid_t H5E_LINK_g = FAIL; /* Links */ -hid_t H5E_PLIST_g = FAIL; /* Property lists */ -hid_t H5E_DATATYPE_g = FAIL; /* Datatype */ -hid_t H5E_OHDR_g = FAIL; /* Object header */ -hid_t H5E_ATOM_g = FAIL; /* Object atom */ -hid_t H5E_NONE_MAJOR_g = FAIL; /* No error */ -hid_t H5E_SLIST_g = FAIL; /* Skip Lists */ +hid_t H5E_EARRAY_g = FAIL; /* Extensible Array */ hid_t H5E_ARGS_g = FAIL; /* Invalid arguments to routine */ hid_t H5E_CONTEXT_g = FAIL; /* API Context */ -hid_t H5E_EARRAY_g = FAIL; /* Extensible Array */ +hid_t H5E_PLUGIN_g = FAIL; /* Plugin for dynamically loaded library */ +hid_t H5E_LINK_g = FAIL; /* Links */ hid_t H5E_PLINE_g = FAIL; /* Data filters */ +hid_t H5E_DATATYPE_g = FAIL; /* Datatype */ +hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */ +hid_t H5E_RS_g = FAIL; /* Reference Counted Strings */ +hid_t H5E_DATASPACE_g = FAIL; /* Dataspace */ +hid_t H5E_EFL_g = FAIL; /* External file list */ +hid_t H5E_RESOURCE_g = FAIL; /* Resource unavailable */ +hid_t H5E_HEAP_g = FAIL; /* Heap */ +hid_t H5E_BTREE_g = FAIL; /* B-Tree node */ +hid_t H5E_NONE_MAJOR_g = FAIL; /* No error */ +hid_t H5E_ATOM_g = FAIL; /* Object atom */ +hid_t H5E_FARRAY_g = FAIL; /* Fixed Array */ hid_t H5E_ERROR_g = FAIL; /* Error API */ -hid_t H5E_CACHE_g = FAIL; /* Object cache */ /* Minor error IDs */ -/* Generic low-level file I/O errors */ -hid_t H5E_SEEKERROR_g = FAIL; /* Seek failed */ -hid_t H5E_READERROR_g = FAIL; /* Read failed */ -hid_t H5E_WRITEERROR_g = FAIL; /* Write failed */ -hid_t H5E_CLOSEERROR_g = FAIL; /* Close failed */ -hid_t H5E_OVERFLOW_g = FAIL; /* Address overflowed */ -hid_t H5E_FCNTL_g = FAIL; /* File control (fcntl) failed */ - -/* Resource errors */ -hid_t H5E_NOSPACE_g = FAIL; /* No space available for allocation */ -hid_t H5E_CANTALLOC_g = FAIL; /* Can't allocate space */ -hid_t H5E_CANTCOPY_g = FAIL; /* Unable to copy object */ -hid_t H5E_CANTFREE_g = FAIL; /* Unable to free object */ -hid_t H5E_ALREADYEXISTS_g = FAIL; /* Object already exists */ -hid_t H5E_CANTLOCK_g = FAIL; /* Unable to lock object */ -hid_t H5E_CANTUNLOCK_g = FAIL; /* Unable to unlock object */ -hid_t H5E_CANTGC_g = FAIL; /* Unable to garbage collect */ -hid_t H5E_CANTGETSIZE_g = FAIL; /* Unable to compute size */ -hid_t H5E_OBJOPEN_g = FAIL; /* Object is already open */ - -/* Heap errors */ -hid_t H5E_CANTRESTORE_g = FAIL; /* Can't restore condition */ -hid_t H5E_CANTCOMPUTE_g = FAIL; /* Can't compute value */ -hid_t H5E_CANTEXTEND_g = FAIL; /* Can't extend heap's space */ -hid_t H5E_CANTATTACH_g = FAIL; /* Can't attach object */ -hid_t H5E_CANTUPDATE_g = FAIL; /* Can't update object */ -hid_t H5E_CANTOPERATE_g = FAIL; /* Can't operate on object */ - -/* Function entry/exit interface errors */ -hid_t H5E_CANTINIT_g = FAIL; /* Unable to initialize object */ -hid_t H5E_ALREADYINIT_g = FAIL; /* Object already initialized */ -hid_t H5E_CANTRELEASE_g = FAIL; /* Unable to release object */ - -/* Property list errors */ -hid_t H5E_CANTGET_g = FAIL; /* Can't get value */ -hid_t H5E_CANTSET_g = FAIL; /* Can't set value */ -hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */ -hid_t H5E_SETDISALLOWED_g = FAIL; /* Disallowed operation */ - -/* Free space errors */ -hid_t H5E_CANTMERGE_g = FAIL; /* Can't merge objects */ -hid_t H5E_CANTREVIVE_g = FAIL; /* Can't revive object */ -hid_t H5E_CANTSHRINK_g = FAIL; /* Can't shrink container */ - /* Object header related errors */ hid_t H5E_LINKCOUNT_g = FAIL; /* Bad object header link count */ hid_t H5E_VERSION_g = FAIL; /* Wrong version number */ @@ -111,50 +67,18 @@ hid_t H5E_CANTPACK_g = FAIL; /* Can't pack messages */ hid_t H5E_CANTRESET_g = FAIL; /* Can't reset object */ hid_t H5E_CANTRENAME_g = FAIL; /* Unable to rename object */ -/* System level errors */ -hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */ - -/* I/O pipeline errors */ -hid_t H5E_NOFILTER_g = FAIL; /* Requested filter is not available */ -hid_t H5E_CALLBACK_g = FAIL; /* Callback failed */ -hid_t H5E_CANAPPLY_g = FAIL; /* Error from filter 'can apply' callback */ -hid_t H5E_SETLOCAL_g = FAIL; /* Error from filter 'set local' callback */ -hid_t H5E_NOENCODER_g = FAIL; /* Filter present but encoding disabled */ -hid_t H5E_CANTFILTER_g = FAIL; /* Filter operation failed */ - /* Group related errors */ hid_t H5E_CANTOPENOBJ_g = FAIL; /* Can't open object */ hid_t H5E_CANTCLOSEOBJ_g = FAIL; /* Can't close object */ hid_t H5E_COMPLEN_g = FAIL; /* Name component is too long */ hid_t H5E_PATH_g = FAIL; /* Problem with path to object */ -/* No error */ -hid_t H5E_NONE_MINOR_g = FAIL; /* No error */ +/* System level errors */ +hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */ /* Plugin errors */ hid_t H5E_OPENERROR_g = FAIL; /* Can't open directory or file */ -/* File accessibility errors */ -hid_t H5E_FILEEXISTS_g = FAIL; /* File already exists */ -hid_t H5E_FILEOPEN_g = FAIL; /* File already open */ -hid_t H5E_CANTCREATE_g = FAIL; /* Unable to create file */ -hid_t H5E_CANTOPENFILE_g = FAIL; /* Unable to open file */ -hid_t H5E_CANTCLOSEFILE_g = FAIL; /* Unable to close file */ -hid_t H5E_NOTHDF5_g = FAIL; /* Not an HDF5 file */ -hid_t H5E_BADFILE_g = FAIL; /* Bad file ID accessed */ -hid_t H5E_TRUNCATED_g = FAIL; /* File has been truncated */ -hid_t H5E_MOUNT_g = FAIL; /* File mount error */ -hid_t H5E_CANTLOCKFILE_g = FAIL; /* Unable to lock file */ -hid_t H5E_CANTUNLOCKFILE_g = FAIL; /* Unable to unlock file */ - -/* Object atom related errors */ -hid_t H5E_BADATOM_g = FAIL; /* Unable to find atom information (already closed?) */ -hid_t H5E_BADGROUP_g = FAIL; /* Unable to find ID group information */ -hid_t H5E_CANTREGISTER_g = FAIL; /* Unable to register new atom */ -hid_t H5E_CANTINC_g = FAIL; /* Unable to increment reference count */ -hid_t H5E_CANTDEC_g = FAIL; /* Unable to decrement reference count */ -hid_t H5E_NOIDS_g = FAIL; /* Out of IDs for group */ - /* Cache related errors */ hid_t H5E_CANTFLUSH_g = FAIL; /* Unable to flush data from cache */ hid_t H5E_CANTUNSERIALIZE_g = FAIL; /* Unable to mark metadata as unserialized */ @@ -185,6 +109,22 @@ hid_t H5E_LOGFAIL_g = FAIL; /* old H5E_LOGGING_g (maintained for bin hid_t H5E_CANTCORK_g = FAIL; /* Unable to cork an object */ hid_t H5E_CANTUNCORK_g = FAIL; /* Unable to uncork an object */ +/* I/O pipeline errors */ +hid_t H5E_NOFILTER_g = FAIL; /* Requested filter is not available */ +hid_t H5E_CALLBACK_g = FAIL; /* Callback failed */ +hid_t H5E_CANAPPLY_g = FAIL; /* Error from filter 'can apply' callback */ +hid_t H5E_SETLOCAL_g = FAIL; /* Error from filter 'set local' callback */ +hid_t H5E_NOENCODER_g = FAIL; /* Filter present but encoding disabled */ +hid_t H5E_CANTFILTER_g = FAIL; /* Filter operation failed */ + +/* Generic low-level file I/O errors */ +hid_t H5E_SEEKERROR_g = FAIL; /* Seek failed */ +hid_t H5E_READERROR_g = FAIL; /* Read failed */ +hid_t H5E_WRITEERROR_g = FAIL; /* Write failed */ +hid_t H5E_CLOSEERROR_g = FAIL; /* Close failed */ +hid_t H5E_OVERFLOW_g = FAIL; /* Address overflowed */ +hid_t H5E_FCNTL_g = FAIL; /* File control (fcntl) failed */ + /* Link related errors */ hid_t H5E_TRAVERSE_g = FAIL; /* Link traversal failure */ hid_t H5E_NLINKS_g = FAIL; /* Too many soft links in path */ @@ -192,12 +132,18 @@ hid_t H5E_NOTREGISTERED_g = FAIL; /* Link class not registered */ hid_t H5E_CANTMOVE_g = FAIL; /* Can't move object */ hid_t H5E_CANTSORT_g = FAIL; /* Can't sort objects */ -/* Parallel MPI errors */ -hid_t H5E_MPI_g = FAIL; /* Some MPI function failed */ -hid_t H5E_MPIERRSTR_g = FAIL; /* MPI Error String */ -hid_t H5E_CANTRECV_g = FAIL; /* Can't receive data */ -hid_t H5E_CANTGATHER_g = FAIL; /* Can't gather data */ -hid_t H5E_NO_INDEPENDENT_g = FAIL; /* Can't perform independent IO */ +/* File accessibility errors */ +hid_t H5E_FILEEXISTS_g = FAIL; /* File already exists */ +hid_t H5E_FILEOPEN_g = FAIL; /* File already open */ +hid_t H5E_CANTCREATE_g = FAIL; /* Unable to create file */ +hid_t H5E_CANTOPENFILE_g = FAIL; /* Unable to open file */ +hid_t H5E_CANTCLOSEFILE_g = FAIL; /* Unable to close file */ +hid_t H5E_NOTHDF5_g = FAIL; /* Not an HDF5 file */ +hid_t H5E_BADFILE_g = FAIL; /* Bad file ID accessed */ +hid_t H5E_TRUNCATED_g = FAIL; /* File has been truncated */ +hid_t H5E_MOUNT_g = FAIL; /* File mount error */ +hid_t H5E_CANTLOCKFILE_g = FAIL; /* Unable to lock file */ +hid_t H5E_CANTUNLOCKFILE_g = FAIL; /* Unable to unlock file */ /* Dataspace errors */ hid_t H5E_CANTCLIP_g = FAIL; /* Can't clip hyperslab region */ @@ -209,6 +155,11 @@ hid_t H5E_CANTCOMPARE_g = FAIL; /* Can't compare objects */ hid_t H5E_INCONSISTENTSTATE_g = FAIL; /* Internal states are inconsistent */ hid_t H5E_CANTAPPEND_g = FAIL; /* Can't append object */ +/* Free space errors */ +hid_t H5E_CANTMERGE_g = FAIL; /* Can't merge objects */ +hid_t H5E_CANTREVIVE_g = FAIL; /* Can't revive object */ +hid_t H5E_CANTSHRINK_g = FAIL; /* Can't shrink container */ + /* Argument errors */ hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */ hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */ @@ -216,6 +167,21 @@ hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */ hid_t H5E_BADRANGE_g = FAIL; /* Out of range */ hid_t H5E_BADVALUE_g = FAIL; /* Bad value */ +/* Heap errors */ +hid_t H5E_CANTRESTORE_g = FAIL; /* Can't restore condition */ +hid_t H5E_CANTCOMPUTE_g = FAIL; /* Can't compute value */ +hid_t H5E_CANTEXTEND_g = FAIL; /* Can't extend heap's space */ +hid_t H5E_CANTATTACH_g = FAIL; /* Can't attach object */ +hid_t H5E_CANTUPDATE_g = FAIL; /* Can't update object */ +hid_t H5E_CANTOPERATE_g = FAIL; /* Can't operate on object */ + +/* Parallel MPI errors */ +hid_t H5E_MPI_g = FAIL; /* Some MPI function failed */ +hid_t H5E_MPIERRSTR_g = FAIL; /* MPI Error String */ +hid_t H5E_CANTRECV_g = FAIL; /* Can't receive data */ +hid_t H5E_CANTGATHER_g = FAIL; /* Can't gather data */ +hid_t H5E_NO_INDEPENDENT_g = FAIL; /* Can't perform independent IO */ + /* B-tree related errors */ hid_t H5E_NOTFOUND_g = FAIL; /* Object not found */ hid_t H5E_EXISTS_g = FAIL; /* Object already exists */ @@ -228,9 +194,44 @@ hid_t H5E_CANTINSERT_g = FAIL; /* Unable to insert object */ hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */ hid_t H5E_CANTMODIFY_g = FAIL; /* Unable to modify record */ hid_t H5E_CANTREMOVE_g = FAIL; /* Unable to remove object */ +hid_t H5E_CANTFIND_g = FAIL; /* Unable to check for record */ + +/* Property list errors */ +hid_t H5E_CANTGET_g = FAIL; /* Can't get value */ +hid_t H5E_CANTSET_g = FAIL; /* Can't set value */ +hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */ +hid_t H5E_SETDISALLOWED_g = FAIL; /* Disallowed operation */ + +/* Resource errors */ +hid_t H5E_NOSPACE_g = FAIL; /* No space available for allocation */ +hid_t H5E_CANTALLOC_g = FAIL; /* Can't allocate space */ +hid_t H5E_CANTCOPY_g = FAIL; /* Unable to copy object */ +hid_t H5E_CANTFREE_g = FAIL; /* Unable to free object */ +hid_t H5E_ALREADYEXISTS_g = FAIL; /* Object already exists */ +hid_t H5E_CANTLOCK_g = FAIL; /* Unable to lock object */ +hid_t H5E_CANTUNLOCK_g = FAIL; /* Unable to unlock object */ +hid_t H5E_CANTGC_g = FAIL; /* Unable to garbage collect */ +hid_t H5E_CANTGETSIZE_g = FAIL; /* Unable to compute size */ +hid_t H5E_OBJOPEN_g = FAIL; /* Object is already open */ + +/* Function entry/exit interface errors */ +hid_t H5E_CANTINIT_g = FAIL; /* Unable to initialize object */ +hid_t H5E_ALREADYINIT_g = FAIL; /* Object already initialized */ +hid_t H5E_CANTRELEASE_g = FAIL; /* Unable to release object */ /* Datatype conversion errors */ hid_t H5E_CANTCONVERT_g = FAIL; /* Can't convert datatypes */ hid_t H5E_BADSIZE_g = FAIL; /* Bad size for object */ +/* No error */ +hid_t H5E_NONE_MINOR_g = FAIL; /* No error */ + +/* Object atom related errors */ +hid_t H5E_BADATOM_g = FAIL; /* Unable to find atom information (already closed?) */ +hid_t H5E_BADGROUP_g = FAIL; /* Unable to find ID group information */ +hid_t H5E_CANTREGISTER_g = FAIL; /* Unable to register new atom */ +hid_t H5E_CANTINC_g = FAIL; /* Unable to increment reference count */ +hid_t H5E_CANTDEC_g = FAIL; /* Unable to decrement reference count */ +hid_t H5E_NOIDS_g = FAIL; /* Out of IDs for group */ + #endif /* H5Edefin_H */ diff --git a/src/H5Einit.h b/src/H5Einit.h index d7afd4c5da..6959009d24 100644 --- a/src/H5Einit.h +++ b/src/H5Einit.h @@ -21,150 +21,95 @@ /* Major error codes */ /*********************/ -HDassert(H5E_FUNC_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FILE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "File accessibility"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SOHM_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Shared Object Header Messages"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SOHM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SYM_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PLUGIN_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Plugin for dynamically loaded library"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PLUGIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") HDassert(H5E_VFL_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Virtual File Layer"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_INTERNAL_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL) +HDassert(H5E_CACHE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Object cache"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BTREE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL) +HDassert(H5E_OHDR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Object header"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_REFERENCE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "References"))==NULL) +HDassert(H5E_SLIST_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Skip Lists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_SLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DATASPACE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL) +HDassert(H5E_TST_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_RESOURCE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL) +HDassert(H5E_STORAGE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Data storage"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_RS_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL) +HDassert(H5E_PAGEBUF_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Page Buffering"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_PAGEBUF_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FARRAY_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Fixed Array"))==NULL) +HDassert(H5E_SOHM_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Shared Object Header Messages"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_SOHM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_HEAP_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Heap"))==NULL) +HDassert(H5E_SYM_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ATTR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Attribute"))==NULL) +HDassert(H5E_PLIST_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Property lists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ATTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") HDassert(H5E_IO_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Low-level I/O"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_EFL_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "External file list"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_TST_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PAGEBUF_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Page Buffering"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PAGEBUF_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") HDassert(H5E_FSPACE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Free Space Manager"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_FSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DATASET_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Dataset"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_STORAGE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Data storage"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_LINK_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Links"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PLIST_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Property lists"))==NULL) +HDassert(H5E_FILE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "File accessibility"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DATATYPE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Datatype"))==NULL) +HDassert(H5E_ATTR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Attribute"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_ATTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_OHDR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Object header"))==NULL) +HDassert(H5E_REFERENCE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "References"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ATOM_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Object atom"))==NULL) +HDassert(H5E_INTERNAL_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NONE_MAJOR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "No error"))==NULL) +HDassert(H5E_DATASET_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Dataset"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NONE_MAJOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SLIST_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Skip Lists"))==NULL) +HDassert(H5E_EARRAY_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Extensible Array"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_EARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") HDassert(H5E_ARGS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Invalid arguments to routine"))==NULL) @@ -176,204 +121,87 @@ if((msg = H5E__create_msg(cls, H5E_MAJOR, "API Context"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_CONTEXT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_EARRAY_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Extensible Array"))==NULL) +HDassert(H5E_PLUGIN_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Plugin for dynamically loaded library"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_EARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_PLUGIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_LINK_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Links"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") HDassert(H5E_PLINE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Data filters"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ERROR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Error API"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CACHE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MAJOR, "Object cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/*********************/ -/* Minor error codes */ -/*********************/ - - -/* Generic low-level file I/O errors */ -HDassert(H5E_SEEKERROR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Seek failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SEEKERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_READERROR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Read failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_READERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_WRITEERROR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Write failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_WRITEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CLOSEERROR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Close failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CLOSEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_OVERFLOW_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Address overflowed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OVERFLOW_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FCNTL_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "File control (fcntl) failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FCNTL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Resource errors */ -HDassert(H5E_NOSPACE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTALLOC_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't allocate space"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOPY_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTFREE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ALREADYEXISTS_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTLOCK_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNLOCK_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTGC_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTGETSIZE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to compute size"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGETSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_OBJOPEN_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Object is already open"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OBJOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Heap errors */ -HDassert(H5E_CANTRESTORE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't restore condition"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRESTORE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOMPUTE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't compute value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOMPUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTEXTEND_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't extend heap's space"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTEXTEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTATTACH_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't attach object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTATTACH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUPDATE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't update object"))==NULL) +HDassert(H5E_DATATYPE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Datatype"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUPDATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTOPERATE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't operate on object"))==NULL) +HDassert(H5E_FUNC_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTOPERATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Function entry/exit interface errors */ -HDassert(H5E_CANTINIT_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to initialize object"))==NULL) +HDassert(H5E_RS_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ALREADYINIT_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Object already initialized"))==NULL) +HDassert(H5E_DATASPACE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALREADYINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRELEASE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to release object"))==NULL) +HDassert(H5E_EFL_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "External file list"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRELEASE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Property list errors */ -HDassert(H5E_CANTGET_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't get value"))==NULL) +HDassert(H5E_RESOURCE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSET_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't set value"))==NULL) +HDassert(H5E_HEAP_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Heap"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DUPCLASS_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL) +HDassert(H5E_BTREE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SETDISALLOWED_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Disallowed operation"))==NULL) +HDassert(H5E_NONE_MAJOR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "No error"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SETDISALLOWED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_NONE_MAJOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Free space errors */ -HDassert(H5E_CANTMERGE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't merge objects"))==NULL) +HDassert(H5E_ATOM_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Object atom"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_ATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREVIVE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't revive object"))==NULL) +HDassert(H5E_FARRAY_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Fixed Array"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_FARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSHRINK_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't shrink container"))==NULL) +HDassert(H5E_ERROR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MAJOR, "Error API"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSHRINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +/*********************/ +/* Minor error codes */ +/*********************/ + + /* Object header related errors */ HDassert(H5E_LINKCOUNT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL) @@ -421,45 +249,6 @@ if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to rename object"))==NULL) if((H5E_CANTRENAME_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* System level errors */ -HDassert(H5E_SYSERRSTR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "System error message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SYSERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* I/O pipeline errors */ -HDassert(H5E_NOFILTER_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CALLBACK_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Callback failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANAPPLY_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SETLOCAL_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOENCODER_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Filter present but encoding disabled"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOENCODER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTFILTER_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Filter operation failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - /* Group related errors */ HDassert(H5E_CANTOPENOBJ_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't open object"))==NULL) @@ -482,11 +271,11 @@ if((msg = H5E__create_msg(cls, H5E_MINOR, "Problem with path to object"))==NULL) if((H5E_PATH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* No error */ -HDassert(H5E_NONE_MINOR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "No error"))==NULL) +/* System level errors */ +HDassert(H5E_SYSERRSTR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "System error message"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NONE_MINOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_SYSERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Plugin errors */ @@ -496,95 +285,6 @@ if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't open directory or file"))==NULL if((H5E_OPENERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* File accessibility errors */ -HDassert(H5E_FILEEXISTS_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "File already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILEEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FILEOPEN_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "File already open"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILEOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCREATE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to create file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCREATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTOPENFILE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to open file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTOPENFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCLOSEFILE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to close file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLOSEFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOTHDF5_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Not an HDF5 file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTHDF5_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADFILE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Bad file ID accessed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_TRUNCATED_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "File has been truncated"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TRUNCATED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_MOUNT_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "File mount error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_MOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTLOCKFILE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to lock file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLOCKFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNLOCKFILE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to unlock file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNLOCKFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Object atom related errors */ -HDassert(H5E_BADATOM_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to find atom information (already closed?)"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADGROUP_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to find ID group information"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADGROUP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREGISTER_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to register new atom"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTREGISTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTINC_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to increment reference count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDEC_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to decrement reference count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDEC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOIDS_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Out of IDs for group"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOIDS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - /* Cache related errors */ HDassert(H5E_CANTFLUSH_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to flush data from cache"))==NULL) @@ -727,6 +427,70 @@ if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to uncork an object"))==NULL) if((H5E_CANTUNCORK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +/* I/O pipeline errors */ +HDassert(H5E_NOFILTER_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CALLBACK_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Callback failed"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANAPPLY_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_SETLOCAL_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_NOENCODER_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Filter present but encoding disabled"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_NOENCODER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTFILTER_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Filter operation failed"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + +/* Generic low-level file I/O errors */ +HDassert(H5E_SEEKERROR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Seek failed"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_SEEKERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_READERROR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Read failed"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_READERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_WRITEERROR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Write failed"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_WRITEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CLOSEERROR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Close failed"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CLOSEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_OVERFLOW_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Address overflowed"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_OVERFLOW_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_FCNTL_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "File control (fcntl) failed"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_FCNTL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + /* Link related errors */ HDassert(H5E_TRAVERSE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Link traversal failure"))==NULL) @@ -741,44 +505,74 @@ if((H5E_NLINKS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HDassert(H5E_NOTREGISTERED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Link class not registered"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTREGISTERED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_NOTREGISTERED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTMOVE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't move object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTSORT_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't sort objects"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTSORT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + +/* File accessibility errors */ +HDassert(H5E_FILEEXISTS_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "File already exists"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_FILEEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_FILEOPEN_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "File already open"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_FILEOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTCREATE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to create file"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTCREATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTOPENFILE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to open file"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTOPENFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMOVE_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't move object"))==NULL) +HDassert(H5E_CANTCLOSEFILE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to close file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_CANTCLOSEFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSORT_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't sort objects"))==NULL) +HDassert(H5E_NOTHDF5_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Not an HDF5 file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSORT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_NOTHDF5_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Parallel MPI errors */ -HDassert(H5E_MPI_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Some MPI function failed"))==NULL) +HDassert(H5E_BADFILE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Bad file ID accessed"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_MPI_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_BADFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_MPIERRSTR_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "MPI Error String"))==NULL) +HDassert(H5E_TRUNCATED_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "File has been truncated"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_TRUNCATED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRECV_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't receive data"))==NULL) +HDassert(H5E_MOUNT_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "File mount error"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_MOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTGATHER_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't gather data"))==NULL) +HDassert(H5E_CANTLOCKFILE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to lock file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGATHER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_CANTLOCKFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NO_INDEPENDENT_g==(-1)); -if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't perform independent IO"))==NULL) +HDassert(H5E_CANTUNLOCKFILE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to unlock file"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NO_INDEPENDENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) +if((H5E_CANTUNLOCKFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Dataspace errors */ @@ -823,6 +617,23 @@ if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't append object"))==NULL) if((H5E_CANTAPPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +/* Free space errors */ +HDassert(H5E_CANTMERGE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't merge objects"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTREVIVE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't revive object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTSHRINK_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't shrink container"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTSHRINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + /* Argument errors */ HDassert(H5E_UNINITIALIZED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL) @@ -850,6 +661,65 @@ if((msg = H5E__create_msg(cls, H5E_MINOR, "Bad value"))==NULL) if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +/* Heap errors */ +HDassert(H5E_CANTRESTORE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't restore condition"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTRESTORE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTCOMPUTE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't compute value"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTCOMPUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTEXTEND_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't extend heap's space"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTEXTEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTATTACH_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't attach object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTATTACH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTUPDATE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't update object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTUPDATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTOPERATE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't operate on object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTOPERATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + +/* Parallel MPI errors */ +HDassert(H5E_MPI_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Some MPI function failed"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_MPI_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_MPIERRSTR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "MPI Error String"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTRECV_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't receive data"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTGATHER_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't gather data"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTGATHER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_NO_INDEPENDENT_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't perform independent IO"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_NO_INDEPENDENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + /* B-tree related errors */ HDassert(H5E_NOTFOUND_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Object not found"))==NULL) @@ -906,6 +776,102 @@ if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to remove object"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_CANTREMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTFIND_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to check for record"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTFIND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + +/* Property list errors */ +HDassert(H5E_CANTGET_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't get value"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTSET_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't set value"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_DUPCLASS_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_SETDISALLOWED_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Disallowed operation"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_SETDISALLOWED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + +/* Resource errors */ +HDassert(H5E_NOSPACE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTALLOC_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't allocate space"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTCOPY_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTFREE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_ALREADYEXISTS_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTLOCK_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTUNLOCK_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTGC_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTGETSIZE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to compute size"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTGETSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_OBJOPEN_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Object is already open"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_OBJOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + +/* Function entry/exit interface errors */ +HDassert(H5E_CANTINIT_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to initialize object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_ALREADYINIT_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Object already initialized"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_ALREADYINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTRELEASE_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to release object"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTRELEASE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Datatype conversion errors */ HDassert(H5E_CANTCONVERT_g==(-1)); @@ -919,4 +885,43 @@ if((msg = H5E__create_msg(cls, H5E_MINOR, "Bad size for object"))==NULL) if((H5E_BADSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +/* No error */ +HDassert(H5E_NONE_MINOR_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "No error"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_NONE_MINOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + +/* Object atom related errors */ +HDassert(H5E_BADATOM_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to find atom information (already closed?)"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_BADATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_BADGROUP_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to find ID group information"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_BADGROUP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTREGISTER_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to register new atom"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTREGISTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTINC_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to increment reference count"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTINC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_CANTDEC_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to decrement reference count"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTDEC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +HDassert(H5E_NOIDS_g==(-1)); +if((msg = H5E__create_msg(cls, H5E_MINOR, "Out of IDs for group"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_NOIDS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + #endif /* H5Einit_H */ diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h index b495dd6f75..fa3843afac 100644 --- a/src/H5Epubgen.h +++ b/src/H5Epubgen.h @@ -25,157 +25,81 @@ extern "C" { /* Major error codes */ /*********************/ -#define H5E_FUNC (H5OPEN H5E_FUNC_g) -#define H5E_FILE (H5OPEN H5E_FILE_g) -#define H5E_SOHM (H5OPEN H5E_SOHM_g) -#define H5E_SYM (H5OPEN H5E_SYM_g) -#define H5E_PLUGIN (H5OPEN H5E_PLUGIN_g) #define H5E_VFL (H5OPEN H5E_VFL_g) -#define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g) -#define H5E_BTREE (H5OPEN H5E_BTREE_g) -#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g) -#define H5E_DATASPACE (H5OPEN H5E_DATASPACE_g) -#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g) -#define H5E_RS (H5OPEN H5E_RS_g) -#define H5E_FARRAY (H5OPEN H5E_FARRAY_g) -#define H5E_HEAP (H5OPEN H5E_HEAP_g) -#define H5E_ATTR (H5OPEN H5E_ATTR_g) -#define H5E_IO (H5OPEN H5E_IO_g) -#define H5E_EFL (H5OPEN H5E_EFL_g) +#define H5E_CACHE (H5OPEN H5E_CACHE_g) +#define H5E_OHDR (H5OPEN H5E_OHDR_g) +#define H5E_SLIST (H5OPEN H5E_SLIST_g) #define H5E_TST (H5OPEN H5E_TST_g) +#define H5E_STORAGE (H5OPEN H5E_STORAGE_g) #define H5E_PAGEBUF (H5OPEN H5E_PAGEBUF_g) +#define H5E_SOHM (H5OPEN H5E_SOHM_g) +#define H5E_SYM (H5OPEN H5E_SYM_g) +#define H5E_PLIST (H5OPEN H5E_PLIST_g) +#define H5E_IO (H5OPEN H5E_IO_g) #define H5E_FSPACE (H5OPEN H5E_FSPACE_g) +#define H5E_FILE (H5OPEN H5E_FILE_g) +#define H5E_ATTR (H5OPEN H5E_ATTR_g) +#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g) +#define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g) #define H5E_DATASET (H5OPEN H5E_DATASET_g) -#define H5E_STORAGE (H5OPEN H5E_STORAGE_g) -#define H5E_LINK (H5OPEN H5E_LINK_g) -#define H5E_PLIST (H5OPEN H5E_PLIST_g) -#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g) -#define H5E_OHDR (H5OPEN H5E_OHDR_g) -#define H5E_ATOM (H5OPEN H5E_ATOM_g) -#define H5E_NONE_MAJOR (H5OPEN H5E_NONE_MAJOR_g) -#define H5E_SLIST (H5OPEN H5E_SLIST_g) +#define H5E_EARRAY (H5OPEN H5E_EARRAY_g) #define H5E_ARGS (H5OPEN H5E_ARGS_g) #define H5E_CONTEXT (H5OPEN H5E_CONTEXT_g) -#define H5E_EARRAY (H5OPEN H5E_EARRAY_g) +#define H5E_PLUGIN (H5OPEN H5E_PLUGIN_g) +#define H5E_LINK (H5OPEN H5E_LINK_g) #define H5E_PLINE (H5OPEN H5E_PLINE_g) +#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g) +#define H5E_FUNC (H5OPEN H5E_FUNC_g) +#define H5E_RS (H5OPEN H5E_RS_g) +#define H5E_DATASPACE (H5OPEN H5E_DATASPACE_g) +#define H5E_EFL (H5OPEN H5E_EFL_g) +#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g) +#define H5E_HEAP (H5OPEN H5E_HEAP_g) +#define H5E_BTREE (H5OPEN H5E_BTREE_g) +#define H5E_NONE_MAJOR (H5OPEN H5E_NONE_MAJOR_g) +#define H5E_ATOM (H5OPEN H5E_ATOM_g) +#define H5E_FARRAY (H5OPEN H5E_FARRAY_g) #define H5E_ERROR (H5OPEN H5E_ERROR_g) -#define H5E_CACHE (H5OPEN H5E_CACHE_g) -H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ -H5_DLLVAR hid_t H5E_FILE_g; /* File accessibility */ -H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */ -H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */ -H5_DLLVAR hid_t H5E_PLUGIN_g; /* Plugin for dynamically loaded library */ H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */ -H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */ -H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */ -H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */ -H5_DLLVAR hid_t H5E_DATASPACE_g; /* Dataspace */ -H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */ -H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */ -H5_DLLVAR hid_t H5E_FARRAY_g; /* Fixed Array */ -H5_DLLVAR hid_t H5E_HEAP_g; /* Heap */ -H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */ -H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */ -H5_DLLVAR hid_t H5E_EFL_g; /* External file list */ +H5_DLLVAR hid_t H5E_CACHE_g; /* Object cache */ +H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */ +H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */ H5_DLLVAR hid_t H5E_TST_g; /* Ternary Search Trees */ +H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */ H5_DLLVAR hid_t H5E_PAGEBUF_g; /* Page Buffering */ +H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */ +H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */ +H5_DLLVAR hid_t H5E_PLIST_g; /* Property lists */ +H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */ H5_DLLVAR hid_t H5E_FSPACE_g; /* Free Space Manager */ +H5_DLLVAR hid_t H5E_FILE_g; /* File accessibility */ +H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */ +H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */ +H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */ H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */ -H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */ -H5_DLLVAR hid_t H5E_LINK_g; /* Links */ -H5_DLLVAR hid_t H5E_PLIST_g; /* Property lists */ -H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */ -H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */ -H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */ -H5_DLLVAR hid_t H5E_NONE_MAJOR_g; /* No error */ -H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */ +H5_DLLVAR hid_t H5E_EARRAY_g; /* Extensible Array */ H5_DLLVAR hid_t H5E_ARGS_g; /* Invalid arguments to routine */ H5_DLLVAR hid_t H5E_CONTEXT_g; /* API Context */ -H5_DLLVAR hid_t H5E_EARRAY_g; /* Extensible Array */ +H5_DLLVAR hid_t H5E_PLUGIN_g; /* Plugin for dynamically loaded library */ +H5_DLLVAR hid_t H5E_LINK_g; /* Links */ H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */ +H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */ +H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ +H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */ +H5_DLLVAR hid_t H5E_DATASPACE_g; /* Dataspace */ +H5_DLLVAR hid_t H5E_EFL_g; /* External file list */ +H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */ +H5_DLLVAR hid_t H5E_HEAP_g; /* Heap */ +H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */ +H5_DLLVAR hid_t H5E_NONE_MAJOR_g; /* No error */ +H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */ +H5_DLLVAR hid_t H5E_FARRAY_g; /* Fixed Array */ H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */ -H5_DLLVAR hid_t H5E_CACHE_g; /* Object cache */ /*********************/ /* Minor error codes */ /*********************/ -/* Generic low-level file I/O errors */ -#define H5E_SEEKERROR (H5OPEN H5E_SEEKERROR_g) -#define H5E_READERROR (H5OPEN H5E_READERROR_g) -#define H5E_WRITEERROR (H5OPEN H5E_WRITEERROR_g) -#define H5E_CLOSEERROR (H5OPEN H5E_CLOSEERROR_g) -#define H5E_OVERFLOW (H5OPEN H5E_OVERFLOW_g) -#define H5E_FCNTL (H5OPEN H5E_FCNTL_g) -H5_DLLVAR hid_t H5E_SEEKERROR_g; /* Seek failed */ -H5_DLLVAR hid_t H5E_READERROR_g; /* Read failed */ -H5_DLLVAR hid_t H5E_WRITEERROR_g; /* Write failed */ -H5_DLLVAR hid_t H5E_CLOSEERROR_g; /* Close failed */ -H5_DLLVAR hid_t H5E_OVERFLOW_g; /* Address overflowed */ -H5_DLLVAR hid_t H5E_FCNTL_g; /* File control (fcntl) failed */ - -/* Resource errors */ -#define H5E_NOSPACE (H5OPEN H5E_NOSPACE_g) -#define H5E_CANTALLOC (H5OPEN H5E_CANTALLOC_g) -#define H5E_CANTCOPY (H5OPEN H5E_CANTCOPY_g) -#define H5E_CANTFREE (H5OPEN H5E_CANTFREE_g) -#define H5E_ALREADYEXISTS (H5OPEN H5E_ALREADYEXISTS_g) -#define H5E_CANTLOCK (H5OPEN H5E_CANTLOCK_g) -#define H5E_CANTUNLOCK (H5OPEN H5E_CANTUNLOCK_g) -#define H5E_CANTGC (H5OPEN H5E_CANTGC_g) -#define H5E_CANTGETSIZE (H5OPEN H5E_CANTGETSIZE_g) -#define H5E_OBJOPEN (H5OPEN H5E_OBJOPEN_g) -H5_DLLVAR hid_t H5E_NOSPACE_g; /* No space available for allocation */ -H5_DLLVAR hid_t H5E_CANTALLOC_g; /* Can't allocate space */ -H5_DLLVAR hid_t H5E_CANTCOPY_g; /* Unable to copy object */ -H5_DLLVAR hid_t H5E_CANTFREE_g; /* Unable to free object */ -H5_DLLVAR hid_t H5E_ALREADYEXISTS_g; /* Object already exists */ -H5_DLLVAR hid_t H5E_CANTLOCK_g; /* Unable to lock object */ -H5_DLLVAR hid_t H5E_CANTUNLOCK_g; /* Unable to unlock object */ -H5_DLLVAR hid_t H5E_CANTGC_g; /* Unable to garbage collect */ -H5_DLLVAR hid_t H5E_CANTGETSIZE_g; /* Unable to compute size */ -H5_DLLVAR hid_t H5E_OBJOPEN_g; /* Object is already open */ - -/* Heap errors */ -#define H5E_CANTRESTORE (H5OPEN H5E_CANTRESTORE_g) -#define H5E_CANTCOMPUTE (H5OPEN H5E_CANTCOMPUTE_g) -#define H5E_CANTEXTEND (H5OPEN H5E_CANTEXTEND_g) -#define H5E_CANTATTACH (H5OPEN H5E_CANTATTACH_g) -#define H5E_CANTUPDATE (H5OPEN H5E_CANTUPDATE_g) -#define H5E_CANTOPERATE (H5OPEN H5E_CANTOPERATE_g) -H5_DLLVAR hid_t H5E_CANTRESTORE_g; /* Can't restore condition */ -H5_DLLVAR hid_t H5E_CANTCOMPUTE_g; /* Can't compute value */ -H5_DLLVAR hid_t H5E_CANTEXTEND_g; /* Can't extend heap's space */ -H5_DLLVAR hid_t H5E_CANTATTACH_g; /* Can't attach object */ -H5_DLLVAR hid_t H5E_CANTUPDATE_g; /* Can't update object */ -H5_DLLVAR hid_t H5E_CANTOPERATE_g; /* Can't operate on object */ - -/* Function entry/exit interface errors */ -#define H5E_CANTINIT (H5OPEN H5E_CANTINIT_g) -#define H5E_ALREADYINIT (H5OPEN H5E_ALREADYINIT_g) -#define H5E_CANTRELEASE (H5OPEN H5E_CANTRELEASE_g) -H5_DLLVAR hid_t H5E_CANTINIT_g; /* Unable to initialize object */ -H5_DLLVAR hid_t H5E_ALREADYINIT_g; /* Object already initialized */ -H5_DLLVAR hid_t H5E_CANTRELEASE_g; /* Unable to release object */ - -/* Property list errors */ -#define H5E_CANTGET (H5OPEN H5E_CANTGET_g) -#define H5E_CANTSET (H5OPEN H5E_CANTSET_g) -#define H5E_DUPCLASS (H5OPEN H5E_DUPCLASS_g) -#define H5E_SETDISALLOWED (H5OPEN H5E_SETDISALLOWED_g) -H5_DLLVAR hid_t H5E_CANTGET_g; /* Can't get value */ -H5_DLLVAR hid_t H5E_CANTSET_g; /* Can't set value */ -H5_DLLVAR hid_t H5E_DUPCLASS_g; /* Duplicate class name in parent class */ -H5_DLLVAR hid_t H5E_SETDISALLOWED_g; /* Disallowed operation */ - -/* Free space errors */ -#define H5E_CANTMERGE (H5OPEN H5E_CANTMERGE_g) -#define H5E_CANTREVIVE (H5OPEN H5E_CANTREVIVE_g) -#define H5E_CANTSHRINK (H5OPEN H5E_CANTSHRINK_g) -H5_DLLVAR hid_t H5E_CANTMERGE_g; /* Can't merge objects */ -H5_DLLVAR hid_t H5E_CANTREVIVE_g; /* Can't revive object */ -H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */ - /* Object header related errors */ #define H5E_LINKCOUNT (H5OPEN H5E_LINKCOUNT_g) #define H5E_VERSION (H5OPEN H5E_VERSION_g) @@ -196,24 +120,6 @@ H5_DLLVAR hid_t H5E_CANTPACK_g; /* Can't pack messages */ H5_DLLVAR hid_t H5E_CANTRESET_g; /* Can't reset object */ H5_DLLVAR hid_t H5E_CANTRENAME_g; /* Unable to rename object */ -/* System level errors */ -#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g) -H5_DLLVAR hid_t H5E_SYSERRSTR_g; /* System error message */ - -/* I/O pipeline errors */ -#define H5E_NOFILTER (H5OPEN H5E_NOFILTER_g) -#define H5E_CALLBACK (H5OPEN H5E_CALLBACK_g) -#define H5E_CANAPPLY (H5OPEN H5E_CANAPPLY_g) -#define H5E_SETLOCAL (H5OPEN H5E_SETLOCAL_g) -#define H5E_NOENCODER (H5OPEN H5E_NOENCODER_g) -#define H5E_CANTFILTER (H5OPEN H5E_CANTFILTER_g) -H5_DLLVAR hid_t H5E_NOFILTER_g; /* Requested filter is not available */ -H5_DLLVAR hid_t H5E_CALLBACK_g; /* Callback failed */ -H5_DLLVAR hid_t H5E_CANAPPLY_g; /* Error from filter 'can apply' callback */ -H5_DLLVAR hid_t H5E_SETLOCAL_g; /* Error from filter 'set local' callback */ -H5_DLLVAR hid_t H5E_NOENCODER_g; /* Filter present but encoding disabled */ -H5_DLLVAR hid_t H5E_CANTFILTER_g; /* Filter operation failed */ - /* Group related errors */ #define H5E_CANTOPENOBJ (H5OPEN H5E_CANTOPENOBJ_g) #define H5E_CANTCLOSEOBJ (H5OPEN H5E_CANTCLOSEOBJ_g) @@ -224,52 +130,14 @@ H5_DLLVAR hid_t H5E_CANTCLOSEOBJ_g; /* Can't close object */ H5_DLLVAR hid_t H5E_COMPLEN_g; /* Name component is too long */ H5_DLLVAR hid_t H5E_PATH_g; /* Problem with path to object */ -/* No error */ -#define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g) -H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */ +/* System level errors */ +#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g) +H5_DLLVAR hid_t H5E_SYSERRSTR_g; /* System error message */ /* Plugin errors */ #define H5E_OPENERROR (H5OPEN H5E_OPENERROR_g) H5_DLLVAR hid_t H5E_OPENERROR_g; /* Can't open directory or file */ -/* File accessibility errors */ -#define H5E_FILEEXISTS (H5OPEN H5E_FILEEXISTS_g) -#define H5E_FILEOPEN (H5OPEN H5E_FILEOPEN_g) -#define H5E_CANTCREATE (H5OPEN H5E_CANTCREATE_g) -#define H5E_CANTOPENFILE (H5OPEN H5E_CANTOPENFILE_g) -#define H5E_CANTCLOSEFILE (H5OPEN H5E_CANTCLOSEFILE_g) -#define H5E_NOTHDF5 (H5OPEN H5E_NOTHDF5_g) -#define H5E_BADFILE (H5OPEN H5E_BADFILE_g) -#define H5E_TRUNCATED (H5OPEN H5E_TRUNCATED_g) -#define H5E_MOUNT (H5OPEN H5E_MOUNT_g) -#define H5E_CANTLOCKFILE (H5OPEN H5E_CANTLOCKFILE_g) -#define H5E_CANTUNLOCKFILE (H5OPEN H5E_CANTUNLOCKFILE_g) -H5_DLLVAR hid_t H5E_FILEEXISTS_g; /* File already exists */ -H5_DLLVAR hid_t H5E_FILEOPEN_g; /* File already open */ -H5_DLLVAR hid_t H5E_CANTCREATE_g; /* Unable to create file */ -H5_DLLVAR hid_t H5E_CANTOPENFILE_g; /* Unable to open file */ -H5_DLLVAR hid_t H5E_CANTCLOSEFILE_g; /* Unable to close file */ -H5_DLLVAR hid_t H5E_NOTHDF5_g; /* Not an HDF5 file */ -H5_DLLVAR hid_t H5E_BADFILE_g; /* Bad file ID accessed */ -H5_DLLVAR hid_t H5E_TRUNCATED_g; /* File has been truncated */ -H5_DLLVAR hid_t H5E_MOUNT_g; /* File mount error */ -H5_DLLVAR hid_t H5E_CANTLOCKFILE_g; /* Unable to lock file */ -H5_DLLVAR hid_t H5E_CANTUNLOCKFILE_g; /* Unable to unlock file */ - -/* Object atom related errors */ -#define H5E_BADATOM (H5OPEN H5E_BADATOM_g) -#define H5E_BADGROUP (H5OPEN H5E_BADGROUP_g) -#define H5E_CANTREGISTER (H5OPEN H5E_CANTREGISTER_g) -#define H5E_CANTINC (H5OPEN H5E_CANTINC_g) -#define H5E_CANTDEC (H5OPEN H5E_CANTDEC_g) -#define H5E_NOIDS (H5OPEN H5E_NOIDS_g) -H5_DLLVAR hid_t H5E_BADATOM_g; /* Unable to find atom information (already closed?) */ -H5_DLLVAR hid_t H5E_BADGROUP_g; /* Unable to find ID group information */ -H5_DLLVAR hid_t H5E_CANTREGISTER_g; /* Unable to register new atom */ -H5_DLLVAR hid_t H5E_CANTINC_g; /* Unable to increment reference count */ -H5_DLLVAR hid_t H5E_CANTDEC_g; /* Unable to decrement reference count */ -H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ - /* Cache related errors */ #define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g) #define H5E_CANTUNSERIALIZE (H5OPEN H5E_CANTUNSERIALIZE_g) @@ -328,6 +196,34 @@ H5_DLLVAR hid_t H5E_LOGFAIL_g; /* old H5E_LOGGING_g (maintained for binary H5_DLLVAR hid_t H5E_CANTCORK_g; /* Unable to cork an object */ H5_DLLVAR hid_t H5E_CANTUNCORK_g; /* Unable to uncork an object */ +/* I/O pipeline errors */ +#define H5E_NOFILTER (H5OPEN H5E_NOFILTER_g) +#define H5E_CALLBACK (H5OPEN H5E_CALLBACK_g) +#define H5E_CANAPPLY (H5OPEN H5E_CANAPPLY_g) +#define H5E_SETLOCAL (H5OPEN H5E_SETLOCAL_g) +#define H5E_NOENCODER (H5OPEN H5E_NOENCODER_g) +#define H5E_CANTFILTER (H5OPEN H5E_CANTFILTER_g) +H5_DLLVAR hid_t H5E_NOFILTER_g; /* Requested filter is not available */ +H5_DLLVAR hid_t H5E_CALLBACK_g; /* Callback failed */ +H5_DLLVAR hid_t H5E_CANAPPLY_g; /* Error from filter 'can apply' callback */ +H5_DLLVAR hid_t H5E_SETLOCAL_g; /* Error from filter 'set local' callback */ +H5_DLLVAR hid_t H5E_NOENCODER_g; /* Filter present but encoding disabled */ +H5_DLLVAR hid_t H5E_CANTFILTER_g; /* Filter operation failed */ + +/* Generic low-level file I/O errors */ +#define H5E_SEEKERROR (H5OPEN H5E_SEEKERROR_g) +#define H5E_READERROR (H5OPEN H5E_READERROR_g) +#define H5E_WRITEERROR (H5OPEN H5E_WRITEERROR_g) +#define H5E_CLOSEERROR (H5OPEN H5E_CLOSEERROR_g) +#define H5E_OVERFLOW (H5OPEN H5E_OVERFLOW_g) +#define H5E_FCNTL (H5OPEN H5E_FCNTL_g) +H5_DLLVAR hid_t H5E_SEEKERROR_g; /* Seek failed */ +H5_DLLVAR hid_t H5E_READERROR_g; /* Read failed */ +H5_DLLVAR hid_t H5E_WRITEERROR_g; /* Write failed */ +H5_DLLVAR hid_t H5E_CLOSEERROR_g; /* Close failed */ +H5_DLLVAR hid_t H5E_OVERFLOW_g; /* Address overflowed */ +H5_DLLVAR hid_t H5E_FCNTL_g; /* File control (fcntl) failed */ + /* Link related errors */ #define H5E_TRAVERSE (H5OPEN H5E_TRAVERSE_g) #define H5E_NLINKS (H5OPEN H5E_NLINKS_g) @@ -340,17 +236,29 @@ H5_DLLVAR hid_t H5E_NOTREGISTERED_g; /* Link class not registered */ H5_DLLVAR hid_t H5E_CANTMOVE_g; /* Can't move object */ H5_DLLVAR hid_t H5E_CANTSORT_g; /* Can't sort objects */ -/* Parallel MPI errors */ -#define H5E_MPI (H5OPEN H5E_MPI_g) -#define H5E_MPIERRSTR (H5OPEN H5E_MPIERRSTR_g) -#define H5E_CANTRECV (H5OPEN H5E_CANTRECV_g) -#define H5E_CANTGATHER (H5OPEN H5E_CANTGATHER_g) -#define H5E_NO_INDEPENDENT (H5OPEN H5E_NO_INDEPENDENT_g) -H5_DLLVAR hid_t H5E_MPI_g; /* Some MPI function failed */ -H5_DLLVAR hid_t H5E_MPIERRSTR_g; /* MPI Error String */ -H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive data */ -H5_DLLVAR hid_t H5E_CANTGATHER_g; /* Can't gather data */ -H5_DLLVAR hid_t H5E_NO_INDEPENDENT_g; /* Can't perform independent IO */ +/* File accessibility errors */ +#define H5E_FILEEXISTS (H5OPEN H5E_FILEEXISTS_g) +#define H5E_FILEOPEN (H5OPEN H5E_FILEOPEN_g) +#define H5E_CANTCREATE (H5OPEN H5E_CANTCREATE_g) +#define H5E_CANTOPENFILE (H5OPEN H5E_CANTOPENFILE_g) +#define H5E_CANTCLOSEFILE (H5OPEN H5E_CANTCLOSEFILE_g) +#define H5E_NOTHDF5 (H5OPEN H5E_NOTHDF5_g) +#define H5E_BADFILE (H5OPEN H5E_BADFILE_g) +#define H5E_TRUNCATED (H5OPEN H5E_TRUNCATED_g) +#define H5E_MOUNT (H5OPEN H5E_MOUNT_g) +#define H5E_CANTLOCKFILE (H5OPEN H5E_CANTLOCKFILE_g) +#define H5E_CANTUNLOCKFILE (H5OPEN H5E_CANTUNLOCKFILE_g) +H5_DLLVAR hid_t H5E_FILEEXISTS_g; /* File already exists */ +H5_DLLVAR hid_t H5E_FILEOPEN_g; /* File already open */ +H5_DLLVAR hid_t H5E_CANTCREATE_g; /* Unable to create file */ +H5_DLLVAR hid_t H5E_CANTOPENFILE_g; /* Unable to open file */ +H5_DLLVAR hid_t H5E_CANTCLOSEFILE_g; /* Unable to close file */ +H5_DLLVAR hid_t H5E_NOTHDF5_g; /* Not an HDF5 file */ +H5_DLLVAR hid_t H5E_BADFILE_g; /* Bad file ID accessed */ +H5_DLLVAR hid_t H5E_TRUNCATED_g; /* File has been truncated */ +H5_DLLVAR hid_t H5E_MOUNT_g; /* File mount error */ +H5_DLLVAR hid_t H5E_CANTLOCKFILE_g; /* Unable to lock file */ +H5_DLLVAR hid_t H5E_CANTUNLOCKFILE_g; /* Unable to unlock file */ /* Dataspace errors */ #define H5E_CANTCLIP (H5OPEN H5E_CANTCLIP_g) @@ -370,6 +278,14 @@ H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */ H5_DLLVAR hid_t H5E_INCONSISTENTSTATE_g; /* Internal states are inconsistent */ H5_DLLVAR hid_t H5E_CANTAPPEND_g; /* Can't append object */ +/* Free space errors */ +#define H5E_CANTMERGE (H5OPEN H5E_CANTMERGE_g) +#define H5E_CANTREVIVE (H5OPEN H5E_CANTREVIVE_g) +#define H5E_CANTSHRINK (H5OPEN H5E_CANTSHRINK_g) +H5_DLLVAR hid_t H5E_CANTMERGE_g; /* Can't merge objects */ +H5_DLLVAR hid_t H5E_CANTREVIVE_g; /* Can't revive object */ +H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */ + /* Argument errors */ #define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g) #define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g) @@ -382,6 +298,32 @@ H5_DLLVAR hid_t H5E_BADTYPE_g; /* Inappropriate type */ H5_DLLVAR hid_t H5E_BADRANGE_g; /* Out of range */ H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */ +/* Heap errors */ +#define H5E_CANTRESTORE (H5OPEN H5E_CANTRESTORE_g) +#define H5E_CANTCOMPUTE (H5OPEN H5E_CANTCOMPUTE_g) +#define H5E_CANTEXTEND (H5OPEN H5E_CANTEXTEND_g) +#define H5E_CANTATTACH (H5OPEN H5E_CANTATTACH_g) +#define H5E_CANTUPDATE (H5OPEN H5E_CANTUPDATE_g) +#define H5E_CANTOPERATE (H5OPEN H5E_CANTOPERATE_g) +H5_DLLVAR hid_t H5E_CANTRESTORE_g; /* Can't restore condition */ +H5_DLLVAR hid_t H5E_CANTCOMPUTE_g; /* Can't compute value */ +H5_DLLVAR hid_t H5E_CANTEXTEND_g; /* Can't extend heap's space */ +H5_DLLVAR hid_t H5E_CANTATTACH_g; /* Can't attach object */ +H5_DLLVAR hid_t H5E_CANTUPDATE_g; /* Can't update object */ +H5_DLLVAR hid_t H5E_CANTOPERATE_g; /* Can't operate on object */ + +/* Parallel MPI errors */ +#define H5E_MPI (H5OPEN H5E_MPI_g) +#define H5E_MPIERRSTR (H5OPEN H5E_MPIERRSTR_g) +#define H5E_CANTRECV (H5OPEN H5E_CANTRECV_g) +#define H5E_CANTGATHER (H5OPEN H5E_CANTGATHER_g) +#define H5E_NO_INDEPENDENT (H5OPEN H5E_NO_INDEPENDENT_g) +H5_DLLVAR hid_t H5E_MPI_g; /* Some MPI function failed */ +H5_DLLVAR hid_t H5E_MPIERRSTR_g; /* MPI Error String */ +H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive data */ +H5_DLLVAR hid_t H5E_CANTGATHER_g; /* Can't gather data */ +H5_DLLVAR hid_t H5E_NO_INDEPENDENT_g; /* Can't perform independent IO */ + /* B-tree related errors */ #define H5E_NOTFOUND (H5OPEN H5E_NOTFOUND_g) #define H5E_EXISTS (H5OPEN H5E_EXISTS_g) @@ -394,6 +336,7 @@ H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */ #define H5E_CANTLIST (H5OPEN H5E_CANTLIST_g) #define H5E_CANTMODIFY (H5OPEN H5E_CANTMODIFY_g) #define H5E_CANTREMOVE (H5OPEN H5E_CANTREMOVE_g) +#define H5E_CANTFIND (H5OPEN H5E_CANTFIND_g) H5_DLLVAR hid_t H5E_NOTFOUND_g; /* Object not found */ H5_DLLVAR hid_t H5E_EXISTS_g; /* Object already exists */ H5_DLLVAR hid_t H5E_CANTENCODE_g; /* Unable to encode value */ @@ -405,6 +348,47 @@ H5_DLLVAR hid_t H5E_CANTINSERT_g; /* Unable to insert object */ H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */ H5_DLLVAR hid_t H5E_CANTMODIFY_g; /* Unable to modify record */ H5_DLLVAR hid_t H5E_CANTREMOVE_g; /* Unable to remove object */ +H5_DLLVAR hid_t H5E_CANTFIND_g; /* Unable to check for record */ + +/* Property list errors */ +#define H5E_CANTGET (H5OPEN H5E_CANTGET_g) +#define H5E_CANTSET (H5OPEN H5E_CANTSET_g) +#define H5E_DUPCLASS (H5OPEN H5E_DUPCLASS_g) +#define H5E_SETDISALLOWED (H5OPEN H5E_SETDISALLOWED_g) +H5_DLLVAR hid_t H5E_CANTGET_g; /* Can't get value */ +H5_DLLVAR hid_t H5E_CANTSET_g; /* Can't set value */ +H5_DLLVAR hid_t H5E_DUPCLASS_g; /* Duplicate class name in parent class */ +H5_DLLVAR hid_t H5E_SETDISALLOWED_g; /* Disallowed operation */ + +/* Resource errors */ +#define H5E_NOSPACE (H5OPEN H5E_NOSPACE_g) +#define H5E_CANTALLOC (H5OPEN H5E_CANTALLOC_g) +#define H5E_CANTCOPY (H5OPEN H5E_CANTCOPY_g) +#define H5E_CANTFREE (H5OPEN H5E_CANTFREE_g) +#define H5E_ALREADYEXISTS (H5OPEN H5E_ALREADYEXISTS_g) +#define H5E_CANTLOCK (H5OPEN H5E_CANTLOCK_g) +#define H5E_CANTUNLOCK (H5OPEN H5E_CANTUNLOCK_g) +#define H5E_CANTGC (H5OPEN H5E_CANTGC_g) +#define H5E_CANTGETSIZE (H5OPEN H5E_CANTGETSIZE_g) +#define H5E_OBJOPEN (H5OPEN H5E_OBJOPEN_g) +H5_DLLVAR hid_t H5E_NOSPACE_g; /* No space available for allocation */ +H5_DLLVAR hid_t H5E_CANTALLOC_g; /* Can't allocate space */ +H5_DLLVAR hid_t H5E_CANTCOPY_g; /* Unable to copy object */ +H5_DLLVAR hid_t H5E_CANTFREE_g; /* Unable to free object */ +H5_DLLVAR hid_t H5E_ALREADYEXISTS_g; /* Object already exists */ +H5_DLLVAR hid_t H5E_CANTLOCK_g; /* Unable to lock object */ +H5_DLLVAR hid_t H5E_CANTUNLOCK_g; /* Unable to unlock object */ +H5_DLLVAR hid_t H5E_CANTGC_g; /* Unable to garbage collect */ +H5_DLLVAR hid_t H5E_CANTGETSIZE_g; /* Unable to compute size */ +H5_DLLVAR hid_t H5E_OBJOPEN_g; /* Object is already open */ + +/* Function entry/exit interface errors */ +#define H5E_CANTINIT (H5OPEN H5E_CANTINIT_g) +#define H5E_ALREADYINIT (H5OPEN H5E_ALREADYINIT_g) +#define H5E_CANTRELEASE (H5OPEN H5E_CANTRELEASE_g) +H5_DLLVAR hid_t H5E_CANTINIT_g; /* Unable to initialize object */ +H5_DLLVAR hid_t H5E_ALREADYINIT_g; /* Object already initialized */ +H5_DLLVAR hid_t H5E_CANTRELEASE_g; /* Unable to release object */ /* Datatype conversion errors */ #define H5E_CANTCONVERT (H5OPEN H5E_CANTCONVERT_g) @@ -412,6 +396,24 @@ H5_DLLVAR hid_t H5E_CANTREMOVE_g; /* Unable to remove object */ H5_DLLVAR hid_t H5E_CANTCONVERT_g; /* Can't convert datatypes */ H5_DLLVAR hid_t H5E_BADSIZE_g; /* Bad size for object */ +/* No error */ +#define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g) +H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */ + +/* Object atom related errors */ +#define H5E_BADATOM (H5OPEN H5E_BADATOM_g) +#define H5E_BADGROUP (H5OPEN H5E_BADGROUP_g) +#define H5E_CANTREGISTER (H5OPEN H5E_CANTREGISTER_g) +#define H5E_CANTINC (H5OPEN H5E_CANTINC_g) +#define H5E_CANTDEC (H5OPEN H5E_CANTDEC_g) +#define H5E_NOIDS (H5OPEN H5E_NOIDS_g) +H5_DLLVAR hid_t H5E_BADATOM_g; /* Unable to find atom information (already closed?) */ +H5_DLLVAR hid_t H5E_BADGROUP_g; /* Unable to find ID group information */ +H5_DLLVAR hid_t H5E_CANTREGISTER_g; /* Unable to register new atom */ +H5_DLLVAR hid_t H5E_CANTINC_g; /* Unable to increment reference count */ +H5_DLLVAR hid_t H5E_CANTDEC_g; /* Unable to decrement reference count */ +H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ + #ifdef __cplusplus } #endif diff --git a/src/H5Eterm.h b/src/H5Eterm.h index 9684c29ce1..09f47c9a24 100644 --- a/src/H5Eterm.h +++ b/src/H5Eterm.h @@ -19,89 +19,45 @@ /* Reset major error IDs */ -H5E_FUNC_g= -H5E_FILE_g= -H5E_SOHM_g= -H5E_SYM_g= -H5E_PLUGIN_g= H5E_VFL_g= -H5E_INTERNAL_g= -H5E_BTREE_g= -H5E_REFERENCE_g= -H5E_DATASPACE_g= -H5E_RESOURCE_g= -H5E_RS_g= -H5E_FARRAY_g= -H5E_HEAP_g= -H5E_ATTR_g= -H5E_IO_g= -H5E_EFL_g= +H5E_CACHE_g= +H5E_OHDR_g= +H5E_SLIST_g= H5E_TST_g= +H5E_STORAGE_g= H5E_PAGEBUF_g= +H5E_SOHM_g= +H5E_SYM_g= +H5E_PLIST_g= +H5E_IO_g= H5E_FSPACE_g= +H5E_FILE_g= +H5E_ATTR_g= +H5E_REFERENCE_g= +H5E_INTERNAL_g= H5E_DATASET_g= -H5E_STORAGE_g= -H5E_LINK_g= -H5E_PLIST_g= -H5E_DATATYPE_g= -H5E_OHDR_g= -H5E_ATOM_g= -H5E_NONE_MAJOR_g= -H5E_SLIST_g= +H5E_EARRAY_g= H5E_ARGS_g= H5E_CONTEXT_g= -H5E_EARRAY_g= +H5E_PLUGIN_g= +H5E_LINK_g= H5E_PLINE_g= -H5E_ERROR_g= -H5E_CACHE_g= (-1); +H5E_DATATYPE_g= +H5E_FUNC_g= +H5E_RS_g= +H5E_DATASPACE_g= +H5E_EFL_g= +H5E_RESOURCE_g= +H5E_HEAP_g= +H5E_BTREE_g= +H5E_NONE_MAJOR_g= +H5E_ATOM_g= +H5E_FARRAY_g= +H5E_ERROR_g= (-1); /* Reset minor error IDs */ -/* Generic low-level file I/O errors */ -H5E_SEEKERROR_g= -H5E_READERROR_g= -H5E_WRITEERROR_g= -H5E_CLOSEERROR_g= -H5E_OVERFLOW_g= -H5E_FCNTL_g= - -/* Resource errors */ -H5E_NOSPACE_g= -H5E_CANTALLOC_g= -H5E_CANTCOPY_g= -H5E_CANTFREE_g= -H5E_ALREADYEXISTS_g= -H5E_CANTLOCK_g= -H5E_CANTUNLOCK_g= -H5E_CANTGC_g= -H5E_CANTGETSIZE_g= -H5E_OBJOPEN_g= - -/* Heap errors */ -H5E_CANTRESTORE_g= -H5E_CANTCOMPUTE_g= -H5E_CANTEXTEND_g= -H5E_CANTATTACH_g= -H5E_CANTUPDATE_g= -H5E_CANTOPERATE_g= - -/* Function entry/exit interface errors */ -H5E_CANTINIT_g= -H5E_ALREADYINIT_g= -H5E_CANTRELEASE_g= - -/* Property list errors */ -H5E_CANTGET_g= -H5E_CANTSET_g= -H5E_DUPCLASS_g= -H5E_SETDISALLOWED_g= - -/* Free space errors */ -H5E_CANTMERGE_g= -H5E_CANTREVIVE_g= -H5E_CANTSHRINK_g= - /* Object header related errors */ H5E_LINKCOUNT_g= H5E_VERSION_g= @@ -113,50 +69,18 @@ H5E_CANTPACK_g= H5E_CANTRESET_g= H5E_CANTRENAME_g= -/* System level errors */ -H5E_SYSERRSTR_g= - -/* I/O pipeline errors */ -H5E_NOFILTER_g= -H5E_CALLBACK_g= -H5E_CANAPPLY_g= -H5E_SETLOCAL_g= -H5E_NOENCODER_g= -H5E_CANTFILTER_g= - /* Group related errors */ H5E_CANTOPENOBJ_g= H5E_CANTCLOSEOBJ_g= H5E_COMPLEN_g= H5E_PATH_g= -/* No error */ -H5E_NONE_MINOR_g= +/* System level errors */ +H5E_SYSERRSTR_g= /* Plugin errors */ H5E_OPENERROR_g= -/* File accessibility errors */ -H5E_FILEEXISTS_g= -H5E_FILEOPEN_g= -H5E_CANTCREATE_g= -H5E_CANTOPENFILE_g= -H5E_CANTCLOSEFILE_g= -H5E_NOTHDF5_g= -H5E_BADFILE_g= -H5E_TRUNCATED_g= -H5E_MOUNT_g= -H5E_CANTLOCKFILE_g= -H5E_CANTUNLOCKFILE_g= - -/* Object atom related errors */ -H5E_BADATOM_g= -H5E_BADGROUP_g= -H5E_CANTREGISTER_g= -H5E_CANTINC_g= -H5E_CANTDEC_g= -H5E_NOIDS_g= - /* Cache related errors */ H5E_CANTFLUSH_g= H5E_CANTUNSERIALIZE_g= @@ -187,6 +111,22 @@ H5E_LOGFAIL_g= H5E_CANTCORK_g= H5E_CANTUNCORK_g= +/* I/O pipeline errors */ +H5E_NOFILTER_g= +H5E_CALLBACK_g= +H5E_CANAPPLY_g= +H5E_SETLOCAL_g= +H5E_NOENCODER_g= +H5E_CANTFILTER_g= + +/* Generic low-level file I/O errors */ +H5E_SEEKERROR_g= +H5E_READERROR_g= +H5E_WRITEERROR_g= +H5E_CLOSEERROR_g= +H5E_OVERFLOW_g= +H5E_FCNTL_g= + /* Link related errors */ H5E_TRAVERSE_g= H5E_NLINKS_g= @@ -194,12 +134,18 @@ H5E_NOTREGISTERED_g= H5E_CANTMOVE_g= H5E_CANTSORT_g= -/* Parallel MPI errors */ -H5E_MPI_g= -H5E_MPIERRSTR_g= -H5E_CANTRECV_g= -H5E_CANTGATHER_g= -H5E_NO_INDEPENDENT_g= +/* File accessibility errors */ +H5E_FILEEXISTS_g= +H5E_FILEOPEN_g= +H5E_CANTCREATE_g= +H5E_CANTOPENFILE_g= +H5E_CANTCLOSEFILE_g= +H5E_NOTHDF5_g= +H5E_BADFILE_g= +H5E_TRUNCATED_g= +H5E_MOUNT_g= +H5E_CANTLOCKFILE_g= +H5E_CANTUNLOCKFILE_g= /* Dataspace errors */ H5E_CANTCLIP_g= @@ -211,6 +157,11 @@ H5E_CANTCOMPARE_g= H5E_INCONSISTENTSTATE_g= H5E_CANTAPPEND_g= +/* Free space errors */ +H5E_CANTMERGE_g= +H5E_CANTREVIVE_g= +H5E_CANTSHRINK_g= + /* Argument errors */ H5E_UNINITIALIZED_g= H5E_UNSUPPORTED_g= @@ -218,6 +169,21 @@ H5E_BADTYPE_g= H5E_BADRANGE_g= H5E_BADVALUE_g= +/* Heap errors */ +H5E_CANTRESTORE_g= +H5E_CANTCOMPUTE_g= +H5E_CANTEXTEND_g= +H5E_CANTATTACH_g= +H5E_CANTUPDATE_g= +H5E_CANTOPERATE_g= + +/* Parallel MPI errors */ +H5E_MPI_g= +H5E_MPIERRSTR_g= +H5E_CANTRECV_g= +H5E_CANTGATHER_g= +H5E_NO_INDEPENDENT_g= + /* B-tree related errors */ H5E_NOTFOUND_g= H5E_EXISTS_g= @@ -229,10 +195,45 @@ H5E_CANTSWAP_g= H5E_CANTINSERT_g= H5E_CANTLIST_g= H5E_CANTMODIFY_g= -H5E_CANTREMOVE_g= +H5E_CANTREMOVE_g= +H5E_CANTFIND_g= + +/* Property list errors */ +H5E_CANTGET_g= +H5E_CANTSET_g= +H5E_DUPCLASS_g= +H5E_SETDISALLOWED_g= + +/* Resource errors */ +H5E_NOSPACE_g= +H5E_CANTALLOC_g= +H5E_CANTCOPY_g= +H5E_CANTFREE_g= +H5E_ALREADYEXISTS_g= +H5E_CANTLOCK_g= +H5E_CANTUNLOCK_g= +H5E_CANTGC_g= +H5E_CANTGETSIZE_g= +H5E_OBJOPEN_g= + +/* Function entry/exit interface errors */ +H5E_CANTINIT_g= +H5E_ALREADYINIT_g= +H5E_CANTRELEASE_g= /* Datatype conversion errors */ H5E_CANTCONVERT_g= -H5E_BADSIZE_g= (-1); +H5E_BADSIZE_g= + +/* No error */ +H5E_NONE_MINOR_g= + +/* Object atom related errors */ +H5E_BADATOM_g= +H5E_BADGROUP_g= +H5E_CANTREGISTER_g= +H5E_CANTINC_g= +H5E_CANTDEC_g= +H5E_NOIDS_g= (-1); #endif /* H5Eterm_H */ diff --git a/src/H5Gent.c b/src/H5Gent.c index feaf9f9cf5..a2a94bffde 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -354,143 +354,6 @@ H5G__ent_reset(H5G_entry_t *ent) FUNC_LEAVE_NOAPI_VOID } /* end H5G__ent_reset() */ -/*------------------------------------------------------------------------- - * Function: H5G__ent_convert - * - * Purpose: Convert a link to a symbol table entry - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Sep 20 2005 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk, H5O_type_t obj_type, - const void *crt_info, H5G_entry_t *ent) -{ - size_t name_offset; /* Offset of name in heap */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* check arguments */ - HDassert(f); - HDassert(heap); - HDassert(name); - HDassert(lnk); - - /* Reset the new entry */ - H5G__ent_reset(ent); - - /* Add the new name to the heap */ - if (H5HL_insert(f, heap, HDstrlen(name) + 1, name, &name_offset) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap") - ent->name_off = name_offset; - - /* Build correct information for symbol table entry based on link type */ - switch (lnk->type) { - case H5L_TYPE_HARD: - if (obj_type == H5O_TYPE_GROUP) { - const H5G_obj_create_t *gcrt_info = (const H5G_obj_create_t *)crt_info; - - ent->type = gcrt_info->cache_type; - if (ent->type != H5G_NOTHING_CACHED) - ent->cache = gcrt_info->cache; -#ifndef NDEBUG - else { - /* Make sure there is no stab message in the target object - */ - H5O_loc_t targ_oloc; /* Location of link target */ - htri_t stab_exists; /* Whether the target symbol table exists */ - - /* Build target object location */ - if (H5O_loc_reset(&targ_oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location") - targ_oloc.file = f; - targ_oloc.addr = lnk->u.hard.addr; - - /* Check if a symbol table message exists */ - if ((stab_exists = H5O_msg_exists(&targ_oloc, H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message") - - HDassert(!stab_exists); - } /* end else */ -#endif /* NDEBUG */ - } /* end if */ - else if (obj_type == H5O_TYPE_UNKNOWN) { - /* Try to retrieve symbol table information for caching */ - H5O_loc_t targ_oloc; /* Location of link target */ - H5O_t *oh; /* Link target object header */ - H5O_stab_t stab; /* Link target symbol table */ - htri_t stab_exists; /* Whether the target symbol table exists */ - - /* Build target object location */ - if (H5O_loc_reset(&targ_oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location") - targ_oloc.file = f; - targ_oloc.addr = lnk->u.hard.addr; - - /* Get the object header */ - if (NULL == (oh = H5O_protect(&targ_oloc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_SYM, H5E_CANTPROTECT, FAIL, "unable to protect target object header") - - /* Check if a symbol table message exists */ - if ((stab_exists = H5O_msg_exists_oh(oh, H5O_STAB_ID)) < 0) { - if (H5O_unprotect(&targ_oloc, oh, H5AC__NO_FLAGS_SET) < 0) - HERROR(H5E_SYM, H5E_CANTUNPROTECT, "unable to release object header"); - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message") - } /* end if */ - - if (stab_exists) { - /* Read symbol table message */ - if (NULL == H5O_msg_read_oh(f, oh, H5O_STAB_ID, &stab)) { - if (H5O_unprotect(&targ_oloc, oh, H5AC__NO_FLAGS_SET) < 0) - HERROR(H5E_SYM, H5E_CANTUNPROTECT, "unable to release object header"); - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read STAB message") - } /* end if */ - - /* Cache symbol table message */ - ent->type = H5G_CACHED_STAB; - ent->cache.stab.btree_addr = stab.btree_addr; - ent->cache.stab.heap_addr = stab.heap_addr; - } /* end if */ - else - /* No symbol table message, don't cache anything */ - ent->type = H5G_NOTHING_CACHED; - - if (H5O_unprotect(&targ_oloc, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - } /* end else */ - else - ent->type = H5G_NOTHING_CACHED; - - ent->header = lnk->u.hard.addr; - break; - - case H5L_TYPE_SOFT: { - size_t lnk_offset; /* Offset to sym-link value */ - - /* Insert link value into local heap */ - if (H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap") - - ent->type = H5G_CACHED_SLINK; - ent->cache.slink.lval_offset = lnk_offset; - } break; - - case H5L_TYPE_ERROR: - case H5L_TYPE_EXTERNAL: - case H5L_TYPE_MAX: - default: - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type") - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__ent_convert() */ /*------------------------------------------------------------------------- * Function: H5G__ent_debug @@ -562,3 +425,76 @@ H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, con FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G__ent_debug() */ + +/*------------------------------------------------------------------------- + * Function: H5G__ent_to_link + * + * Purpose: Convert a symbol table entry to a link + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5G__ent_to_link(const H5G_entry_t *ent, const H5HL_t *heap, H5O_link_t *lnk) +{ + const char *name; /* Pointer to link name in heap */ + size_t block_size; /* Size of the heap block */ + bool dup_soft = false; /* xstrdup the symbolic link name or not */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* check arguments */ + assert(ent); + assert(heap); + assert(lnk); + + /* Get the size of the heap block */ + block_size = H5HL_heap_get_size(heap); + + /* Get pointer to link's name in the heap */ + if (NULL == (name = (const char *)H5HL_offset_into(heap, ent->name_off))) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name"); + + /* Set (default) common info for link */ + lnk->cset = H5F_DEFAULT_CSET; + lnk->corder = 0; + lnk->corder_valid = false; /* Creation order not valid for this link */ + if (NULL == (lnk->name = H5MM_strndup(name, (block_size - ent->name_off)))) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to duplicate link name"); + + /* Object is a symbolic or hard link */ + if (ent->type == H5G_CACHED_SLINK) { + const char *s; /* Pointer to link value */ + + if (NULL == (s = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset))) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbolic link name"); + + /* Copy the link value */ + if (NULL == (lnk->u.soft.name = H5MM_strndup(s, (block_size - ent->cache.slink.lval_offset)))) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to duplicate symbolic link name"); + + dup_soft = true; + + /* Set link type */ + lnk->type = H5L_TYPE_SOFT; + } /* end if */ + else { + /* Set address of object */ + lnk->u.hard.addr = ent->header; + + /* Set link type */ + lnk->type = H5L_TYPE_HARD; + } /* end else */ + +done: + if (ret_value < 0) { + if (lnk->name) + H5MM_xfree(lnk->name); + if (ent->type == H5G_CACHED_SLINK && dup_soft) + H5MM_xfree(lnk->u.soft.name); + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__ent_to_link() */ diff --git a/src/H5Glink.c b/src/H5Glink.c index cd01bc986d..87b909017a 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -188,72 +188,6 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_link_cmp_corder_dec() */ -/*------------------------------------------------------------------------- - * Function: H5G__ent_to_link - * - * Purpose: Convert a symbol table entry to a link - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Sep 16 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, const char *name) -{ - hbool_t dup_soft = FALSE; /* xstrdup the symbolic link name or not */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* check arguments */ - HDassert(lnk); - HDassert(heap); - HDassert(ent); - HDassert(name); - - /* Set (default) common info for link */ - lnk->cset = H5F_DEFAULT_CSET; - lnk->corder = 0; - lnk->corder_valid = FALSE; /* Creation order not valid for this link */ - if ((lnk->name = H5MM_xstrdup(name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to duplicate link name") - - /* Object is a symbolic or hard link */ - if (ent->type == H5G_CACHED_SLINK) { - const char *s; /* Pointer to link value */ - - if ((s = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get symbolic link name") - - /* Copy the link value */ - if ((lnk->u.soft.name = H5MM_xstrdup(s)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to duplicate symbolic link name") - - dup_soft = TRUE; - - /* Set link type */ - lnk->type = H5L_TYPE_SOFT; - } /* end if */ - else { - /* Set address of object */ - lnk->u.hard.addr = ent->header; - - /* Set link type */ - lnk->type = H5L_TYPE_HARD; - } /* end else */ - -done: - if (ret_value < 0) { - if (lnk->name) - H5MM_xfree(lnk->name); - if (ent->type == H5G_CACHED_SLINK && dup_soft) - H5MM_xfree(lnk->u.soft.name); - } - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__ent_to_link() */ /*------------------------------------------------------------------------- * Function: H5G_link_to_info @@ -332,6 +266,140 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_link_to_info() */ +/*------------------------------------------------------------------------- + * Function: H5G__link_to_ent + * + * Purpose: Convert a link to a symbol table entry + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5G__link_to_ent(H5F_t *f, H5HL_t *heap, const H5O_link_t *lnk, H5O_type_t obj_type, const void *crt_info, + H5G_entry_t *ent) +{ + size_t name_offset; /* Offset of name in heap */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* check arguments */ + assert(f); + assert(heap); + assert(lnk && lnk->name); + + /* Reset the new entry */ + H5G__ent_reset(ent); + + /* Add the new name to the heap */ + if (H5HL_insert(f, heap, strlen(lnk->name) + 1, lnk->name, &name_offset) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap"); + ent->name_off = name_offset; + + /* Build correct information for symbol table entry based on link type */ + switch (lnk->type) { + case H5L_TYPE_HARD: + if (obj_type == H5O_TYPE_GROUP) { + const H5G_obj_create_t *gcrt_info = (const H5G_obj_create_t *)crt_info; + + ent->type = gcrt_info->cache_type; + if (ent->type != H5G_NOTHING_CACHED) + ent->cache = gcrt_info->cache; +#ifndef NDEBUG + else { + /* Make sure there is no stab message in the target object + */ + H5O_loc_t targ_oloc; /* Location of link target */ + htri_t stab_exists; /* Whether the target symbol table exists */ + + /* Build target object location */ + if (H5O_loc_reset(&targ_oloc) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location"); + targ_oloc.file = f; + targ_oloc.addr = lnk->u.hard.addr; + + /* Check if a symbol table message exists */ + if ((stab_exists = H5O_msg_exists(&targ_oloc, H5O_STAB_ID)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message"); + + assert(!stab_exists); + } /* end else */ +#endif /* NDEBUG */ + } /* end if */ + else if (obj_type == H5O_TYPE_UNKNOWN) { + /* Try to retrieve symbol table information for caching */ + H5O_loc_t targ_oloc; /* Location of link target */ + H5O_t *oh; /* Link target object header */ + H5O_stab_t stab; /* Link target symbol table */ + htri_t stab_exists; /* Whether the target symbol table exists */ + + /* Build target object location */ + if (H5O_loc_reset(&targ_oloc) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location"); + targ_oloc.file = f; + targ_oloc.addr = lnk->u.hard.addr; + + /* Get the object header */ + if (NULL == (oh = H5O_protect(&targ_oloc, H5AC__READ_ONLY_FLAG, false))) + HGOTO_ERROR(H5E_SYM, H5E_CANTPROTECT, FAIL, "unable to protect target object header"); + + /* Check if a symbol table message exists */ + if ((stab_exists = H5O_msg_exists_oh(oh, H5O_STAB_ID)) < 0) { + if (H5O_unprotect(&targ_oloc, oh, H5AC__NO_FLAGS_SET) < 0) + HERROR(H5E_SYM, H5E_CANTUNPROTECT, "unable to release object header"); + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message"); + } /* end if */ + + if (stab_exists) { + /* Read symbol table message */ + if (NULL == H5O_msg_read_oh(f, oh, H5O_STAB_ID, &stab)) { + if (H5O_unprotect(&targ_oloc, oh, H5AC__NO_FLAGS_SET) < 0) + HERROR(H5E_SYM, H5E_CANTUNPROTECT, "unable to release object header"); + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read STAB message"); + } /* end if */ + + /* Cache symbol table message */ + ent->type = H5G_CACHED_STAB; + ent->cache.stab.btree_addr = stab.btree_addr; + ent->cache.stab.heap_addr = stab.heap_addr; + } /* end if */ + else + /* No symbol table message, don't cache anything */ + ent->type = H5G_NOTHING_CACHED; + + if (H5O_unprotect(&targ_oloc, oh, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); + } /* end else */ + else + ent->type = H5G_NOTHING_CACHED; + + ent->header = lnk->u.hard.addr; + break; + + case H5L_TYPE_SOFT: { + size_t lnk_offset; /* Offset to sym-link value */ + + /* Insert link value into local heap */ + if (H5HL_insert(f, heap, strlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap"); + + ent->type = H5G_CACHED_SLINK; + ent->cache.slink.lval_offset = lnk_offset; + } break; + + case H5L_TYPE_ERROR: + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_MAX: + default: + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type"); + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__link_to_ent() */ + /*------------------------------------------------------------------------- * Function: H5G__link_to_loc * diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 84e8fffa93..f2001cdede 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -539,7 +539,7 @@ H5G__loc_insert(H5G_loc_t *grp_loc, char *name, H5G_loc_t *obj_loc, H5O_type_t o lnk.u.hard.addr = obj_loc->oloc->addr; /* Insert new group into current group's symbol table */ - if (H5G_obj_insert(grp_loc->oloc, name, &lnk, TRUE, obj_type, crt_info) < 0) + if (H5G_obj_insert(grp_loc->oloc, &lnk, true, obj_type, crt_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert object") /* Set the name of the object location */ @@ -626,6 +626,68 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_loc_exists() */ +/*------------------------------------------------------------------------- + * Function: H5G__loc_addr_cb + * + * Purpose: Callback for retrieving the address for an object in a group + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G__loc_addr_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) +{ + haddr_t *udata = (haddr_t *)_udata; /* User data passed in */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Check if the name in this group resolved to a valid link */ + if (obj_loc == NULL) + *udata = HADDR_UNDEF; /* No object found */ + else + *udata = obj_loc->oloc->addr; /* Set address of object */ + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G__loc_addr_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5G__loc_addr + * + * Purpose: Retrieve the information for an object from a group location + * and path to that object + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5G__loc_addr(const H5G_loc_t *loc, const char *name, haddr_t *addr /*out*/) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args. */ + assert(loc); + assert(name && *name); + assert(addr); + + /* Traverse group hierarchy to locate object */ + if (H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_addr_cb, addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__loc_addr() */ + + /*------------------------------------------------------------------------- * Function: H5G__loc_info_cb * diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 20e496de00..a56b495bae 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -367,6 +367,7 @@ H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key) H5G_node_key_t *lt_key = (H5G_node_key_t *)_lt_key; H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key; const char *s1, *s2; + size_t max_len; int ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -382,8 +383,14 @@ H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key) if ((s2 = (const char *)H5HL_offset_into(udata->heap, rt_key->offset)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name") + /* Compute maximum length of string to compare */ + if (rt_key->offset > lt_key->offset) + max_len = udata->block_size - rt_key->offset; + else + max_len = udata->block_size - lt_key->offset; + /* Set return value */ - ret_value = HDstrcmp(s1, s2); + ret_value = HDstrncmp(s1, s2, max_len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -432,13 +439,13 @@ H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key) /* left side */ if ((s = (const char *)H5HL_offset_into(udata->heap, lt_key->offset)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name") - if (HDstrcmp(udata->name, s) <= 0) + if (HDstrncmp(udata->name, s, (udata->block_size - lt_key->offset)) <= 0) ret_value = (-1); else { /* right side */ if ((s = (const char *)H5HL_offset_into(udata->heap, rt_key->offset)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name") - if (HDstrcmp(udata->name, s) > 0) + if (HDstrncmp(udata->name, s, (udata->block_size - rt_key->offset)) > 0) ret_value = 1; } /* end else */ @@ -505,7 +512,7 @@ H5G_node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, void if ((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table name") - cmp = HDstrcmp(udata->common.name, s); + cmp = HDstrncmp(udata->common.name, s, (udata->common.block_size - sn->entry[idx].name_off)); if (cmp < 0) rt = idx; @@ -602,7 +609,7 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, hbool_t H HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name") /* Check if symbol is already present */ - if (0 == (cmp = HDstrcmp(udata->common.name, s))) + if (0 == (cmp = HDstrncmp(udata->common.name, s, (udata->common.block_size - sn->entry[idx].name_off)))) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "symbol is already present in symbol table") if (cmp < 0) @@ -613,8 +620,7 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, hbool_t H idx += cmp > 0 ? 1 : 0; /* Convert link information & name to symbol table entry */ - if (H5G__ent_convert(f, udata->common.heap, udata->common.name, udata->lnk, udata->obj_type, - udata->crt_info, &ent) < 0) + if (H5G__link_to_ent(f, udata->common.heap, udata->lnk, udata->obj_type, udata->crt_info, &ent) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5B_INS_ERROR, "unable to convert link") /* Determine where to place entry in node */ @@ -759,7 +765,7 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out*/, idx = (lt + rt) / 2; if ((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name") - cmp = HDstrcmp(udata->common.name, s); + cmp = HDstrncmp(udata->common.name, s, (udata->common.block_size - sn->entry[idx].name_off)); if (cmp < 0) rt = idx; else @@ -772,7 +778,11 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out*/, /* Get a pointer to the name of the link */ if (NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name") - link_name_len = HDstrlen(lnk.name) + 1; + + /* Compute the size of the link name in the heap, being defensive about corrupted data */ + link_name_len = HDstrnlen(lnk.name, (udata->common.block_size - sn->entry[idx].name_off)) + 1; + if (link_name_len > (udata->common.block_size - sn->entry[idx].name_off)) + link_name_len = (udata->common.block_size - sn->entry[idx].name_off); /* Set up rest of link structure */ lnk.corder_valid = FALSE; @@ -809,8 +819,13 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out*/, /* Remove the soft link's value from the local heap */ if (lnk.u.soft.name) { size_t soft_link_len; /* Length of string in local heap */ + /* Compute the size of the soft link name in the heap, being defensive about corrupted data */ + soft_link_len = HDstrnlen(lnk.u.soft.name, + (udata->common.block_size - sn->entry[idx].cache.slink.lval_offset)) + + 1; + if (soft_link_len > (udata->common.block_size - sn->entry[idx].cache.slink.lval_offset)) + soft_link_len = (udata->common.block_size - sn->entry[idx].cache.slink.lval_offset); - soft_link_len = HDstrlen(lnk.u.soft.name) + 1; if (H5HL_remove(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, soft_link_len) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, @@ -947,15 +962,10 @@ H5G__node_iterate(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, if (udata->skip > 0) --udata->skip; else { - H5O_link_t lnk; /* Link for entry */ - const char *name; /* Pointer to link name in heap */ - - /* Get the pointer to the name of the link in the heap */ - if ((name = (const char *)H5HL_offset_into(udata->heap, ents[u].name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get symbol table node name") + H5O_link_t lnk; /* Link for entry */ /* Convert the entry to a link */ - if (H5G__ent_to_link(&lnk, udata->heap, &ents[u], name) < 0) + if (H5G__ent_to_link(&ents[u], udata->heap, &lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, "unable to convert symbol table entry to link") @@ -1180,7 +1190,6 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; const H5O_loc_t *src_oloc = udata->src_oloc; H5O_copy_t *cpy_info = udata->cpy_info; - H5HL_t *heap = NULL; H5G_node_t *sn = NULL; unsigned int i; /* Local index variable */ int ret_value = H5_ITER_CONT; @@ -1191,32 +1200,30 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(udata); + HDassert(udata->src_heap); /* load the symbol table into memory from the source file */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") - /* get the base address of the heap */ - if (NULL == (heap = H5HL_protect(f, udata->src_heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "unable to protect symbol name") - /* copy object in this node one by one */ for (i = 0; i < sn->nsyms; i++) { H5G_entry_t *src_ent = &(sn->entry[i]); /* Convenience variable to refer to current source group entry */ H5O_link_t lnk; /* Link to insert */ - const char *name; /* Name of source object */ + char *name; /* Name of source object */ H5G_entry_t tmp_src_ent; /* Temporary copy. Change will not affect the cache */ H5O_type_t obj_type = H5O_TYPE_UNKNOWN; /* Target object type */ H5G_copy_file_ud_t *cpy_udata; /* Copy file udata */ H5G_obj_create_t gcrt_info; /* Group creation info */ + size_t max_link_len; /* Max. length of string in local heap */ /* expand soft link */ if (H5G_CACHED_SLINK == src_ent->type && cpy_info->expand_soft_link) { - H5O_info_t oinfo; /* Information about object pointed to by soft link */ - H5G_loc_t grp_loc; /* Group location holding soft link */ - H5G_name_t grp_path; /* Path for group holding soft link */ - char *link_name; /* Pointer to value of soft link */ + haddr_t obj_addr = HADDR_UNDEF; /* Address of object pointed to by soft link */ + H5G_loc_t grp_loc; /* Group location holding soft link */ + H5G_name_t grp_path; /* Path for group holding soft link */ + char *link_name; /* Pointer to value of soft link */ /* Make a temporary copy, so that it will not change the info in the cache */ H5MM_memcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t)); @@ -1228,20 +1235,25 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const grp_loc.oloc = (H5O_loc_t *)src_oloc; H5_GCC_CLANG_DIAG_ON("cast-qual") - /* Get pointer to link value in local heap */ - if ((link_name = (char *)H5HL_offset_into(heap, tmp_src_ent.cache.slink.lval_offset)) == NULL) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name") + if ((link_name = + (char *)H5HL_offset_into(udata->src_heap, tmp_src_ent.cache.slink.lval_offset)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name"); + + /* Sanity check soft link name, to detect running off the end of the heap block */ + max_link_len = udata->src_block_size - tmp_src_ent.cache.slink.lval_offset; + if (strnlen(link_name, max_link_len) == max_link_len) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "invalid link name offset"); /* Check if the object pointed by the soft link exists in the source file */ /* Only basic information is needed */ - if (H5G_loc_info(&grp_loc, link_name, &oinfo, H5O_INFO_BASIC) >= 0) { - tmp_src_ent.header = oinfo.addr; + if (H5G__loc_addr(&grp_loc, link_name, &obj_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFIND, H5_ITER_ERROR, + "unable to check if soft link resolves to an object"); + if (H5F_addr_defined(obj_addr)) { + tmp_src_ent.header = obj_addr; src_ent = &tmp_src_ent; } /* end if */ - else - H5E_clear_stack(NULL); /* discard any errors from a dangling soft link */ - } /* if ((H5G_CACHED_SLINK == src_ent->type)... */ - + } /* if ((H5G_CACHED_SLINK == src_ent->type)... */ /* Check if object in source group is a hard link */ if (H5F_addr_defined(src_ent->header)) { H5O_loc_t new_dst_oloc; /* Copied object location in destination */ @@ -1281,28 +1293,39 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const /* Construct link information for eventual insertion */ lnk.type = H5L_TYPE_SOFT; - if ((lnk.u.soft.name = (char *)H5HL_offset_into(heap, src_ent->cache.slink.lval_offset)) == NULL) + if ((lnk.u.soft.name = + (char *)H5HL_offset_into(udata->src_heap, src_ent->cache.slink.lval_offset)) == NULL) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name") + + /* Sanity check soft link name, to detect running off the end of the heap block */ + max_link_len = udata->src_block_size - src_ent->cache.slink.lval_offset; + if (strnlen(lnk.u.soft.name, max_link_len) == max_link_len) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "invalid link name offset"); } /* else if */ else HDassert(0 && "Unknown entry type"); + /* Determine name of source object */ + if ((name = (char *)H5HL_offset_into(udata->src_heap, src_ent->name_off)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get source object name"); + + /* Sanity check soft link name, to detect running off the end of the heap block */ + max_link_len = udata->src_block_size - src_ent->name_off; + if (strnlen(name, max_link_len) == max_link_len) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "invalid link name offset"); + /* Set up common link data */ lnk.cset = H5F_DEFAULT_CSET; /* XXX: Allow user to set this */ lnk.corder = 0; /* Creation order is not tracked for old-style links */ lnk.corder_valid = FALSE; /* Creation order is not valid */ - /* lnk.name = name; */ /* This will be set in callback */ - - /* Determine name of source object */ - if ((name = (const char *)H5HL_offset_into(heap, src_ent->name_off)) == NULL) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get source object name") + lnk.name = name; /* Name of link */ /* Set copied metadata tag */ H5_BEGIN_TAG(H5AC__COPIED_TAG); /* Insert the new object in the destination file's group */ /* (Don't increment the link count - that's already done above for hard links) */ - if (H5G__stab_insert_real(udata->dst_file, udata->dst_stab, name, &lnk, obj_type, + if (H5G__stab_insert_real(udata->dst_file, udata->dst_stab, &lnk, obj_type, (obj_type == H5O_TYPE_GROUP ? &gcrt_info : NULL)) < 0) HGOTO_ERROR_TAG(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") @@ -1312,9 +1335,6 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const } /* end of for (i=0; i<sn->nsyms; i++) */ done: - if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to unprotect symbol name") - if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") @@ -1372,18 +1392,13 @@ H5G__node_build_table(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr /* Iterate over the symbol table node entries, adding to link table */ for (u = 0; u < sn->nsyms; u++) { - const char *name; /* Pointer to link name in heap */ - size_t linkno; /* Link allocated */ - - /* Get pointer to link's name in the heap */ - if ((name = (const char *)H5HL_offset_into(udata->heap, sn->entry[u].name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get symbol table link name") + size_t linkno; /* Link allocated */ /* Determine the link to operate on in the table */ linkno = udata->ltable->nlinks++; /* Convert the entry to a link */ - if (H5G__ent_to_link(&udata->ltable->lnks[linkno], udata->heap, &sn->entry[u], name) < 0) + if (H5G__ent_to_link(&sn->entry[u], udata->heap, &udata->ltable->lnks[linkno]) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, "unable to convert symbol table entry to link") } /* end for */ @@ -1471,7 +1486,8 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, had H5G_bt_common_t udata; /*data to pass through B-tree */ H5E_clear_stack(NULL); /* discard that error */ - udata.heap = heap; + udata.heap = heap; + udata.block_size = H5HL_heap_get_size(heap); if (H5B_debug(f, addr, stream, indent, fwidth, H5B_SNODE, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to debug B-tree node"); } /* end if */ diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 7570a4f4a6..cc1f91ea34 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -398,7 +398,7 @@ H5G_obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) /* Insert link into group */ H5_GCC_CLANG_DIAG_OFF("cast-qual") - if (H5G_obj_insert(udata->grp_oloc, lnk->name, (H5O_link_t *)lnk, FALSE, H5O_TYPE_UNKNOWN, NULL) < 0) + if (H5G_obj_insert(udata->grp_oloc, (H5O_link_t *)lnk, false, H5O_TYPE_UNKNOWN, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert link into group") H5_GCC_CLANG_DIAG_ON("cast-qual") @@ -410,8 +410,8 @@ done: * Function: H5G_obj_insert * * Purpose: Insert a new symbol into the group described by GRP_OLOC. - * file F. The name of the new symbol is NAME and its symbol - * table entry is OBJ_LNK. Increment the reference + * file F. The name of the new symbol is OBJ_LNK->NAME and its + * symbol table entry is OBJ_LNK. Increment the reference * count for the object the link points if OBJ_LNK is a hard link * and ADJ_LINK is true. * @@ -423,8 +423,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, hbool_t adj_link, - H5O_type_t obj_type, const void *crt_info) +H5G_obj_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk, hbool_t adj_link, H5O_type_t obj_type, + const void *crt_info) { H5O_pline_t tmp_pline; /* Pipeline message */ H5O_pline_t *pline = NULL; /* Pointer to pipeline message */ @@ -438,7 +438,6 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* check arguments */ HDassert(grp_oloc && grp_oloc->file); - HDassert(name && *name); HDassert(obj_lnk); /* Check if we have information about the number of objects in this group */ @@ -548,7 +547,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, * group is in the "new format" now and the link info should be * set up, etc. */ - if (H5G_obj_insert(grp_oloc, name, obj_lnk, adj_link, obj_type, crt_info) < 0) + if (H5G_obj_insert(grp_oloc, obj_lnk, adj_link, obj_type, crt_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into group") /* Done with insertion now */ @@ -561,7 +560,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Insert into symbol table or "dense" storage */ if (use_old_format) { /* Insert into symbol table */ - if (H5G__stab_insert(grp_oloc, name, obj_lnk, obj_type, crt_info) < 0) + if (H5G__stab_insert(grp_oloc, obj_lnk, obj_type, crt_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry into symbol table") } /* end if */ else { diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index d3aa8afe60..0bb7b5c83c 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -154,8 +154,9 @@ typedef struct { */ typedef struct H5G_bt_common_t { /* downward */ - const char *name; /*points to temporary memory */ - H5HL_t *heap; /*symbol table heap */ + const char *name; /* Points to temporary memory */ + H5HL_t *heap; /* Symbol table heap */ + size_t block_size; /* Size of the heap block */ } H5G_bt_common_t; /* @@ -213,11 +214,12 @@ typedef struct H5G_bt_it_it_t { /* Data passed through B-tree iteration for copying copy symbol table content */ typedef struct H5G_bt_it_cpy_t { - const H5O_loc_t *src_oloc; /* Source object location */ - haddr_t src_heap_addr; /* Heap address of the source symbol table */ - H5F_t *dst_file; /* File of destination group */ - const H5O_stab_t *dst_stab; /* Symbol table message for destination group */ - H5O_copy_t *cpy_info; /* Information for copy operation */ + const H5O_loc_t *src_oloc; /* Source object location */ + H5HL_t *src_heap; /* Heap for the source symbol table */ + size_t src_block_size; /* Size of the heap block */ + H5F_t *dst_file; /* File of destination group */ + const H5O_stab_t *dst_stab; /* Symbol table message for destination group */ + H5O_copy_t *cpy_info; /* Information for copy operation */ } H5G_bt_it_cpy_t; /* Common information for "by index" lookups in symbol tables */ @@ -349,9 +351,9 @@ H5_DLL const char *H5G__component(const char *name, size_t *size_p); */ H5_DLL herr_t H5G__stab_create(H5O_loc_t *grp_oloc, const H5O_ginfo_t *ginfo, H5O_stab_t *stab); H5_DLL herr_t H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint); -H5_DLL herr_t H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, - H5O_type_t obj_type, const void *crt_info); -H5_DLL herr_t H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5O_link_t *obj_lnk, +H5_DLL herr_t H5G__stab_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk, H5O_type_t obj_type, + const void *crt_info); +H5_DLL herr_t H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info); H5_DLL herr_t H5G__stab_delete(H5F_t *f, const H5O_stab_t *stab); H5_DLL herr_t H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, @@ -381,8 +383,7 @@ H5_DLL void H5G__ent_reset(H5G_entry_t *ent); H5_DLL herr_t H5G__ent_decode_vec(const H5F_t *f, const uint8_t **pp, const uint8_t *p_end, H5G_entry_t *ent, unsigned n); H5_DLL herr_t H5G__ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n); -H5_DLL herr_t H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk, - H5O_type_t obj_type, const void *crt_info, H5G_entry_t *ent); +H5_DLL herr_t H5G__ent_to_link(const H5G_entry_t *ent, const H5HL_t *heap, H5O_link_t *lnk); H5_DLL herr_t H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, const H5HL_t *heap); @@ -399,7 +400,8 @@ H5_DLL herr_t H5G__node_iterate_size(H5F_t *f, const void *_lt_key, haddr_t addr H5_DLL herr_t H5G__node_free(H5G_node_t *sym); /* Functions that understand links in groups */ -H5_DLL herr_t H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, const char *name); +H5_DLL herr_t H5G__link_to_ent(H5F_t *f, H5HL_t *heap, const H5O_link_t *lnk, H5O_type_t obj_type, + const void *crt_info, H5G_entry_t *ent); H5_DLL herr_t H5G__link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t *obj_loc); H5_DLL herr_t H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, H5_iter_order_t order); H5_DLL herr_t H5G__link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, hsize_t *last_lnk, @@ -469,6 +471,7 @@ H5_DLL herr_t H5G__name_init(H5G_name_t *name, const char *path); */ H5_DLL herr_t H5G__loc_insert(H5G_loc_t *grp_loc, char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info); +H5_DLL herr_t H5G__loc_addr(const H5G_loc_t *loc, const char *name, haddr_t *addr /*out*/); /* Testing functions */ #ifdef H5G_TESTING diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 8063a5b8ef..61aced37c1 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -224,8 +224,8 @@ H5_DLL herr_t H5G_link_to_info(const struct H5O_link_t *lnk, H5L_info_t *linfo); /* * Functions that understand group objects */ -H5_DLL herr_t H5G_obj_insert(const struct H5O_loc_t *grp_oloc, const char *name, struct H5O_link_t *obj_lnk, - hbool_t adj_link, H5O_type_t obj_type, const void *crt_info); +H5_DLL herr_t H5G_obj_insert(const struct H5O_loc_t *grp_oloc, struct H5O_link_t *obj_lnk, bool adj_link, + H5O_type_t obj_type, const void *crt_info); H5_DLL ssize_t H5G_obj_get_name_by_idx(const struct H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name, size_t size); H5_DLL herr_t H5G_obj_remove(const struct H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name); diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 01f8ae05aa..97bc514647 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -241,8 +241,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5O_link_t *obj_lnk, - H5O_type_t obj_type, const void *crt_info) +H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, H5O_link_t *obj_lnk, H5O_type_t obj_type, + const void *crt_info) { H5HL_t *heap = NULL; /* Pointer to local heap */ H5G_bt_ins_t udata; /* Data to pass through B-tree */ @@ -253,7 +253,6 @@ H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5O_li /* check arguments */ HDassert(f); HDassert(stab); - HDassert(name && *name); HDassert(obj_lnk); /* Pin the heap down in memory */ @@ -261,11 +260,12 @@ H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5O_li HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") /* Initialize data to pass through B-tree */ - udata.common.name = name; - udata.common.heap = heap; - udata.lnk = obj_lnk; - udata.obj_type = obj_type; - udata.crt_info = crt_info; + udata.common.name = obj_lnk->name; + udata.common.heap = heap; + udata.common.block_size = H5HL_heap_get_size(heap); + udata.lnk = obj_lnk; + udata.obj_type = obj_type; + udata.crt_info = crt_info; /* Insert into symbol table */ if (H5B_insert(f, H5B_SNODE, stab->btree_addr, &udata) < 0) @@ -282,9 +282,7 @@ done: /*------------------------------------------------------------------------- * Function: H5G__stab_insert * - * Purpose: Insert a new symbol into the table described by GRP_ENT in - * file F. The name of the new symbol is NAME and its symbol - * table entry is OBJ_ENT. + * Purpose: Insert a new link, OBJ_LNK, into the group, GRP_OLOC. * * Return: Non-negative on success/Negative on failure * @@ -294,8 +292,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, H5O_type_t obj_type, - const void *crt_info) +H5G__stab_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info) { H5O_stab_t stab; /* Symbol table message */ herr_t ret_value = SUCCEED; /* Return value */ @@ -304,15 +301,14 @@ H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_ln /* check arguments */ HDassert(grp_oloc && grp_oloc->file); - HDassert(name && *name); HDassert(obj_lnk); /* Retrieve symbol table message */ if (NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table") - if (H5G__stab_insert_real(grp_oloc->file, &stab, name, obj_lnk, obj_type, crt_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") + if (H5G__stab_insert_real(grp_oloc->file, &stab, obj_lnk, obj_type, crt_info) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the link"); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -352,9 +348,10 @@ H5G__stab_remove(const H5O_loc_t *loc, H5RS_str_t *grp_full_path_r, const char * HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") /* Initialize data to pass through B-tree */ - udata.common.name = name; - udata.common.heap = heap; - udata.grp_full_path_r = grp_full_path_r; + udata.common.name = name; + udata.common.heap = heap; + udata.common.block_size = H5HL_heap_get_size(heap); + udata.grp_full_path_r = grp_full_path_r; /* Remove from symbol table */ if (H5B_remove(loc->file, H5B_SNODE, stab.btree_addr, &udata) < 0) @@ -409,9 +406,10 @@ H5G__stab_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") /* Initialize data to pass through B-tree */ - udata.common.name = obj_lnk.name; - udata.common.heap = heap; - udata.grp_full_path_r = grp_full_path_r; + udata.common.name = obj_lnk.name; + udata.common.heap = heap; + udata.common.block_size = H5HL_heap_get_size(heap); + udata.grp_full_path_r = grp_full_path_r; /* Remove link from symbol table */ if (H5B_remove(grp_oloc->file, H5B_SNODE, stab.btree_addr, &udata) < 0) @@ -678,6 +676,7 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) H5G_bt_it_gnbi_t *udata = (H5G_bt_it_gnbi_t *)_udata; size_t name_off; /* Offset of name in heap */ const char *name; /* Pointer to name string in heap */ + size_t block_size; /* Size of the heap block */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -686,13 +685,16 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) HDassert(ent); HDassert(udata && udata->heap); + /* Get the size of the heap block */ + block_size = H5HL_heap_get_size(udata->heap); + /* Get name offset in heap */ name_off = ent->name_off; if ((name = (const char *)H5HL_offset_into(udata->heap, name_off)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name") - if ((udata->name = H5MM_strdup(name)) == NULL) + if (NULL == (udata->name = H5MM_strndup(name, (block_size - name_off)))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to duplicate symbol table link name") done: @@ -812,7 +814,7 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata) /* Check for setting link info */ if (udata->lnk) /* Convert the entry to a link */ - if (H5G__ent_to_link(udata->lnk, udata->heap, ent, udata->name) < 0) + if (H5G__ent_to_link(ent, udata->heap, udata->lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link") done: @@ -861,10 +863,11 @@ H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk) udata.heap = heap; /* Set up the user data for actual B-tree find operation */ - bt_udata.common.name = name; - bt_udata.common.heap = heap; - bt_udata.op = H5G_stab_lookup_cb; - bt_udata.op_data = &udata; + bt_udata.common.name = name; + bt_udata.common.heap = heap; + bt_udata.common.block_size = H5HL_heap_get_size(heap); + bt_udata.op = H5G_stab_lookup_cb; + bt_udata.op_data = &udata; /* Search the B-tree */ if ((ret_value = H5B_find(grp_oloc->file, H5B_SNODE, stab.btree_addr, &bt_udata)) < 0) @@ -895,8 +898,7 @@ done: static herr_t H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) { - H5G_bt_it_lbi_t *udata = (H5G_bt_it_lbi_t *)_udata; - const char *name; /* Pointer to name string in heap */ + H5G_bt_it_lbi_t *udata = (H5G_bt_it_lbi_t *)_udata; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -905,12 +907,8 @@ H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) HDassert(ent); HDassert(udata && udata->heap); - /* Get a pointer to the link name */ - if ((name = (const char *)H5HL_offset_into(udata->heap, ent->name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name") - /* Convert the entry to a link */ - if (H5G__ent_to_link(udata->lnk, udata->heap, ent, name) < 0) + if (H5G__ent_to_link(ent, udata->heap, udata->lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link") udata->found = TRUE; diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 404bfadcbf..d73da48dee 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -801,10 +801,10 @@ H5G__verify_cached_stabs_test(hid_t gid) { H5G_t *grp = NULL; /* Group */ htri_t stab_exists; - H5O_stab_t stab; /* Symbol table message */ - H5G_bt_common_t udata = {NULL, NULL}; /* Dummy udata so H5B_iterate doesn't freak out */ - haddr_t prev_tag = HADDR_UNDEF; /* Previous metadata tag */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_stab_t stab; /* Symbol table message */ + H5G_bt_common_t udata = {NULL, NULL, 0}; /* Dummy udata so H5B_iterate doesn't freak out */ + haddr_t prev_tag = HADDR_UNDEF; /* Previous metadata tag */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5HG.c b/src/H5HG.c index 7461a9de76..80b0750e74 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -593,6 +593,11 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object /*out*/, size_t *buf_size) HDassert(f); HDassert(hobj); + /* Heap object idx 0 is the free space in the heap and should never be given out */ + if (0 == hobj->idx) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad heap index, heap object = {%" PRIxHADDR ", %zu}", + hobj->addr, hobj->idx); + /* Load the heap */ if (NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") @@ -666,6 +671,11 @@ H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust) if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + /* Heap object idx 0 is the free space in the heap and should never be given out */ + if (0 == hobj->idx) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad heap index, heap object = {%" PRIxHADDR ", %zu}", + hobj->addr, hobj->idx); + /* Load the heap */ if (NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") @@ -717,6 +727,11 @@ H5HG_get_obj_size(H5F_t *f, H5HG_t *hobj, size_t *obj_size) HDassert(hobj); HDassert(obj_size); + /* Heap object idx 0 is the free space in the heap and should never be given out */ + if (0 == hobj->idx) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad heap index, heap object = {%" PRIxHADDR ", %zu}", + hobj->addr, hobj->idx); + /* Load the heap */ if (NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") @@ -764,6 +779,11 @@ H5HG_remove(H5F_t *f, H5HG_t *hobj) if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + /* Heap object idx 0 is the free space in the heap and should never be given out */ + if (0 == hobj->idx) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad heap index, heap object = {%" PRIxHADDR ", %zu}", + hobj->addr, hobj->idx); + /* Load the heap */ if (NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") diff --git a/src/H5HL.c b/src/H5HL.c index 8a59d0474e..6037e4899e 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -306,13 +306,11 @@ done: H5HL_t * H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags) { - H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ - H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ - H5HL_dblk_t *dblk = NULL; /* Local heap data block */ - H5HL_t *heap = NULL; /* Heap data structure */ - unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */ - unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */ - H5HL_t *ret_value = NULL; + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ + H5HL_dblk_t *dblk = NULL; /* Local heap data block */ + H5HL_t *heap = NULL; /* Heap data structure */ + H5HL_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) @@ -339,19 +337,25 @@ H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags) /* Check if the heap is already pinned in memory */ /* (for re-entrant situation) */ if (heap->prots == 0) { + void *pin_obj; /* Pointer to local heap object to pin */ + /* Check if heap has separate data block */ if (heap->single_cache_obj) - /* Set the flag for pinning the prefix when unprotecting it */ - prfx_cache_flags |= H5AC__PIN_ENTRY_FLAG; + /* Pin prefix */ + pin_obj = prfx; else { /* Protect the local heap data block */ if (NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap, flags))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap data block"); - /* Set the flag for pinning the data block when unprotecting it */ - dblk_cache_flags |= H5AC__PIN_ENTRY_FLAG; + /* Pin data block */ + pin_obj = dblk; } + + /* Pin local heap object */ + if (H5AC_pin_protected_entry(pin_obj) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, NULL, "unable to pin local heap object"); } /* Increment # of times heap is protected */ @@ -362,11 +366,11 @@ H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags) done: /* Release the prefix from the cache, now pinned */ - if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) + if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap prefix"); /* Release the data block from the cache, now pinned */ - if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) + if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap data block"); FUNC_LEAVE_NOAPI(ret_value) @@ -945,6 +949,26 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_delete() */ +/*------------------------------------------------------------------------- + * Function: H5HL_heap_get_size + * + * Purpose: Retrieves the current size of a heap's block + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +size_t +H5HL_heap_get_size(const H5HL_t *heap) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check arguments */ + assert(heap); + + FUNC_LEAVE_NOAPI(heap->dblk_size) +} /* end H5HL_heap_get_size() */ + /*------------------------------------------------------------------------- * Function: H5HL_get_size * diff --git a/src/H5HLcache.c b/src/H5HLcache.c index dcf1249dda..1758159cc4 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -241,7 +241,7 @@ H5HL__fl_deserialize(H5HL_t *heap) const uint8_t *image; /* Pointer into image buffer */ /* Sanity check */ - if (free_block >= heap->dblk_size) + if ((free_block + (2 * heap->sizeof_size)) > heap->dblk_size) HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list"); /* Allocate & initialize free list node */ diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 51e7e992b0..70ecf906a3 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -54,6 +54,7 @@ typedef struct H5HL_t H5HL_t; */ H5_DLL herr_t H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr /*out*/); H5_DLL herr_t H5HL_delete(H5F_t *f, haddr_t addr); +H5_DLL size_t H5HL_heap_get_size(const H5HL_t *heap); H5_DLL herr_t H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size); H5_DLL herr_t H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size); H5_DLL herr_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf, size_t *offset); diff --git a/src/H5L.c b/src/H5L.c index d670365743..248b6342a1 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -1625,7 +1625,7 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT H5_GCC_CLANG_DIAG_ON("cast-qual") /* Insert link into group */ - if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, + if (H5G_obj_insert(grp_loc->oloc, udata->lnk, TRUE, udata->ocrt_info ? udata->ocrt_info->obj_type : H5O_TYPE_UNKNOWN, udata->ocrt_info ? udata->ocrt_info->crt_info : NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object") @@ -2406,7 +2406,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_GCC_CLANG_DIAG_ON("cast-qual") /* Insert the link into the group */ - if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0) + if (H5G_obj_insert(grp_loc->oloc, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") /* If the link was a user-defined link, call its move callback if it has one */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index b32b82ff9e..230ef4e064 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -336,6 +336,10 @@ H5O__cache_deserialize(const void *image, size_t len, void *_udata, hbool_t *dir &(udata->common), dirty) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize first object header chunk") + /* Check for corruption in object header # of messages */ + if (oh->version == H5O_VERSION_1 && udata->v1_pfx_nmesgs < oh->nmesgs) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad object header message count"); + /* Note that we've loaded the object header from the file */ udata->made_attempt = TRUE; diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 2d458fcba8..90c61fd006 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -501,6 +501,12 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Get message class to operate on */ copy_type = mesg_src->type; + /* Sanity check message for possible corruption */ + if (H5O_UNKNOWN_ID != mesg_src->type->id && H5O_NULL_ID != mesg_src->type->id) + if (0 == mesg_src->raw_size) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "message of type '%s' has zero size", + mesg_src->type->name); + /* Check for continuation message; these are converted to NULL * messages because the destination OH will have only one chunk */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 16a12eb95c..65fb83c5ae 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -359,6 +359,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags /*in,out*/, const uint8_t ** hsize_t dim[H5O_LAYOUT_NDIMS]; /* Dimensions of the array */ H5T_t *array_dt; /* Temporary pointer to the array datatype */ H5T_t *temp_type; /* Temporary pointer to the field's datatype */ + unsigned memb_idx; /* Local index counter */ /* Get the length of the field name */ if (!skip) { @@ -377,10 +378,19 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags /*in,out*/, const uint8_t ** */ actual_name_length = HDstrlen((const char *)*pp); } + if (0 == actual_name_length) + HGOTO_ERROR(H5E_OHDR, H5E_BADSIZE, FAIL, "0 length enum name"); if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length, p_end)) HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + /* Check for duplicated field name */ + for (memb_idx = 0; memb_idx < dt->shared->u.compnd.nmembs; memb_idx++) + if (0 == strcmp((const char *)*pp, dt->shared->u.compnd.memb[memb_idx].name)) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, + "duplicated compound field name '%s', for fields %u and %u", + (const char *)*pp, memb_idx, dt->shared->u.compnd.nmembs); + /* Decode the field name */ if (NULL == (dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name = H5MM_xstrdup((const char *)*pp))) @@ -497,6 +507,18 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags /*in,out*/, const uint8_t ** if (version == H5O_DTYPE_VERSION_1) { /* Check if this member is an array field */ if (ndims > 0) { + /* Validate decoded dims */ + for (unsigned u = 0; u < ndims; u++) + if (!(dim[u] > 0)) { + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name = + H5MM_xfree(dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name); + if (H5T_close_real(temp_type) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, + "can't release datatype info"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, + "zero-sized dimension specified"); + } + /* Create the array datatype for the field */ if ((array_dt = H5T__array_create(temp_type, ndims, dim)) == NULL) { dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name = diff --git a/src/H5Oefl.c b/src/H5Oefl.c index af8f83b4f0..2f70c84978 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -80,9 +80,10 @@ H5O_efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED { H5O_efl_t *mesg = NULL; int version; - const uint8_t *p_end = p + p_size - 1; /* pointer to last byte in p */ - const char *s = NULL; - H5HL_t *heap = NULL; + const uint8_t *p_end = p + p_size - 1; /* pointer to last byte in p */ + const char *s = NULL; + H5HL_t *heap = NULL; + size_t block_size; /* Size of the heap block */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -140,6 +141,8 @@ H5O_efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED if (*s != '\0') HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "entry at offset 0 in local heap not an empty string") #endif + /* Get the size of the heap block */ + block_size = H5HL_heap_get_size(heap); for (size_t u = 0; u < mesg->nused; u++) { /* Name */ @@ -151,7 +154,7 @@ H5O_efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get external file name") if (*s == '\0') HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "invalid external file name") - mesg->slot[u].name = H5MM_xstrdup(s); + mesg->slot[u].name = H5MM_strndup(s, (block_size - mesg->slot[u].name_offset)); if (mesg->slot[u].name == NULL) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "string duplication failed") @@ -391,36 +394,38 @@ H5O__efl_reset(void *_mesg) /*------------------------------------------------------------------------- * Function: H5O_efl_total_size * - * Purpose: Return the total size of the external file list by summing + * Purpose: Query the total size of the external file list by summing * the sizes of all of the files. * - * Return: Success: Total reserved size for external data. - * - * Failure: 0 + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Tuesday, March 3, 1998 * *------------------------------------------------------------------------- */ -hsize_t -H5O_efl_total_size(H5O_efl_t *efl) +herr_t +H5O_efl_total_size(const H5O_efl_t *efl, hsize_t *size) { - hsize_t ret_value = 0, tmp; + hsize_t total_size = 0, tmp; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT if (efl->nused > 0 && H5O_EFL_UNLIMITED == efl->slot[efl->nused - 1].size) - ret_value = H5O_EFL_UNLIMITED; + *size = H5O_EFL_UNLIMITED; else { size_t u; /* Local index variable */ - for (u = 0; u < efl->nused; u++, ret_value = tmp) { - tmp = ret_value + efl->slot[u].size; - if (tmp <= ret_value) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, 0, "total external storage size overflowed"); + for (u = 0; u < efl->nused; u++, total_size = tmp) { + tmp = total_size + efl->slot[u].size; + if (tmp < total_size) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "total external storage size overflowed"); } /* end for */ - } /* end else */ + + /* Set the size to return */ + *size = total_size; + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 0c5c993f56..3536648ef0 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -43,7 +43,7 @@ static herr_t H5O__layout_pre_copy_file(H5F_t *file_src, const void *mesg_src, h const H5O_copy_t *cpy_info, void *udata); static void *H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata); -static herr_t H5O__layout_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); +static herr_t H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{ @@ -1242,8 +1242,8 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ H5O_layout_t *layout_src = (H5O_layout_t *)mesg_src; H5O_layout_t *layout_dst = NULL; - hbool_t copied = FALSE; /* Whether the data was copied */ - void *ret_value = NULL; /* Return value */ + bool copied = false; /* Whether the data was copied */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1264,18 +1264,29 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, if (H5D__compact_copy(file_src, &layout_src->storage.u.compact, file_dst, &layout_dst->storage.u.compact, udata->src_dtype, cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage") - copied = TRUE; + copied = true; } /* end if */ break; - case H5D_CONTIGUOUS: + case H5D_CONTIGUOUS: { + hsize_t nelmts; /* Number of elements in dataset's extent */ + size_t dt_size; /* Size of dataset's datatype in bytes */ + /* Sanity check the dataset's info */ + if (H5D__contig_check(file_src, layout_src, udata->src_space_extent, udata->src_dtype) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid layout / dataspace / datatype info"); + /* Compute the size of the contiguous storage for versions of the * layout message less than version 3 because versions 1 & 2 would * truncate the dimension sizes to 32-bits of information. - QAK 5/26/04 */ + nelmts = H5S_extent_nelem(udata->src_space_extent); + dt_size = H5T_get_size(udata->src_dtype); if (layout_src->version < H5O_LAYOUT_VERSION_3) - layout_dst->storage.u.contig.size = - H5S_extent_nelem(udata->src_space_extent) * H5T_get_size(udata->src_dtype); + layout_dst->storage.u.contig.size = nelmts * dt_size; + else + /* Sanity check layout storage size */ + if (layout_dst->storage.u.contig.size != (nelmts * dt_size)) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid layout storage size "); if (H5D__contig_is_space_alloc(&layout_src->storage) || (cpy_info->shared_fo && @@ -1284,9 +1295,9 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, if (H5D__contig_copy(file_src, &layout_src->storage.u.contig, file_dst, &layout_dst->storage.u.contig, udata->src_dtype, cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage") - copied = TRUE; - } /* end if */ - break; + copied = true; + } /* end if */ + } break; case H5D_CHUNKED: if (H5D__chunk_is_space_alloc(&layout_src->storage) || @@ -1297,7 +1308,7 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage") - copied = TRUE; + copied = true; } /* end if */ break; diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 0115fd5150..50b182d3ca 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -597,8 +597,8 @@ H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh); H5_DLL herr_t H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link); /* Shared object operators */ -H5_DLL void *H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, - const H5O_msg_class_t *type); +H5_DLL void *H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, size_t buf_size, + const uint8_t *buf, const H5O_msg_class_t *type); H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf /*out*/, const H5O_shared_t *sh_mesg); H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); H5_DLL herr_t H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *mesg_type, diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 82f08aa810..fe20340f53 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -1000,7 +1000,7 @@ H5_DLL herr_t H5O_loc_free(H5O_loc_t *loc); H5_DLL H5O_loc_t *H5O_get_loc(hid_t id); /* EFL operators */ -H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl); +H5_DLL herr_t H5O_efl_total_size(const H5O_efl_t *efl, hsize_t *size); /* Fill value operators */ H5_DLL herr_t H5O_fill_reset_dyn(H5O_fill_t *fill); diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index c95f11539e..3031c9ce14 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -195,9 +195,6 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN H5F_DECODE_LENGTH(f, p, sdim->size[i]); if (flags & H5S_VALID_MAX) { - if (NULL == (sdim->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed") - /* * Ensure that decoding doesn't cause reading past buffer's end, * due to possible data corruption - check that we have space to @@ -206,8 +203,16 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN if (H5_IS_BUFFER_OVERFLOW(p, (sizeof_size * sdim->rank), p_end)) HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding") - for (i = 0; i < sdim->rank; i++) + /* Max sizes */ + if (NULL == (sdim->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); + for (i = 0; i < sdim->rank; i++) { H5F_DECODE_LENGTH(f, p, sdim->max[i]); + if (sdim->size[i] > sdim->max[i]) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "dataspace dim %u size of %llu is greater than maxdim size of %llu", i, + (unsigned long long)sdim->size[i], (unsigned long long)sdim->max[i]); + } } /* end if */ } /* end if */ diff --git a/src/H5Oshared.c b/src/H5Oshared.c index c6f31bcb7d..f09e2766cd 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -295,12 +295,13 @@ done: *------------------------------------------------------------------------- */ void * -H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, +H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, size_t buf_size, const uint8_t *buf, const H5O_msg_class_t *type) { - H5O_shared_t sh_mesg; /* Shared message info */ - unsigned version; /* Shared message version */ - void *ret_value = NULL; /* Return value */ + const uint8_t *buf_end = buf + buf_size - 1; /* End of the buffer */ + H5O_shared_t sh_mesg; /* Shared message info */ + unsigned version; /* Shared message version */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -310,6 +311,8 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu HDassert(type); /* Version */ + if (H5_IS_BUFFER_OVERFLOW(buf, 1, buf_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); version = *buf++; if (version < H5O_SHARED_VERSION_1 || version > H5O_SHARED_VERSION_LATEST) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for shared object message") @@ -317,6 +320,8 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu /* Get the shared information type * Flags are unused before version 3. */ + if (H5_IS_BUFFER_OVERFLOW(buf, 1, buf_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (version >= H5O_SHARED_VERSION_2) sh_mesg.type = *buf++; else { @@ -325,8 +330,11 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu } /* end else */ /* Skip reserved bytes (for version 1) */ - if (version == H5O_SHARED_VERSION_1) + if (version == H5O_SHARED_VERSION_1) { + if (H5_IS_BUFFER_OVERFLOW(buf, 6, buf_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); buf += 6; + } /* Body */ if (version == H5O_SHARED_VERSION_1) { @@ -334,7 +342,11 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu sh_mesg.u.loc.index = 0; /* Decode stored "symbol table entry" into message location */ + if (H5_IS_BUFFER_OVERFLOW(buf, H5F_SIZEOF_SIZE(f), buf_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); buf += H5F_SIZEOF_SIZE(f); /* Skip over local heap address */ + if (H5_IS_BUFFER_OVERFLOW(buf, H5F_sizeof_addr(f), buf_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &buf, &(sh_mesg.u.loc.oh_addr)); } /* end if */ else if (version >= H5O_SHARED_VERSION_2) { @@ -343,6 +355,8 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu */ if (sh_mesg.type == H5O_SHARE_TYPE_SOHM) { HDassert(version >= H5O_SHARED_VERSION_3); + if (H5_IS_BUFFER_OVERFLOW(buf, sizeof(sh_mesg.u.heap_id), buf_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5MM_memcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id)); } /* end if */ else { @@ -353,6 +367,8 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu sh_mesg.type = H5O_SHARE_TYPE_COMMITTED; sh_mesg.u.loc.index = 0; + if (H5_IS_BUFFER_OVERFLOW(buf, H5F_sizeof_addr(f), buf_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &buf, &sh_mesg.u.loc.oh_addr); } /* end else */ } /* end else if */ diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 3fb2f76617..df5d0bbb6e 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -64,7 +64,7 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *iofla /* Check for shared message */ if (mesg_flags & H5O_MSG_FLAG_SHARED) { /* Retrieve native message info indirectly through shared message */ - if (NULL == (ret_value = H5O_shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE))) + if (NULL == (ret_value = H5O_shared_decode(f, open_oh, ioflags, p_size, p, H5O_SHARED_TYPE))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message") /* We currently do not support automatically fixing shared messages */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 58990622ff..fe336fbc6c 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -354,6 +354,7 @@ H5O__stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo { const H5O_stab_t *stab_src = (const H5O_stab_t *)mesg_src; H5O_stab_t *stab_dst = (H5O_stab_t *)mesg_dst; + H5HL_t *heap = NULL; /* Pointer to source group's heap */ H5G_bt_it_cpy_t udata; /* B-tree user data */ herr_t ret_value = SUCCEED; /* Return value */ @@ -370,18 +371,26 @@ H5O__stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo if (cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth) HGOTO_DONE(SUCCEED) + /* Get the heap for the copy*/ + if (NULL == (heap = H5HL_protect(src_oloc->file, stab_src->heap_addr, H5AC__READ_ONLY_FLAG))) + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect local heap"); + /* Set up B-tree iteration user data */ - udata.src_oloc = src_oloc; - udata.src_heap_addr = stab_src->heap_addr; - udata.dst_file = dst_oloc->file; - udata.dst_stab = stab_dst; - udata.cpy_info = cpy_info; + udata.src_oloc = src_oloc; + udata.src_heap = heap; + udata.src_block_size = H5HL_heap_get_size(heap); + udata.dst_file = dst_oloc->file; + udata.dst_stab = stab_dst; + udata.cpy_info = cpy_info; /* Iterate over objects in group, copying them */ if ((H5B_iterate(src_oloc->file, H5B_SNODE, stab_src->btree_addr, H5G__node_copy, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") done: + if (heap && H5HL_unprotect(heap) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTUNPROTECT, FAIL, "unable to unprotect local heap"); + FUNC_LEAVE_NOAPI(ret_value) } /* H5O__stab_post_copy_file() */ diff --git a/src/H5S.c b/src/H5S.c index 8dbc9a14fd..180f309325 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1250,6 +1250,8 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], con H5TRACE4("e", "iIs*[a1]h*[a1]h", space_id, rank, dims, max); /* Check args */ + if (rank > H5S_MAX_RANK) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "dataspace rank too large: %u", rank); if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") if (rank > 0 && dims == NULL) @@ -1689,6 +1691,30 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_decode() */ +/*------------------------------------------------------------------------- + * Function: H5S_get_simple_extent + * + * Purpose: Internal function for retrieving the extent for a dataspace object + * + * Return: Success: Pointer to the extent for a dataspace (not copied) + * Failure: NULL + * + * Note: This routine participates in the "Inlining C function pointers" + * pattern, don't call it directly, use the appropriate macro + * defined in H5Sprivate.h. + * + *------------------------------------------------------------------------- + */ +const H5S_extent_t * +H5S_get_simple_extent(const H5S_t *space) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + assert(space); + + FUNC_LEAVE_NOAPI(&space->extent) +} /* end H5S_get_simple_extent() */ + /*------------------------------------------------------------------------- * Function: H5S_get_simple_extent_type * diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 1483269324..0e62c8a9e4 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1290,6 +1290,9 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hb if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint32_t), p_end)) HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection rank") UINT32DECODE(pp, rank); + if (0 == rank || rank > H5S_MAX_RANK) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "invalid rank (%u) for serialized point selection", + rank); if (!*space) { /* Patch the rank of the allocated dataspace */ @@ -1312,17 +1315,22 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hb UINT32DECODE(pp, num_elem); - /* Allocate space for the coordinates */ - if (NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information") - /* Determine necessary size of buffer for coordinates */ size_t enc_type_size = sizeof(uint32_t); size_t coordinate_buffer_requirement = num_elem * rank * enc_type_size; + /* Check for overflow during multiplication */ + if (num_elem != (coordinate_buffer_requirement / (rank * enc_type_size))) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "size of point selection buffer overflowed"); + + /* Check for possible buffer overrun */ if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, coordinate_buffer_requirement, p_end)) HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection coordinates") + /* Allocate space for the coordinates */ + if (NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t)))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information"); + /* Retrieve the coordinates from the buffer */ for (tcoord = coord, i = 0; i < num_elem; i++) for (j = 0; j < (unsigned)rank; j++, tcoord++) diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index f3f821aad4..b388b5e7e7 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -161,6 +161,7 @@ typedef struct H5S_sel_iter_op_t { /* If the module using this macro is allowed access to the private variables, access them directly */ #ifdef H5S_MODULE +#define H5S_GET_EXTENT(S) (&(S)->extent) #define H5S_GET_EXTENT_TYPE(S) ((S)->extent.type) #define H5S_GET_EXTENT_NDIMS(S) ((S)->extent.rank) #define H5S_GET_EXTENT_NPOINTS(S) ((S)->extent.nelem) @@ -188,6 +189,7 @@ typedef struct H5S_sel_iter_op_t { ((*(ITER)->type->iter_get_seq_list)(ITER, MAXSEQ, MAXBYTES, NSEQ, NBYTES, OFF, LEN)) #define H5S_SELECT_ITER_RELEASE(ITER) ((*(ITER)->type->iter_release)(ITER)) #else /* H5S_MODULE */ +#define H5S_GET_EXTENT(S) (H5S_get_simple_extent(S)) #define H5S_GET_EXTENT_TYPE(S) (H5S_get_simple_extent_type(S)) #define H5S_GET_EXTENT_NDIMS(S) (H5S_get_simple_extent_ndims(S)) #define H5S_GET_EXTENT_NPOINTS(S) (H5S_get_simple_extent_npoints(S)) @@ -231,13 +233,15 @@ struct H5O_loc_t; typedef struct H5S_t H5S_t; /* Operations on dataspaces */ -H5_DLL H5S_t *H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max); -H5_DLL herr_t H5S_close(H5S_t *ds); -H5_DLL H5S_class_t H5S_get_simple_extent_type(const H5S_t *ds); -H5_DLL hssize_t H5S_get_simple_extent_npoints(const H5S_t *ds); -H5_DLL hsize_t H5S_get_npoints_max(const H5S_t *ds); -H5_DLL hbool_t H5S_has_extent(const H5S_t *ds); -H5_DLL int H5S_get_simple_extent_ndims(const H5S_t *ds); +H5_DLL herr_t H5S_init(void); +H5_DLL H5S_t *H5S_copy(const H5S_t *src, bool share_selection, bool copy_max); +H5_DLL herr_t H5S_close(H5S_t *ds); +H5_DLL const H5S_extent_t *H5S_get_simple_extent(const H5S_t *ds); +H5_DLL H5S_class_t H5S_get_simple_extent_type(const H5S_t *ds); +H5_DLL hssize_t H5S_get_simple_extent_npoints(const H5S_t *ds); +H5_DLL hsize_t H5S_get_npoints_max(const H5S_t *ds); +H5_DLL bool H5S_has_extent(const H5S_t *ds); +H5_DLL int H5S_get_simple_extent_ndims(const H5S_t *ds); H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[] /*out*/, hsize_t max_dims[] /*out*/); H5_DLL herr_t H5S_write(H5F_t *f, struct H5O_t *oh, unsigned update_flags, H5S_t *ds); H5_DLL herr_t H5S_append(H5F_t *f, struct H5O_t *oh, H5S_t *ds); diff --git a/src/H5T.c b/src/H5T.c index 9bc8e8bbbd..58eb030c2b 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -4854,12 +4854,12 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co * Make sure the first entry in the table is the no-op conversion path. */ if (0 == H5T_g.npaths) { - if (NULL == (H5T_g.path = (H5T_path_t **)H5MM_malloc(128 * sizeof(H5T_path_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + if (NULL == (H5T_g.path = (H5T_path_t **)H5MM_calloc(128 * sizeof(H5T_path_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for type conversion path table") H5T_g.apaths = 128; if (NULL == (H5T_g.path[0] = H5FL_CALLOC(H5T_path_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for no-op conversion path") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for no-op conversion path") HDsnprintf(H5T_g.path[0]->name, sizeof(H5T_g.path[0]->name), "no-op"); H5T_g.path[0]->conv.is_app = FALSE; H5T_g.path[0]->conv.u.lib_func = H5T__conv_noop; @@ -5122,6 +5122,75 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__path_find_real() */ +/*------------------------------------------------------------------------- + * Function: H5T__path_table_search + * + * Purpose: Searches the global datatype conversion path table for a + * conversion path between two datatypes. + * + * Sets `idx` to be the index of the last table entry compared + * (which will be the index of the matching conversion path on + * success). If no matching path is found, the value for `idx` + * will be the index into the path table where a new path + * entry with source and destination datatypes matching src + * and dst should be inserted. In this case, the caller should + * be sure to increment the index value by 1 if the value of + * the last comparison is > 0. + * + * If `last_cmp` is non-NULL, the value of the last comparison + * (-1, 0, or 1) is returned through it. + * + * Return: Success: true (conversion path found, index in *idx) + * Failure: false (no conversion path between types) + * + *------------------------------------------------------------------------- + */ +static bool +H5T__path_table_search(const H5T_t *src, const H5T_t *dst, int *idx, int *last_cmp) +{ + int lt, rt, md; /* Left, middle, and right edges */ + int cmp; /* Comparison result */ + bool ret_value = false; /* Return value */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + assert(0 != H5T_g.npaths); + assert(src); + assert(src->shared); + assert(dst); + assert(dst->shared); + assert(idx); + + /* Find the conversion path in the table, using a binary search */ + /* NOTE: Doesn't match against entry 0, which is the no-op path */ + lt = md = 1; + rt = H5T_g.npaths; + cmp = -1; + + while (cmp && lt < rt) { + md = (lt + rt) / 2; + assert(H5T_g.path[md]); + cmp = H5T_cmp(src, H5T_g.path[md]->src, false); + if (0 == cmp) + cmp = H5T_cmp(dst, H5T_g.path[md]->dst, false); + if (cmp < 0) + rt = md; + else if (cmp > 0) + lt = md + 1; + else + /* Match found */ + ret_value = true; + } + + /* Set middle index & comparison values */ + *idx = md; + if (last_cmp) + *last_cmp = cmp; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__path_table_search() */ + /*------------------------------------------------------------------------- * Function: H5T_path_noop * @@ -5146,6 +5215,47 @@ H5T_path_noop(const H5T_path_t *p) FUNC_LEAVE_NOAPI(p->is_noop || (p->is_hard && 0 == H5T_cmp(p->src, p->dst, FALSE))) } /* end H5T_path_noop() */ +/*------------------------------------------------------------------------- + * Function: H5T_noop_conv + * + * Purpose: Check if a conversion between two dataypes will be a no-op + * + * Return: true / false (can't fail) + * + *------------------------------------------------------------------------- + */ +bool +H5T_noop_conv(const H5T_t *src, const H5T_t *dst) +{ + bool ret_value = false; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + assert(src); + assert(src->shared); + assert(dst); + assert(dst->shared); + + /* Check the conversion path. If source and destination types are equal + * then its a no-op conversion, as long as neither type has a "force conversion" + * flag. Otherwise search over the conversion table entries. + */ + if (src->shared->force_conv == false && dst->shared->force_conv == false && + 0 == H5T_cmp(src, dst, true)) { + ret_value = true; + } /* end if */ + else { + int idx = 0; /* Matching entry */ + + /* Search the table of conversion paths */ + if (H5T__path_table_search(src, dst, &idx, NULL)) + ret_value = H5T_path_noop(H5T_g.path[idx]); + } /* end else */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_noop_conv() */ + /*------------------------------------------------------------------------- * Function: H5T_path_compound_subset * @@ -6068,6 +6178,7 @@ H5T_patch_vlen_file(H5T_t *dt, H5F_t *file) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T_patch_vlen_file() */ + /*------------------------------------------------------------------------- * Function: H5T_is_numeric_with_unusual_unused_bits * @@ -6092,7 +6203,14 @@ H5T_is_numeric_with_unusual_unused_bits(const H5T_t *dt) assert(dt->shared); /* Is the correct type? */ - if (H5T_INTEGER == dt->shared->type || H5T_FLOAT == dt->shared->type || H5T_BITFIELD == dt->shared->type) + if (H5T_INTEGER == dt->shared->type || H5T_FLOAT == dt->shared->type || + H5T_BITFIELD == dt->shared->type) { +#if LDBL_MANT_DIG == 106 + /* This currently won't work for the IBM long double type */ + if (H5T_FLOAT == dt->shared->type && dt->shared->size == 16 && + (dt->shared->u.atomic.prec == 64 || dt->shared->u.atomic.prec == 128)) + HGOTO_DONE(false); +#endif /* Has unused bits? */ if (dt->shared->u.atomic.prec < (dt->shared->size * 8)) { @@ -6103,6 +6221,7 @@ H5T_is_numeric_with_unusual_unused_bits(const H5T_t *dt) if (dt->shared->size > 1 && ((dt->shared->size * 8) > surround_bits)) HGOTO_DONE(true); } + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 4b29fa3382..4ba401ffc0 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -121,6 +121,7 @@ H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f); H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt); H5_DLL H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst); H5_DLL hbool_t H5T_path_noop(const H5T_path_t *p); +H5_DLL bool H5T_noop_conv(const H5T_t *src, const H5T_t *dst); H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p); H5_DLL H5T_subset_info_t *H5T_path_compound_subset(const H5T_path_t *p); H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t buf_stride, diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 25d322ea27..692991c4da 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -981,8 +981,10 @@ H5Z__filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], s HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit decompression") /* decompress the buffer */ - if (H5Z__nbit_decompress(outbuf, d_nelmts, (unsigned char *)*buf, cd_values) < 0) + if (H5Z__nbit_decompress(outbuf, d_nelmts, (unsigned char *)*buf, cd_values) < 0) { + H5MM_xfree(outbuf); HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, 0, "can't decompress buffer") + } } /* end if */ /* output; compress */ else { @@ -1214,7 +1216,7 @@ static herr_t H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j, size_t *buf_len, const unsigned parms[], unsigned *parms_index) { - unsigned i, nmembers, member_offset, member_class, member_size, used_size = 0, size; + unsigned i, nmembers, member_offset, member_class, member_size, used_size = 0, prev_used_size, size; parms_atomic p; herr_t ret_value = SUCCEED; /* Return value */ @@ -1228,10 +1230,15 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsig member_class = parms[(*parms_index)++]; /* Check for overflow */ - member_size = parms[*parms_index]; + member_size = parms[*parms_index]; + prev_used_size = used_size; used_size += member_size; if (used_size > size) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "compound member offset overflowed compound size") + HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "compound member size overflowed compound size"); + if (used_size <= prev_used_size) + HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "compound member size overflowed compound size"); + if ((member_offset + member_size) > size) + HGOTO_ERROR(H5E_PLINE, H5E_BADRANGE, FAIL, "compound member offset overflowed compound size"); switch (member_class) { case H5Z_NBIT_ATOMIC: p.size = member_size; diff --git a/src/H5err.txt b/src/H5err.txt index c3c629e524..a15378c199 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -198,6 +198,7 @@ MINOR, BTREE, H5E_CANTINSERT, Unable to insert object MINOR, BTREE, H5E_CANTLIST, Unable to list node MINOR, BTREE, H5E_CANTMODIFY, Unable to modify record MINOR, BTREE, H5E_CANTREMOVE, Unable to remove object +MINOR, BTREE, H5E_CANTFIND, Unable to check for record # Object header related errors MINOR, OHDR, H5E_LINKCOUNT, Bad object header link count
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor