summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2015-03-06 05:13:47 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2015-03-06 05:13:47 (GMT)
commit76d509dd6f454de8b01d0116dc73e56ea5949aa8 (patch)
treebd3291ac545e0ab332624aed7b6435899b13d4ef /src
parent50c38a5733bf39c2ba2cdb0de4d03e4aa78b1814 (diff)
downloadhdf5-76d509dd6f454de8b01d0116dc73e56ea5949aa8.zip
hdf5-76d509dd6f454de8b01d0116dc73e56ea5949aa8.tar.gz
hdf5-76d509dd6f454de8b01d0116dc73e56ea5949aa8.tar.bz2
[svn-r26378] Bring revisions #26220 - #26324 from trunk to revise_chunks. h5committested.
Diffstat (limited to 'src')
-rw-r--r--src/H5.c80
-rw-r--r--src/H5Edeprec.c2
-rw-r--r--src/H5FD.c1
-rw-r--r--src/H5I.c3
-rw-r--r--src/H5Omtime.c38
-rw-r--r--src/H5Osdspace.c4
-rw-r--r--src/H5P.c1
-rw-r--r--src/H5Pfapl.c1
-rw-r--r--src/H5R.c4
-rw-r--r--src/H5S.c10
-rw-r--r--src/H5Sall.c41
-rw-r--r--src/H5Shyper.c188
-rw-r--r--src/H5Snone.c35
-rw-r--r--src/H5Spkg.h4
-rw-r--r--src/H5Spoint.c56
-rw-r--r--src/H5Sprivate.h4
-rw-r--r--src/H5Spublic.h3
-rw-r--r--src/H5Sselect.c81
-rw-r--r--src/H5Tfields.c1
-rw-r--r--src/H5Topaque.c1
-rw-r--r--src/H5config.h.in38
-rw-r--r--src/H5private.h7
-rw-r--r--src/Makefile.in4
23 files changed, 391 insertions, 216 deletions
diff --git a/src/H5.c b/src/H5.c
index af8b668..52dc566 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -52,7 +52,9 @@
/* Local Prototypes */
/********************/
static void H5_debug_mask(const char*);
-
+#ifdef H5_HAVE_PARALLEL
+static int H5_mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *flag);
+#endif /*H5_HAVE_PARALLEL*/
/*********************/
/* Package Variables */
@@ -109,6 +111,43 @@ H5_init_library(void)
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
+
+#ifdef H5_HAVE_PARALLEL
+ {
+ int mpi_initialized;
+ int mpi_code;
+
+ MPI_Initialized(&mpi_initialized);
+
+#ifdef H5_HAVE_MPE
+ /* Initialize MPE instrumentation library. */
+ if (!H5_MPEinit_g)
+ {
+ int mpe_code;
+ if (mpi_initialized){
+ mpe_code = MPE_Init_log();
+ HDassert(mpe_code >=0);
+ H5_MPEinit_g = TRUE;
+ }
+ }
+#endif /*H5_HAVE_MPE*/
+
+ /* add an attribute on MPI_COMM_SELF to call H5_term_library
+ when it is destroyed, i.e. on MPI_Finalize */
+ if (mpi_initialized) {
+ int key_val;
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_NULL_COPY_FN,
+ (MPI_Comm_delete_attr_function *)H5_mpi_delete_cb,
+ &key_val, NULL)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_create_keyval failed", mpi_code)
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Comm_set_attr(MPI_COMM_SELF, key_val, NULL)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_set_attr failed", mpi_code)
+ }
+ }
+#endif /*H5_HAVE_PARALLEL*/
+
/*
* Make sure the package information is updated.
*/
@@ -132,24 +171,6 @@ H5_init_library(void)
H5_debug_g.pkg[H5_PKG_V].name = "v";
H5_debug_g.pkg[H5_PKG_Z].name = "z";
-#ifdef H5_HAVE_MPE
- /* Initialize MPE instrumentation library. May need to move this
- * up earlier if any of the above initialization involves using
- * the instrumentation code.
- */
- if (!H5_MPEinit_g)
- {
- int mpe_code;
- int mpi_initialized;
- MPI_Initialized(&mpi_initialized);
- if (mpi_initialized){
- mpe_code = MPE_Init_log();
- HDassert(mpe_code >=0);
- H5_MPEinit_g = TRUE;
- }
- }
-#endif
-
/*
* Install atexit() library cleanup routines unless the H5dont_atexit()
* has been called. Once we add something to the atexit() list it stays
@@ -580,6 +601,27 @@ H5_debug_mask(const char *s)
}
} /* end H5_debug_mask() */
+#ifdef H5_HAVE_PARALLEL
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_delete_cb
+ *
+ * Purpose: Callback attribute on MPI_COMM_SELF to terminate the HDF5
+ * library when the communicator is destroyed, i.e. on MPI_Finalize.
+ *
+ * Return: MPI_SUCCESS
+ *
+ * Programmer: Mohamad Chaarawi, February 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int H5_mpi_delete_cb(MPI_Comm UNUSED comm, int UNUSED keyval, void UNUSED *attr_val, int UNUSED *flag)
+{
+ H5_term_library();
+ return MPI_SUCCESS;
+}
+#endif /*H5_HAVE_PARALLEL*/
+
/*-------------------------------------------------------------------------
* Function: H5get_libversion
diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c
index 3e9444b..6a83745 100644
--- a/src/H5Edeprec.c
+++ b/src/H5Edeprec.c
@@ -152,6 +152,7 @@ H5Eget_major(H5E_major_t maj)
char *ret_value; /* Return value */
FUNC_ENTER_API_NOCLEAR(NULL)
+ H5TRACE1("*s", "i", maj);
/* Get the message object */
if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(maj, H5I_ERROR_MSG)))
@@ -204,6 +205,7 @@ H5Eget_minor(H5E_minor_t min)
char *ret_value; /* Return value */
FUNC_ENTER_API_NOCLEAR(NULL)
+ H5TRACE1("*s", "i", min);
/* Get the message object */
if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(min, H5I_ERROR_MSG)))
diff --git a/src/H5FD.c b/src/H5FD.c
index fbb37f9..b5cb8df 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -886,6 +886,7 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
H5FD_t *ret_value=NULL;
FUNC_ENTER_API(NULL)
+ H5TRACE4("*x", "*sIuia", name, flags, fapl_id, maxaddr);
/* Check arguments */
if(H5P_DEFAULT == fapl_id)
diff --git a/src/H5I.c b/src/H5I.c
index 46fd076..a6d12c1 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -952,6 +952,7 @@ H5Iobject_verify(hid_t id, H5I_type_t id_type)
void * ret_value; /* Return value */
FUNC_ENTER_API(NULL)
+ H5TRACE2("*x", "iIt", id, id_type);
if(H5I_IS_LIB_TYPE(id_type))
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type")
@@ -1092,6 +1093,7 @@ H5Iremove_verify(hid_t id, H5I_type_t id_type)
void * ret_value; /* Return value */
FUNC_ENTER_API(NULL)
+ H5TRACE2("*x", "iIt", id, id_type);
if(H5I_IS_LIB_TYPE(id_type))
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type")
@@ -1940,6 +1942,7 @@ H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key)
void *ret_value; /* Return value */
FUNC_ENTER_API(NULL)
+ H5TRACE3("*x", "Itx*x", type, func, key);
/* Check arguments */
if(H5I_IS_LIB_TYPE(type))
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 612d656..c9375f9 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -200,8 +200,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
/* decode */
for(i = 0; i < 14; i++)
- if(!HDisdigit(p[i]))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
+ if(!HDisdigit(p[i]))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
/*
* Convert YYYYMMDDhhmmss UTC to a time_t. This is a little problematic
@@ -219,36 +219,14 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
tm.tm_sec = (p[12]-'0')*10 + (p[13]-'0');
tm.tm_isdst = -1; /*figure it out*/
if((time_t)-1 == (the_time = HDmktime(&tm)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
#if defined(H5_HAVE_TM_GMTOFF)
- /* FreeBSD, OSF 4.0 */
+ /* BSD-like systems */
the_time += tm.tm_gmtoff;
-#elif defined(H5_HAVE___TM_GMTOFF)
- /* Linux libc-4 */
- the_time += tm.__tm_gmtoff;
#elif defined(H5_HAVE_TIMEZONE)
- /* Linux libc-5 */
- the_time -= timezone - (tm.tm_isdst?3600:0);
-#elif defined(H5_HAVE_BSDGETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE)
- /* Irix5.3 */
- {
- struct timezone tz;
-
- if(HDBSDgettimeofday(NULL, &tz) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
- the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
- }
-#elif defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) && defined(H5_GETTIMEOFDAY_GIVES_TZ)
- {
- struct timezone tz;
- struct timeval tv; /* Used as a placebo; some systems don't like NULL */
-
- if(HDgettimeofday(&tv, &tz) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
-
- the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
- }
+ /* GNU/Linux systems */
+ the_time -= timezone - (tm.tm_isdst ? 3600 : 0);
#else
/*
* The catch-all. If we can't convert a character string universal
@@ -257,14 +235,12 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
* only way a user can get the modification time is from our internal
* query routines, which can gracefully recover.
*/
-
- /* Irix64 */
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
#endif
/* The return value */
if(NULL == (mesg = H5FL_MALLOC(time_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
*mesg = the_time;
/* Set return value */
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 9ca8436..875cd56 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -308,7 +308,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(mesg);
- if(!dest && NULL == (dest = H5FL_MALLOC(H5S_extent_t)))
+ if(!dest && NULL == (dest = H5FL_CALLOC(H5S_extent_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy extent information */
@@ -463,7 +463,7 @@ H5O_sdspace_pre_copy_file(H5F_t UNUSED *file_src, const void *mesg_src,
*/
if(udata) {
/* Allocate copy of dataspace extent */
- if(NULL == (udata->src_space_extent = H5FL_MALLOC(H5S_extent_t)))
+ if(NULL == (udata->src_space_extent = H5FL_CALLOC(H5S_extent_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed")
/* Create a copy of the dataspace extent */
diff --git a/src/H5P.c b/src/H5P.c
index 113203d..ff230ed 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -1596,6 +1596,7 @@ H5Pget_class_name(hid_t pclass_id)
char *ret_value; /* return value */
FUNC_ENTER_API(NULL)
+ H5TRACE1("*s", "i", pclass_id);
/* Check arguments. */
if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS)))
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 089bfb9..7a44e86 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -920,6 +920,7 @@ H5Pget_driver_info(hid_t plist_id)
void *ret_value; /* Return value */
FUNC_ENTER_API(NULL)
+ H5TRACE1("*x", "i", plist_id);
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
diff --git a/src/H5R.c b/src/H5R.c
index 8396dcc..26f4b9d 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -291,7 +291,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5
H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr);
/* Serialize the selection into heap buffer */
- if(H5S_SELECT_SERIALIZE(space, p) < 0)
+ if(H5S_SELECT_SERIALIZE(space, &p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection")
/* Save the serialized buffer for later */
@@ -659,7 +659,7 @@ H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref)
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found")
/* Unserialize the selection */
- if(H5S_select_deserialize(ret_value, p) < 0)
+ if(H5S_SELECT_DESERIALIZE(&ret_value, &p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection")
done:
diff --git a/src/H5S.c b/src/H5S.c
index 1146ab4..a9812695 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -509,6 +509,10 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
FUNC_ENTER_NOAPI(FAIL)
+ /* Release destination extent before we copy over it */
+ if(H5S_extent_release(dst) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
+
/* Copy the regular fields */
dst->type = src->type;
dst->version = src->version;
@@ -583,7 +587,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max)
FUNC_ENTER_NOAPI(NULL)
- if(NULL == (dst = H5FL_MALLOC(H5S_t)))
+ if(NULL == (dst = H5FL_CALLOC(H5S_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the source dataspace's extent */
@@ -1536,7 +1540,7 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
buf += extent_size;
/* Encode the selection part of dataspace. */
- if(H5S_SELECT_SERIALIZE(obj, buf) < 0)
+ if(H5S_SELECT_SERIALIZE(obj, &buf) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space")
} /* end else */
@@ -1655,7 +1659,7 @@ H5S_decode(const unsigned char *buf)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
/* Decode the select part of dataspace. I believe this part always exists. */
- if(H5S_SELECT_DESERIALIZE(ds, buf) < 0)
+ if(H5S_SELECT_DESERIALIZE(&ds, &buf) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection")
/* Set return value */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 24caad2..1105915 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -39,8 +39,8 @@ static herr_t H5S_all_get_seq_list(const H5S_t *space, unsigned flags,
static herr_t H5S_all_release(H5S_t *space);
static htri_t H5S_all_is_valid(const H5S_t *space);
static hssize_t H5S_all_serial_size(const H5S_t *space);
-static herr_t H5S_all_serialize(const H5S_t *space, uint8_t *buf);
-static herr_t H5S_all_deserialize(H5S_t *space, const uint8_t *buf);
+static herr_t H5S_all_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S_all_deserialize(H5S_t *space, const uint8_t **p);
static herr_t H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S_all_offset(const H5S_t *space, hsize_t *off);
static htri_t H5S_all_is_contiguous(const H5S_t *space);
@@ -496,9 +496,11 @@ H5S_all_serial_size (const H5S_t UNUSED *space)
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_all_serialize(space, buf)
- H5S_t *space; IN: Dataspace pointer of selection to serialize
- uint8 *buf; OUT: Buffer to put serialized selection into
+ herr_t H5S_all_serialize(space, p)
+ const H5S_t *space; IN: Dataspace with selection to serialize
+ uint8_t **p; OUT: Pointer to buffer to put serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -510,17 +512,19 @@ H5S_all_serial_size (const H5S_t UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_all_serialize (const H5S_t *space, uint8_t *buf)
+H5S_all_serialize (const H5S_t *space, uint8_t **p)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(space);
+ HDassert(p);
+ HDassert(*p);
/* Store the preamble information */
- UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(buf, (uint32_t)1); /* Store the version number */
- UINT32ENCODE(buf, (uint32_t)0); /* Store the un-used padding */
- UINT32ENCODE(buf, (uint32_t)0); /* Store the additional information length */
+ UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
+ UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */
+ UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */
+ UINT32ENCODE(*p, (uint32_t)0); /* Store the additional information length */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_all_serialize() */
@@ -532,9 +536,12 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf)
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_all_deserialize(space, buf)
- H5S_t *space; IN/OUT: Dataspace pointer to place selection into
- uint8 *buf; IN: Buffer to retrieve serialized selection from
+ herr_t H5S_all_deserialize(space, p)
+ H5S_t *space; IN/OUT: Dataspace pointer to place
+ selection into
+ uint8 **p; OUT: Pointer to buffer holding serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -546,16 +553,18 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_all_deserialize(H5S_t *space, const uint8_t UNUSED *buf)
+H5S_all_deserialize(H5S_t *space, const uint8_t UNUSED **p)
{
- herr_t ret_value; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI(FAIL)
HDassert(space);
+ HDassert(p);
+ HDassert(*p);
/* Change to "all" selection */
- if((ret_value = H5S_select_all(space, TRUE)) < 0)
+ if(H5S_select_all(space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
done:
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index c97c9b6..9b1562f 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -54,8 +54,8 @@ static herr_t H5S_hyper_get_seq_list(const H5S_t *space, unsigned flags,
static herr_t H5S_hyper_release(H5S_t *space);
static htri_t H5S_hyper_is_valid(const H5S_t *space);
static hssize_t H5S_hyper_serial_size(const H5S_t *space);
-static herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t *buf);
-static herr_t H5S_hyper_deserialize(H5S_t *space, const uint8_t *buf);
+static herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S_hyper_deserialize(H5S_t *space, const uint8_t **p);
static herr_t H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S_hyper_offset(const H5S_t *space, hsize_t *offset);
static htri_t H5S_hyper_is_contiguous(const H5S_t *space);
@@ -1994,7 +1994,7 @@ H5S_hyper_serial_size(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **buf)
+H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **p)
{
H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
hsize_t u; /* Index variable */
@@ -2007,7 +2007,7 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start,
HDassert(start);
HDassert(end);
HDassert(rank < H5O_LAYOUT_NDIMS);
- HDassert(buf && *buf);
+ HDassert(p && *p);
/* Walk through the list of spans, recursing or outputing them */
curr=spans->head;
@@ -2019,7 +2019,7 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start,
end[rank]=curr->high;
/* Recurse down to the next dimension */
- if(H5S_hyper_serialize_helper(curr->down,start,end,rank+1,buf)<0)
+ if(H5S_hyper_serialize_helper(curr->down,start,end,rank+1,p)<0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
} /* end if */
else {
@@ -2027,17 +2027,17 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start,
/* Encode previous starting points */
for(u=0; u<rank; u++)
- UINT32ENCODE(*buf, (uint32_t)start[u]);
+ UINT32ENCODE(*p, (uint32_t)start[u]);
/* Encode starting point for this span */
- UINT32ENCODE(*buf, (uint32_t)curr->low);
+ UINT32ENCODE(*p, (uint32_t)curr->low);
/* Encode previous ending points */
for(u=0; u<rank; u++)
- UINT32ENCODE(*buf, (uint32_t)end[u]);
+ UINT32ENCODE(*p, (uint32_t)end[u]);
/* Encode starting point for this span */
- UINT32ENCODE(*buf, (uint32_t)curr->high);
+ UINT32ENCODE(*p, (uint32_t)curr->high);
} /* end else */
/* Advance to next node */
@@ -2055,9 +2055,11 @@ done:
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_hyper_serialize(space, buf)
- H5S_t *space; IN: Dataspace pointer of selection to serialize
- uint8 *buf; OUT: Buffer to put serialized selection into
+ herr_t H5S_hyper_serialize(space, p)
+ const H5S_t *space; IN: Dataspace with selection to serialize
+ uint8_t **p; OUT: Pointer to buffer to put serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -2069,7 +2071,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
+H5S_hyper_serialize (const H5S_t *space, uint8_t **p)
{
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
@@ -2089,14 +2091,14 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
HDassert(space);
/* Store the preamble information */
- UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(buf, (uint32_t)1); /* Store the version number */
- UINT32ENCODE(buf, (uint32_t)0); /* Store the un-used padding */
- lenp = buf; /* keep the pointer to the length location for later */
- buf += 4; /* skip over space for length */
+ UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
+ UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */
+ UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */
+ lenp = *p; /* keep the pointer to the length location for later */
+ *p += 4; /* skip over space for length */
/* Encode number of dimensions */
- UINT32ENCODE(buf, (uint32_t)space->extent.rank);
+ UINT32ENCODE(*p, (uint32_t)space->extent.rank);
len += 4;
/* Check for a "regular" hyperslab selection */
@@ -2114,7 +2116,7 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
/* Encode number of hyperslabs */
H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
- UINT32ENCODE(buf, (uint32_t)block_count);
+ UINT32ENCODE(*p, (uint32_t)block_count);
len+=4;
/* Now serialize the information for the regular hyperslab */
@@ -2137,11 +2139,11 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
/* Encode hyperslab starting location */
for(u = 0; u < ndims; u++)
- UINT32ENCODE(buf, (uint32_t)offset[u]);
+ UINT32ENCODE(*p, (uint32_t)offset[u]);
/* Encode hyperslab ending location */
for(u = 0; u < ndims; u++)
- UINT32ENCODE(buf, (uint32_t)(offset[u] + (diminfo[u].block - 1)));
+ UINT32ENCODE(*p, (uint32_t)(offset[u] + (diminfo[u].block - 1)));
/* Move the offset to the next sequence to start */
offset[fast_dim]+=diminfo[fast_dim].stride;
@@ -2192,15 +2194,15 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
/* Encode number of hyperslabs */
block_count = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
- UINT32ENCODE(buf, (uint32_t)block_count);
+ UINT32ENCODE(*p, (uint32_t)block_count);
len+=4;
/* Add 8 bytes times the rank for each hyperslab selected */
H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, size_t);
- len += (size_t)(8 * space->extent.rank * block_count);
+ len += (uint32_t)(8 * space->extent.rank * block_count);
/* Encode each hyperslab in selection */
- H5S_hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &buf);
+ H5S_hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, p);
} /* end else */
/* Encode length */
@@ -2216,9 +2218,12 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_hyper_deserialize(space, buf)
- H5S_t *space; IN/OUT: Dataspace pointer to place selection into
- uint8 *buf; IN: Buffer to retrieve serialized selection from
+ herr_t H5S_hyper_deserialize(space, p)
+ H5S_t *space; IN/OUT: Dataspace pointer to place
+ selection into
+ uint8 **p; OUT: Pointer to buffer holding serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -2230,9 +2235,9 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf)
+H5S_hyper_deserialize (H5S_t *space, const uint8_t **p)
{
- uint32_t rank; /* rank of points */
+ unsigned rank; /* rank of points */
size_t num_elem=0; /* number of elements in selection */
hsize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */
hsize_t end[H5O_LAYOUT_NDIMS]; /* hyperslab end information */
@@ -2251,14 +2256,13 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf)
/* Check args */
HDassert(space);
- HDassert(buf);
+ HDassert(p);
+ HDassert(*p);
/* Deserialize slabs to select */
- buf+=16; /* Skip over selection header */
- UINT32DECODE(buf,rank); /* decode the rank of the point selection */
- if(rank!=space->extent.rank)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of pointer does not match dataspace")
- UINT32DECODE(buf,num_elem); /* decode the number of points */
+ /* (The header and rank have already beed decoded) */
+ rank = space->extent.rank; /* Retrieve rank from space */
+ UINT32DECODE(*p,num_elem); /* decode the number of points */
/* Set the count & stride for all blocks */
for(tcount=count,tstride=stride,j=0; j<rank; j++,tstride++,tcount++) {
@@ -2270,14 +2274,14 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf)
for(i=0; i<num_elem; i++) {
/* Decode the starting points */
for(tstart=start,j=0; j<rank; j++,tstart++)
- UINT32DECODE(buf, *tstart);
+ UINT32DECODE(*p, *tstart);
/* Decode the ending points */
for(tend=end,j=0; j<rank; j++,tend++)
- UINT32DECODE(buf, *tend);
+ UINT32DECODE(*p, *tend);
/* Change the ending points into blocks */
- for(tblock=block,tstart=start,tend=end,j=0; j<(unsigned)rank; j++,tstart++,tend++,tblock++)
+ for(tblock=block,tstart=start,tend=end,j=0; j<rank; j++,tstart++,tend++,tblock++)
*tblock=(*tend-*tstart)+1;
/* Select or add the hyperslab to the current selection */
@@ -8856,3 +8860,109 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_get_seq_list() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Sis_regular_hyperslab
+ PURPOSE
+ Determine if a hyperslab selection is regular
+ USAGE
+ htri_t H5Sis_regular_hyperslab(dsid)
+ hid_t dsid; IN: Dataspace ID of hyperslab selection to query
+ RETURNS
+ TRUE/FALSE for hyperslab selection, FAIL on error or when querying other
+ selection types.
+ DESCRIPTION
+ If a hyperslab can be represented as a single call to H5Sselect_hyperslab,
+ with the H5S_SELECT_SET option, it is regular. If the hyperslab selection
+ would require multiple calls to H5Sselect_hyperslab, it is irregular.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5Sis_regular_hyperslab(hid_t spaceid)
+{
+ H5S_t *space; /* Dataspace to query */
+ htri_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("t", "i", spaceid);
+
+ /* Check args */
+ if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection")
+
+ ret_value = H5S_hyper_is_regular(space);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Sis_regular_hyperslab() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Sgetregular_hyperslab
+ PURPOSE
+ Retrieve a regular hyperslab selection
+ USAGE
+ herr_t H5Sget_regular_hyperslab(dsid, start, stride, block, count)
+ hid_t dsid; IN: Dataspace ID of hyperslab selection to query
+ hsize_t start[]; OUT: Offset of start of hyperslab
+ hsize_t stride[]; OUT: Hyperslab stride
+ hsize_t count[]; OUT: Number of blocks included in hyperslab
+ hsize_t block[]; OUT: Size of block in hyperslab
+ RETURNS
+ Non-negative on success/Negative on failure. (It is an error to query
+ the regular hyperslab selections for non-regular hyperslab selections)
+ DESCRIPTION
+ Retrieve the start/stride/count/block for a regular hyperslab selection.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Note that if a hyperslab is originally regular, then becomes irregular
+ through selection operations, and then becomes regular again, the new
+ final regular selection may be equivalent but not identical to the
+ original regular selection.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[],
+ hsize_t count[], hsize_t block[])
+{
+ H5S_t *space; /* Dataspace to query */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "i*h*h*h*h", spaceid, start, stride, count, block);
+
+ /* Check args */
+ if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection")
+ if(TRUE != H5S_hyper_is_regular(space))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a regular hyperslab selection")
+
+ /* Retrieve hyperslab parameters */
+ if(start)
+ for(u = 0; u < space->extent.rank; u++)
+ start[u] = space->select.sel_info.hslab->app_diminfo[u].start;
+ if(stride)
+ for(u = 0; u < space->extent.rank; u++)
+ stride[u] = space->select.sel_info.hslab->app_diminfo[u].stride;
+ if(count)
+ for(u = 0; u < space->extent.rank; u++)
+ count[u] = space->select.sel_info.hslab->app_diminfo[u].count;
+ if(block)
+ for(u = 0; u < space->extent.rank; u++)
+ block[u] = space->select.sel_info.hslab->app_diminfo[u].block;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Sget_regular_hyperslab() */
+
diff --git a/src/H5Snone.c b/src/H5Snone.c
index 3c5eccc..c5ec2de 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -40,8 +40,8 @@ static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags,
static herr_t H5S_none_release(H5S_t *space);
static htri_t H5S_none_is_valid(const H5S_t *space);
static hssize_t H5S_none_serial_size(const H5S_t *space);
-static herr_t H5S_none_serialize(const H5S_t *space, uint8_t *buf);
-static herr_t H5S_none_deserialize(H5S_t *space, const uint8_t *buf);
+static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S_none_deserialize(H5S_t *space, const uint8_t **p);
static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S_none_offset(const H5S_t *space, hsize_t *off);
static htri_t H5S_none_is_contiguous(const H5S_t *space);
@@ -464,9 +464,11 @@ H5S_none_serial_size(const H5S_t UNUSED *space)
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_none_serialize(space, buf)
- H5S_t *space; IN: Dataspace pointer of selection to serialize
- uint8 *buf; OUT: Buffer to put serialized selection into
+ herr_t H5S_none_serialize(space, p)
+ const H5S_t *space; IN: Dataspace with selection to serialize
+ uint8_t **p; OUT: Pointer to buffer to put serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -478,17 +480,17 @@ H5S_none_serial_size(const H5S_t UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_serialize(const H5S_t *space, uint8_t *buf)
+H5S_none_serialize(const H5S_t *space, uint8_t **p)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(space);
/* Store the preamble information */
- UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(buf, (uint32_t)1); /* Store the version number */
- UINT32ENCODE(buf, (uint32_t)0); /* Store the un-used padding */
- UINT32ENCODE(buf, (uint32_t)0); /* Store the additional information length */
+ UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
+ UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */
+ UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */
+ UINT32ENCODE(*p, (uint32_t)0); /* Store the additional information length */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_none_serialize() */
@@ -500,9 +502,12 @@ H5S_none_serialize(const H5S_t *space, uint8_t *buf)
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_none_deserialize(space, buf)
- H5S_t *space; IN/OUT: Dataspace pointer to place selection into
- uint8 *buf; IN: Buffer to retrieve serialized selection from
+ herr_t H5S_none_deserialize(space, p)
+ H5S_t *space; IN/OUT: Dataspace pointer to place
+ selection into
+ uint8 **p; OUT: Pointer to buffer holding serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -514,13 +519,15 @@ H5S_none_serialize(const H5S_t *space, uint8_t *buf)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_deserialize(H5S_t *space, const uint8_t UNUSED *buf)
+H5S_none_deserialize(H5S_t *space, const uint8_t UNUSED **p)
{
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(space);
+ HDassert(p);
+ HDassert(*p);
/* Change to "none" selection */
if(H5S_select_none(space) < 0)
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 0a9df69..5f84717 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -130,9 +130,9 @@ typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space);
/* Method to determine number of bytes required to store current selection */
typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space);
/* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
-typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t *buf);
+typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p);
/* Method to store create selection from "serialized" form (a byte sequence suitable for storing on disk) */
-typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, const uint8_t *buf);
+typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, const uint8_t **p);
/* Method to determine smallest n-D bounding box containing the current selection */
typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end);
/* Method to determine linear offset of initial element in selection within dataspace */
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 70842df..44e0510 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -41,8 +41,8 @@ static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags,
static herr_t H5S_point_release(H5S_t *space);
static htri_t H5S_point_is_valid(const H5S_t *space);
static hssize_t H5S_point_serial_size(const H5S_t *space);
-static herr_t H5S_point_serialize(const H5S_t *space, uint8_t *buf);
-static herr_t H5S_point_deserialize(H5S_t *space, const uint8_t *buf);
+static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S_point_deserialize(H5S_t *space, const uint8_t **p);
static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S_point_offset(const H5S_t *space, hsize_t *off);
static htri_t H5S_point_is_contiguous(const H5S_t *space);
@@ -804,9 +804,11 @@ H5S_point_serial_size (const H5S_t *space)
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_point_serialize(space, buf)
- H5S_t *space; IN: Dataspace pointer of selection to serialize
- uint8 *buf; OUT: Buffer to put serialized selection into
+ herr_t H5S_point_serialize(space, p)
+ const H5S_t *space; IN: Dataspace with selection to serialize
+ uint8_t **p; OUT: Pointer to buffer to put serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -818,7 +820,7 @@ H5S_point_serial_size (const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_serialize (const H5S_t *space, uint8_t *buf)
+H5S_point_serialize (const H5S_t *space, uint8_t **p)
{
H5S_pnt_node_t *curr; /* Point information nodes */
uint8_t *lenp; /* pointer to length location for later storage */
@@ -830,18 +832,18 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf)
HDassert(space);
/* Store the preamble information */
- UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
- UINT32ENCODE(buf, (uint32_t)1); /* Store the version number */
- UINT32ENCODE(buf, (uint32_t)0); /* Store the un-used padding */
- lenp=buf; /* keep the pointer to the length location for later */
- buf+=4; /* skip over space for length */
+ UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
+ UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */
+ UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */
+ lenp=*p; /* keep the pointer to the length location for later */
+ *p+=4; /* skip over space for length */
/* Encode number of dimensions */
- UINT32ENCODE(buf, (uint32_t)space->extent.rank);
+ UINT32ENCODE(*p, (uint32_t)space->extent.rank);
len+=4;
/* Encode number of elements */
- UINT32ENCODE(buf, (uint32_t)space->select.num_elem);
+ UINT32ENCODE(*p, (uint32_t)space->select.num_elem);
len+=4;
/* Encode each point in selection */
@@ -852,7 +854,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf)
/* Encode each point */
for(u=0; u<space->extent.rank; u++)
- UINT32ENCODE(buf, (uint32_t)curr->pnt[u]);
+ UINT32ENCODE(*p, (uint32_t)curr->pnt[u]);
curr=curr->next;
} /* end while */
@@ -870,9 +872,12 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf)
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_point_deserialize(space, buf)
- H5S_t *space; IN/OUT: Dataspace pointer to place selection into
- uint8 *buf; IN: Buffer to retrieve serialized selection from
+ herr_t H5S_point_deserialize(space, p)
+ H5S_t *space; IN/OUT: Dataspace pointer to place
+ selection into
+ uint8 **p; OUT: Pointer to buffer holding serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -884,10 +889,10 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_deserialize (H5S_t *space, const uint8_t *buf)
+H5S_point_deserialize (H5S_t *space, const uint8_t **p)
{
H5S_seloper_t op=H5S_SELECT_SET; /* Selection operation */
- uint32_t rank; /* Rank of points */
+ unsigned rank; /* Rank of points */
size_t num_elem=0; /* Number of elements in selection */
hsize_t *coord=NULL, *tcoord; /* Pointer to array of elements */
unsigned i, j; /* local counting variables */
@@ -897,14 +902,13 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf)
/* Check args */
HDassert(space);
- HDassert(buf);
+ HDassert(p);
+ HDassert(*p);
/* Deserialize points to select */
- buf += 16; /* Skip over selection header */
- UINT32DECODE(buf, rank); /* decode the rank of the point selection */
- if(rank != space->extent.rank)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of pointer does not match dataspace")
- UINT32DECODE(buf, num_elem); /* decode the number of points */
+ /* (The header and rank have already beed decoded) */
+ rank = space->extent.rank; /* Retrieve rank from space */
+ UINT32DECODE(*p, num_elem); /* decode the number of points */
/* Allocate space for the coordinates */
if(NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t))))
@@ -913,7 +917,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf)
/* Retrieve the coordinates from the buffer */
for(tcoord = coord, i = 0; i < num_elem; i++)
for(j = 0; j < (unsigned)rank; j++, tcoord++)
- UINT32DECODE(buf, *tcoord);
+ UINT32DECODE(*p, *tcoord);
/* Select points */
if(H5S_select_elements(space, op, num_elem, (const hsize_t *)coord) < 0)
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 44cd6c3..7b7b8c6 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -206,7 +206,7 @@ H5_DLL int H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t
H5_DLL htri_t H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2);
/* Operations on selections */
-H5_DLL herr_t H5S_select_deserialize(H5S_t *space, const uint8_t *buf);
+H5_DLL herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p);
H5_DLL H5S_sel_type H5S_get_select_type(const H5S_t *space);
H5_DLL herr_t H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space,
H5D_operator_t op, void *operator_data);
@@ -227,7 +227,7 @@ H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space);
-H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t *buf);
+H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p);
H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
H5_DLL htri_t H5S_select_is_single(const H5S_t *space);
H5_DLL htri_t H5S_select_is_regular(const H5S_t *space);
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 0a39ce1..37d3866 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -137,6 +137,9 @@ H5_DLL herr_t H5Sselect_all(hid_t spaceid);
H5_DLL herr_t H5Sselect_none(hid_t spaceid);
H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
+H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid);
+H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
+ hsize_t stride[], hsize_t count[], hsize_t block[]);
H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 2cb4b38..a4f13d7 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -239,9 +239,11 @@ H5S_select_serial_size(const H5S_t *space)
PURPOSE
Serialize the selection for a dataspace into a buffer
USAGE
- herr_t H5S_select_serialize(space, buf)
+ herr_t H5S_select_serialize(space, p)
const H5S_t *space; IN: Dataspace with selection to serialize
- uint8_t *buf; OUT: Buffer to put serialized selection
+ uint8_t **p; OUT: Pointer to buffer to put serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -256,17 +258,17 @@ H5S_select_serial_size(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_serialize(const H5S_t *space, uint8_t *buf)
+H5S_select_serialize(const H5S_t *space, uint8_t **p)
{
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(space);
- HDassert(buf);
+ HDassert(p);
/* Call the selection type's serialize function */
- ret_value=(*space->select.type->serialize)(space,buf);
+ ret_value=(*space->select.type->serialize)(space,p);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_serialize() */
@@ -428,9 +430,13 @@ H5S_select_valid(const H5S_t *space)
Deserialize the current selection from a user-provided buffer into a real
selection in the dataspace.
USAGE
- herr_t H5S_select_deserialize(space, buf)
- H5S_t *space; IN/OUT: Dataspace pointer to place selection into
- uint8 *buf; IN: Buffer to retrieve serialized selection from
+ herr_t H5S_select_deserialize(space, p)
+ H5S_t **space; IN/OUT: Dataspace pointer to place
+ selection into. Will be allocated if not
+ provided.
+ uint8 **p; OUT: Pointer to buffer holding serialized
+ selection. Will be advanced to end of
+ serialized selection.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -444,42 +450,81 @@ H5S_select_valid(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_deserialize (H5S_t *space, const uint8_t *buf)
+H5S_select_deserialize (H5S_t **space, const uint8_t **p)
{
- const uint8_t *tbuf; /* Temporary pointer to the selection type */
- uint32_t sel_type; /* Pointer to the selection type */
+ H5S_t *tmp_space; /* Pointer to actual dataspace to use, either
+ *space or a newly allocated one */
+ uint32_t sel_type; /* Pointer to the selection type */
herr_t ret_value=FAIL; /* return value */
FUNC_ENTER_NOAPI(FAIL)
HDassert(space);
- tbuf=buf;
- UINT32DECODE(tbuf, sel_type);
+ /* Allocate space if not provided */
+ if(!*space) {
+ if(NULL == (tmp_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ } /* end if */
+ else
+ tmp_space = *space;
+
+ /* Decode selection type */
+ UINT32DECODE(*p, sel_type);
+
+ /* Skip over the remainder of the header */
+ *p += 12;
+
+ /* Decode and check or patch rank for point and hyperslab selections */
+ if((sel_type == H5S_SEL_POINTS) || (sel_type == H5S_SEL_HYPERSLABS)) {
+ uint32_t rank; /* Rank of dataspace */
+
+ /* Decode the rank of the point selection */
+ UINT32DECODE(*p,rank);
+
+ if(!*space)
+ /* Patch the rank of the allocated dataspace */
+ tmp_space->extent.rank = rank;
+ else
+ /* Verify the rank of the provided dataspace */
+ if(rank != tmp_space->extent.rank)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace")
+ } /* end if */
+
+ /* Make routine for selection type */
switch(sel_type) {
case H5S_SEL_POINTS: /* Sequence of points selected */
- ret_value=(*H5S_sel_point->deserialize)(space,buf);
+ ret_value = (*H5S_sel_point->deserialize)(tmp_space, p);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
- ret_value=(*H5S_sel_hyper->deserialize)(space,buf);
+ ret_value = (*H5S_sel_hyper->deserialize)(tmp_space, p);
break;
case H5S_SEL_ALL: /* Entire extent selected */
- ret_value=(*H5S_sel_all->deserialize)(space,buf);
+ ret_value = (*H5S_sel_all->deserialize)(tmp_space, p);
break;
case H5S_SEL_NONE: /* Nothing selected */
- ret_value=(*H5S_sel_none->deserialize)(space,buf);
+ ret_value = (*H5S_sel_none->deserialize)(tmp_space, p);
break;
default:
break;
}
- if(ret_value<0)
+ if(ret_value < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection")
+ /* Return space to the caller if allocated */
+ if(!*space)
+ *space = tmp_space;
+
done:
+ /* Free temporary space if not passed to caller (only happens on error) */
+ if(!*space && tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_select_deserialize() */
diff --git a/src/H5Tfields.c b/src/H5Tfields.c
index 0e0d4e7..fb186fb 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -163,6 +163,7 @@ H5Tget_member_name(hid_t type_id, unsigned membno)
char *ret_value;
FUNC_ENTER_API(NULL)
+ H5TRACE2("*s", "iIu", type_id, membno);
/* Check args */
if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE)))
diff --git a/src/H5Topaque.c b/src/H5Topaque.c
index d68e659..e93bf65 100644
--- a/src/H5Topaque.c
+++ b/src/H5Topaque.c
@@ -121,6 +121,7 @@ H5Tget_tag(hid_t type_id)
char *ret_value;
FUNC_ENTER_API(NULL)
+ H5TRACE1("*s", "i", type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
diff --git a/src/H5config.h.in b/src/H5config.h.in
index cc8a59c..42dfcfb 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -20,9 +20,6 @@
/* Define the default plugins path to compile */
#undef DEFAULT_PLUGINDIR
-/* Define the default virtual file driver to compile */
-#undef DEFAULT_VFD
-
/* Define if `dev_t' is a scalar */
#undef DEV_T_IS_SCALAR
@@ -52,9 +49,6 @@
long long values. */
#undef FP_TO_ULLONG_RIGHT_MAXIMUM
-/* Define if gettimeofday() populates the tz pointer passed in */
-#undef GETTIMEOFDAY_GIVES_TZ
-
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
@@ -64,9 +58,6 @@
/* Define if the __attribute__(()) extension is present */
#undef HAVE_ATTRIBUTE
-/* Define to 1 if you have the `BSDgettimeofday' function. */
-#undef HAVE_BSDGETTIMEOFDAY
-
/* Define if the compiler understands C99 designated initialization of structs
and unions */
#undef HAVE_C99_DESIGNATED_INITIALIZER
@@ -83,14 +74,10 @@
/* Define if Darwin or Mac OS X */
#undef HAVE_DARWIN
-/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
- */
-#undef HAVE_DECL_TZNAME
-
/* Define to 1 if you have the `difftime' function. */
#undef HAVE_DIFFTIME
-/* Define if the direct I/O virtual file driver should be compiled */
+/* Define if the direct I/O virtual file driver (VFD) should be compiled */
#undef HAVE_DIRECT
/* Define to 1 if you have the <dirent.h> header file. */
@@ -313,12 +300,6 @@
/* Define if `struct text_info' is defined */
#undef HAVE_STRUCT_TEXT_INFO
-/* Define if `struct timezone' is defined */
-#undef HAVE_STRUCT_TIMEZONE
-
-/* Define to 1 if `tm_zone' is a member of `struct tm'. */
-#undef HAVE_STRUCT_TM_TM_ZONE
-
/* Define if `struct videoconfig' is defined */
#undef HAVE_STRUCT_VIDEOCONFIG
@@ -379,14 +360,6 @@
/* Define if `tm_gmtoff' is a member of `struct tm' */
#undef HAVE_TM_GMTOFF
-/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
- `HAVE_STRUCT_TM_TM_ZONE' instead. */
-#undef HAVE_TM_ZONE
-
-/* Define to 1 if you don't have `tm_zone' but do have the external array
- `tzname'. */
-#undef HAVE_TZNAME
-
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
@@ -414,9 +387,6 @@
/* Define to 1 if you have the `_scrsize' function. */
#undef HAVE__SCRSIZE
-/* Define if `__tm_gmtoff' is a member of `struct tm' */
-#undef HAVE___TM_GMTOFF
-
/* Define if your system can't handle converting floating-point values to long
long. */
#undef HW_FP_TO_LLONG_NOT_WORKS
@@ -470,9 +440,6 @@
/* Define if deprecated public API symbols are disabled */
#undef NO_DEPRECATED_SYMBOLS
-/* Define if shared writing must be disabled (CodeWarrior only) */
-#undef NO_SHARED_WRITING
-
/* Name of package */
#undef PACKAGE
@@ -627,9 +594,6 @@
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-#undef TM_IN_SYS_TIME
-
/* Define if your system can compile unsigned long long to floating-point
casts. */
#undef ULLONG_TO_FP_CAST_WORKS
diff --git a/src/H5private.h b/src/H5private.h
index 9c66296..336d84a 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -160,6 +160,10 @@
#include <dirent.h>
#endif
+/* Define the default VFD for this platform.
+ * Since the removal of the Windows VFD, this is sec2 for all platforms.
+ */
+#define H5_DEFAULT_VFD H5FD_SEC2
#ifdef H5_HAVE_WIN32_API
/* The following two defines must be before any windows headers are included */
@@ -567,9 +571,6 @@ typedef struct {
#ifndef HDatol
#define HDatol(S) atol(S)
#endif /* HDatol */
-#ifndef HDBSDgettimeofday
- #define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P)
-#endif /* HDBSDgettimeofday */
#ifndef HDbsearch
#define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F)
#endif /* HDbsearch */
diff --git a/src/Makefile.in b/src/Makefile.in
index 6abbec1..6c01edd 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -728,8 +728,8 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chkexe files are used to mark tests that have run successfully.
# .chklog files are output from those tests.
-# *.clog are from the MPE option.
-CHECK_CLEANFILES = *.chkexe *.chklog *.clog
+# *.clog and *.clog2 are from the MPE option.
+CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.