summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-01-28 02:11:39 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-01-28 02:11:39 (GMT)
commit7191f26717255667e86c86559ffc316f73f4c1bd (patch)
tree3179c22066f9880e7f09849e8a620ad398f68fa9 /src
parent2cbd7f1b3cd50d21279ef81093632cb7bf6f97ea (diff)
downloadhdf5-7191f26717255667e86c86559ffc316f73f4c1bd.zip
hdf5-7191f26717255667e86c86559ffc316f73f4c1bd.tar.gz
hdf5-7191f26717255667e86c86559ffc316f73f4c1bd.tar.bz2
[svn-r16369] Description:
Bring r16347:16367 from trunk into revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) (h5committest not required on this branch)
Diffstat (limited to 'src')
-rw-r--r--src/H5B2int.c6
-rw-r--r--src/H5EA.c2
-rw-r--r--src/H5EAcache.c12
-rw-r--r--src/H5EAhdr.c11
-rw-r--r--src/H5EApkg.h5
-rw-r--r--src/H5EAprivate.h6
-rw-r--r--src/H5EAtest.c95
-rw-r--r--src/H5F.c156
-rw-r--r--src/H5Fprivate.h5
-rw-r--r--src/H5Torder.c2
10 files changed, 242 insertions, 58 deletions
diff --git a/src/H5B2int.c b/src/H5B2int.c
index aa1fdca..b5d4048 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -275,7 +275,7 @@ H5B2_shared_free(void *_shared)
/* Free the array of offsets into the native key block */
if(shared->nat_off)
- H5FL_SEQ_FREE(size_t, shared->nat_off);
+ shared->nat_off = H5FL_SEQ_FREE(size_t, shared->nat_off);
/* Release the node info */
if(shared->node_info) {
@@ -292,11 +292,11 @@ H5B2_shared_free(void *_shared)
} /* end for */
/* Free the array of node info structs */
- H5FL_SEQ_FREE(H5B2_node_info_t, shared->node_info);
+ shared->node_info = H5FL_SEQ_FREE(H5B2_node_info_t, shared->node_info);
} /* end if */
/* Free the shared B-tree info itself */
- (void)H5FL_FREE(H5B2_shared_t, shared);
+ shared = H5FL_FREE(H5B2_shared_t, shared);
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5EA.c b/src/H5EA.c
index eadb9c0..aa65da7 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -906,7 +906,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
} /* end if */
/* Release the extensible array wrapper */
- (void)H5FL_FREE(H5EA_t, ea);
+ ea = H5FL_FREE(H5EA_t, ea);
CATCH
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index a3c9f87..bf2bf43 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -596,7 +596,7 @@ H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
/* Decode elements in index block */
if(hdr->cparam.idx_blk_elmts > 0) {
/* Convert from raw elements on disk into native elements in memory */
- if((hdr->cparam.cls->decode)(p, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0)
+ if((hdr->cparam.cls->decode)(p, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) < 0)
H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements")
p += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size);
} /* end if */
@@ -720,7 +720,7 @@ H5EA__cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Encode elements in index block */
if(iblock->hdr->cparam.idx_blk_elmts > 0) {
/* Convert from native elements in memory into raw elements on disk */
- if((iblock->hdr->cparam.cls->encode)(p, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts) < 0)
+ if((iblock->hdr->cparam.cls->encode)(p, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts, iblock->hdr->cb_ctx) < 0)
H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements")
p += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size);
} /* end if */
@@ -1326,7 +1326,7 @@ H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
if(!dblock->npages) {
/* Decode elements in data block */
/* Convert from raw elements on disk into native elements in memory */
- if((hdr->cparam.cls->decode)(p, dblock->elmts, *nelmts) < 0)
+ if((hdr->cparam.cls->decode)(p, dblock->elmts, *nelmts, hdr->cb_ctx) < 0)
H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
p += (*nelmts * hdr->cparam.raw_elmt_size);
} /* end if */
@@ -1440,7 +1440,7 @@ H5EA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Encode elements in data block */
/* Convert from native elements in memory into raw elements on disk */
- if((dblock->hdr->cparam.cls->encode)(p, dblock->elmts, dblock->nelmts) < 0)
+ if((dblock->hdr->cparam.cls->encode)(p, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0)
H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
p += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size);
} /* end if */
@@ -1655,7 +1655,7 @@ HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr);
/* Decode elements in data block page */
/* Convert from raw elements on disk into native elements in memory */
- if((hdr->cparam.cls->decode)(p, dblk_page->elmts, hdr->dblk_page_nelmts) < 0)
+ if((hdr->cparam.cls->decode)(p, dblk_page->elmts, hdr->dblk_page_nelmts, hdr->cb_ctx) < 0)
H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
p += (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size);
@@ -1750,7 +1750,7 @@ H5EA__cache_dblk_page_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t ad
/* Encode elements in data block page */
/* Convert from native elements in memory into raw elements on disk */
- if((dblk_page->hdr->cparam.cls->encode)(p, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts) < 0)
+ if((dblk_page->hdr->cparam.cls->encode)(p, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts, dblk_page->hdr->cb_ctx) < 0)
H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
p += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size);
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index afbd6bd..349dceb 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -140,6 +140,10 @@ H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls))
/* Set the class of the array */
hdr->cparam.cls = cls;
+ /* Create the callback context */
+ if(NULL == (hdr->cb_ctx = (*cls->crt_context)(f)))
+ H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context")
+
/* Set the return value */
ret_value = hdr;
@@ -686,6 +690,11 @@ H5EA__hdr_dest(H5EA_hdr_t *hdr))
HDassert(hdr);
HDassert(hdr->rc == 0);
+ /* Destroy the callback context */
+ if((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context")
+ hdr->cb_ctx = NULL;
+
/* Check for data block element buffer factory info to free */
if(hdr->elmt_fac.fac) {
unsigned u; /* Local index variable */
@@ -712,7 +721,7 @@ H5EA__hdr_dest(H5EA_hdr_t *hdr))
hdr->sblk_info = (H5EA_sblk_info_t *)H5FL_SEQ_FREE(H5EA_sblk_info_t, hdr->sblk_info);
/* Free the shared info itself */
- (void)H5FL_FREE(H5EA_hdr_t, hdr);
+ hdr = H5FL_FREE(H5EA_hdr_t, hdr);
CATCH
diff --git a/src/H5EApkg.h b/src/H5EApkg.h
index 51305c4..7ac5be6 100644
--- a/src/H5EApkg.h
+++ b/src/H5EApkg.h
@@ -464,7 +464,7 @@ typedef struct H5EA_hdr_t {
/* Information for H5AC cache functions, _must_ be first field in structure */
H5AC_info_t cache_info;
- /* Extensible array configuration/creation parameters (stored) */
+ /* Extensible array configuration/creation parameters (stored in header) */
H5EA_create_t cparam; /* Creation parameters for extensible array */
/* Index block information (stored in header) */
@@ -496,6 +496,9 @@ typedef struct H5EA_hdr_t {
/* Data block information (not stored) */
size_t dblk_page_nelmts; /* # of elements per data block page */
+
+ /* Client information (not stored) */
+ void *cb_ctx; /* Callback context */
} H5EA_hdr_t;
/* The extensible array index block information */
diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h
index a1f3221..3b9ba4d 100644
--- a/src/H5EAprivate.h
+++ b/src/H5EAprivate.h
@@ -62,9 +62,11 @@ typedef struct H5EA_class_t {
size_t nat_elmt_size; /* Size of native (memory) element */
/* Extensible array client callback methods */
+ void *(*crt_context)(const H5F_t *f); /* Create context for other callbacks */
+ herr_t (*dst_context)(void *ctx); /* Destroy context */
herr_t (*fill)(void *nat_blk, size_t nelmts); /* Fill array of elements with encoded form of "missing element" value */
- herr_t (*encode)(void *raw, const void *elmt, size_t nelmts); /* Encode elements from native form to disk storage form */
- herr_t (*decode)(const void *raw, void *elmt, size_t nelmts); /* Decode elements from disk storage form to native form */
+ herr_t (*encode)(void *raw, const void *elmt, size_t nelmts, void *ctx); /* Encode elements from native form to disk storage form */
+ herr_t (*decode)(const void *raw, void *elmt, size_t nelmts, void *ctx); /* Decode elements from disk storage form to native form */
herr_t (*debug)(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); /* Print an element for debugging */
} H5EA_class_t;
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index eea69ea..31dfb5f 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -39,6 +39,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5FLprivate.h" /* Free Lists */
#include "H5Vprivate.h" /* Vector functions */
@@ -46,11 +47,17 @@
/* Local Macros */
/****************/
+/* Sanity checking value for callback contexts */
+#define H5EA__TEST_BOGUS_VAL 42
/******************/
/* Local Typedefs */
/******************/
+/* Callback context */
+typedef struct H5EA__test_ctx_t {
+ uint32_t bogus; /* Placeholder field to verify that context is working */
+} H5EA__test_ctx_t;
/********************/
/* Package Typedefs */
@@ -62,9 +69,13 @@
/********************/
/* Extensible array class callbacks */
+static void *H5EA__test_crt_context(const H5F_t *f);
+static herr_t H5EA__test_dst_context(void *ctx);
static herr_t H5EA__test_fill(void *nat_blk, size_t nelmts);
-static herr_t H5EA__test_encode(void *raw, const void *elmt, size_t nelmts);
-static herr_t H5EA__test_decode(const void *raw, void *elmt, size_t nelmts);
+static herr_t H5EA__test_encode(void *raw, const void *elmt, size_t nelmts,
+ void *ctx);
+static herr_t H5EA__test_decode(const void *raw, void *elmt, size_t nelmts,
+ void *ctx);
static herr_t H5EA__test_debug(FILE *stream, int indent, int fwidth,
hsize_t idx, const void *elmt);
@@ -77,6 +88,8 @@ static herr_t H5EA__test_debug(FILE *stream, int indent, int fwidth,
const H5EA_class_t H5EA_CLS_TEST[1]={{
H5EA_CLS_TEST_ID, /* Type of Extensible array */
sizeof(uint64_t), /* Size of native element */
+ H5EA__test_crt_context, /* Create context */
+ H5EA__test_dst_context, /* Destroy context */
H5EA__test_fill, /* Fill block of missing elements callback */
H5EA__test_encode, /* Element encoding callback */
H5EA__test_decode, /* Element decoding callback */
@@ -93,6 +106,76 @@ const H5EA_class_t H5EA_CLS_TEST[1]={{
/* Local Variables */
/*******************/
+/* Declare a free list to manage the H5EA__test_ctx_t struct */
+H5FL_DEFINE_STATIC(H5EA__test_ctx_t);
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA__test_crt_context
+ *
+ * Purpose: Create context for callbacks
+ *
+ * Return: Success: non-NULL
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, January 27, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(STATIC, ERR,
+void *, NULL, NULL,
+H5EA__test_crt_context(const H5F_t UNUSED *f))
+
+ /* Local variables */
+ H5EA__test_ctx_t *ctx; /* Context for callbacks */
+
+ /* Sanity checks */
+ HDassert(f);
+
+ /* Allocate new context structure */
+ if(NULL == (ctx = H5FL_MALLOC(H5EA__test_ctx_t)))
+ H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context")
+
+ /* Initialize the context */
+ ctx->bogus = H5EA__TEST_BOGUS_VAL;
+
+ /* Set return value */
+ ret_value = ctx;
+
+CATCH
+
+END_FUNC(STATIC) /* end H5EA__test_crt_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA__test_dst_context
+ *
+ * Purpose: Destroy context for callbacks
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, January 27, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(STATIC, NOERR,
+herr_t, SUCCEED, -,
+H5EA__test_dst_context(void *_ctx))
+
+ /* Local variables */
+ H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
+
+ /* Sanity checks */
+ HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus);
+
+ /* Release context structure */
+ ctx = H5FL_FREE(H5EA__test_ctx_t, ctx);
+
+END_FUNC(STATIC) /* end H5EA__test_dst_context() */
/*-------------------------------------------------------------------------
@@ -139,15 +222,17 @@ END_FUNC(STATIC) /* end H5EA__test_fill() */
*/
BEGIN_FUNC(STATIC, NOERR,
herr_t, SUCCEED, -,
-H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts))
+H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx))
/* Local variables */
+ H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
/* Sanity checks */
HDassert(raw);
HDassert(elmt);
HDassert(nelmts);
+ HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus);
/* Encode native elements into raw elements */
while(nelmts) {
@@ -180,9 +265,10 @@ END_FUNC(STATIC) /* end H5EA__test_encode() */
*/
BEGIN_FUNC(STATIC, NOERR,
herr_t, SUCCEED, -,
-H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts))
+H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx))
/* Local variables */
+ H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
uint64_t *elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */
const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
@@ -190,6 +276,7 @@ H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts))
HDassert(raw);
HDassert(elmt);
HDassert(nelmts);
+ HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus);
/* Decode raw elements into native elements */
while(nelmts) {
diff --git a/src/H5F.c b/src/H5F.c
index 50e26d8..14efa63 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2326,7 +2326,7 @@ H5F_decr_nopen_objs(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_addr_encode
+ * Function: H5F_addr_encode_len
*
* Purpose: Encodes an address into the buffer pointed to by *PP and
* then increments the pointer to the first byte after the
@@ -2337,35 +2337,65 @@ H5F_decr_nopen_objs(H5F_t *f)
* Programmer: Robb Matzke
* Friday, November 7, 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
void
-H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
+H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr)
{
- unsigned i;
+ unsigned u; /* Local index variable */
+
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_encode_len)
- assert(f);
- assert(pp && *pp);
+ HDassert(addr_len);
+ HDassert(pp && *pp);
- if (H5F_addr_defined(addr)) {
- for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
+ if(H5F_addr_defined(addr)) {
+ for(u = 0; u < addr_len; u++) {
*(*pp)++ = (uint8_t)(addr & 0xff);
addr >>= 8;
- }
- assert("overflow" && 0 == addr);
-
- } else {
- for (i=0; i<H5F_SIZEOF_ADDR(f); i++)
+ } /* end for */
+ HDassert("overflow" && 0 == addr);
+ } /* end if */
+ else {
+ for(u = 0; u < addr_len; u++)
*(*pp)++ = 0xff;
- }
-}
+ } /* end else */
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5F_addr_encode_len() */
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode
+ * Function: H5F_addr_encode
+ *
+ * Purpose: Encodes an address into the buffer pointed to by *PP and
+ * then increments the pointer to the first byte after the
+ * address. An undefined value is stored as all 1's.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_encode)
+
+ HDassert(f);
+
+ H5F_addr_encode_len(H5F_SIZEOF_ADDR(f), pp, addr);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5F_addr_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_addr_decode_len
*
* Purpose: Decodes an address from the buffer pointed to by *PP and
* updates the pointer to point to the next byte after the
@@ -2379,40 +2409,88 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
* Programmer: Robb Matzke
* Friday, November 7, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
-H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/)
+H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/)
{
- unsigned i;
- haddr_t tmp;
- uint8_t c;
- hbool_t all_zero = TRUE;
+ hbool_t all_zero = TRUE; /* True if address was all zeroes */
+ unsigned u; /* Local index variable */
- assert(f);
- assert(pp && *pp);
- assert(addr_p);
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_decode_len)
+ HDassert(addr_len);
+ HDassert(pp && *pp);
+ HDassert(addr_p);
+
+ /* Reset value in destination */
*addr_p = 0;
- for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
+ /* Decode bytes from address */
+ for(u = 0; u < addr_len; u++) {
+ uint8_t c; /* Local decoded byte */
+
+ /* Get decoded byte (and advance pointer) */
c = *(*pp)++;
- if (c != 0xff)
+
+ /* Check for non-undefined address byte value */
+ if(c != 0xff)
all_zero = FALSE;
- if (i<sizeof(*addr_p)) {
- tmp = c;
- tmp <<= (i * 8); /*use tmp to get casting right */
+ if(u < sizeof(*addr_p)) {
+ haddr_t tmp = c; /* Local copy of address, for casting */
+
+ /* Shift decoded byte to correct position */
+ tmp <<= (u * 8); /*use tmp to get casting right */
+
+ /* Merge into already decoded bytes */
*addr_p |= tmp;
- } else if (!all_zero) {
- assert(0 == **pp); /*overflow */
- }
- }
- if (all_zero)
+ } /* end if */
+ else
+ if(!all_zero)
+ HDassert(0 == **pp); /*overflow */
+ } /* end for */
+
+ /* If 'all_zero' is still TRUE, the address was entirely composed of '0xff'
+ * bytes, which is the encoded form of 'HADDR_UNDEF', so set the destination
+ * to that value */
+ if(all_zero)
*addr_p = HADDR_UNDEF;
-}
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5F_addr_decode_len() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_addr_decode
+ *
+ * Purpose: Decodes an address from the buffer pointed to by *PP and
+ * updates the pointer to point to the next byte after the
+ * address.
+ *
+ * If the value read is all 1's then the address is returned
+ * with an undefined value.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_decode)
+
+ HDassert(f);
+
+ H5F_addr_decode_len(H5F_SIZEOF_ADDR(f), pp, addr_p);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5F_addr_decode() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index e717b99..cd6bcd0 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -508,8 +508,11 @@ H5_DLL herr_t H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr,
/* Address-related functions */
H5_DLL void H5F_addr_encode(const H5F_t *, uint8_t** /*in,out*/, haddr_t);
+H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t** /*in,out*/, haddr_t);
H5_DLL void H5F_addr_decode(const H5F_t *, const uint8_t** /*in,out*/,
- haddr_t* /*out*/);
+ haddr_t* /*out*/);
+H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t** /*in,out*/,
+ haddr_t* /*out*/);
/* File access property list callbacks */
H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data);
diff --git a/src/H5Torder.c b/src/H5Torder.c
index 34dbd8e..6c0667b 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -158,6 +158,8 @@ H5Tset_order(hid_t type_id, H5T_order_t order)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined")
while (dt->shared->parent)
dt = dt->shared->parent; /*defer to parent*/
+ if (order == H5T_ORDER_NONE && !(H5T_REFERENCE == dt->shared->type || H5T_IS_FIXED_STRING(dt->shared)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal byte order")
if (!H5T_IS_ATOMIC(dt->shared))
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype")