summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/H5Aint.c6
-rw-r--r--src/H5B2leaf.c2
-rw-r--r--src/H5D.c2
-rw-r--r--src/H5Dchunk.c51
-rw-r--r--src/H5Dint.c4
-rw-r--r--src/H5FDs3comms.c4
-rw-r--r--src/H5Fmount.c2
-rw-r--r--src/H5Fprivate.h2
-rw-r--r--src/H5Gint.c2
-rw-r--r--src/H5Gobj.c2
-rw-r--r--src/H5Gtraverse.c2
-rw-r--r--src/H5I.c3
-rw-r--r--src/H5L.c4
-rw-r--r--src/H5Ochunk.c2
-rw-r--r--src/H5Odbg.c4
-rw-r--r--src/H5Oint.c101
-rw-r--r--src/H5Oprivate.h2
-rw-r--r--src/H5Pfapl.c3
-rw-r--r--src/H5T.c444
-rw-r--r--src/H5TS.c9
-rw-r--r--src/H5Tcommit.c6
-rw-r--r--src/H5Tcompound.c87
-rw-r--r--src/H5Tnative.c2
-rw-r--r--src/H5Tprivate.h6
-rw-r--r--src/H5VLconnector.h1
-rw-r--r--src/H5VLnative.h1
-rw-r--r--src/H5VLnative_attr.c3
-rw-r--r--src/H5VLnative_dataset.c48
-rw-r--r--src/H5VLnative_group.c5
-rw-r--r--src/H5Z.c3
-rw-r--r--src/H5Znbit.c4
-rw-r--r--src/H5private.h58
-rw-r--r--src/H5public.h40
-rw-r--r--src/H5trace.c6
35 files changed, 646 insertions, 277 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 070cf62..f582056 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_SRC C)
#-----------------------------------------------------------------------------
diff --git a/src/H5Aint.c b/src/H5Aint.c
index fc5ea34..1a74abe 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -224,7 +224,7 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of dataspace")
/* Copy the object header information */
- if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to copy entry")
/* Deep copy of the group hierarchy path */
@@ -390,7 +390,7 @@ H5A__open_common(const H5G_loc_t *loc, H5A_t *attr)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path")
/* Deep copy of the symbol table entry */
- if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry")
/* Deep copy of the group hier. path */
@@ -909,7 +909,7 @@ H5A__get_type(H5A_t *attr)
* reopen the type before returning it to the user. Make the type
* read-only.
*/
- if (NULL == (dt = H5T_copy(attr->shared->dt, H5T_COPY_REOPEN)))
+ if (NULL == (dt = H5T_copy_reopen(attr->shared->dt)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy datatype")
/* Mark any datatypes as being in memory now */
diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c
index 7ed0468..c1221ba 100644
--- a/src/H5B2leaf.c
+++ b/src/H5B2leaf.c
@@ -1051,7 +1051,7 @@ H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr,
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t H5_ATTR_UNUSED *leaf2)
+H5B2__assert_leaf2(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf, const H5B2_leaf_t H5_ATTR_UNUSED *leaf2)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
diff --git a/src/H5D.c b/src/H5D.c
index 178bb30..61a40df 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -598,7 +598,7 @@ H5Dget_offset(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier")
/* Get the offset */
- if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset")
done:
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 556e367..e760f63 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -323,6 +323,7 @@ static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfil
#ifdef H5_HAVE_PARALLEL
static herr_t H5D__chunk_collective_fill(const H5D_t *dset,
H5D_chunk_coll_info_t *chunk_info, size_t chunk_size, const void *fill_buf);
+static int H5D__chunk_cmp_addr(const void *addr1, const void *addr2);
#endif /* H5_HAVE_PARALLEL */
static int
@@ -4958,6 +4959,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
MPI_Datatype mem_type, file_type;
H5FD_mpio_xfer_t prev_xfer_mode; /* Previous data xfer mode */
hbool_t have_xfer_mode = FALSE; /* Whether the previous xffer mode has been retrieved */
+ hbool_t need_addr_sort = FALSE;
int i; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5006,19 +5008,28 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
/* make sure that the addresses in the datatype are
monotonically non decreasing */
- if(i)
- HDassert(chunk_disp_array[i] > chunk_disp_array[i - 1]);
- } /* end if */
+ if(i && (chunk_disp_array[i] < chunk_disp_array[i - 1]))
+ need_addr_sort = TRUE;
+ } /* end for */
/* calculate if there are any leftover blocks after evenly
distributing. If there are, then round robin the distribution
to processes 0 -> leftover. */
if(leftover && leftover > mpi_rank) {
chunk_disp_array[blocks] = (MPI_Aint)chunk_info->addr[blocks*mpi_size + mpi_rank];
+ if(blocks && (chunk_disp_array[blocks] < chunk_disp_array[blocks - 1]))
+ need_addr_sort = TRUE;
block_lens[blocks] = block_len;
blocks++;
}
+ /*
+ * Ensure that the blocks are sorted in monotonically non-decreasing
+ * order of offset in the file.
+ */
+ if(need_addr_sort)
+ HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr);
+
/* MSC - should use this if MPI_type_create_hindexed block is working:
* mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type);
*/
@@ -5073,6 +5084,36 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_collective_fill() */
+
+
+static int
+H5D__chunk_cmp_addr(const void *addr1, const void *addr2)
+{
+ MPI_Aint _addr1 = (MPI_Aint)0, _addr2 = (MPI_Aint)0;
+ int ret_value = 0;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ _addr1 = *((const MPI_Aint *) addr1);
+ _addr2 = *((const MPI_Aint *) addr2);
+
+#if MPI_VERSION >= 3 && MPI_SUBVERSION >= 1
+ {
+ MPI_Aint diff = MPI_Aint_diff(_addr1, _addr2);
+
+ if(diff < (MPI_Aint)0)
+ ret_value = -1;
+ else if(diff > (MPI_Aint)0)
+ ret_value = 1;
+ else
+ ret_value = 0;
+ }
+#else
+ ret_value = (_addr1 > _addr2) - (_addr1 < _addr2);
+#endif
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__chunk_cmp_addr() */
#endif /* H5_HAVE_PARALLEL */
@@ -7162,7 +7203,7 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__get_num_chunks() */
@@ -7300,7 +7341,7 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
} /* end if H5F_addr_defined */
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__get_chunk_info() */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 0d67fd0..1624f7b 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1534,7 +1534,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Shallow copy (take ownership) of the object location object */
- if(H5O_loc_copy(&(dataset->oloc), loc->oloc, H5_COPY_SHALLOW) < 0)
+ if(H5O_loc_copy_shallow(&(dataset->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy object location")
/* Shallow copy (take ownership) of the group hier. path */
@@ -3881,7 +3881,7 @@ H5D__get_type(const H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to patch datatype's file pointer")
/* Copy the dataset's datatype */
- if(NULL == (dt = H5T_copy(dset->shared->type, H5T_COPY_REOPEN)))
+ if(NULL == (dt = H5T_copy_reopen(dset->shared->type)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy datatype")
/* Mark any datatypes as being in memory now */
diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c
index f08e9d5..d9d4c88 100644
--- a/src/H5FDs3comms.c
+++ b/src/H5FDs3comms.c
@@ -1202,7 +1202,7 @@ H5FD_s3comms_s3r_open(const char *url,
if ((region != NULL && *region != '\0') ||
(id != NULL && *id != '\0') ||
- (signing_key != NULL && *signing_key != '\0'))
+ (signing_key != NULL))
{
/* if one exists, all three must exist
*/
@@ -1214,7 +1214,7 @@ H5FD_s3comms_s3r_open(const char *url,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL,
"secret id cannot be null.\n");
}
- if (signing_key == NULL || signing_key[0] == '\0') {
+ if (signing_key == NULL) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL,
"signing key cannot be null.\n");
}
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 13d95aa..5e6b899 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -766,7 +766,7 @@ H5F_traverse_mount(H5O_loc_t *oloc/*in,out*/)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to free object location")
/* Copy the entry for the root group */
- if(H5O_loc_copy(oloc, mnt_oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(oloc, mnt_oloc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
/* In case the shared root group info points to a different file handle
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index f0c28ca..fbb164d 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -432,7 +432,7 @@ typedef struct H5F_t H5F_t;
default: HDassert("bad sizeof size" && 0); \
}
-#define H5F_DECODE_LENGTH(f,p,l) H5F_DECODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f))
+#define H5F_DECODE_LENGTH(f,p,l) DECODE_VAR(p,l,H5F_SIZEOF_SIZE(f))
/*
* Macros that check for overflows. These are somewhat dangerous to fiddle
diff --git a/src/H5Gint.c b/src/H5Gint.c
index e0b8bd7..a3849a6 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -336,7 +336,7 @@ H5G_open(const H5G_loc_t *loc)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for group")
/* Shallow copy (take ownership) of the group location object */
- if(H5O_loc_copy(&(grp->oloc), loc->oloc, H5_COPY_SHALLOW) < 0)
+ if(H5O_loc_copy_shallow(&(grp->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy object location")
if(H5G_name_copy(&(grp->path), loc->path, H5_COPY_SHALLOW) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy path")
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 15dbd79..1892182 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -738,7 +738,7 @@ H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info)
H5G_loc_reset(&grp_loc);
/* Deep copy (duplicate) of the group location object */
- if(H5O_loc_copy(&grp_oloc, (H5O_loc_t *)oloc, H5_COPY_DEEP) < 0) /* (Casting away const OK - QAK) */
+ if(H5O_loc_copy_deep(&grp_oloc, oloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy object location")
/* Open the group */
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 7482e27..0f27880 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -132,7 +132,7 @@ H5G__traverse_slink_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc, const char H5_ATTR_UNU
} /* end if */
else {
/* Copy new location information for resolved object */
- H5O_loc_copy(udata->obj_loc->oloc, obj_loc->oloc, H5_COPY_DEEP);
+ H5O_loc_copy_deep(udata->obj_loc->oloc, obj_loc->oloc);
/* Indicate that the object exists */
udata->exists = TRUE;
diff --git a/src/H5I.c b/src/H5I.c
index 2ba8a2a..b233d23 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -215,7 +215,8 @@ H5I_term_package(void)
*-------------------------------------------------------------------------
*/
H5I_type_t
-H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func)
+H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved,
+ H5I_free_t free_func)
{
H5I_class_t *cls = NULL; /* New ID class */
H5I_type_t new_type; /* New ID type value */
diff --git a/src/H5L.c b/src/H5L.c
index 0d5bc02..47e29c0 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -1910,7 +1910,7 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT
* copy and wipe out grp_loc)
*/
H5G_name_reset(&temp_path);
- if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location")
temp_loc.oloc = &temp_oloc;
@@ -2695,7 +2695,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
* copy and wipe out grp_loc)
*/
H5G_name_reset(&temp_path);
- if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0)
+ if(H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location")
temp_loc.oloc = &temp_oloc;
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 9ce5a46..72402e4 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -358,7 +358,7 @@ H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5O__chunk_update_idx() */
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index b8190ae..3c91cae 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -153,7 +153,7 @@ H5O__assert(const H5O_t *oh)
/* Loop over all messages in object header */
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
- uint8_t *curr_hdr; /* Start of current message header */
+ uint8_t H5_ATTR_NDEBUG_UNUSED *curr_hdr; /* Start of current message header */
size_t curr_tot_size; /* Total size of current message (including header) */
curr_hdr = curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh);
@@ -164,7 +164,7 @@ H5O__assert(const H5O_t *oh)
free_space += curr_tot_size;
else if(H5O_CONT_ID == curr_msg->type->id) {
H5O_cont_t *cont = (H5O_cont_t *)curr_msg->native;
- hbool_t found_chunk = FALSE; /* Found a chunk that matches */
+ hbool_t H5_ATTR_NDEBUG_UNUSED found_chunk = FALSE; /* Found a chunk that matches */
HDassert(cont);
diff --git a/src/H5Oint.c b/src/H5Oint.c
index d5a3a71..04220af 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -1913,27 +1913,19 @@ H5O_loc_reset(H5O_loc_t *loc)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_loc_reset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5O_loc_copy
*
- * Purpose: Copy object location information
+ * Purpose: Copy object location information, according to the depth.
*
* Return: Success: Non-negative
- * Failure: Negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Monday, September 19, 2005
*
- * Notes: 'depth' parameter determines how much of the group entry
- * structure we want to copy. The values are:
- * H5_COPY_SHALLOW - Copy all the field values from the source
- * to the destination, but not copying objects pointed to.
- * (Destination "takes ownership" of objects pointed to)
- * H5_COPY_DEEP - Copy all the fields from the source to
- * the destination, deep copying objects pointed to.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1946,25 +1938,88 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
HDassert(dst);
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
+ /* Invoke correct routine */
+ if(depth == H5_COPY_SHALLOW)
+ H5O_loc_copy_shallow(dst, src);
+ else
+ H5O_loc_copy_deep(dst, src);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_loc_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_loc_copy_shallow
+ *
+ * Purpose: Shallow copy object location information. Copies all the field
+ * values from the source to the destination, but not copying
+ * objects pointed to. (i.e. destination "takes ownership" of
+ * objects pointed to)
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_loc_copy_shallow(H5O_loc_t *dst, H5O_loc_t *src)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments */
+ HDassert(src);
+ HDassert(dst);
+
/* Copy the top level information */
H5MM_memcpy(dst, src, sizeof(H5O_loc_t));
- /* Deep copy the names */
- if(depth == H5_COPY_DEEP) {
- /* If the original entry was holding open the file, this one should
- * hold it open, too.
- */
- if(src->holding_file)
- H5F_INCR_NOPEN_OBJS(dst->file);
- }
- else if(depth == H5_COPY_SHALLOW) {
- H5O_loc_reset(src);
- }
+ /* Reset the source location, as the destination 'owns' it now */
+ H5O_loc_reset(src);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_loc_copy() */
+} /* end H5O_loc_copy_shallow() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_loc_copy_deep
+ *
+ * Purpose: Deep copy object location information. Copies all the fields
+ * from the source to the destination, deep copying objects
+ * pointed to.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_loc_copy_deep(H5O_loc_t *dst, const H5O_loc_t *src)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments */
+ HDassert(src);
+ HDassert(dst);
+
+ /* Copy the top level information */
+ H5MM_memcpy(dst, src, sizeof(H5O_loc_t));
+
+ /* If the original entry was holding open the file, this one should
+ * hold it open, too.
+ */
+ if(src->holding_file)
+ H5F_INCR_NOPEN_OBJS(dst->file);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_loc_copy_deep() */
+
/*-------------------------------------------------------------------------
* Function: H5O_loc_hold_file
*
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 52a72b2..ceaa96d 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -997,6 +997,8 @@ H5_DLL herr_t H5O_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent,
/* These functions operate on object locations */
H5_DLL herr_t H5O_loc_reset(H5O_loc_t *loc);
H5_DLL herr_t H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth);
+H5_DLL herr_t H5O_loc_copy_shallow(H5O_loc_t *dst, H5O_loc_t *src);
+H5_DLL herr_t H5O_loc_copy_deep(H5O_loc_t *dst, const H5O_loc_t *src);
H5_DLL herr_t H5O_loc_hold_file(H5O_loc_t *loc);
H5_DLL herr_t H5O_loc_free(H5O_loc_t *loc);
H5_DLL H5O_loc_t *H5O_get_loc(hid_t id);
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 9a04c3e..7866464 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -4479,7 +4479,8 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close)
+H5Pset_evict_on_close(hid_t fapl_id,
+ hbool_t H5_ATTR_PARALLEL_UNUSED evict_on_close)
{
H5P_genplist_t *plist; /* property list pointer */
herr_t ret_value = SUCCEED; /* return value */
diff --git a/src/H5T.c b/src/H5T.c
index f1c2dbb..5d3c4a1 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -301,6 +301,9 @@
/* Local Typedefs */
/******************/
+/* Typedef for recursive const-correct datatype copying routines */
+typedef H5T_t *(*H5T_copy_func_t)(H5T_t *old_dt);
+
/********************/
/* Local Prototypes */
@@ -313,6 +316,11 @@ static herr_t H5T__set_size(H5T_t *dt, size_t size);
static herr_t H5T__close_cb(H5T_t *dt);
static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_func_t *conv);
static hbool_t H5T__detect_vlen_ref(const H5T_t *dt);
+static H5T_t *H5T__initiate_copy(const H5T_t *old_dt);
+static H5T_t *H5T__copy_transient(H5T_t *old_dt);
+static H5T_t *H5T__copy_all(H5T_t *old_dt);
+static herr_t H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt,
+ H5T_shared_t *reopened_fo, hbool_t set_memory_type, H5T_copy_func_t copyfn);
/*****************************/
@@ -3304,132 +3312,152 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__create() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5T_copy
+ * Function: H5T__initiate_copy
*
- * Purpose: Copies datatype OLD_DT. The resulting data type is not
- * locked and is a transient type.
+ * Purpose: Allocates datatype structures, copies core fields, and initializes
+ * VOL fields.
*
* Return: Success: Pointer to a new copy of the OLD_DT argument.
- *
* Failure: NULL
*
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
+ * Note: Common code for both H5T_copy and H5T_copy_reopen, as part of
+ * the const-correct datatype copying routines.
+ *
+ * Programmer: David Young
+ * January 18, 2020
*
*-------------------------------------------------------------------------
*/
-H5T_t *
-H5T_copy(H5T_t *old_dt, H5T_copy_t method)
+static H5T_t *
+H5T__initiate_copy(const H5T_t *old_dt)
{
- H5T_t *new_dt = NULL, *tmp = NULL;
- H5T_shared_t *reopened_fo = NULL;
- unsigned i;
- char *s;
- H5T_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
+ H5T_t *new_dt = NULL; /* Copy of datatype */
+ H5T_t *ret_value = NULL; /* Return value */
- /* check args */
- HDassert(old_dt);
+ FUNC_ENTER_STATIC
/* Allocate space */
if(NULL == (new_dt = H5FL_MALLOC(H5T_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "H5T_t memory allocation failed")
if(NULL == (new_dt->shared = H5FL_MALLOC(H5T_shared_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "H5T_shared_t memory allocation failed")
- /* Copy shared information (entry information is copied last) */
+ /* Copy shared information */
*(new_dt->shared) = *(old_dt->shared);
- /* No VOL object */
+ /* Reset VOL fields */
new_dt->vol_obj = NULL;
-
- /* No owned VOL object */
new_dt->shared->owned_vol_obj = NULL;
- /* Check what sort of copy we are making */
- switch (method) {
- case H5T_COPY_TRANSIENT:
- /*
- * Return an unlocked transient type.
- */
- new_dt->shared->state = H5T_STATE_TRANSIENT;
- break;
+ /* Set return value */
+ ret_value = new_dt;
- case H5T_COPY_ALL:
- /*
- * Return a transient type (locked or unlocked) or an unopened named
- * type. Immutable transient types are degraded to read-only.
- */
- if(H5T_STATE_OPEN==old_dt->shared->state)
- new_dt->shared->state = H5T_STATE_NAMED;
- else if(H5T_STATE_IMMUTABLE==old_dt->shared->state)
- new_dt->shared->state = H5T_STATE_RDONLY;
- break;
+done:
+ if(ret_value == NULL)
+ if(new_dt) {
+ if(new_dt->shared)
+ new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ new_dt = H5FL_FREE(H5T_t, new_dt);
+ } /* end if */
- case H5T_COPY_REOPEN:
- /*
- * Return a transient type (locked or unlocked) or an opened named
- * type. Immutable transient types are degraded to read-only.
- */
- if(old_dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) {
- /* Check if the object is already open */
- if(NULL == (reopened_fo = (H5T_shared_t *)H5FO_opened(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr))) {
- /* Clear any errors from H5FO_opened() */
- H5E_clear_stack(NULL);
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__initiate_copy() */
- /* Open named datatype again */
- if(H5O_open(&old_dt->oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type")
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__copy_transient
+ *
+ * Purpose: Part of recursive framework for const-correct datatype copying.
+ *
+ * Return: Success: Pointer to a new copy of the OLD_DT argument.
+ * Failure: NULL
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5T_t *
+H5T__copy_transient(H5T_t *old_dt)
+{
+ H5T_t *ret_value = NULL; /* Return value */
- /* Insert opened named datatype into opened object list for the file */
- if(H5FO_insert(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr, new_dt->shared, FALSE)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, NULL, "can't insert datatype into list of open objects")
+ FUNC_ENTER_STATIC
- /* Increment object count for the object in the top file */
- if(H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count")
+ /* Copy datatype, with correct method */
+ if(NULL == (ret_value = H5T_copy(old_dt, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't make 'transient' copy of datatype")
- new_dt->shared->fo_count = 1;
- } /* end if */
- else {
- /* The object is already open. Free the H5T_shared_t struct
- * we had been using and use the one that already exists.
- * Not terribly efficient. */
- new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
- new_dt->shared = reopened_fo;
-
- reopened_fo->fo_count++;
-
- /* Check if the object has been opened through the top file yet */
- if(H5FO_top_count(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) == 0) {
- /* Open the object through this top file */
- if(H5O_open(&old_dt->oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open object header")
- } /* end if */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__copy_transient() */
- /* Increment object count for the object in the top file */
- if(H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count")
- } /* end else */
- new_dt->shared->state = H5T_STATE_OPEN;
- }
- else if(H5T_STATE_IMMUTABLE == old_dt->shared->state) {
- new_dt->shared->state = H5T_STATE_RDONLY;
- }
- break;
- default:
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid copy method type")
- } /* end switch */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__copy_all
+ *
+ * Purpose: Part of recursive framework for const-correct datatype copying.
+ *
+ * Return: Success: Pointer to a new copy of the OLD_DT argument.
+ * Failure: NULL
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5T_t *
+H5T__copy_all(H5T_t *old_dt)
+{
+ H5T_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Copy datatype, with correct method */
+ if(NULL == (ret_value = H5T_copy(old_dt, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't make 'all' copy of datatype")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__copy_transient() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__complete_copy
+ *
+ * Purpose: Completes copying datatype fields, as part of the recursive
+ * const-correct datatype copy routines.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Note: Common code for both H5T_copy and H5T_copy_reopen.
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo,
+ hbool_t set_memory_type, H5T_copy_func_t copyfn)
+{
+ H5T_t *tmp = NULL; /* Temporary copy of compound field's datatype */
+ char *s; /* Temporary copy of compound field name / enum value name */
+ unsigned i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
/* Update fields in the new struct, if we aren't sharing an already opened
* committed datatype */
if(!reopened_fo) {
/* Copy parent information */
if(old_dt->shared->parent)
- new_dt->shared->parent = H5T_copy(old_dt->shared->parent, method);
+ if(NULL == (new_dt->shared->parent = (*copyfn)(old_dt->shared->parent)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy datatype's parent type")
switch(new_dt->shared->type) {
case H5T_COMPOUND:
@@ -3443,10 +3471,8 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
*/
/* Only malloc if space has been allocated for members - NAF */
if(new_dt->shared->u.compnd.nalloc > 0) {
- new_dt->shared->u.compnd.memb =
- (H5T_cmemb_t *)H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t));
- if (NULL == new_dt->shared->u.compnd.memb)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (new_dt->shared->u.compnd.memb = H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t))))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed")
H5MM_memcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb,
new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t));
@@ -3456,15 +3482,17 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
unsigned j;
int old_match;
- s = new_dt->shared->u.compnd.memb[i].name;
- new_dt->shared->u.compnd.memb[i].name = H5MM_xstrdup(s);
- tmp = H5T_copy (old_dt->shared->u.compnd.memb[i].type, method);
+ if(NULL == (s = H5MM_xstrdup(new_dt->shared->u.compnd.memb[i].name)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy string for compound field's name")
+ new_dt->shared->u.compnd.memb[i].name = s;
+ if(NULL == (tmp = (*copyfn)(old_dt->shared->u.compnd.memb[i].type)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy compound field's datatype")
new_dt->shared->u.compnd.memb[i].type = tmp;
HDassert(tmp != NULL);
/* Range check against compound member's offset */
- if ((accum_change < 0) && ((ssize_t) new_dt->shared->u.compnd.memb[i].offset < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype")
+ if((accum_change < 0) && ((ssize_t) new_dt->shared->u.compnd.memb[i].offset < accum_change))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
/* Apply the accumulated size change to the offset of the field */
new_dt->shared->u.compnd.memb[i].offset += (size_t) accum_change;
@@ -3479,7 +3507,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
/* check if we couldn't find a match */
if(old_match < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "fields in datatype corrupted")
} /* end if */
else
old_match = (int) i;
@@ -3494,8 +3522,8 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
} /* end for */
/* Range check against datatype size */
- if ((accum_change < 0) && ((ssize_t) new_dt->shared->size < accum_change))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype")
+ if((accum_change < 0) && ((ssize_t) new_dt->shared->size < accum_change))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype")
/* Apply the accumulated size change to the size of the compound struct */
new_dt->shared->size += (size_t) accum_change;
@@ -3508,27 +3536,25 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
* of each new member with copied values. That is, H5T_copy() is a
* deep copy.
*/
- new_dt->shared->u.enumer.name =
- (char **)H5MM_malloc(new_dt->shared->u.enumer.nalloc * sizeof(char*));
- new_dt->shared->u.enumer.value =
- (uint8_t *)H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size);
- if(NULL == new_dt->shared->u.enumer.value)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (new_dt->shared->u.enumer.name = H5MM_malloc(new_dt->shared->u.enumer.nalloc * sizeof(char*))))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "enam name array memory allocation failed")
+ if(NULL == (new_dt->shared->u.enumer.value = H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "enam value array memory allocation failed")
H5MM_memcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value,
new_dt->shared->u.enumer.nmembs * new_dt->shared->size);
for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) {
- s = old_dt->shared->u.enumer.name[i];
- new_dt->shared->u.enumer.name[i] = H5MM_xstrdup(s);
+ if(NULL == (s = H5MM_xstrdup(old_dt->shared->u.enumer.name[i])))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy string for enum value's name")
+ new_dt->shared->u.enumer.name[i] = s;
} /* end for */
break;
case H5T_VLEN:
case H5T_REFERENCE:
- if(method == H5T_COPY_TRANSIENT || method == H5T_COPY_REOPEN) {
+ if(set_memory_type)
/* H5T_copy converts any type into a memory type */
if(H5T_set_loc(new_dt, NULL, H5T_LOC_MEMORY) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
- } /* end if */
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
break;
case H5T_OPAQUE:
@@ -3540,7 +3566,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
case H5T_ARRAY:
/* Re-compute the array's size, in case it's base type changed size */
- new_dt->shared->size=new_dt->shared->u.array.nelem*new_dt->shared->parent->shared->size;
+ new_dt->shared->size = new_dt->shared->u.array.nelem * new_dt->shared->parent->shared->size;
break;
case H5T_NO_CLASS:
@@ -3559,15 +3585,15 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
* type and the new type is also named.
*/
if(H5O_loc_reset(&new_dt->oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, NULL, "unable to initialize location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to initialize location")
if(H5G_name_reset(&new_dt->path) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reset path")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path")
if(new_dt->shared->state == H5T_STATE_NAMED || new_dt->shared->state == H5T_STATE_OPEN) {
- if(H5O_loc_copy(&(new_dt->oloc), &(old_dt->oloc), H5_COPY_DEEP) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location")
+ if(H5O_loc_copy_deep(&(new_dt->oloc), &(old_dt->oloc)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy object location")
if(H5G_name_copy(&(new_dt->path), &(old_dt->path), H5_COPY_DEEP) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to copy path")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy path")
} /* end if */
/* Copy shared location information if the new type is named or if it is
@@ -3576,28 +3602,194 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method)
if((old_dt->sh_loc.type == H5O_SHARE_TYPE_SOHM || old_dt->sh_loc.type == H5O_SHARE_TYPE_HERE) ||
new_dt->shared->state == H5T_STATE_NAMED || new_dt->shared->state == H5T_STATE_OPEN) {
if(H5O_set_shared(&(new_dt->sh_loc), &(old_dt->sh_loc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy shared information")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy shared information")
} /* end if */
else
/* Reset shared component info */
H5O_msg_reset_share(H5O_DTYPE_ID, new_dt);
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__complete_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_copy
+ *
+ * Purpose: Copies datatype OLD_DT. The resulting data type is not
+ * locked and is a transient type.
+ *
+ * Return: Success: Pointer to a new copy of the OLD_DT argument.
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, December 4, 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+H5T_t *
+H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
+{
+ H5T_t *new_dt = NULL; /* New datatype */
+ H5T_copy_func_t copyfn; /* Pointer to correct copy routine */
+ H5T_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* check args */
+ HDassert(old_dt);
+
+ /* Allocate and copy core datatype information */
+ if(NULL == (new_dt = H5T__initiate_copy(old_dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy core datatype info")
+
+ /* Check what sort of copy we are making */
+ switch (method) {
+ case H5T_COPY_TRANSIENT:
+ /*
+ * Return an unlocked transient type.
+ */
+ new_dt->shared->state = H5T_STATE_TRANSIENT;
+ copyfn = H5T__copy_transient;
+ break;
+
+ case H5T_COPY_ALL:
+ /*
+ * Return a transient type (locked or unlocked) or an unopened named
+ * type. Immutable transient types are degraded to read-only.
+ */
+ if(H5T_STATE_OPEN==old_dt->shared->state)
+ new_dt->shared->state = H5T_STATE_NAMED;
+ else if(H5T_STATE_IMMUTABLE==old_dt->shared->state)
+ new_dt->shared->state = H5T_STATE_RDONLY;
+ copyfn = H5T__copy_all;
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid copy method type")
+ } /* end switch */
+
+ /* Finish making the copy of the datatype */
+ if(H5T__complete_copy(new_dt, old_dt, NULL, (method == H5T_COPY_TRANSIENT), copyfn) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't complete datatype initialization")
+
/* Set return value */
ret_value = new_dt;
done:
- if(ret_value == NULL) {
+ if(ret_value == NULL)
if(new_dt) {
- if(new_dt->shared)
- new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ HDassert(new_dt->shared);
+ new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
new_dt = H5FL_FREE(H5T_t, new_dt);
} /* end if */
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_copy() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_copy_reopen
+ *
+ * Purpose: Copy a datatype, possibly reopening a named datatype, as part
+ * the const-correct datatype copying routines.
+ *
+ * Return: Success: Pointer to a new copy of the OLD_DT argument.
+ * Failure: NULL
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+H5T_t *
+H5T_copy_reopen(H5T_t *old_dt)
+{
+ H5T_t *new_dt = NULL; /* New datatype */
+ H5T_shared_t *reopened_fo = NULL; /* Pointer to reopened existing named datatype */
+ H5T_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* check args */
+ HDassert(old_dt);
+
+ /* Allocate and copy core datatype information */
+ if(NULL == (new_dt = H5T__initiate_copy(old_dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy core datatype info")
+
+ /*
+ * Return a transient type (locked or unlocked) or an opened named
+ * type. Immutable transient types are degraded to read-only.
+ */
+ if(old_dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) {
+ /* Check if the object is already open */
+ if(NULL == (reopened_fo = (H5T_shared_t *)H5FO_opened(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr))) {
+ /* Clear any errors from H5FO_opened() */
+ H5E_clear_stack(NULL);
+
+ /* Open named datatype again */
+ if(H5O_open(&old_dt->oloc) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type")
+
+ /* Insert opened named datatype into opened object list for the file */
+ if(H5FO_insert(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr, new_dt->shared, FALSE)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, NULL, "can't insert datatype into list of open objects")
+
+ /* Increment object count for the object in the top file */
+ if(H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count")
+
+ new_dt->shared->fo_count = 1;
+ } /* end if */
+ else {
+ /* The object is already open. Free the H5T_shared_t struct
+ * we had been using and use the one that already exists.
+ * Not terribly efficient. */
+ new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ new_dt->shared = reopened_fo;
+
+ reopened_fo->fo_count++;
+
+ /* Check if the object has been opened through the top file yet */
+ if(H5FO_top_count(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) == 0) {
+ /* Open the object through this top file */
+ if(H5O_open(&old_dt->oloc) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open object header")
+ } /* end if */
+
+ /* Increment object count for the object in the top file */
+ if(H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count")
+ } /* end else */
+
+ /* Set state for new datatype */
+ new_dt->shared->state = H5T_STATE_OPEN;
+ } /* end if */
+ else
+ /* Downgrade immutable datatypes to read-only */
+ if(H5T_STATE_IMMUTABLE == old_dt->shared->state)
+ new_dt->shared->state = H5T_STATE_RDONLY;
+
+ /* Finish making the copy of the datatype */
+ if(H5T__complete_copy(new_dt, old_dt, reopened_fo, TRUE, H5T_copy_reopen) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't complete datatype initialization")
+
+ /* Set return value */
+ ret_value = new_dt;
+
+done:
+ if(ret_value == NULL)
+ if(new_dt) {
+ HDassert(new_dt->shared);
+ new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ new_dt = H5FL_FREE(H5T_t, new_dt);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_copy_reopen() */
+
/*-------------------------------------------------------------------------
* Function: H5T_lock
*
diff --git a/src/H5TS.c b/src/H5TS.c
index cc55810..b0cef7f 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -639,13 +639,4 @@ H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata)
} /* H5TS_create_thread */
-#else /* H5_HAVE_THREADSAFE */
-
-uint64_t
-H5TS_thread_id(void)
-{
- return 0;
-}
-
#endif /* H5_HAVE_THREADSAFE */
-
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 1b922d5..7d26af3 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -446,7 +446,7 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
/* Copy the new object header's location into the datatype, taking ownership of it */
- if(H5O_loc_copy(&(type->oloc), &temp_oloc, H5_COPY_SHALLOW) < 0)
+ if(H5O_loc_copy_shallow(&(type->oloc), &temp_oloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
if(H5G_name_copy(&(type->path), &temp_path, H5_COPY_SHALLOW) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
@@ -943,7 +943,7 @@ H5T_open(const H5G_loc_t *loc)
#endif /* H5_USING_MEMCHECKER */
/* Shallow copy (take ownership) of the object location object */
- if(H5O_loc_copy(&dt->oloc, loc->oloc, H5_COPY_SHALLOW) < 0)
+ if(H5O_loc_copy_shallow(&dt->oloc, loc->oloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location")
/* Shallow copy (take ownership) of the group hier. path */
@@ -1033,7 +1033,7 @@ H5T__open_oid(const H5G_loc_t *loc)
dt->shared->state = H5T_STATE_OPEN;
/* Shallow copy (take ownership) of the object location object */
- if(H5O_loc_copy(&dt->oloc, loc->oloc, H5_COPY_SHALLOW) < 0)
+ if(H5O_loc_copy_shallow(&dt->oloc, loc->oloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location")
/* Shallow copy (take ownership) of the group hier. path */
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index d4f1008..f4a9e04 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -51,8 +51,9 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5T_pack(const H5T_t *dt);
-static htri_t H5T_is_packed(const H5T_t *dt);
+static herr_t H5T__pack(const H5T_t *dt);
+static htri_t H5T__is_packed(const H5T_t *dt);
+static H5T_t *H5T__reopen_member_type(const H5T_t *dt, unsigned membno);
/*********************/
@@ -226,7 +227,7 @@ H5Tget_member_type(hid_t type_id, unsigned membno)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number")
/* Retrieve the datatype for the member */
- if(NULL == (memb_dt = H5T_get_member_type(dt, membno, H5T_COPY_REOPEN)))
+ if(NULL == (memb_dt = H5T__reopen_member_type(dt, membno)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type")
/* Get an ID for the datatype */
@@ -245,8 +246,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5T_get_member_type
*
- * Purpose: Private function for H5Tget_member_type. Returns the data
- * type of the specified member.
+ * Purpose: Returns a copy of the data type of the specified member.
*
* Return: Success: A copy of the member datatype;
* modifying the returned datatype does not
@@ -260,18 +260,19 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method)
+H5T_get_member_type(const H5T_t *dt, unsigned membno)
{
H5T_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
+ /* Sanity checks */
HDassert(dt);
HDassert(membno < dt->shared->u.compnd.nmembs);
- /* Copy datatype into an atom */
- if(NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, method)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy member datatype")
+ /* Copy datatype */
+ if(NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy member datatype")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -279,6 +280,43 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T__reopen_member_type
+ *
+ * Purpose: Private function for H5Tget_member_type. Returns a re-opened
+ * copy of the data type of the specified member.
+ *
+ * Return: Success: A copy of the member datatype;
+ * modifying the returned datatype does not
+ * modify the member type.
+ *
+ * Failure: NULL
+ *
+ * Programmer: David Young
+ * January 18, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5T_t *
+H5T__reopen_member_type(const H5T_t *dt, unsigned membno)
+{
+ H5T_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(dt);
+ HDassert(membno < dt->shared->u.compnd.nmembs);
+
+ /* Copy datatype, possibly re-opening it */
+ if(NULL == (ret_value = H5T_copy_reopen(dt->shared->u.compnd.memb[membno].type)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to reopen member datatype")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__reopen_member_type() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5T__get_member_size
*
* Purpose: Returns the size of the specified member.
@@ -387,7 +425,7 @@ H5Tpack(hid_t type_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype")
/* Pack */
- if(H5T_pack(dt) < 0)
+ if(H5T__pack(dt) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack compound datatype")
done:
@@ -493,7 +531,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T_pack
+ * Function: H5T__pack
*
* Purpose: Recursively packs a compound datatype by removing padding
* bytes. This is done in place (that is, destructively).
@@ -506,17 +544,17 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_pack(const H5T_t *dt)
+H5T__pack(const H5T_t *dt)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(dt);
if(H5T_detect_class(dt, H5T_COMPOUND, FALSE) > 0) {
/* If datatype has been packed, skip packing it and indicate success */
- if(TRUE == H5T_is_packed(dt))
+ if(TRUE == H5T__is_packed(dt))
HGOTO_DONE(SUCCEED)
/* Check for packing unmodifiable datatype */
@@ -524,7 +562,7 @@ H5T_pack(const H5T_t *dt)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is read-only")
if(dt->shared->parent) {
- if (H5T_pack(dt->shared->parent) < 0)
+ if(H5T__pack(dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack parent of datatype")
/* Adjust size of datatype appropriately */
@@ -539,7 +577,7 @@ H5T_pack(const H5T_t *dt)
/* Recursively pack the members */
for(i = 0; i < dt->shared->u.compnd.nmembs; i++) {
- if(H5T_pack(dt->shared->u.compnd.memb[i].type) < 0)
+ if(H5T__pack(dt->shared->u.compnd.memb[i].type) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack part of a compound datatype")
/* Update the member size */
@@ -552,7 +590,7 @@ H5T_pack(const H5T_t *dt)
for(i = 0, offset = 0; i < dt->shared->u.compnd.nmembs; i++) {
dt->shared->u.compnd.memb[i].offset = offset;
offset += dt->shared->u.compnd.memb[i].size;
- }
+ } /* end for */
/* Change total size */
dt->shared->size = MAX(1, offset);
@@ -564,11 +602,11 @@ H5T_pack(const H5T_t *dt)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_pack() */
+} /* end H5T__pack() */
/*-------------------------------------------------------------------------
- * Function: H5T_is_packed
+ * Function: H5T__is_packed
*
* Purpose: Checks whether a datatype which is compound (or has compound
* components) is packed.
@@ -583,11 +621,11 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5T_is_packed(const H5T_t *dt)
+H5T__is_packed(const H5T_t *dt)
{
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(dt);
@@ -596,12 +634,11 @@ H5T_is_packed(const H5T_t *dt)
dt = dt->shared->parent;
/* If this is a compound datatype, check if it is packed */
- if(dt->shared->type == H5T_COMPOUND) {
+ if(dt->shared->type == H5T_COMPOUND)
ret_value = (htri_t)(dt->shared->u.compnd.packed);
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_is_packed() */
+} /* end H5T__is_packed() */
/*-------------------------------------------------------------------------
@@ -638,7 +675,7 @@ H5T__update_packed(const H5T_t *dt)
/* Now check if all members are packed */
for(i = 0; i < dt->shared->u.compnd.nmembs; i++)
- if(!H5T_is_packed(dt->shared->u.compnd.memb[i].type)) {
+ if(!H5T__is_packed(dt->shared->u.compnd.memb[i].type)) {
dt->shared->u.compnd.packed = FALSE;
break;
} /* end if */
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 8859102..357bb08 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -272,7 +272,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
/* Construct child compound type and retrieve a list of their IDs, offsets, total size, and alignment for compound type. */
for(u = 0; u < nmemb; u++) {
- if(NULL == (memb_type = H5T_get_member_type(dtype, u, H5T_COPY_TRANSIENT)))
+ if(NULL == (memb_type = H5T_get_member_type(dtype, u)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed")
if(NULL == (comp_mname[u] = H5T__get_member_name(dtype, u)))
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index d8e98af..e05bb4e 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -59,7 +59,6 @@ struct H5S_t;
typedef enum H5T_copy_t {
H5T_COPY_TRANSIENT,
H5T_COPY_ALL,
- H5T_COPY_REOPEN
} H5T_copy_t;
/* Location of datatype information */
@@ -109,7 +108,8 @@ H5_DLLVAR H5T_order_t H5T_native_order_g;
/* Private functions */
H5_DLL herr_t H5T_init(void);
-H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method);
+H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method);
+H5_DLL H5T_t *H5T_copy_reopen(H5T_t *old_dt);
H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable);
H5_DLL herr_t H5T_close(H5T_t *dt);
H5_DLL herr_t H5T_close_real(H5T_t *dt);
@@ -164,7 +164,7 @@ H5_DLL herr_t H5T_update_shared(H5T_t *type);
/* Field functions (for both compound & enumerated types) */
H5_DLL int H5T_get_nmembers(const H5T_t *dt);
-H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method);
+H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno);
H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno);
/* Atomic functions */
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index baa4cca..39d9b14 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -91,7 +91,6 @@ typedef int H5VL_attr_optional_t;
typedef enum H5VL_dataset_get_t {
H5VL_DATASET_GET_DAPL, /* access property list */
H5VL_DATASET_GET_DCPL, /* creation property list */
- H5VL_DATASET_GET_OFFSET, /* offset */
H5VL_DATASET_GET_SPACE, /* dataspace */
H5VL_DATASET_GET_SPACE_STATUS, /* space status */
H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index e1f3f93..b607abc 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -48,6 +48,7 @@
#define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */
#define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */
#define H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE 8 /* H5Dvlen_get_buf_size */
+#define H5VL_NATIVE_DATASET_GET_OFFSET 9 /* H5Dget_offset */
/* Values for native VOL connector file optional VOL operations */
#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */
diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c
index e54c49f..8072cd5 100644
--- a/src/H5VLnative_attr.c
+++ b/src/H5VLnative_attr.c
@@ -525,7 +525,8 @@ done:
*/
herr_t
H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_attr_optional_t opt_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req,
+ va_list H5_ATTR_DEPRECATED_USED arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index bea2c50..8660e80 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -297,18 +297,6 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type,
break;
}
- /* H5Dget_offset */
- case H5VL_DATASET_GET_OFFSET:
- {
- haddr_t *ret = HDva_arg(arguments, haddr_t *);
-
- /* Set return value */
- *ret = H5D__get_offset(dset);
- if(!H5F_addr_defined(*ret))
- *ret = HADDR_UNDEF;
- break;
- }
-
default:
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset")
} /* end switch */
@@ -391,16 +379,17 @@ herr_t
H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
- H5D_t *dset = NULL; /* Dataset */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = (H5D_t *)obj; /* Dataset */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
+ /* Sanity checks */
+ HDassert(dset);
+
switch(optional_type) {
case H5VL_NATIVE_DATASET_FORMAT_CONVERT:
{ /* H5Dformat_convert */
- dset = (H5D_t *)obj;
-
switch(dset->shared->layout.type) {
case H5D_CHUNKED:
/* Convert the chunk indexing type to version 1 B-tree if not */
@@ -436,8 +425,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
{ /* H5Dget_chunk_index_type */
H5D_chunk_index_t *idx_type = HDva_arg(arguments, H5D_chunk_index_t *);
- dset = (H5D_t *)obj;
-
/* Make sure the dataset is chunked */
if(H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
@@ -453,8 +440,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
hsize_t *offset = HDva_arg(arguments, hsize_t *);
hsize_t *chunk_nbytes = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
-
/* Make sure the dataset is chunked */
if(H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
@@ -472,8 +457,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
hid_t space_id = HDva_arg(arguments, hid_t);
hsize_t *nchunks = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
- HDassert(dset);
HDassert(dset->shared);
HDassert(dset->shared->space);
@@ -505,8 +488,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
haddr_t *addr = HDva_arg(arguments, haddr_t *);
hsize_t *size = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
- HDassert(dset);
HDassert(dset->shared);
HDassert(dset->shared->space);
@@ -534,8 +515,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
haddr_t *addr = HDva_arg(arguments, haddr_t *);
hsize_t *size = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
- HDassert(dset);
HDassert(dset->shared);
/* Make sure the dataset is chunked */
@@ -556,8 +535,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
void *buf = HDva_arg(arguments, void *);
hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
- dset = (H5D_t *)obj;
-
/* Check arguments */
if(NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
@@ -585,8 +562,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
const void *buf = HDva_arg(arguments, const void *);
hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
- dset = (H5D_t *)obj;
-
/* Check arguments */
if(NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
@@ -612,13 +587,22 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
hid_t space_id = HDva_arg(arguments, hid_t);
hsize_t *size = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
-
if(H5D__vlen_get_buf_size(dset, type_id, space_id, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of vlen buf needed")
break;
}
+ /* H5Dget_offset */
+ case H5VL_NATIVE_DATASET_GET_OFFSET:
+ {
+ haddr_t *ret = HDva_arg(arguments, haddr_t *);
+
+ /* Set return value */
+ *ret = H5D__get_offset(dset);
+ if(!H5F_addr_defined(*ret))
+ *ret = HADDR_UNDEF;
+ break;
+ }
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c
index 3fdb2d9..236ee9d 100644
--- a/src/H5VLnative_group.c
+++ b/src/H5VLnative_group.c
@@ -266,8 +266,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_group_optional(void *obj, H5VL_group_optional_t optional_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_group_optional(void H5_ATTR_UNUSED *obj,
+ H5VL_group_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req, va_list H5_ATTR_DEPRECATED_USED arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Z.c b/src/H5Z.c
index 53186f1..2f477a3 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -585,7 +585,8 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
+H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id,
+ void *key H5_ATTR_PARALLEL_USED)
{
H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index fe0041c..2f79725 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -338,7 +338,7 @@ H5Z_calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms)
H5T_class_t dtype_member_class; /* Compound datatype's member datatype's class */
/* Get member datatype */
- if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT)))
+ if(NULL == (dtype_member = H5T_get_member_type(type, u)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype")
/* Get member datatype's class */
@@ -695,7 +695,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned *cd_values_index,
/* For each member, set parameters */
for(u = 0; u < nmembers; u++) {
/* Get member datatype */
- if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT)))
+ if(NULL == (dtype_member = H5T_get_member_type(type, u)))
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype")
/* Get member datatype's class */
diff --git a/src/H5private.h b/src/H5private.h
index f090203..f570723 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -304,17 +304,38 @@
* file). Be sure to update that file if the #ifdefs change here.
*/
#ifdef __cplusplus
-# define H5_ATTR_FORMAT(X,Y,Z) /*void*/
-# define H5_ATTR_UNUSED /*void*/
-# define H5_ATTR_NDEBUG_UNUSED /*void*/
-# define H5_ATTR_NORETURN /*void*/
-# define H5_ATTR_CONST /*void*/
-# define H5_ATTR_PURE /*void*/
-# define H5_ATTR_FALLTHROUGH /*void*/
+# define H5_ATTR_FORMAT(X,Y,Z) /*void*/
+# define H5_ATTR_UNUSED /*void*/
+# define H5_ATTR_DEPRECATED_USED /*void*/
+# define H5_ATTR_NDEBUG_UNUSED /*void*/
+# define H5_ATTR_DEBUG_API_USED /*void*/
+# define H5_ATTR_PARALLEL_UNUSED /*void*/
+# define H5_ATTR_PARALLEL_USED /*void*/
+# define H5_ATTR_NORETURN /*void*/
+# define H5_ATTR_CONST /*void*/
+# define H5_ATTR_PURE /*void*/
+# define H5_ATTR_FALLTHROUGH /*void*/
#else /* __cplusplus */
#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C)
# define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z)))
# define H5_ATTR_UNUSED __attribute__((unused))
+#ifdef H5_HAVE_PARALLEL
+# define H5_ATTR_PARALLEL_UNUSED __attribute__((unused))
+# define H5_ATTR_PARALLEL_USED /*void*/
+#else
+# define H5_ATTR_PARALLEL_UNUSED /*void*/
+# define H5_ATTR_PARALLEL_USED __attribute__((unused))
+#endif
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+#define H5_ATTR_DEPRECATED_USED H5_ATTR_UNUSED
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+#define H5_ATTR_DEPRECATED_USED /*void*/
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+#ifdef H5_DEBUG_API
+#define H5_ATTR_DEBUG_API_USED /*void*/
+#else /* H5_DEBUG_API */
+#define H5_ATTR_DEBUG_API_USED H5_ATTR_UNUSED
+#endif /* H5_DEBUG_API */
#ifndef NDEBUG
#define H5_ATTR_NDEBUG_UNUSED /*void*/
#else /* NDEBUG */
@@ -329,13 +350,17 @@
# define H5_ATTR_FALLTHROUGH /*void*/
#endif
#else
-# define H5_ATTR_FORMAT(X,Y,Z) /*void*/
-# define H5_ATTR_UNUSED /*void*/
-# define H5_ATTR_NDEBUG_UNUSED /*void*/
-# define H5_ATTR_NORETURN /*void*/
-# define H5_ATTR_CONST /*void*/
-# define H5_ATTR_PURE /*void*/
-# define H5_ATTR_FALLTHROUGH /*void*/
+# define H5_ATTR_FORMAT(X,Y,Z) /*void*/
+# define H5_ATTR_UNUSED /*void*/
+# define H5_ATTR_NDEBUG_UNUSED /*void*/
+# define H5_ATTR_DEBUG_API_USED /*void*/
+# define H5_ATTR_DEPRECATED_USED /*void*/
+# define H5_ATTR_PARALLEL_UNUSED /*void*/
+# define H5_ATTR_PARALLEL_USED /*void*/
+# define H5_ATTR_NORETURN /*void*/
+# define H5_ATTR_CONST /*void*/
+# define H5_ATTR_PURE /*void*/
+# define H5_ATTR_FALLTHROUGH /*void*/
#endif
#endif /* __cplusplus */
@@ -1893,12 +1918,11 @@ H5_DLL double H5_trace(const double *calltime, const char *func, const char *typ
/* global library version information string */
extern char H5_lib_vers_info_g[];
+#include "H5TSprivate.h"
+
/* Lock headers */
#ifdef H5_HAVE_THREADSAFE
-/* Include required thread-safety header */
-#include "H5TSprivate.h"
-
/* replacement structure for original global variable */
typedef struct H5_api_struct {
H5TS_mutex_t init_lock; /* API entrance mutex */
diff --git a/src/H5public.h b/src/H5public.h
index 86a1fbb..3312cf4 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -51,7 +51,45 @@
# endif
#endif
#ifdef H5_HAVE_INTTYPES_H
-# include <inttypes.h> /* For uint64_t on some platforms */
+# include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */
+#else /* H5_HAVE_INTTYPES_H */
+/* The following definitions should be suitable for 64-bit Windows, which is
+ * LLP64, and for 32-bit Windows, which is ILP32. Those are the only
+ * platforms where <inttypes.h> is likely to be missing. VS2015 and later
+ * *may* provide these definitions.
+ */
+#ifdef _WIN64
+# define PRIdPTR "lld"
+# define PRIoPTR "llo"
+# define PRIuPTR "llu"
+# define PRIxPTR "llx"
+#else /* _WIN64 */
+# define PRIdPTR "ld"
+# define PRIoPTR "lo"
+# define PRIuPTR "lu"
+# define PRIxPTR "lx"
+#endif /* _WIN64 */
+
+# define PRId8 "d"
+# define PRIo8 "o"
+# define PRIu8 "u"
+# define PRIx8 "x"
+# define PRId16 "d"
+# define PRIo16 "o"
+# define PRIu16 "u"
+# define PRIx16 "x"
+# define PRId32 "d"
+# define PRIo32 "o"
+# define PRIu32 "u"
+# define PRIx32 "x"
+# define PRId64 "lld"
+# define PRIo64 "llo"
+# define PRIu64 "llu"
+# define PRIx64 "llx"
+# define PRIdMAX "lld"
+# define PRIoMAX "llo"
+# define PRIuMAX "llu"
+# define PRIxMAX "llx"
#endif
#ifdef H5_HAVE_STDDEF_H
# include <stddef.h>
diff --git a/src/H5trace.c b/src/H5trace.c
index ec5c6a2..7168d5d 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -2746,9 +2746,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_DATASET_GET_STORAGE_SIZE:
HDfprintf(out, "H5VL_DATASET_GET_STORAGE_SIZE");
break;
- case H5VL_DATASET_GET_OFFSET:
- HDfprintf(out, "H5VL_DATASET_GET_OFFSET");
- break;
default:
HDfprintf(out, "%ld", (long)get);
break;
@@ -3276,6 +3273,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE:
HDfprintf(out, "H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE");
break;
+ case H5VL_NATIVE_DATASET_GET_OFFSET:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_GET_OFFSET");
+ break;
default:
HDfprintf(out, "%ld", (long)optional);
break;