summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5B2int.c2
-rw-r--r--src/H5FD.c6
-rw-r--r--src/H5FDmpi.c4
-rw-r--r--src/H5FDpublic.h2
-rw-r--r--src/H5Fprivate.h44
-rw-r--r--src/H5Gcache.c2
-rw-r--r--src/H5HFdbg.c4
-rw-r--r--src/H5HFsection.c7
-rw-r--r--src/H5O.c20
-rw-r--r--src/H5Oainfo.c6
-rw-r--r--src/H5Oalloc.c88
-rw-r--r--src/H5Oattr.c6
-rw-r--r--src/H5Ocache.c10
-rw-r--r--src/H5Ocont.c4
-rw-r--r--src/H5Ocopy.c12
-rw-r--r--src/H5Odbg.c4
-rw-r--r--src/H5Odtype.c28
-rw-r--r--src/H5Oefl.c10
-rw-r--r--src/H5Ofill.c9
-rw-r--r--src/H5Ofsinfo.c6
-rw-r--r--src/H5Oginfo.c10
-rw-r--r--src/H5Olinfo.c10
-rw-r--r--src/H5Olink.c18
-rw-r--r--src/H5Omessage.c41
-rw-r--r--src/H5Opkg.h9
-rw-r--r--src/H5Opline.c4
-rw-r--r--src/H5Oshmesg.c8
-rw-r--r--src/H5Ostab.c2
-rw-r--r--src/H5Otest.c4
-rw-r--r--src/H5P.c56
-rw-r--r--src/H5Pdapl.c34
-rw-r--r--src/H5Pdcpl.c142
-rw-r--r--src/H5Pint.c384
-rw-r--r--src/H5Pocpl.c8
-rw-r--r--src/H5Ppkg.h6
-rw-r--r--src/H5Pstrcpl.c2
-rw-r--r--src/H5R.c10
-rw-r--r--src/H5SL.c8
-rw-r--r--src/H5Sall.c24
-rw-r--r--src/H5Shyper.c24
-rw-r--r--src/H5Snone.c6
-rw-r--r--src/H5Spoint.c6
-rw-r--r--src/H5T.c13
-rw-r--r--src/H5Tarray.c10
-rw-r--r--src/H5Tfields.c50
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--src/H5Ztrans.c12
47 files changed, 689 insertions, 488 deletions
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 4355174..8ea8426 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -140,7 +140,7 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
unsigned my_idx = 0; /* Final index value */
int cmp = -1; /* Key comparison value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
hi = nrec;
while(lo < hi && cmp) {
diff --git a/src/H5FD.c b/src/H5FD.c
index 8ff9d9a..7db584e 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -1350,7 +1350,7 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/)
{
int ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(f);
HDassert(flags);
@@ -1361,7 +1361,6 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/)
else
*flags=0;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_query() */
@@ -1387,7 +1386,7 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/)
{
int ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(driver);
HDassert(flags);
@@ -1398,7 +1397,6 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/)
else
*flags = 0;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_driver_query() */
diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c
index afc5536..01c28e6 100644
--- a/src/H5FDmpi.c
+++ b/src/H5FDmpi.c
@@ -479,11 +479,11 @@ H5FD_mpi_setup_collective(hid_t dxpl_id, MPI_Datatype *btype, MPI_Datatype *ftyp
/* Set buffer MPI type */
if(H5P_set(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, btype) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property")
/* Set File MPI type */
if(H5P_set(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, ftype) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index 5f70f71..ed50bc7 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -313,7 +313,7 @@ typedef enum {
H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE,
H5FD_FILE_IMAGE_OP_FILE_OPEN,
H5FD_FILE_IMAGE_OP_FILE_RESIZE,
- H5FD_FILE_IMAGE_OP_FILE_CLOSE,
+ H5FD_FILE_IMAGE_OP_FILE_CLOSE
} H5FD_file_image_op_t;
/* Define structure to hold file image callbacks */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 40e075b..7c6fae8 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -70,10 +70,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
*(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++; \
}
-/* Encode a 32-bit unsigned integer into a variable-sized buffer */
+/* Encode an unsigned integer into a variable-sized buffer */
/* (Assumes that the high bits of the integer are zero) */
-# define UINT32ENCODE_VAR(p, n, l) { \
- uint32_t _n = (n); \
+# define ENCODE_VAR(p, typ, n, l) { \
+ typ _n = (n); \
size_t _i; \
uint8_t *_p = (uint8_t*)(p); \
\
@@ -82,6 +82,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
(p) = (uint8_t*)(p) + l; \
}
+/* Encode a 32-bit unsigned integer into a variable-sized buffer */
+/* (Assumes that the high bits of the integer are zero) */
+# define UINT32ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint32_t, n, l)
+
# define INT64ENCODE(p, n) { \
int64_t _n = (n); \
size_t _i; \
@@ -108,15 +112,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
/* Encode a 64-bit unsigned integer into a variable-sized buffer */
/* (Assumes that the high bits of the integer are zero) */
-# define UINT64ENCODE_VAR(p, n, l) { \
- uint64_t _n = (n); \
- size_t _i; \
- uint8_t *_p = (uint8_t*)(p); \
- \
- for(_i = 0; _i < l; _i++, _n >>= 8) \
- *_p++ = (uint8_t)(_n & 0xff); \
- (p) = (uint8_t*)(p) + l; \
-}
+# define UINT64ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint64_t, n, l)
/* DECODE converts little endian bytes pointed by p to integer values and store
* it in i. For signed values, need to do sign-extension when converting
@@ -152,12 +148,9 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
(i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \
}
-/* Decode a variable-sized buffer into a 32-bit unsigned integer */
+/* Decode a variable-sized buffer */
/* (Assumes that the high bits of the integer will be zero) */
-/* (Note: this is exactly the same code as the 64-bit variable-length decoder
- * and bugs/improvements should be make in both places - QAK)
- */
-# define UINT32DECODE_VAR(p, n, l) { \
+# define DECODE_VAR(p, n, l) { \
size_t _i; \
\
n = 0; \
@@ -167,6 +160,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
(p) += l; \
}
+/* Decode a variable-sized buffer into a 32-bit unsigned integer */
+/* (Assumes that the high bits of the integer will be zero) */
+# define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l)
+
# define INT64DECODE(p, n) { \
/* WE DON'T CHECK FOR OVERFLOW! */ \
size_t _i; \
@@ -191,18 +188,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
/* Decode a variable-sized buffer into a 64-bit unsigned integer */
/* (Assumes that the high bits of the integer will be zero) */
-/* (Note: this is exactly the same code as the 32-bit variable-length decoder
- * and bugs/improvements should be make in both places - QAK)
- */
-# define UINT64DECODE_VAR(p, n, l) { \
- size_t _i; \
- \
- n = 0; \
- (p) += l; \
- for (_i = 0; _i < l; _i++) \
- n = (n << 8) | *(--p); \
- (p) += l; \
-}
+# define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, n, l)
/* Address-related macros */
#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \
diff --git a/src/H5Gcache.c b/src/H5Gcache.c
index 1d2ad8b..15dbf65 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -302,7 +302,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5G_node_dest(H5F_t *f, H5G_node_t *sym)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index caaedc7..76c7b96 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -80,7 +80,7 @@ typedef struct {
/* Local Prototypes */
/********************/
-static herr_t H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream,
+static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream,
int indent, int fwidth);
@@ -113,7 +113,7 @@ static herr_t H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream,
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth)
+H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index 87fa069..e9ea7e0 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -651,9 +651,7 @@ herr_t
H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, hid_t dxpl_id,
H5HF_free_section_t *sect, haddr_t *dblock_addr, size_t *dblock_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI_NOERR
/*
* Check arguments.
@@ -678,8 +676,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, hid_t dxpl_id,
*dblock_size = hdr->man_dtable.row_block_size[sect->u.single.par_entry / hdr->man_dtable.cparam.width];
} /* end else */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_sect_single_dblock_info() */
diff --git a/src/H5O.c b/src/H5O.c
index 5050941..a896ee0 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1717,7 +1717,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
while(curr_msg < cont_msg_info.nmsgs) {
H5O_chunk_proxy_t *chk_proxy; /* Proxy for chunk, to bring it into memory */
#ifndef NDEBUG
- unsigned chkcnt = oh->nchunks; /* Count of chunks (for sanity checking) */
+ size_t chkcnt = oh->nchunks; /* Count of chunks (for sanity checking) */
#endif /* NDEBUG */
/* Bring the chunk into the cache */
@@ -2007,15 +2007,15 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
/* Check version, to determine how to store time information */
if(oh->version == H5O_VERSION_1) {
- int idx; /* Index of modification time message to update */
+ size_t idx; /* Index of modification time message to update */
/* Look for existing message */
- for(idx = 0; idx < (int)oh->nmesgs; idx++)
+ for(idx = 0; idx < oh->nmesgs; idx++)
if(H5O_MSG_MTIME == oh->mesg[idx].type || H5O_MSG_MTIME_NEW == oh->mesg[idx].type)
break;
/* Create a new message, if necessary */
- if(idx == (int)oh->nmesgs) {
+ if(idx == oh->nmesgs) {
unsigned mesg_flags = 0; /* Flags for message in object header */
/* If we would have to create a new message, but we aren't 'forcing' it, get out now */
@@ -2023,7 +2023,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
HGOTO_DONE(SUCCEED); /*nothing to do*/
/* Allocate space for the modification time message */
- if((idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now)) < 0)
+ if(H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now, &idx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message")
/* Set the message's flags if appropriate */
@@ -2130,7 +2130,7 @@ done:
herr_t
H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags)
{
- int idx; /* Local index variable */
+ size_t idx; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2139,7 +2139,7 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags)
HDassert(oh);
/* Look for existing message */
- for(idx = 0; idx < (int)oh->nmesgs; idx++)
+ for(idx = 0; idx < oh->nmesgs; idx++)
if(H5O_MSG_BOGUS == oh->mesg[idx].type)
break;
@@ -2155,7 +2155,7 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags)
bogus->u = H5O_BOGUS_VALUE;
/* Allocate space in the object header for bogus message */
- if((idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_BOGUS, &mesg_flags, bogus)) < 0)
+ if(H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_BOGUS, &mesg_flags, bogus, &idx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
/* Point to "bogus" information (take it over) */
@@ -2715,8 +2715,8 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
hdr->version = oh->version;
/* Set the number of messages & chunks */
- hdr->nmesgs = oh->nmesgs;
- hdr->nchunks = oh->nchunks;
+ H5_ASSIGN_OVERFLOW(hdr->nmesgs, oh->nmesgs, size_t, unsigned);
+ H5_ASSIGN_OVERFLOW(hdr->nchunks, oh->nchunks, size_t, unsigned);
/* Set the status flags */
hdr->flags = oh->flags;
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index ad99be0..654163b 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -196,7 +196,7 @@ H5O_ainfo_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void
/* The flags for the attribute indices */
flags = ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0;
- flags |= ainfo->index_corder ? H5O_AINFO_INDEX_CORDER : 0;
+ flags = (unsigned char)(flags | (ainfo->index_corder ? H5O_AINFO_INDEX_CORDER : 0));
*p++ = flags;
/* Max. creation order value for the object */
@@ -284,12 +284,12 @@ H5O_ainfo_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Set return value */
- ret_value = 1 /* Version */
+ ret_value = (size_t)(1 /* Version */
+ 1 /* Index flags */
+ (ainfo->track_corder ? 2 : 0) /* Curr. max. creation order value */
+ H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" attributes */
+ H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of attributes */
- + (ainfo->index_corder ? H5F_SIZEOF_ADDR(f) : 0); /* Address of v2 B-tree for indexing creation order values of attributes */
+ + (ainfo->index_corder ? H5F_SIZEOF_ADDR(f) : 0)); /* Address of v2 B-tree for indexing creation order values of attributes */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_ainfo_size() */
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 05322af..5c00fb2 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -59,14 +59,15 @@
/********************/
static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno,
- hbool_t *chk_dirtied, unsigned idx, uint8_t *new_gap_loc, size_t new_gap_size);
+ hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size);
static herr_t H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied,
H5O_mesg_t *mesg, uint8_t *new_gap_loc, size_t new_gap_size);
-static herr_t H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned null_idx,
+static herr_t H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t null_idx,
const H5O_msg_class_t *new_type, void *new_native, size_t new_size);
static htri_t H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- unsigned chunkno, size_t size, int *msg_idx);
-static int H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size);
+ unsigned chunkno, size_t size, size_t *msg_idx);
+static herr_t H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size,
+ size_t *new_idx);
static htri_t H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u);
static htri_t H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh);
static htri_t H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh);
@@ -109,10 +110,10 @@ H5FL_EXTERN(H5O_cont_t);
*/
static herr_t
H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied,
- unsigned idx, uint8_t *new_gap_loc, size_t new_gap_size)
+ size_t idx, uint8_t *new_gap_loc, size_t new_gap_size)
{
hbool_t merged_with_null; /* Whether the gap was merged with a null message */
- unsigned u; /* Local index variable */
+ size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -335,7 +336,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned null_idx,
+H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t null_idx,
const H5O_msg_class_t *new_type, void *new_native, size_t new_size)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
@@ -505,7 +506,7 @@ done:
*/
static htri_t
H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
- size_t size, int *msg_idx)
+ size_t size, size_t *msg_idx)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
@@ -514,11 +515,12 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
uint8_t *old_image; /* Old address of chunk's image in memory */
size_t old_size; /* Old size of chunk */
htri_t extended; /* If chunk can be extended */
- int extend_msg = -1;/* Index of null message to extend */
+ size_t extend_msg; /* Index of null message to extend */
+ hbool_t extended_msg = FALSE; /* Whether an existing message was extended */
uint8_t new_size_flags = 0; /* New chunk #0 size flags */
hbool_t adjust_size_flags = FALSE; /* Whether to adjust the chunk #0 size flags */
size_t extra_prfx_size = 0; /* Extra bytes added to object header prefix */
- unsigned u; /* Local index variable */
+ size_t u; /* Local index variable */
htri_t ret_value = TRUE; /* return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -542,13 +544,14 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
== ((oh->chunk[chunkno].image + oh->chunk[chunkno].size) -
(oh->chunk[chunkno].gap + H5O_SIZEOF_CHKSUM_OH(oh))))) {
- extend_msg = (int)u;
+ extend_msg = u;
+ extended_msg = TRUE;
break;
} /* end if */
} /* end for */
/* If we can extend an existing null message, adjust the delta appropriately */
- if(extend_msg >= 0) {
+ if(extended_msg) {
HDassert(oh->chunk[chunkno].gap == 0);
delta = aligned_size - oh->mesg[extend_msg].raw_size;
} /* end if */
@@ -598,7 +601,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
/* Adjust object header prefix flags */
if(adjust_size_flags) {
- oh->flags &= (uint8_t)~H5O_HDR_CHUNK0_SIZE;
+ oh->flags = (uint8_t)(oh->flags & ~H5O_HDR_CHUNK0_SIZE);
oh->flags |= new_size_flags;
/* Mark object header as dirty in cache */
@@ -607,7 +610,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
} /* end if */
/* If we can extend an existing null message, take care of that */
- if(extend_msg >= 0) {
+ if(extended_msg) {
/* Adjust message size of existing null message */
oh->mesg[extend_msg].raw_size += delta;
} /* end if */
@@ -619,7 +622,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
/* Set extension message */
- extend_msg = (int)oh->nmesgs++;
+ extend_msg = oh->nmesgs++;
/* Initialize new null message */
oh->mesg[extend_msg].type = H5O_MSG_NULL;
@@ -690,7 +693,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
if(H5O_chunk_resize(oh, chk_proxy) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk")
- /* Set return value */
+ /* Set new message index */
*msg_idx = extend_msg;
done:
@@ -737,8 +740,8 @@ done:
*
*-------------------------------------------------------------------------
*/
-static int
-H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
+static herr_t
+H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new_idx)
{
/* Struct for storing information about "best" messages to allocate from */
typedef struct {
@@ -756,13 +759,13 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
int found_null = (-1); /* Best fit null message */
alloc_info found_attr = {-1, 0, 0, 0, 0}; /* Best fit attribute message */
alloc_info found_other = {-1, 0, 0, 0, 0}; /* Best fit other message */
- unsigned idx; /*message number */
+ size_t idx; /* Message number */
uint8_t *p = NULL; /*ptr into new chunk */
H5O_cont_t *cont = NULL; /*native continuation message */
unsigned chunkno; /* Chunk allocated */
haddr_t new_chunk_addr;
unsigned u; /* Local index variable */
- int ret_value; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1089,11 +1092,11 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
cont->chunkno = chunkno;
/* Split the null message and point at continuation message */
- if(H5O_alloc_null(f, dxpl_id, oh, (unsigned)found_null, H5O_MSG_CONT, cont, cont_size) < 0)
+ if(H5O_alloc_null(f, dxpl_id, oh, (size_t)found_null, H5O_MSG_CONT, cont, cont_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message")
- /* Set return value */
- ret_value = (int)idx;
+ /* Set new message index value */
+ *new_idx = idx;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1114,14 +1117,14 @@ done:
*
*-------------------------------------------------------------------------
*/
-int
+herr_t
H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
- const void *mesg)
+ const void *mesg, size_t *mesg_idx)
{
- size_t raw_size; /* Raw size of message */
- size_t aligned_size; /* Size of message including alignment */
- int idx; /* Index of message which fits allocation */
- int ret_value; /* Return value */
+ size_t raw_size; /* Raw size of message */
+ size_t aligned_size; /* Size of message including alignment */
+ size_t idx; /* Index of message which fits allocation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1129,6 +1132,7 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
HDassert(oh);
HDassert(type);
HDassert(mesg);
+ HDassert(mesg_idx);
/* Compute the size needed to store the message in the object header */
raw_size = (type->raw_size)(f, FALSE, mesg);
@@ -1139,12 +1143,12 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
aligned_size = H5O_ALIGN_OH(oh, raw_size);
/* look for a null message which is large enough */
- for(idx = 0; idx < (int)oh->nmesgs; idx++)
+ for(idx = 0; idx < oh->nmesgs; idx++)
if(H5O_NULL_ID == oh->mesg[idx].type->id && oh->mesg[idx].raw_size >= aligned_size)
break;
/* if we didn't find one, then allocate more header space */
- if(idx >= (int)oh->nmesgs) {
+ if(idx >= oh->nmesgs) {
unsigned chunkno;
/* check to see if we can extend one of the chunks. If we can,
@@ -1163,22 +1167,22 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
} /* end for */
/* If we were not able to extend a chunk, create a new one */
- if(idx >= (int)oh->nmesgs)
- if((idx = H5O_alloc_new_chunk(f, dxpl_id, oh, raw_size)) < 0)
+ if(idx >= oh->nmesgs)
+ if(H5O_alloc_new_chunk(f, dxpl_id, oh, raw_size, &idx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create a new object header data chunk")
} /* end if */
- HDassert(idx >= 0 && idx < (int)oh->nmesgs);
+ HDassert(idx < oh->nmesgs);
/* Split the null message and point at continuation message */
- if(H5O_alloc_null(f, dxpl_id, oh, (unsigned)idx, type, NULL, aligned_size) < 0)
+ if(H5O_alloc_null(f, dxpl_id, oh, idx, type, NULL, aligned_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message")
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
- /* Set return value */
- ret_value = (int)idx;
+ /* Set message index value */
+ *mesg_idx = idx;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1296,7 +1300,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
size_t nonnull_size; /* Total size of nonnull messages in the chunk pointed to by cont message */
H5O_mesg_t *curr_msg; /* Pointer to the current message to operate on */
size_t gap_size; /* Size of gap produced */
- unsigned v; /* Local index variable */
+ size_t v; /* Local index variable */
/* Spin through messages */
nonnull_size = 0;
@@ -1533,7 +1537,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
} /* end if */
else {
H5O_mesg_t *null_msg; /* Pointer to current message to operate on */
- unsigned v; /* Local index variable */
+ size_t v; /* Local index variable */
/* Check if messages in chunk pointed to can replace continuation message */
if(H5O_CONT_ID == curr_msg->type->id) {
@@ -1607,7 +1611,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
null_chk_dirtied = FALSE;
} /* end if */
else {
- unsigned new_null_msg; /* Message index for new null message */
+ size_t new_null_msg; /* Message index for new null message */
/* Check if null message is large enough to still exist */
if((null_msg->raw_size - curr_msg->raw_size) < (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) {
@@ -2135,8 +2139,8 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno)
uint8_t new_size_flags = 0; /* New chunk #0 size flags */
hbool_t adjust_size_flags = FALSE; /* Whether to adjust the chunk #0 size flags */
size_t less_prfx_size = 0; /* Bytes removed from object header prefix */
+ size_t u; /* Index */
herr_t ret_value = SUCCEED; /* Return value */
- unsigned u; /* Index */
FUNC_ENTER_NOAPI_NOINIT
@@ -2237,7 +2241,7 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno)
if(adjust_size_flags) {
/* Adjust object header prefix flags */
- oh->flags &= (uint8_t)~H5O_HDR_CHUNK0_SIZE;
+ oh->flags = (uint8_t)(oh->flags & ~H5O_HDR_CHUNK0_SIZE);
oh->flags |= new_size_flags;
/* Slide chunk 0 data down */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 510d64f..b8e6b32 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -300,7 +300,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
if(attr->shared->version >= H5O_ATTR_VERSION_2) {
flags = (is_type_shared ? H5O_ATTR_FLAG_TYPE_SHARED : 0 );
flags |= (is_space_shared ? H5O_ATTR_FLAG_SPACE_SHARED : 0);
- *p++ = flags; /* Set flags for attribute */
+ *p++ = (uint8_t)flags; /* Set flags for attribute */
} /* end if */
else
*p++ = 0; /* Reserved, for version <2 */
@@ -723,7 +723,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/)
{
const H5A_t *attr = (const H5A_t *)_mesg;
@@ -753,7 +753,7 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/)
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx)
{
H5A_t *attr = (H5A_t *)_mesg;
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 2c33ebe..f09f693 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -658,7 +658,7 @@ H5O_size(const H5F_t UNUSED *f, const H5O_t *oh, size_t *size_ptr)
/* Report the object header's prefix+first chunk length */
if(oh->chunk0_size)
- *size_ptr = H5O_SIZEOF_HDR(oh) + oh->chunk0_size;
+ *size_ptr = (size_t)H5O_SIZEOF_HDR(oh) + oh->chunk0_size;
else
*size_ptr = oh->chunk[0].size;
@@ -983,7 +983,7 @@ H5O_cache_chk_size(const H5F_t UNUSED *f, const H5O_chunk_proxy_t *chk_proxy, si
static herr_t
H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont)
{
- unsigned contno; /* Continuation message index */
+ size_t contno; /* Continuation message index */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1034,7 +1034,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
{
const uint8_t *p; /* Pointer into buffer to decode */
uint8_t *eom_ptr; /* Pointer to end of messages for a chunk */
- unsigned curmesg; /* Current message being decoded in object header */
+ size_t curmesg; /* Current message being decoded in object header */
unsigned merged_null_msgs = 0; /* Number of null messages merged together */
unsigned chunkno; /* Current chunk's index */
#ifndef NDEBUG
@@ -1104,7 +1104,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
nullcnt = 0;
#endif /* NDEBUG */
while(p < eom_ptr) {
- unsigned mesgno; /* Current message to operate on */
+ size_t mesgno; /* Current message to operate on */
size_t mesg_size; /* Size of message read in */
unsigned id; /* ID (type) of current message */
uint8_t flags; /* Flags for current message */
@@ -1166,7 +1166,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
/* Combine adjacent null messages */
mesgno = oh->nmesgs - 1;
- oh->mesg[mesgno].raw_size += H5O_SIZEOF_MSGHDR_OH(oh) + mesg_size;
+ oh->mesg[mesgno].raw_size += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + mesg_size;
oh->mesg[mesgno].dirty = TRUE;
merged_null_msgs++;
udata->merged_null_msgs++;
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index b609bfd..647532b 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -179,8 +179,8 @@ H5O_cont_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void UNUSED *
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Set return value */
- ret_value = H5F_SIZEOF_ADDR(f) + /* Continuation header address */
- H5F_SIZEOF_SIZE(f); /* Continuation header length */
+ ret_value = (size_t)(H5F_SIZEOF_ADDR(f) + /* Continuation header address */
+ H5F_SIZEOF_SIZE(f)); /* Continuation header length */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_cont_size() */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index b22eeb0..1d1aa90 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -342,7 +342,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
void *cpy_udata = NULL; /* User data for passing to message callbacks */
uint64_t dst_oh_size; /* Total size of the destination OH */
size_t dst_oh_null; /* Size of the null message to add to destination OH */
- unsigned dst_oh_gap; /* Size of the gap in chunk #0 of destination OH */
+ size_t dst_oh_gap; /* Size of the gap in chunk #0 of destination OH */
uint8_t *current_pos; /* Current position in destination image */
size_t msghdr_size;
herr_t ret_value = SUCCEED;
@@ -629,14 +629,14 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Compute space for messages. */
dst_oh_size = 0;
for(mesgno = 0; mesgno < oh_dst->nmesgs; mesgno++) {
- dst_oh_size += H5O_SIZEOF_MSGHDR_OH(oh_dst);
+ dst_oh_size += (uint64_t)H5O_SIZEOF_MSGHDR_OH(oh_dst);
dst_oh_size += oh_dst->mesg[mesgno].raw_size;
} /* end for */
/* Check if we need to determine correct value for chunk #0 size bits */
if(oh_dst->version > H5O_VERSION_1) {
/* Reset destination object header's "chunk 0 size" flags */
- oh_dst->flags &= ~H5O_HDR_CHUNK0_SIZE;
+ oh_dst->flags = (uint8_t)(oh_dst->flags & ~H5O_HDR_CHUNK0_SIZE);
/* Determine correct value for chunk #0 size bits */
if(dst_oh_size > 4294967295)
@@ -745,7 +745,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Check if we need to add a NULL message to this header */
if(dst_oh_null > 0) {
- unsigned null_idx; /* Index of new NULL message */
+ size_t null_idx; /* Index of new NULL message */
/* Make sure we have enough space for new NULL message */
if(oh_dst->nmesgs + 1 > oh_dst->alloc_nmesgs)
@@ -1413,7 +1413,7 @@ H5O_copy_free_comm_dt_cb(void *item, void *_key, void UNUSED *op_data)
haddr_t *addr = (haddr_t *)item;
H5O_copy_search_comm_dt_key_t *key = (H5O_copy_search_comm_dt_key_t *)_key;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(addr);
HDassert(key);
@@ -1449,7 +1449,7 @@ H5O_copy_comm_dt_cmp(const void *_key1, const void *_key2)
const H5O_copy_search_comm_dt_key_t *key2 = (const H5O_copy_search_comm_dt_key_t *)_key2;
int ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check fileno. It is unlikely to be different so check if they are equal
* first so only one comparison needs to be made. */
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 5c07b64..5901c61 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -398,7 +398,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
if(0 == i) {
if(H5F_addr_ne(oh->chunk[i].addr, addr))
HDfprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n");
- chunk_size = oh->chunk[i].size - H5O_SIZEOF_HDR(oh);
+ chunk_size = oh->chunk[i].size - (size_t)H5O_SIZEOF_HDR(oh);
} /* end if */
else
chunk_size = oh->chunk[i].size;
@@ -424,7 +424,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
unsigned chunkno; /* Chunk for message */
/* Accumulate message's size to total */
- mesg_total += H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size;
+ mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size;
/* For version 2 object header, add size of "OCHK" for continuation chunk */
if (oh->mesg[i].type->id == H5O_CONT_ID)
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 6158fd9..b482115 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -626,6 +626,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
case H5T_ORDER_ERROR:
case H5T_ORDER_VAX:
+ case H5T_ORDER_MIXED:
case H5T_ORDER_NONE:
default:
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet")
@@ -696,6 +697,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
HDassert(dt->shared->version >= H5O_DTYPE_VERSION_3);
break;
+ case H5T_ORDER_MIXED:
case H5T_ORDER_ERROR:
case H5T_ORDER_NONE:
default:
@@ -764,7 +766,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "normalization scheme is not supported in file format yet")
} /* end switch */
- flags |= (dt->shared->u.atomic.u.f.sign << 8) & 0xff00;
+ flags = (unsigned)(flags | ((dt->shared->u.atomic.u.f.sign << 8) & 0xff00));
UINT16ENCODE(*pp, dt->shared->u.atomic.offset);
UINT16ENCODE(*pp, dt->shared->u.atomic.prec);
HDassert(dt->shared->u.atomic.u.f.epos <= 255);
@@ -787,8 +789,9 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
flags |= 0x01;
break;
- case H5T_ORDER_ERROR:
case H5T_ORDER_VAX:
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_ERROR:
case H5T_ORDER_NONE:
default:
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet")
@@ -806,8 +809,8 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
HDassert(dt->shared->u.atomic.lsb_pad == H5T_PAD_ZERO);
HDassert(dt->shared->u.atomic.msb_pad == H5T_PAD_ZERO);
- flags |= (dt->shared->u.atomic.u.s.pad & 0x0f);
- flags |= (dt->shared->u.atomic.u.s.cset & 0x0f) << 4;
+ flags = (unsigned)(flags | (dt->shared->u.atomic.u.s.pad & 0x0f));
+ flags = (unsigned)(flags | ((((unsigned)dt->shared->u.atomic.u.s.cset) & 0x0f) << 4));
break;
case H5T_BITFIELD:
@@ -822,8 +825,9 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
flags |= 0x01;
break;
- case H5T_ORDER_ERROR:
case H5T_ORDER_VAX:
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_ERROR:
case H5T_ORDER_NONE:
default:
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet")
@@ -874,7 +878,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
z = HDstrlen(dt->shared->u.opaque.tag);
aligned = (z + 7) & (H5T_OPAQUE_TAG_MAX - 8);
- flags |= aligned;
+ flags = (unsigned)(flags | aligned);
HDmemcpy(*pp, dt->shared->u.opaque.tag, MIN(z,aligned));
for(n = MIN(z, aligned); n < aligned; n++)
(*pp)[n] = 0;
@@ -918,7 +922,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
/* Member offset */
/* (starting with version 3 of the datatype message, use the minimum # of bytes required) */
if(dt->shared->version >= H5O_DTYPE_VERSION_3)
- UINT32ENCODE_VAR(*pp, dt->shared->u.compnd.memb[i].offset, offset_nbytes)
+ UINT32ENCODE_VAR(*pp, (uint32_t)dt->shared->u.compnd.memb[i].offset, offset_nbytes)
else
UINT32ENCODE(*pp, dt->shared->u.compnd.memb[i].offset)
@@ -1000,8 +1004,8 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
flags |= (dt->shared->u.vlen.type & 0x0f);
if(dt->shared->u.vlen.type == H5T_VLEN_STRING) {
- flags |= (dt->shared->u.vlen.pad & 0x0f) << 4;
- flags |= ((unsigned)dt->shared->u.vlen.cset & 0x0f) << 8;
+ flags = (unsigned)(flags | (((unsigned)dt->shared->u.vlen.pad & 0x0f) << 4));
+ flags = (unsigned)(flags | (((unsigned)dt->shared->u.vlen.cset & 0x0f) << 8));
} /* end if */
/* Encode base type of VL information */
@@ -1599,7 +1603,7 @@ H5O_dtype_shared_post_copy_upd(const H5O_loc_t UNUSED *src_oloc,
{
H5T_t *dt_dst = (H5T_t *)mesg_dst; /* Destination datatype */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
if(dt_dst->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) {
HDassert(H5T_committed(dt_dst));
@@ -1977,6 +1981,10 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
s = "none";
break;
+ case H5T_ORDER_MIXED:
+ s = "mixed";
+ break;
+
case H5T_ORDER_ERROR:
default:
sprintf(buf, "H5T_ORDER_%d", dt->shared->u.atomic.order);
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 3630cf4..db9066e 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -230,7 +230,7 @@ H5O_efl_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *
*/
HDassert(mesg->slot[u].name_offset);
H5F_ENCODE_LENGTH(f, p, mesg->slot[u].name_offset);
- H5F_ENCODE_LENGTH(f, p, mesg->slot[u].offset);
+ H5F_ENCODE_LENGTH(f, p, (hsize_t)mesg->slot[u].offset);
H5F_ENCODE_LENGTH(f, p, mesg->slot[u].size);
} /* end for */
@@ -351,13 +351,13 @@ H5O_efl_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg)
HDassert(f);
HDassert(mesg);
- ret_value = H5F_SIZEOF_ADDR(f) + /*heap address */
+ ret_value = (size_t)H5F_SIZEOF_ADDR(f) + /*heap address */
2 + /*slots allocated*/
2 + /*num slots used*/
4 + /*reserved */
- mesg->nused * (H5F_SIZEOF_SIZE(f) + /*name offset */
- H5F_SIZEOF_SIZE(f) + /*file offset */
- H5F_SIZEOF_SIZE(f)); /*file size */
+ mesg->nused * ((size_t)H5F_SIZEOF_SIZE(f) + /*name offset */
+ (size_t)H5F_SIZEOF_SIZE(f) + /*file offset */
+ (size_t)H5F_SIZEOF_SIZE(f)); /*file size */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_efl_size() */
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index f5569dc..1e8ccb1 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -397,11 +397,11 @@ H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_fill)
/* Encode space allocation time */
HDassert(fill->alloc_time == (H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time));
- flags |= (H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time) << H5O_FILL_SHIFT_ALLOC_TIME;
+ flags = (uint8_t)(flags | ((H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time) << H5O_FILL_SHIFT_ALLOC_TIME));
/* Encode fill value writing time */
HDassert(fill->fill_time == (H5O_FILL_MASK_FILL_TIME & fill->fill_time));
- flags |= (H5O_FILL_MASK_FILL_TIME & fill->fill_time) << H5O_FILL_SHIFT_FILL_TIME;
+ flags = (uint8_t)(flags | ((H5O_FILL_MASK_FILL_TIME & fill->fill_time) << H5O_FILL_SHIFT_FILL_TIME));
/* Check if we need to encode a fill value size */
if(fill->size < 0) {
@@ -833,10 +833,11 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_fill, FILE *s
fprintf(stream,"Incremental\n");
break;
+ case H5D_ALLOC_TIME_DEFAULT:
+ case H5D_ALLOC_TIME_ERROR:
default:
fprintf(stream,"Unknown!\n");
break;
-
} /* end switch */
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Time:");
switch(fill->fill_time) {
@@ -852,6 +853,7 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_fill, FILE *s
fprintf(stream,"If Set\n");
break;
+ case H5D_FILL_TIME_ERROR:
default:
fprintf(stream,"Unknown!\n");
break;
@@ -872,6 +874,7 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_fill, FILE *s
fprintf(stream,"User Defined\n");
break;
+ case H5D_FILL_VALUE_ERROR:
default:
fprintf(stream,"Unknown!\n");
break;
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index 3f0b15d..11bf43b 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -105,7 +105,7 @@ H5O_fsinfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- fsinfo->strategy = *p++; /* file space strategy */
+ fsinfo->strategy = (H5F_file_space_type_t)*p++; /* file space strategy */
H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* free space section size threshold */
/* Addresses of free space managers: only exist for H5F_FILE_SPACE_ALL_PERSIST */
@@ -231,10 +231,10 @@ H5O_fsinfo_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg
/* Addresses of free-space managers exist only for H5F_FILE_SPACE_ALL_PERSIST type */
if(H5F_FILE_SPACE_ALL_PERSIST == fsinfo->strategy)
- fs_addr_size = (H5FD_MEM_NTYPES - 1) * H5F_SIZEOF_ADDR(f);
+ fs_addr_size = (H5FD_MEM_NTYPES - 1) * (size_t)H5F_SIZEOF_ADDR(f);
ret_value = 2 /* Version & strategy */
- + H5F_SIZEOF_SIZE(f) /* Threshold */
+ + (size_t)H5F_SIZEOF_SIZE(f) /* Threshold */
+ fs_addr_size; /* Addresses of free-space managers */
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index 418b053..d579984 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -184,7 +184,7 @@ H5O_ginfo_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, con
/* The flags for the group info */
flags = ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0;
- flags |= ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0;
+ flags = (unsigned char)(flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0));
*p++ = flags;
/* Store the max. # of links to store compactly & the min. # of links to store densely */
@@ -273,12 +273,12 @@ H5O_ginfo_size(const H5F_t UNUSED *f, hbool_t UNUSED disable_shared, const void
ret_value = 1 + /* Version */
1 + /* Flags */
(ginfo->store_link_phase_change ? (
- 2 + /* "Max compact" links */
- 2 /* "Min dense" links */
+ (size_t)(2 + /* "Max compact" links */
+ 2) /* "Min dense" links */
) : 0) + /* "Min dense" links */
(ginfo->store_est_entry_info ? (
- 2 + /* Estimated # of entries in group */
- 2 /* Estimated length of name of entry in group */
+ (size_t)(2 + /* Estimated # of entries in group */
+ 2) /* Estimated length of name of entry in group */
) : 0);
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index 5c0ed53..5d3d75c 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -206,7 +206,7 @@ H5O_linfo_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void
/* The flags for the link indices */
index_flags = linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0;
- index_flags |= linfo->index_corder ? H5O_LINFO_INDEX_CORDER : 0;
+ index_flags = (uint8_t)(index_flags | (linfo->index_corder ? H5O_LINFO_INDEX_CORDER : 0));
*p++ = index_flags;
/* Max. link creation order value for the group, if tracked */
@@ -296,10 +296,10 @@ H5O_linfo_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg)
/* Set return value */
ret_value = 1 /* Version */
+ 1 /* Index flags */
- + (linfo->track_corder ? 8 : 0) /* Curr. max. creation order value */
- + H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" links */
- + H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of links */
- + (linfo->index_corder ? H5F_SIZEOF_ADDR(f) : 0); /* Address of v2 B-tree for indexing creation order values of links */
+ + (linfo->track_corder ? (size_t)8 : 0) /* Curr. max. creation order value */
+ + (size_t)H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" links */
+ + (size_t)H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of links */
+ + (linfo->index_corder ? (size_t)H5F_SIZEOF_ADDR(f) : 0); /* Address of v2 B-tree for indexing creation order values of links */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_linfo_size() */
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 88c9e28..4dda5fe 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -226,6 +226,9 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
break;
/* User-defined links */
+ case H5L_TYPE_EXTERNAL:
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
default:
if(lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown link type")
@@ -306,9 +309,9 @@ H5O_link_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void
link_flags = H5O_LINK_NAME_2;
else
link_flags = H5O_LINK_NAME_1;
- link_flags |= lnk->corder_valid ? H5O_LINK_STORE_CORDER : 0;
- link_flags |= (lnk->type != H5L_TYPE_HARD) ? H5O_LINK_STORE_LINK_TYPE : 0;
- link_flags |= (lnk->cset != H5T_CSET_ASCII) ? H5O_LINK_STORE_NAME_CSET : 0;
+ link_flags = (unsigned char)(link_flags | (lnk->corder_valid ? H5O_LINK_STORE_CORDER : 0));
+ link_flags = (unsigned char)(link_flags | ((lnk->type != H5L_TYPE_HARD) ? H5O_LINK_STORE_LINK_TYPE : 0));
+ link_flags = (unsigned char)(link_flags | ((lnk->cset != H5T_CSET_ASCII) ? H5O_LINK_STORE_NAME_CSET : 0));
*p++ = link_flags;
/* Store the type of a non-default link */
@@ -366,6 +369,9 @@ H5O_link_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void
break;
/* User-defined links */
+ case H5L_TYPE_EXTERNAL:
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
default:
HDassert(lnk->type >= H5L_TYPE_UD_MIN && lnk->type <= H5L_TYPE_MAX);
@@ -511,6 +517,9 @@ H5O_link_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg)
HDstrlen(lnk->u.soft.name); /* Link value */
break;
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_EXTERNAL:
+ case H5L_TYPE_MAX:
default: /* Default is user-defined link type */
HDassert(lnk->type >= H5L_TYPE_UD_MIN);
ret_value += 2 + /* User-defined data size */
@@ -837,6 +846,9 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
"Link Value:", lnk->u.soft.name);
break;
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_EXTERNAL:
+ case H5L_TYPE_MAX:
default:
if(lnk->type >= H5L_TYPE_UD_MIN) {
if(lnk->type == H5L_TYPE_EXTERNAL) {
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index c9a0997..1369583 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -76,7 +76,7 @@ typedef struct {
static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native);
static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned *oh_modified, void *_udata/*in,out*/);
-static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
+static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx,
const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags,
unsigned update_flags);
@@ -207,7 +207,7 @@ herr_t
H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
unsigned mesg_flags, unsigned update_flags, void *mesg)
{
- int idx; /* Index of message to modify */
+ size_t idx; /* Index of message to modify */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -220,11 +220,11 @@ H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *t
HDassert(mesg);
/* Allocate space for a new message */
- if((idx = H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, mesg)) < 0)
+ if(H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, mesg, &idx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create new message")
/* Copy the information for the message */
- if(H5O_copy_mesg(f, dxpl_id, oh, (unsigned)idx, type, mesg, mesg_flags, update_flags) < 0)
+ if(H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message")
#ifdef H5O_DEBUG
H5O_assert(oh);
@@ -364,7 +364,7 @@ H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *ty
unsigned mesg_flags, unsigned update_flags, void *mesg)
{
H5O_mesg_t *idx_msg; /* Pointer to message to modify */
- unsigned idx; /* Index of message to modify */
+ size_t idx; /* Index of message to modify */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -788,6 +788,7 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
{
H5O_t *oh = NULL; /* Object header to operate on */
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ unsigned msg_count; /* Message count */
int ret_value; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -805,7 +806,8 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Count the messages of the correct type */
- ret_value = H5O_msg_count_real(oh, type);
+ msg_count = H5O_msg_count_real(oh, type);
+ H5_ASSIGN_OVERFLOW(ret_value, msg_count, unsigned, int);
done:
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
@@ -1431,10 +1433,10 @@ H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id,
ret_value += extra_raw;
/* Adjust size for alignment, if necessary */
- ret_value = H5O_ALIGN_F(f, ret_value);
+ ret_value = (size_t)H5O_ALIGN_F(f, ret_value);
/* Add space for message header */
- ret_value += H5O_SIZEOF_MSGHDR_F(f,
+ ret_value += (size_t)H5O_SIZEOF_MSGHDR_F(f,
(H5F_STORE_MSG_CRT_IDX(f) || oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED));
done:
@@ -1484,10 +1486,10 @@ H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id,
ret_value += extra_raw;
/* Adjust size for alignment, if necessary */
- ret_value = H5O_ALIGN_OH(oh, ret_value);
+ ret_value = (size_t)H5O_ALIGN_OH(oh, ret_value);
/* Add space for message header */
- ret_value += H5O_SIZEOF_MSGHDR_OH(oh);
+ ret_value += (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1894,12 +1896,13 @@ done:
*
*-------------------------------------------------------------------------
*/
-int
+herr_t
H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
- unsigned *mesg_flags, void *native)
+ unsigned *mesg_flags, void *native, size_t *mesg_idx)
{
+ size_t new_idx; /* New index for message */
htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
- int ret_value = FAIL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1910,6 +1913,7 @@ H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
HDassert(!(*mesg_flags & H5O_MSG_FLAG_SHARED));
HDassert(type);
HDassert(native);
+ HDassert(mesg_idx);
/* Check if message is already shared */
if((shared_mesg = H5O_msg_is_shared(type->id, native)) < 0)
@@ -1927,16 +1931,19 @@ H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
} /* end else */
/* Allocate space in the object header for the message */
- if((ret_value = H5O_alloc(f, dxpl_id, oh, type, native)) < 0)
+ if(H5O_alloc(f, dxpl_id, oh, type, native, &new_idx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for message")
/* Get the message's "creation index", if it has one */
if(type->get_crt_index) {
/* Retrieve the creation index from the native message */
- if((type->get_crt_index)(native, &oh->mesg[ret_value].crt_idx) < 0)
+ if((type->get_crt_index)(native, &oh->mesg[new_idx].crt_idx) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve creation index")
} /* end if */
+ /* Set new message index */
+ *mesg_idx = new_idx;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_alloc() */
@@ -1956,7 +1963,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
+H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx,
const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags,
unsigned update_flags)
{
@@ -2293,7 +2300,7 @@ H5O_msg_get_chunkno(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found")
/* Set return value */
- ret_value = idx_msg->chunkno;
+ H5_ASSIGN_OVERFLOW(ret_value, idx_msg->chunkno, unsigned, int);
done:
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index d4cc3fb..1f8a1cd 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -535,8 +535,9 @@ H5_DLL herr_t H5O_dec_rc(H5O_t *oh);
H5_DLL herr_t H5O_free(H5O_t *oh);
/* Object header message routines */
-H5_DLL int H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- const H5O_msg_class_t *type, unsigned *mesg_flags, void *mesg);
+H5_DLL herr_t H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
+ const H5O_msg_class_t *type, unsigned *mesg_flags, void *mesg,
+ size_t *mesg_idx);
H5_DLL herr_t H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags,
void *mesg);
@@ -570,8 +571,8 @@ H5_DLL herr_t H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
/* Object header allocation routines */
H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc);
-H5_DLL int H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- const H5O_msg_class_t *type, const void *mesg);
+H5_DLL herr_t H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
+ const H5O_msg_class_t *type, const void *mesg, size_t *mesg_idx);
H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh, hid_t dxpl_id);
H5_DLL herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5O_mesg_t *mesg, hbool_t adj_link);
diff --git a/src/H5Opline.c b/src/H5Opline.c
index f626106..1a2baa0 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -250,7 +250,7 @@ H5O_pline_encode(H5F_t UNUSED *f, uint8_t *p/*out*/, const void *mesg)
HDassert(mesg);
/* Message header */
- *p++ = pline->version;
+ *p++ = (uint8_t)pline->version;
*p++ = (uint8_t)(pline->nused);
if(pline->version == H5O_PLINE_VERSION_1) {
*p++ = 0; /*reserved 1*/
@@ -467,7 +467,7 @@ H5O_pline_size(const H5F_t UNUSED *f, const void *mesg)
((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */
2 + /*flags */
2 + /*number of client data values */
- (pline->version == H5O_PLINE_VERSION_1 ? H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */
+ (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */
ret_value += pline->filter[i].cd_nelmts * 4;
if(pline->version == H5O_PLINE_VERSION_1)
diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c
index 69c7d49..2575856 100644
--- a/src/H5Oshmesg.c
+++ b/src/H5Oshmesg.c
@@ -129,9 +129,9 @@ H5O_shmesg_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi
HDassert(mesg);
/* Store version, table address, and number of indexes */
- *p++ = mesg->version;
+ *p++ = (uint8_t)mesg->version;
H5F_addr_encode(f, &p, mesg->addr);
- *p++ = mesg->nindexes;
+ *p++ = (uint8_t)mesg->nindexes;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_shmesg_encode() */
@@ -201,9 +201,9 @@ H5O_shmesg_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void UNUSED
/* Sanity check */
HDassert(f);
- ret_value = 1 + /* Version number */
+ ret_value = (size_t)(1 + /* Version number */
H5F_SIZEOF_ADDR(f) + /* Table address */
- 1; /* Number of indexes */
+ 1); /* Number of indexes */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_shmesg_size() */
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 47bd9fc..d05c7c2 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -227,7 +227,7 @@ H5O_stab_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void UNUSED *
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Set return value */
- ret_value=2 * H5F_SIZEOF_ADDR(f);
+ ret_value = (size_t)(2 * H5F_SIZEOF_ADDR(f));
FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Otest.c b/src/H5Otest.c
index 5802904..705f716 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -504,8 +504,8 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc, hid_t dxpl_id)
{
H5O_t *oh = NULL; /* Object header */
haddr_t chk_addr[16]; /* Array of chunk addresses */
- unsigned nchunks; /* Number of chunks in object header */
- unsigned u; /* Local index variable */
+ size_t nchunks; /* Number of chunks in object header */
+ size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
diff --git a/src/H5P.c b/src/H5P.c
index 92b3d18..abbfe4b 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -45,6 +45,13 @@
/* Local Typedefs */
/******************/
+/* Typedef for property iterator callback */
+typedef struct {
+ H5P_iterate_t iter_func; /* Iterator callback */
+ hid_t id; /* Property list or class ID */
+ void *iter_data; /* Iterator callback pointer */
+} H5P_iter_ud_t;
+
/********************/
/* Local Prototypes */
@@ -1045,6 +1052,45 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5P__iterate_cb
+ PURPOSE
+ Internal callback routine when iterating over properties in property list
+ or class
+ USAGE
+ int H5P__iterate_cb(prop, udata)
+ H5P_genprop_t *prop; IN: Pointer to the property
+ void *udata; IN/OUT: Pointer to iteration data from user
+ RETURNS
+ Success: Returns the return value of the last call to ITER_FUNC
+ DESCRIPTION
+ This routine calls the actual callback routine for the property in the
+property list or class.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static int
+H5P__iterate_cb(H5P_genprop_t *prop, void *_udata)
+{
+ H5P_iter_ud_t *udata = (H5P_iter_ud_t *)_udata; /* Pointer to user data */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(prop);
+ HDassert(udata);
+
+ /* Call the user's callback routine */
+ ret_value = (*udata->iter_func)(udata->id, prop->name, udata->iter_data);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__iterate_cb() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5Piterate
PURPOSE
Routine to iterate over the properties in a property list or class
@@ -1099,6 +1145,7 @@ iteration, the function's behavior is undefined.
int
H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
{
+ H5P_iter_ud_t udata; /* User data for internal iterator callback */
int fake_idx = 0; /* Index when user doesn't provide one */
int ret_value; /* return value */
@@ -1111,15 +1158,20 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
if(iter_func == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration callback");
+ /* Set up user data */
+ udata.iter_func = iter_func;
+ udata.id = id;
+ udata.iter_data = iter_data;
+
if(H5I_GENPROP_LST == H5I_get_type(id)) {
/* Iterate over a property list */
- if((ret_value = H5P_iterate_plist(id, (idx ? idx : &fake_idx), iter_func, iter_data)) < 0)
+ if((ret_value = H5P_iterate_plist(id, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list");
} /* end if */
else
if(H5I_GENPROP_CLS == H5I_get_type(id)) {
/* Iterate over a property class */
- if((ret_value = H5P_iterate_pclass(id, (idx ? idx : &fake_idx), iter_func, iter_data)) < 0)
+ if((ret_value = H5P_iterate_pclass(id, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over class");
} /* end if */
else
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index 51e62fe..9e75eaa 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -33,12 +33,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Ppkg.h" /* Property lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Ppkg.h" /* Property lists */
/****************/
@@ -72,7 +72,7 @@
/********************/
/* Property class callbacks */
-static herr_t H5P_dacc_reg_prop(H5P_genclass_t *pclass);
+static herr_t H5P__dacc_reg_prop(H5P_genclass_t *pclass);
/*********************/
@@ -85,7 +85,7 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_DATASET_ACCESS_g, /* Pointer to class ID */
&H5P_LST_DATASET_ACCESS_g, /* Pointer to default property list ID */
- H5P_dacc_reg_prop, /* Default property registration routine */
+ H5P__dacc_reg_prop, /* Default property registration routine */
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
@@ -107,7 +107,7 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{
/*-------------------------------------------------------------------------
- * Function: H5P_dacc_reg_prop
+ * Function: H5P__dacc_reg_prop
*
* Purpose: Register the dataset access property list class's
* properties
@@ -119,14 +119,14 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
-H5P_dacc_reg_prop(H5P_genclass_t *pclass)
+H5P__dacc_reg_prop(H5P_genclass_t *pclass)
{
size_t rdcc_nslots = H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF; /* Default raw data chunk cache # of slots */
size_t rdcc_nbytes = H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF; /* Default raw data chunk cache # of bytes */
double rdcc_w0 = H5D_ACS_PREEMPT_READ_CHUNKS_DEF; /* Default raw data chunk cache dirty ratio */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Register the size of raw data chunk cache (elements) */
if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
@@ -142,7 +142,7 @@ H5P_dacc_reg_prop(H5P_genclass_t *pclass)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dacc_reg_prop() */
+} /* end H5P__dacc_reg_prop() */
/*-------------------------------------------------------------------------
@@ -186,24 +186,24 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double
/* Check arguments. Note that we allow negative values - they are
* considered to "unset" the property. */
- if (rdcc_w0 > 1.0)
+ if(rdcc_w0 > 1.0)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive, or H5D_CHUNK_CACHE_W0_DEFAULT");
/* Get the plist structure */
- if (NULL == (plist = H5P_object_verify(dapl_id,H5P_DATASET_ACCESS)))
+ if(NULL == (plist = H5P_object_verify(dapl_id,H5P_DATASET_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Set sizes */
- if (H5P_set(plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0)
+ if(H5P_set(plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache number of chunks");
- if (H5P_set(plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0)
+ if(H5P_set(plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size");
- if (H5P_set(plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0)
+ if(H5P_set(plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks");
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_chunk_cache() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 54654c5..2235944 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -65,7 +65,7 @@
/* Note that the compact & chunked layout initialization values are using the
* contiguous layout initialization in the union, because the contiguous
* layout is first in the union. These values are overridden in the
- * H5P_init_def_layout() routine. -QAK
+ * H5P__init_def_layout() routine. -QAK
*/
#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}}
@@ -76,7 +76,7 @@
/* Definitions for storage layout property */
#define H5D_CRT_LAYOUT_SIZE sizeof(H5O_layout_t)
#define H5D_CRT_LAYOUT_DEF H5D_DEF_LAYOUT_CONTIG
-#define H5D_CRT_LAYOUT_CMP H5P_dcrt_layout_cmp
+#define H5D_CRT_LAYOUT_CMP H5P__dcrt_layout_cmp
/* Definitions for fill value. size=0 means fill value will be 0 as
* library default; size=-1 means fill value is undefined. */
#define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t)
@@ -88,7 +88,7 @@
/* Definitions for external file list */
#define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t)
#define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL}
-#define H5D_CRT_EXT_FILE_LIST_CMP H5P_dcrt_ext_file_list_cmp
+#define H5D_CRT_EXT_FILE_LIST_CMP H5P__dcrt_ext_file_list_cmp
/******************/
@@ -106,19 +106,19 @@
/********************/
/* General routines */
-static herr_t H5P_set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout);
+static herr_t H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout);
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
-static herr_t H5P_init_def_layout(void);
+static herr_t H5P__init_def_layout(void);
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
/* Property class callbacks */
-static herr_t H5P_dcrt_reg_prop(H5P_genclass_t *pclass);
-static herr_t H5P_dcrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data);
-static herr_t H5P_dcrt_close(hid_t dxpl_id, void *close_data);
+static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass);
+static herr_t H5P__dcrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data);
+static herr_t H5P__dcrt_close(hid_t dxpl_id, void *close_data);
/* Property callbacks */
-static int H5P_dcrt_layout_cmp(const void *value1, const void *value2, size_t size);
-static int H5P_dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size);
+static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t size);
+static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size);
/*********************/
@@ -131,12 +131,12 @@ const H5P_libclass_t H5P_CLS_DCRT[1] = {{
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_DATASET_CREATE_g, /* Pointer to class ID */
&H5P_LST_DATASET_CREATE_g, /* Pointer to default property list ID */
- H5P_dcrt_reg_prop, /* Default property registration routine */
+ H5P__dcrt_reg_prop, /* Default property registration routine */
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
- H5P_dcrt_copy, /* Class copy callback */
+ H5P__dcrt_copy, /* Class copy callback */
NULL, /* Class copy callback info */
- H5P_dcrt_close, /* Class close callback */
+ H5P__dcrt_close, /* Class close callback */
NULL /* Class close callback info */
}};
@@ -163,7 +163,7 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE;
/*-------------------------------------------------------------------------
- * Function: H5P_dcrt_reg_prop
+ * Function: H5P__dcrt_reg_prop
*
* Purpose: Register the dataset creation property list class's properties
*
@@ -174,7 +174,7 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE;
*-------------------------------------------------------------------------
*/
static herr_t
-H5P_dcrt_reg_prop(H5P_genclass_t *pclass)
+H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
{
H5O_layout_t layout = H5D_CRT_LAYOUT_DEF; /* Default storage layout */
H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */
@@ -182,7 +182,7 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass)
H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Register the storage layout property */
if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, H5D_CRT_LAYOUT_CMP, NULL) < 0)
@@ -202,11 +202,11 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dcrt_reg_prop() */
+} /* end H5P__dcrt_reg_prop() */
/*-------------------------------------------------------------------------
- * Function: H5P_dcrt_copy
+ * Function: H5P__dcrt_copy
*
* Purpose: Callback routine which is called whenever any dataset
* creation property list is copied. This routine copies
@@ -222,7 +222,7 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
+H5P__dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
{
H5O_fill_t src_fill, dst_fill; /* Source & destination fill values */
H5O_efl_t src_efl, dst_efl; /* Source & destination external file lists */
@@ -231,7 +231,7 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
H5P_genplist_t *dst_plist; /* Pointer to destination property list */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Verify property list IDs */
if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id)))
@@ -280,6 +280,8 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
dst_layout.storage.u.chunk.ops = NULL;
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HDassert(0 && "Unknown layout type!");
} /* end switch */
@@ -314,11 +316,11 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dcrt_copy() */
+} /* end H5P__dcrt_copy() */
/*-------------------------------------------------------------------------
- * Function: H5P_dcrt_close
+ * Function: H5P__dcrt_close
*
* Purpose: Callback routine which is called whenever any dataset create
* property list is closed. This routine performs any generic
@@ -334,14 +336,14 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data)
+H5P__dcrt_close(hid_t dcpl_id, void UNUSED *close_data)
{
H5O_fill_t fill; /* Fill value */
H5O_efl_t efl; /* External file list */
H5P_genplist_t *plist; /* Property list */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
@@ -362,11 +364,11 @@ H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dcrt_close() */
+} /* end H5P__dcrt_close() */
/*-------------------------------------------------------------------------
- * Function: H5P_dcrt_layout_cmp
+ * Function: H5P__dcrt_layout_cmp
*
* Purpose: Callback routine which is called whenever the layout
* property in the dataset creation property list is
@@ -382,13 +384,13 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5P_dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t UNUSED size)
+H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t UNUSED size)
{
const H5O_layout_t *layout1 = (const H5O_layout_t *)_layout1, /* Create local aliases for values */
*layout2 = (const H5O_layout_t *)_layout2;
herr_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(layout1);
@@ -425,13 +427,15 @@ H5P_dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t UNUSED si
} /* end case */
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HDassert(0 && "Unknown layout type!");
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dcrt_layout_cmp() */
+} /* end H5P__dcrt_layout_cmp() */
/*-------------------------------------------------------------------------
@@ -496,7 +500,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5P_dcrt_ext_file_list_cmp
+ * Function: H5P__dcrt_ext_file_list_cmp
*
* Purpose: Callback routine which is called whenever the external file
* list property in the dataset creation property list is
@@ -512,14 +516,14 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5P_dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t UNUSED size)
+H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t UNUSED size)
{
const H5O_efl_t *efl1 = (const H5O_efl_t *)_efl1, /* Create local aliases for values */
*efl2 = (const H5O_efl_t *)_efl2;
int cmp_value; /* Value from comparison */
herr_t ret_value = 0; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(efl1);
@@ -573,11 +577,11 @@ H5P_dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t UNUSED s
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dcrt_ext_file_list_cmp() */
+} /* end H5P__dcrt_ext_file_list_cmp() */
/*-------------------------------------------------------------------------
- * Function: H5P_set_layout
+ * Function: H5P__set_layout
*
* Purpose: Sets the layout of raw data in the file.
*
@@ -589,12 +593,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5P_set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout)
+H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout)
{
unsigned alloc_time_state; /* State of allocation time property */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Get the allocation time state */
if(H5P_get(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0)
@@ -622,6 +626,8 @@ H5P_set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout)
fill.alloc_time = H5D_ALLOC_TIME_INCR;
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type")
} /* end switch */
@@ -637,12 +643,12 @@ H5P_set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_set_layout() */
+} /* end H5P__set_layout() */
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
/*-------------------------------------------------------------------------
- * Function: H5P_init_def_layout
+ * Function: H5P__init_def_layout
*
* Purpose: Set the default layout information for the various types of
* dataset layouts
@@ -655,13 +661,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5P_init_def_layout(void)
+H5P__init_def_layout(void)
{
const H5O_layout_chunk_t def_layout_chunk = H5D_DEF_LAYOUT_CHUNK_INIT;
const H5O_storage_compact_t def_store_compact = H5D_DEF_STORAGE_COMPACT_INIT;
const H5O_storage_chunk_t def_store_chunk = H5D_DEF_STORAGE_CHUNK_INIT;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Initialize the default layout info for non-contigous layouts */
H5D_def_layout_compact_g.storage.u.compact = def_store_compact;
@@ -672,7 +678,7 @@ H5P_init_def_layout(void)
H5P_dcrt_def_layout_init_g = TRUE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5P_init_def_layout() */
+} /* end H5P__init_def_layout() */
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
@@ -718,7 +724,7 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type)
* the default layout structs have been initialized yet or not. *ick* -QAK
*/
if(!H5P_dcrt_def_layout_init_g)
- if(H5P_init_def_layout() < 0)
+ if(H5P__init_def_layout() < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info")
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
@@ -736,12 +742,14 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type)
layout = &H5D_def_layout_chunk_g;
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type")
} /* end switch */
/* Set value */
- if(H5P_set_layout(plist, layout) < 0)
+ if(H5P__set_layout(plist, layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout")
done:
@@ -845,7 +853,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
* the default layout structs have been initialized yet or not. *ick* -QAK
*/
if(!H5P_dcrt_def_layout_init_g)
- if(H5P_init_def_layout() < 0)
+ if(H5P__init_def_layout() < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info")
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
@@ -870,7 +878,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
/* Set chunk information in property list */
chunk_layout.u.chunk.ndims = (unsigned)ndims;
- if(H5P_set_layout(plist, &chunk_layout) < 0)
+ if(H5P__set_layout(plist, &chunk_layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout")
done:
@@ -959,18 +967,6 @@ done:
* Programmer: Robb Matzke
* Tuesday, March 3, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- * Raymond Lu
- * 7 April 2011
- * Starting from the 1.8.7 release, we allow dataspace to have
- * zero dimension size. So the external storage size for
- * dataset can be zero.
*-------------------------------------------------------------------------
*/
herr_t
@@ -979,16 +975,16 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
size_t idx;
hsize_t total, tmp;
H5O_efl_t efl;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*soh", plist_id, name, offset, size);
/* Check arguments */
- if (!name || !*name)
+ if(!name || !*name)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
- if (offset<0)
+ if(offset < 0)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "negative external file offset")
/* Get the plist structure */
@@ -997,14 +993,14 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list")
- if(efl.nused > 0 && H5O_EFL_UNLIMITED==efl.slot[efl.nused-1].size)
+ if(efl.nused > 0 && H5O_EFL_UNLIMITED == efl.slot[efl.nused - 1].size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited")
- if (H5O_EFL_UNLIMITED!=size) {
- for (idx=0, total=size; idx<efl.nused; idx++, total=tmp) {
+ if(H5O_EFL_UNLIMITED != size) {
+ for(idx = 0, total = size; idx < efl.nused; idx++, total = tmp) {
tmp = total + efl.slot[idx].size;
- if (tmp <= total)
- HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "total external data size overflowed")
+ if(tmp <= total)
+ HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "total external data size overflowed")
} /* end for */
} /* end if */
@@ -1015,23 +1011,23 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
H5O_efl_entry_t *x = (H5O_efl_entry_t *)H5MM_realloc(efl.slot, na * sizeof(H5O_efl_entry_t));
if(!x)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed")
efl.nalloc = na;
efl.slot = x;
} /* end if */
idx = efl.nused;
efl.slot[idx].name_offset = 0; /*not entered into heap yet*/
- efl.slot[idx].name = H5MM_xstrdup (name);
+ efl.slot[idx].name = H5MM_xstrdup(name);
efl.slot[idx].offset = offset;
efl.slot[idx].size = size;
efl.nused++;
if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set external file list")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_external() */
/*-------------------------------------------------------------------------
@@ -1199,7 +1195,7 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Always set K13 compression (and un-set CHIP compression) */
- options_mask &= (~H5_SZIP_CHIP_OPTION_MASK);
+ options_mask &= (unsigned)(~H5_SZIP_CHIP_OPTION_MASK);
options_mask |= H5_SZIP_ALLOW_K13_OPTION_MASK;
/* Always set "raw" (no szip header) flag for data */
@@ -1207,7 +1203,7 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block)
/* Mask off the LSB and MSB options, if they were given */
/* (The HDF5 library sets them internally, as needed) */
- options_mask &= ~(H5_SZIP_LSB_OPTION_MASK|H5_SZIP_MSB_OPTION_MASK);
+ options_mask &= (unsigned)(~(H5_SZIP_LSB_OPTION_MASK | H5_SZIP_MSB_OPTION_MASK));
/* Set the parameters for the filter */
cd_values[0]=options_mask;
@@ -1805,6 +1801,8 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time)
alloc_time = H5D_ALLOC_TIME_INCR;
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type")
} /* end switch */
diff --git a/src/H5Pint.c b/src/H5Pint.c
index dae7b08..a403443 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -55,6 +55,24 @@ typedef struct {
H5P_genclass_t *new_class; /* Pointer to class during path traversal */
} H5P_check_class_t;
+/* Typedef for property list iterator callback */
+typedef struct {
+ H5P_iterate_int_t cb_func; /* Iterator callback */
+ void *udata; /* Iterator callback pointer */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5SL_t *seen; /* Skip list to hold names of properties already seen */
+ int *curr_idx_ptr; /* Pointer to current iteration index */
+ int prev_idx; /* Previous iteration index */
+} H5P_iter_plist_ud_t;
+
+/* Typedef for property list class iterator callback */
+typedef struct {
+ H5P_iterate_int_t cb_func; /* Iterator callback */
+ void *udata; /* Iterator callback pointer */
+ int *curr_idx_ptr; /* Pointer to current iteration index */
+ int prev_idx; /* Previous iteration index */
+} H5P_iter_pclass_ud_t;
+
/********************/
/* Local Prototypes */
@@ -974,17 +992,17 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type,
H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp,
H5P_prp_close_func_t prp_close)
{
- H5P_genprop_t *prop=NULL; /* Pointer to new property copied */
+ H5P_genprop_t *prop = NULL; /* Pointer to new property copied */
H5P_genprop_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(name);
- HDassert((size>0 && value!=NULL) || (size==0));
- HDassert(type!=H5P_PROP_WITHIN_UNKNOWN);
+ HDassert((size > 0 && value != NULL) || (size == 0));
+ HDassert(type != H5P_PROP_WITHIN_UNKNOWN);
/* Allocate the new property */
- if(NULL==(prop = H5FL_MALLOC (H5P_genprop_t)))
+ if(NULL == (prop = H5FL_MALLOC(H5P_genprop_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set the property initial values */
@@ -994,37 +1012,37 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type,
prop->type = type;
/* Duplicate value, if it exists */
- if(value!=NULL) {
- if(NULL==(prop->value = H5MM_malloc (prop->size)))
+ if(value != NULL) {
+ if(NULL == (prop->value = H5MM_malloc (prop->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(prop->value,value,prop->size);
+ HDmemcpy(prop->value, value, prop->size);
} /* end if */
else
- prop->value=NULL;
+ prop->value = NULL;
/* Set the function pointers */
- prop->create=prp_create;
- prop->set=prp_set;
- prop->get=prp_get;
- prop->del=prp_delete;
- prop->copy=prp_copy;
+ prop->create = prp_create;
+ prop->set = prp_set;
+ prop->get = prp_get;
+ prop->del = prp_delete;
+ prop->copy = prp_copy;
/* Use custom comparison routine if available, otherwise default to memcmp() */
- if(prp_cmp!=NULL)
- prop->cmp=prp_cmp;
+ if(prp_cmp != NULL)
+ prop->cmp = prp_cmp;
else
- prop->cmp=&memcmp;
- prop->close=prp_close;
+ prop->cmp = &memcmp;
+ prop->close = prp_close;
/* Set return value */
- ret_value=prop;
+ ret_value = prop;
done:
/* Free any resources allocated */
- if(ret_value==NULL) {
- if(prop!=NULL) {
- if(prop->name!=NULL)
+ if(ret_value == NULL) {
+ if(prop != NULL) {
+ if(prop->name != NULL)
H5MM_xfree(prop->name);
- if(prop->value!=NULL)
+ if(prop->value != NULL)
H5MM_xfree(prop->value);
prop = H5FL_FREE(H5P_genprop_t, prop);
} /* end if */
@@ -2335,8 +2353,9 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size,
/* Check if the property has been deleted */
if(NULL != H5SL_search(plist->del, name)) {
char *temp_name = NULL;
+
/* Remove the property name from the deleted property skip list */
- if(NULL == (temp_name = H5SL_remove(plist->del, name)))
+ if(NULL == (temp_name = (char *)H5SL_remove(plist->del, name)))
HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from deleted skip list")
/* free the name of the removed property */
@@ -3316,14 +3335,113 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5P__iterate_plist_cb
+ PURPOSE
+ Internal callback routine when iterating over properties in property list
+ USAGE
+ int H5P__iterate_plist_cb(item, key, udata)
+ void *item; IN: Pointer to the property
+ void *key; IN: Pointer to the property's name
+ void *udata; IN/OUT: Pointer to iteration data from user
+ RETURNS
+ Success: Returns the return value of the last call to ITER_FUNC
+ DESCRIPTION
+ This routine calls the actual callback routine for the property in the
+property list.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static int
+H5P__iterate_plist_cb(void *_item, void *_key, void *_udata)
+{
+ H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */
+ char *key = (char *)_key; /* Pointer to the property's name */
+ H5P_iter_plist_ud_t *udata = (H5P_iter_plist_ud_t *)_udata; /* Pointer to user data */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(item);
+ HDassert(key);
+
+ /* Check if we've found the correctly indexed property */
+ if(*udata->curr_idx_ptr >= udata->prev_idx) {
+ /* Call the callback function */
+ ret_value = (*udata->cb_func)(item, udata->udata);
+ if(ret_value != 0)
+ HGOTO_DONE(ret_value);
+ } /* end if */
+
+ /* Increment the current index */
+ (*udata->curr_idx_ptr)++;
+
+ /* Add property name to "seen" list */
+ if(H5SL_insert(udata->seen, key, key) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into seen skip list")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__iterate_plist_cb() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5P__iterate_plist_pclass_cb
+ PURPOSE
+ Internal callback routine when iterating over properties in property class
+ USAGE
+ int H5P__iterate_plist_pclass_cb(item, key, udata)
+ void *item; IN: Pointer to the property
+ void *key; IN: Pointer to the property's name
+ void *udata; IN/OUT: Pointer to iteration data from user
+ RETURNS
+ Success: Returns the return value of the last call to ITER_FUNC
+ DESCRIPTION
+ This routine verifies that the property hasn't already been seen or was
+deleted, and then chains to the property list callback.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static int
+H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata)
+{
+ H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */
+ char *key = (char *)_key; /* Pointer to the property's name */
+ H5P_iter_plist_ud_t *udata = (H5P_iter_plist_ud_t *)_udata; /* Pointer to user data */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(item);
+ HDassert(key);
+
+ /* Only call iterator callback for properties we haven't seen
+ * before and that haven't been deleted.
+ */
+ if(NULL == H5SL_search(udata->seen, key) &&
+ NULL == H5SL_search(udata->plist->del, key))
+ ret_value = H5P__iterate_plist_cb(item, key, udata);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__iterate_plist_pclass_cb() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5P_iterate_plist
PURPOSE
Internal routine to iterate over the properties in a property list
USAGE
- herr_t H5P_iterate_plist(plist_id, idx, iter_func, iter_data)
+ int H5P_iterate_plist(plist_id, idx, cb_func, iter_data)
hid_t plist_id; IN: ID of property list to iterate over
int *idx; IN/OUT: Index of the property to begin with
- H5P_iterate_t iter_func; IN: Function pointer to function to be
+ H5P_iterate_t cb_func; IN: Function pointer to function to be
called with each property iterated over.
void *iter_data; IN/OUT: Pointer to iteration data from user
RETURNS
@@ -3366,106 +3484,60 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
-H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_data)
+H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *udata)
{
H5P_genclass_t *tclass; /* Temporary class pointer */
H5P_genplist_t *plist; /* Property list pointer */
- H5P_genprop_t *tmp; /* Temporary pointer to properties */
+ H5P_iter_plist_ud_t udata_int; /* User data for skip list iterator */
H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */
- H5SL_node_t *curr_node; /* Current node in skip list */
int curr_idx = 0; /* Current iteration index */
- int ret_value = FAIL; /* Return value */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(idx);
- HDassert(iter_func);
+ HDassert(cb_func);
/* Get the property list object */
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Create the skip list to hold names of properties already seen */
- if((seen = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties")
-
- /* Walk through the changed properties in the list */
- if(H5SL_count(plist->props) > 0) {
- curr_node = H5SL_first(plist->props);
- while(curr_node != NULL) {
- /* Get pointer to property from node */
- tmp = (H5P_genprop_t *)H5SL_item(curr_node);
-
- /* Check if we've found the correctly indexed property */
- if(curr_idx>=*idx) {
- /* Call the callback function */
- ret_value=(*iter_func)(plist_id,tmp->name,iter_data);
-
- if(ret_value!=0)
- HGOTO_DONE(ret_value);
- } /* end if */
-
- /* Increment the current index */
- curr_idx++;
-
- /* Add property name to "seen" list */
- if(H5SL_insert(seen,tmp->name,tmp->name) < 0)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list")
-
- /* Get the next property node in the skip list */
- curr_node=H5SL_next(curr_node);
- } /* end while */
- } /* end if */
+ if(NULL == (seen = H5SL_create(H5SL_TYPE_STR, NULL)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties")
+
+ /* Set up iterator callback info */
+ udata_int.plist = plist;
+ udata_int.cb_func = cb_func;
+ udata_int.udata = udata;
+ udata_int.seen = seen;
+ udata_int.curr_idx_ptr = &curr_idx;
+ udata_int.prev_idx = *idx;
+
+ /* Iterate over properties in property list proper */
+ /* (Will be only the non-default (i.e. changed) properties) */
+ ret_value = H5SL_iterate(plist->props, H5P__iterate_plist_cb, &udata_int);
+ if(ret_value != 0)
+ HGOTO_DONE(ret_value);
/* Walk up the class hiearchy */
- tclass=plist->pclass;
- while(tclass!=NULL) {
- if(tclass->nprops>0) {
- /* Walk through the properties in the class */
- curr_node=H5SL_first(tclass->props);
- while(curr_node!=NULL) {
- /* Get pointer to property from node */
- tmp = (H5P_genprop_t *)H5SL_item(curr_node);
-
- /* Only call iterator callback for properties we haven't seen
- * before and that haven't been deleted
- */
- if(H5SL_search(seen,tmp->name) == NULL &&
- H5SL_search(plist->del,tmp->name) == NULL) {
-
-
- /* Check if we've found the correctly indexed property */
- if(curr_idx>=*idx) {
- /* Call the callback function */
- ret_value=(*iter_func)(plist_id,tmp->name,iter_data);
-
- if(ret_value!=0)
- HGOTO_DONE(ret_value);
- } /* end if */
-
- /* Increment the current index */
- curr_idx++;
-
- /* Add property name to "seen" list */
- if(H5SL_insert(seen,tmp->name,tmp->name) < 0)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list")
- } /* end if */
-
- /* Get the next property node in the skip list */
- curr_node=H5SL_next(curr_node);
- } /* end while */
- } /* end if */
+ tclass = plist->pclass;
+ while(tclass != NULL) {
+ /* Iterate over properties in property list class */
+ ret_value = H5SL_iterate(tclass->props, H5P__iterate_plist_pclass_cb, &udata_int);
+ if(ret_value != 0)
+ HGOTO_DONE(ret_value);
/* Go up to parent class */
- tclass=tclass->parent;
+ tclass = tclass->parent;
} /* end while */
done:
/* Set the index we stopped at */
- *idx=curr_idx;
+ *idx = curr_idx;
/* Release the skip list of 'seen' properties */
- if(seen!=NULL)
+ if(seen != NULL)
H5SL_close(seen);
FUNC_LEAVE_NOAPI(ret_value)
@@ -3474,14 +3546,65 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5P__iterate_pclass_cb
+ PURPOSE
+ Internal callback routine when iterating over properties in property list
+ class
+ USAGE
+ int H5P__iterate_pclass_cb(item, key, udata)
+ void *item; IN: Pointer to the property
+ void *key; IN: Pointer to the property's name
+ void *udata; IN/OUT: Pointer to iteration data from user
+ RETURNS
+ Success: Returns the return value of the last call to ITER_FUNC
+ DESCRIPTION
+ This routine calls the actual callback routine for the property in the
+property list class.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static int
+H5P__iterate_pclass_cb(void *_item, void *_key, void *_udata)
+{
+ H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */
+ char *key = (char *)_key; /* Pointer to the property's name */
+ H5P_iter_pclass_ud_t *udata = (H5P_iter_pclass_ud_t *)_udata; /* Pointer to user data */
+ int ret_value = 0; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(item);
+ HDassert(key);
+
+ /* Check if we've found the correctly indexed property */
+ if(*udata->curr_idx_ptr >= udata->prev_idx) {
+ /* Call the callback function */
+ ret_value = (*udata->cb_func)(item, udata->udata);
+ if(ret_value != 0)
+ HGOTO_DONE(ret_value);
+ } /* end if */
+
+ /* Increment the current index */
+ (*udata->curr_idx_ptr)++;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P__iterate_pclass_cb() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5P_iterate_pclass
PURPOSE
Internal routine to iterate over the properties in a property class
USAGE
- herr_t H5P_iterate_pclass(pclass_id, idx, iter_func, iter_data)
+ herr_t H5P_iterate_pclass(pclass_id, idx, cb_func, iter_data)
hid_t pclass_id; IN: ID of property class to iterate over
int *idx; IN/OUT: Index of the property to begin with
- H5P_iterate_t iter_func; IN: Function pointer to function to be
+ H5P_iterate_t cb_func; IN: Function pointer to function to be
called with each property iterated over.
void *iter_data; IN/OUT: Pointer to iteration data from user
RETURNS
@@ -3524,49 +3647,36 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
-H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func, void *iter_data)
+H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_int_t cb_func, void *udata)
{
H5P_genclass_t *pclass; /* Property list pointer */
- H5SL_node_t *curr_node; /* Current node in skip list */
- H5P_genprop_t *prop; /* Temporary property pointer */
- int curr_idx=0; /* Current iteration index */
- int ret_value=FAIL; /* Return value */
+ H5P_iter_pclass_ud_t udata_int; /* User data for skip list iterator */
+ int curr_idx = 0; /* Current iteration index */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(idx);
- HDassert(iter_func);
+ HDassert(cb_func);
/* Get the property list object */
if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class")
- /* Cycle through the properties and call the callback */
- curr_idx=0;
- curr_node=H5SL_first(pclass->props);
- while(curr_node!=NULL) {
- if(curr_idx>=*idx) {
- /* Get the property for the node */
- prop = (H5P_genprop_t *)H5SL_item(curr_node);
-
- /* Call the callback function */
- ret_value=(*iter_func)(pclass_id,prop->name,iter_data);
+ /* Set up iterator callback info */
+ udata_int.cb_func = cb_func;
+ udata_int.udata = udata;
+ udata_int.curr_idx_ptr = &curr_idx;
+ udata_int.prev_idx = *idx;
- /* Check if iteration function succeeded */
- if(ret_value!=0)
- HGOTO_DONE(ret_value);
- } /* end if */
-
- /* Increment the iteration index */
- curr_idx++;
-
- /* Get the next property node in the skip list */
- curr_node=H5SL_next(curr_node);
- } /* end while */
+ /* Iterate over properties in property list class proper */
+ ret_value = H5SL_iterate(pclass->props, H5P__iterate_pclass_cb, &udata_int);
+ if(ret_value != 0)
+ HGOTO_DONE(ret_value);
done:
/* Set the index we stopped at */
- *idx=curr_idx;
+ *idx = curr_idx;
FUNC_LEAVE_NOAPI(ret_value)
} /* H5P_iterate_pclass() */
@@ -4108,25 +4218,26 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
/* If not, get the information required to do an H5Pinsert2 with the property into the destination list */
else {
/* Get the pointer to the source property */
- prop=H5P_find_prop_plist(src_plist,name);
+ prop = H5P_find_prop_plist(src_plist, name);
/* Create property object from parameters */
- if((new_prop=H5P_create_prop(prop->name,prop->size,H5P_PROP_WITHIN_LIST,prop->value,prop->create,prop->set,prop->get,prop->del,prop->copy,prop->cmp,prop->close)) == NULL)
+ if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value,
+ prop->create, prop->set, prop->get,
+ prop->del, prop->copy, prop->cmp, prop->close)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property")
/* Call property creation callback, if it exists */
if(new_prop->create) {
- if((new_prop->create)(new_prop->name,new_prop->size,new_prop->value) < 0)
+ if((new_prop->create)(new_prop->name, new_prop->size, new_prop->value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property")
} /* end if */
/* Insert property into property list class */
- if(H5P_add_prop(dst_plist->props,new_prop) < 0)
+ if(H5P_add_prop(dst_plist->props, new_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class")
/* Increment property count for class */
dst_plist->nprops++;
-
} /* end else */
done:
@@ -4202,7 +4313,8 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name)
/* Register the property into the destination */
orig_dst_pclass = dst_pclass;
- if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, prop->del, prop->copy, prop->cmp, prop->close) < 0)
+ if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get,
+ prop->del, prop->copy, prop->cmp, prop->close) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property")
/* Check if the property class changed and needs to be substituted in the ID */
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index 217d0ba..7a52f11 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -379,8 +379,8 @@ H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags)
ohdr_flags &= (uint8_t)~(H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED);
/* Update with new attribute creation order flags */
- ohdr_flags |= (uint8_t)((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? H5O_HDR_ATTR_CRT_ORDER_TRACKED : 0);
- ohdr_flags |= (uint8_t)((crt_order_flags & H5P_CRT_ORDER_INDEXED) ? H5O_HDR_ATTR_CRT_ORDER_INDEXED : 0);
+ ohdr_flags = (uint8_t)(ohdr_flags | ((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? H5O_HDR_ATTR_CRT_ORDER_TRACKED : 0));
+ ohdr_flags = (uint8_t)(ohdr_flags | ((crt_order_flags & H5P_CRT_ORDER_INDEXED) ? H5O_HDR_ATTR_CRT_ORDER_INDEXED : 0));
/* Set object header flags */
if(H5P_set(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
@@ -486,7 +486,7 @@ H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times)
ohdr_flags &= (uint8_t)~H5O_HDR_STORE_TIMES;
/* Update with new time tracking flag */
- ohdr_flags |= (uint8_t)(track_times ? H5O_HDR_STORE_TIMES : 0);
+ ohdr_flags = (uint8_t)(ohdr_flags | (track_times ? H5O_HDR_STORE_TIMES : 0));
/* Set object header flags */
if(H5P_set(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
@@ -1343,7 +1343,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
*
*-------------------------------------------------------------------------
*/
-int
+static int
H5P_ocrt_pipeline_cmp(const void *_pline1, const void *_pline2, size_t UNUSED size)
{
const H5O_pline_t *pline1 = (const H5O_pline_t *)_pline1, /* Create local aliases for values */
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 1e71049..65d314e 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -138,6 +138,8 @@ typedef struct H5P_libclass_t {
void *close_data; /* Pointer to user data to pass along to close callback */
} H5P_libclass_t;
+/* Property list/class iterator callback function pointer */
+typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata);
/*****************************/
/* Package Private Variables */
@@ -176,9 +178,9 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist);
H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops);
H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
H5_DLL int H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2);
-H5_DLL int H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func,
+H5_DLL int H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t iter_func,
void *iter_data);
-H5_DLL int H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func,
+H5_DLL int H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_int_t iter_func,
void *iter_data);
H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name);
H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name);
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index 91cf70b..188fdd2 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -108,7 +108,7 @@ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{
* October 31, 2006
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5P_strcrt_reg_prop(H5P_genclass_t *pclass)
{
H5T_cset_t char_encoding = H5P_STRCRT_CHAR_ENCODING_DEF; /* Default character set encoding */
diff --git a/src/H5R.c b/src/H5R.c
index 8fac4bf..d45947b 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -217,7 +217,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5
HDassert(_ref);
HDassert(loc);
HDassert(name);
- HDassert(ref_type > H5R_BADTYPE || ref_type < H5R_MAXTYPE);
+ HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
/* Set up object location to fill in */
obj_loc.oloc = &oloc;
@@ -272,7 +272,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection")
/* Increase buffer size to allow for the dataset OID */
- buf_size += sizeof(haddr_t);
+ buf_size += (hssize_t)sizeof(haddr_t);
/* Allocate the space to store the serialized information */
H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t);
@@ -418,7 +418,7 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type,
FUNC_ENTER_NOAPI_NOINIT
HDassert(_ref);
- HDassert(ref_type > H5R_BADTYPE || ref_type < H5R_MAXTYPE);
+ HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
HDassert(file);
/* Initialize the object location */
@@ -525,6 +525,8 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type,
} /* end case */
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, FAIL, "can't identify type of object referenced")
} /* end switch */
@@ -880,7 +882,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-ssize_t
+static ssize_t
H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type,
const void *_ref, char *name, size_t size)
{
diff --git a/src/H5SL.c b/src/H5SL.c
index b6c9f8e..7581858 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -745,7 +745,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data)
{
H5SL_node_t *node, *next_node; /* Pointers to skip list nodes */
@@ -817,7 +817,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data)
{
herr_t ret_value = SUCCEED;
@@ -873,7 +873,7 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp)
FUNC_ENTER_NOAPI(NULL)
/* Check args */
- HDassert(type>=H5SL_TYPE_INT && type<=H5SL_TYPE_GENERIC);
+ HDassert(type >= H5SL_TYPE_INT && type <= H5SL_TYPE_GENERIC);
/* Allocate skip list structure */
if(NULL == (new_slist = H5FL_MALLOC(H5SL_t)))
@@ -889,7 +889,7 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp)
new_slist->nobjs = 0;
/* Allocate the header node */
- if(NULL == (header = H5SL_new_node(NULL, NULL, ULONG_MAX)))
+ if(NULL == (header = H5SL_new_node(NULL, NULL, (uint32_t)ULONG_MAX)))
HGOTO_ERROR(H5E_SLIST ,H5E_NOSPACE, NULL, "can't create new skip list node")
/* Initialize header node's forward pointer */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index c99d699..8d56c80 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -112,7 +112,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -445,7 +445,7 @@ H5S_all_copy(H5S_t *dst, const H5S_t UNUSED *src, hbool_t UNUSED share_selection
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_all_is_valid (const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -475,7 +475,7 @@ H5S_all_is_valid (const H5S_t UNUSED *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-hssize_t
+static hssize_t
H5S_all_serial_size (const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -509,7 +509,7 @@ H5S_all_serial_size (const H5S_t UNUSED *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_all_serialize (const H5S_t *space, uint8_t *buf)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -545,7 +545,7 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_all_deserialize(H5S_t *space, const uint8_t UNUSED *buf)
{
herr_t ret_value; /* return value */
@@ -588,7 +588,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
unsigned rank; /* Dataspace rank */
@@ -633,7 +633,7 @@ H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_all_offset(const H5S_t UNUSED *space, hsize_t *offset)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -666,7 +666,7 @@ H5S_all_offset(const H5S_t UNUSED *space, hsize_t *offset)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_all_is_contiguous(const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -695,7 +695,7 @@ H5S_all_is_contiguous(const H5S_t UNUSED *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_all_is_single(const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -725,7 +725,7 @@ H5S_all_is_single(const H5S_t UNUSED *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_all_is_regular(const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -755,7 +755,7 @@ H5S_all_is_regular(const H5S_t UNUSED *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_all_adjust_u(H5S_t UNUSED *space, const hsize_t UNUSED *offset)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -945,7 +945,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_all_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_iter_t *iter,
size_t UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
hsize_t *off, size_t *len)
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 1eeb098..d9b306d 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -234,7 +234,7 @@ H5S_hyper_print_diminfo(FILE *f, const H5S_t *space)
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
{
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
@@ -1614,7 +1614,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_hyper_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection)
{
H5S_hyper_sel_t *dst_hslab; /* Pointer to destination hyperslab info */
@@ -1749,7 +1749,7 @@ H5S_hyper_is_valid_helper (const H5S_hyper_span_info_t *spans, const hssize_t *o
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_hyper_is_valid (const H5S_t *space)
{
unsigned u; /* Counter */
@@ -2068,7 +2068,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
{
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
@@ -2229,7 +2229,7 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf)
{
uint32_t rank; /* rank of points */
@@ -2705,7 +2705,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
unsigned rank; /* Dataspace rank */
@@ -2772,7 +2772,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
{
const hssize_t *sel_offset; /* Pointer to the selection's offset */
@@ -2878,7 +2878,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_hyper_is_contiguous(const H5S_t *space)
{
unsigned small_contiguous, /* Flag for small contiguous block */
@@ -3063,7 +3063,7 @@ H5S_hyper_is_contiguous(const H5S_t *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_hyper_is_single(const H5S_t *space)
{
H5S_hyper_span_info_t *spans; /* Hyperslab span info node */
@@ -3133,7 +3133,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_hyper_is_regular(const H5S_t *space)
{
htri_t ret_value; /* return value */
@@ -3175,7 +3175,7 @@ H5S_hyper_is_regular(const H5S_t *space)
* changing the hyperslab selection of one data space causes a core dump
* when closing some other data space.
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_hyper_release(H5S_t *space)
{
herr_t ret_value = SUCCEED;
@@ -4008,7 +4008,7 @@ H5S_hyper_adjust_helper_u (H5S_hyper_span_info_t *spans, const hsize_t *offset)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset)
{
unsigned u; /* Local index variable */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index e9a3bf9..021dd61 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -113,7 +113,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -589,7 +589,7 @@ H5S_none_bounds(const H5S_t UNUSED *space, hsize_t UNUSED *start, hsize_t UNUSED
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_none_offset(const H5S_t UNUSED *space, hsize_t UNUSED *offset)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -708,7 +708,7 @@ H5S_none_is_regular(const H5S_t UNUSED *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_none_adjust_u(H5S_t UNUSED *space, const hsize_t UNUSED *offset)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 7e82295..817b2f2 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -120,7 +120,7 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t);
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1136,7 +1136,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_point_offset(const H5S_t *space, hsize_t *offset)
{
const hsize_t *pnt; /* Pointer to a selected point's coordinates */
@@ -1316,7 +1316,7 @@ H5S_point_is_regular(const H5S_t *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
{
H5S_pnt_node_t *node; /* Point node */
diff --git a/src/H5T.c b/src/H5T.c
index b2d97bc..5a3c17b 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -734,7 +734,7 @@ DESCRIPTION
Initializes any interface-specific data or routines.
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5T_init_interface(void)
{
H5T_t *native_schar=NULL; /* Datatype structure for native signed char */
@@ -3155,7 +3155,7 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
+H5T_copy(H5T_t *old_dt, H5T_copy_t method)
{
H5T_t *new_dt = NULL, *tmp = NULL;
H5T_shared_t *reopened_fo = NULL;
@@ -3840,8 +3840,10 @@ H5T_set_size(H5T_t *dt, size_t size)
case H5T_ENUM:
case H5T_VLEN:
case H5T_ARRAY:
- assert("can't happen" && 0);
case H5T_REFERENCE:
+ assert("can't happen" && 0);
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
assert("invalid type" && 0);
default:
assert("not implemented yet" && 0);
@@ -4296,6 +4298,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/*void */
break;
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ assert("invalid type" && 0);
default:
assert("not implemented yet" && 0);
}
@@ -5147,7 +5152,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
} /* end for */
/* Apply the accumulated size change to the datatype */
- dt->shared->size += accum_change;
+ dt->shared->size = (size_t)(dt->shared->size + accum_change);
break;
case H5T_VLEN: /* Recurse on the VL information if it's VL, compound or array, then free VL sequence */
diff --git a/src/H5Tarray.c b/src/H5Tarray.c
index e9c8fe7..9986631 100644
--- a/src/H5Tarray.c
+++ b/src/H5Tarray.c
@@ -279,7 +279,7 @@ H5T__get_array_ndims(const H5T_t *dt)
HDassert(dt->shared->type == H5T_ARRAY);
/* Retrieve the number of dimensions */
- FUNC_LEAVE_NOAPI(dt->shared->u.array.ndims)
+ FUNC_LEAVE_NOAPI((int)dt->shared->u.array.ndims)
} /* end H5T__get_array_ndims */
@@ -337,9 +337,8 @@ int
H5T__get_array_dims(const H5T_t *dt, hsize_t dims[])
{
unsigned u; /* Local index variable */
- int ret_value; /* return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(dt);
HDassert(dt->shared->type == H5T_ARRAY);
@@ -350,10 +349,7 @@ H5T__get_array_dims(const H5T_t *dt, hsize_t dims[])
dims[u] = dt->shared->u.array.dim[u];
/* Pass along the array rank as the return value */
- ret_value = dt->shared->u.array.ndims;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI((int)dt->shared->u.array.ndims)
} /* end H5T__get_array_dims */
#ifndef H5_NO_DEPRECATED_SYMBOLS
diff --git a/src/H5Tfields.c b/src/H5Tfields.c
index aa1efe8..163bab3 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -83,7 +83,7 @@ H5Tget_nmembers(hid_t type_id)
H5TRACE1("Is", "i", type_id);
/* Check args */
- if(NULL == (dt = H5I_object_verify(type_id, H5I_DATATYPE)))
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if((ret_value = H5T_get_nmembers(dt)) < 0)
@@ -165,7 +165,7 @@ H5Tget_member_name(hid_t type_id, unsigned membno)
FUNC_ENTER_API(NULL)
/* Check args */
- if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
if(NULL == (ret_value = H5T__get_member_name(dt, membno)))
@@ -217,6 +217,17 @@ H5T__get_member_name(H5T_t const *dt, unsigned membno)
ret_value = H5MM_xstrdup(dt->shared->u.enumer.name[membno]);
break;
+ case H5T_NO_CLASS:
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_REFERENCE:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ case H5T_NCLASSES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class")
} /*lint !e788 All appropriate cases are covered */
@@ -255,31 +266,41 @@ H5Tget_member_index(hid_t type_id, const char *name)
H5TRACE2("Is", "i*s", type_id, name);
/* Check arguments */
- assert(name);
- if(NULL==(dt=H5I_object_verify(type_id,H5I_DATATYPE)))
+ HDassert(name);
+ if(NULL == (dt = (H5T_t*)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Locate member by name */
- switch (dt->shared->type) {
+ switch(dt->shared->type) {
case H5T_COMPOUND:
- for(i=0; i< dt->shared->u.compnd.nmembs; i++) {
+ for(i = 0; i < dt->shared->u.compnd.nmembs; i++)
if(!HDstrcmp(dt->shared->u.compnd.memb[i].name, name))
HGOTO_DONE((int)i)
- }
break;
case H5T_ENUM:
- for(i=0; i< dt->shared->u.enumer.nmembs; i++) {
+ for(i = 0; i < dt->shared->u.enumer.nmembs; i++)
if(!HDstrcmp(dt->shared->u.enumer.name[i], name))
HGOTO_DONE((int)i)
- }
break;
+
+ case H5T_NO_CLASS:
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_REFERENCE:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ case H5T_NCLASSES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type")
} /*lint !e788 All appropriate cases are covered */
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Tget_member_index() */
/*-------------------------------------------------------------------------
@@ -308,7 +329,7 @@ H5T__sort_value(const H5T_t *dt, int *map)
unsigned i, j; /* Local index variables */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(dt);
@@ -381,7 +402,6 @@ H5T__sort_value(const H5T_t *dt, int *map)
} /* end if */
} /* end else */
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__sort_value() */
@@ -411,9 +431,8 @@ H5T__sort_name(const H5T_t *dt, int *map)
size_t size;
hbool_t swapped;
uint8_t tbuf[32];
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
assert(dt);
@@ -488,7 +507,6 @@ H5T__sort_name(const H5T_t *dt, int *map)
}
}
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 0c96896..345924c 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -106,7 +106,7 @@ H5_DLLVAR H5T_order_t H5T_native_order_g;
/* Private functions */
H5_DLL herr_t H5TN_init_interface(void);
H5_DLL herr_t H5T_init(void);
-H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method);
+H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method);
H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable);
H5_DLL herr_t H5T_close(H5T_t *dt);
H5_DLL H5T_t *H5T_get_super(const H5T_t *dt);
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 48948a7..9fa3863 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -537,7 +537,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-void
+static void
H5Z_xform_destroy_parse_tree(H5Z_node *tree)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -567,7 +567,7 @@ H5Z_xform_destroy_parse_tree(H5Z_node *tree)
*
*-------------------------------------------------------------------------
*/
-void *
+static void *
H5Z_xform_parse(const char *expression, H5Z_datval_ptrs* dat_val_pointers)
{
H5Z_token tok;
@@ -1251,7 +1251,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-void *
+static void *
H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers)
{
H5Z_node* ret_value=NULL;
@@ -1386,7 +1386,7 @@ H5Z_op_is_numbs2(H5Z_node* _tree)
*
*-------------------------------------------------------------------------
*/
-void
+static void
H5Z_xform_reduce_tree(H5Z_node* tree)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1516,7 +1516,7 @@ H5Z_xform_create(const char *expr)
* we don't need to allocate any space since no array will have to be
* stored */
if(count > 0)
- if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val = (void *)H5MM_calloc(count * sizeof(void *))))
+ if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val = (void **)H5MM_calloc(count * sizeof(void *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for pointers in transform array")
/* Initialize the num_ptrs field, which will be used to keep track of the number of copies
@@ -1651,7 +1651,7 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop)
count++;
if(count > 0)
- if(NULL == (new_data_xform_prop->dat_val_pointers->ptr_dat_val = (void *)H5MM_calloc(count * sizeof(void *))))
+ if(NULL == (new_data_xform_prop->dat_val_pointers->ptr_dat_val = (void **)H5MM_calloc(count * sizeof(void *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for pointers in transform array")
/* Zero out num_pointers prior to H5Z_xform_cop_tree call; that call will increment it to the right amount */