summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Dfill.c3
-rw-r--r--src/H5HFman.c12
-rw-r--r--src/H5Oalloc.c84
-rw-r--r--src/H5Osdspace.c8
-rw-r--r--src/H5Shyper.c199
-rw-r--r--src/H5Ztrans.c58
-rw-r--r--test/dtypes.c129
-rw-r--r--tools/h5dump/h5dumpgentest.c310
8 files changed, 423 insertions, 380 deletions
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 1929a5a..467ce4b 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -596,6 +596,9 @@ H5D_fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id)
buf = fb_info->fill_alloc_func(fb_info->fill_buf_size, fb_info->fill_alloc_info);
else
buf = H5FL_BLK_MALLOC(non_zero_fill, fb_info->fill_buf_size);
+ if(!buf)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary fill buffer")
+
HDmemcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size);
/* Type convert the dataset buffer, to copy any VL components */
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 0ec6f5f..b1fb322 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -107,7 +107,7 @@ herr_t
H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj,
void *_id)
{
- H5HF_free_section_t *sec_node; /* Pointer to free space section */
+ H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section */
H5HF_direct_t *dblock = NULL; /* Pointer to direct block to modify */
haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */
size_t dblock_size; /* Direct block size */
@@ -176,6 +176,7 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj
/* Reduce (& possibly re-add) single section */
if(H5HF_sect_single_reduce(hdr, dxpl_id, sec_node, obj_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce single section node")
+ sec_node = NULL;
/* Encode the object in the block */
{
@@ -203,6 +204,11 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap")
done:
+ /* Release section node on error */
+ if(ret_value < 0)
+ if(sec_node && H5HF_sect_single_free((H5FS_section_info_t *)sec_node) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release section node")
+
/* Release the direct block (marked as dirty) */
if(dblock && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__DIRTIED_FLAG) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block")
@@ -332,7 +338,7 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
blk_off = (size_t)(obj_off - dblock->block_off);
/* Check for object's offset in the direct block prefix information */
- if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
+ if(blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block")
/* Check for object's length overrunning the end of the direct block */
@@ -553,7 +559,7 @@ H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
blk_off = (size_t)(obj_off - dblock_block_off);
/* Check for object's offset in the direct block prefix information */
- if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
+ if(blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block")
/* Check for object's length overrunning the end of the direct block */
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index a06740c..aba88b4 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -186,7 +186,7 @@ if(chunkno > 0) {
null_msg = &(oh->mesg[oh->nmesgs++]);
null_msg->type = H5O_MSG_NULL;
null_msg->native = NULL;
- null_msg->raw_size = new_gap_size - H5O_SIZEOF_MSGHDR_OH(oh);
+ null_msg->raw_size = new_gap_size - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
null_msg->raw = (oh->chunk[chunkno].image + oh->chunk[chunkno].size)
- (H5O_SIZEOF_CHKSUM_OH(oh) + null_msg->raw_size);
null_msg->chunkno = chunkno;
@@ -297,7 +297,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
}
else if(move_end == move_start && !null_before_gap) {
/* Slide null message up */
- HDmemmove(move_start - gap_size, move_start, mesg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ HDmemmove(move_start - gap_size, move_start, mesg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Adjust start of null message */
mesg->raw -= gap_size;
@@ -371,7 +371,7 @@ H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned null_idx,
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
} /* end if */
else {
- size_t new_mesg_size = new_size + H5O_SIZEOF_MSGHDR_OH(oh); /* Total size of newly allocated message */
+ size_t new_mesg_size = new_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh); /* Total size of newly allocated message */
H5O_mesg_t *null_msg; /* Pointer to new null message */
/* Check if we need to extend message table to hold the new null message */
@@ -553,7 +553,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
delta = aligned_size - oh->mesg[extend_msg].raw_size;
} /* end if */
else
- delta = (aligned_size + H5O_SIZEOF_MSGHDR_OH(oh)) - oh->chunk[chunkno].gap;
+ delta = (aligned_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) - oh->chunk[chunkno].gap;
delta = H5O_ALIGN_OH(oh, delta);
/* Check for changing the chunk #0 data size enough to need adjusting the flags */
@@ -626,7 +626,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
oh->mesg[extend_msg].raw = ((oh->chunk[chunkno].image + oh->chunk[chunkno].size)
- (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[chunkno].gap))
+ H5O_SIZEOF_MSGHDR_OH(oh);
- oh->mesg[extend_msg].raw_size = (delta + oh->chunk[chunkno].gap) - H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[extend_msg].raw_size = (delta + oh->chunk[chunkno].gap) - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[extend_msg].chunkno = chunkno;
} /* end else */
@@ -817,7 +817,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
for(v = 0, tmp_msg = &oh->mesg[0]; v < oh->nmesgs; v++, tmp_msg++) {
if(tmp_msg->type->id == H5O_NULL_ID && (tmp_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh)) == end_msg) {
null_msgno = v;
- null_size = H5O_SIZEOF_MSGHDR_OH(oh) + tmp_msg->raw_size;
+ null_size = (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + tmp_msg->raw_size;
break;
} /* end if */
@@ -854,7 +854,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
/* Keep track of the total size of smaller messages in the last
* chunk, in case we need to move more than 1 message.
*/
- multi_size += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
+ multi_size += curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
} /* end else */
} /* end for */
if(found_null >= 0 || found_attr.msgno >= 0 || found_other.msgno >= 0)
@@ -876,7 +876,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
found_other = found_attr;
HDassert(found_other.msgno >= 0);
- size += H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
+ size += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
} /* end if */
} /* end if */
else
@@ -887,7 +887,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
* for the message header. This must be at least some minimum and
* aligned propertly.
*/
- size = MAX(H5O_MIN_SIZE, size + H5O_SIZEOF_MSGHDR_OH(oh));
+ size = MAX(H5O_MIN_SIZE, size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
HDassert(size == H5O_ALIGN_OH(oh, size));
/*
@@ -961,16 +961,16 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
} /* end if */
else {
/* Copy the raw data */
- HDmemcpy(p, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh),
- curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ HDmemcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh),
+ curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Update the message info */
curr_msg->chunkno = chunkno;
curr_msg->raw = p + H5O_SIZEOF_MSGHDR_OH(oh);
/* Account for copied message in new chunk */
- p += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
- size -= H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ p += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ size -= (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
} /* end else */
} /* end if */
@@ -984,8 +984,8 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
+ ((chunkno == 1) ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh))
- H5O_SIZEOF_CHKSUM_OH(oh) + H5O_SIZEOF_MSGHDR_OH(oh);
null_msg->raw_size = oh->chunk[chunkno - 1].size
- - ((chunkno == 1) ? (size_t)H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh))
- - H5O_SIZEOF_MSGHDR_OH(oh);
+ - ((chunkno == 1) ? (size_t)H5O_SIZEOF_HDR(oh) : (size_t)H5O_SIZEOF_CHKHDR_OH(oh))
+ - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
null_msg->chunkno = chunkno - 1;
HDassert(null_msg->raw_size >= cont_size);
@@ -1017,15 +1017,15 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
/* Copy the message to move (& its prefix) to its new location */
HDmemcpy(p, oh->mesg[found_other.msgno].raw - H5O_SIZEOF_MSGHDR_OH(oh),
- oh->mesg[found_other.msgno].raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ oh->mesg[found_other.msgno].raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Switch moved message to point to new location */
oh->mesg[found_other.msgno].raw = p + H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[found_other.msgno].chunkno = chunkno;
/* Account for copied message in new chunk */
- p += H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
- size -= H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
+ p += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
+ size -= (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
/* Add any available space after the message to move to the new null message */
if(found_other.gap_size > 0) {
@@ -1309,7 +1309,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
/* Find size of all non-null messages in the chunk pointed to by the continuation message */
if(curr_msg->type->id != H5O_NULL_ID) {
HDassert(curr_msg->type->id != H5O_CONT_ID);
- nonnull_size += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
+ nonnull_size += curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
} /* end if */
} /* end if */
} /* end for */
@@ -1321,7 +1321,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
/* (Could count any null messages in the chunk w/the continuation
* message also, but that is pretty complex. -QAK)
*/
- if(nonnull_size && nonnull_size <= (gap_size + cont_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh))) {
+ if(nonnull_size && nonnull_size <= (gap_size + cont_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh))) {
uint8_t *move_start, *move_end; /* Pointers to area of messages to move */
unsigned cont_chunkno; /* Chunk number for continuation message */
@@ -1347,7 +1347,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
size_t move_size; /* Size of the message to be moved */
/* Compute size of message to move */
- move_size = curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
+ move_size = curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
/* Move message out of deleted chunk */
HDmemcpy(move_start, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size);
@@ -1368,7 +1368,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
gap_size += (size_t)(move_end - move_start);
if(gap_size >= (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) {
/* Adjust size of null (was continuation) message */
- cont_msg->raw_size = gap_size - H5O_SIZEOF_MSGHDR_OH(oh);
+ cont_msg->raw_size = gap_size - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
cont_msg->raw = move_start + H5O_SIZEOF_MSGHDR_OH(oh);
cont_msg->dirty = TRUE;
chk_dirtied = TRUE;
@@ -1442,6 +1442,10 @@ done:
static htri_t
H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
{
+ H5O_chunk_proxy_t *null_chk_proxy = NULL; /* Chunk that null message is in */
+ H5O_chunk_proxy_t *curr_chk_proxy = NULL; /* Chunk that message is in */
+ hbool_t null_chk_dirtied = FALSE; /* Flags for unprotecting null chunk */
+ hbool_t curr_chk_dirtied = FALSE; /* Flags for unprotecting curr chunk */
hbool_t packed_msg; /* Flag to indicate that messages were packed */
hbool_t did_packing = FALSE; /* Whether any messages were packed */
htri_t ret_value; /* Return value */
@@ -1482,15 +1486,13 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Don't swap messages if the second message is also a null message */
/* (We'll merge them together later, in another routine) */
if(H5O_NULL_ID != nonnull_msg->type->id) {
- H5O_chunk_proxy_t *null_chk_proxy; /* Chunk that message is in */
-
/* Protect chunk */
if(NULL == (null_chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, curr_msg->chunkno)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Copy raw data for non-null message to new location */
HDmemmove(curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh),
- nonnull_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), nonnull_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ nonnull_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), nonnull_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Adjust non-null message's offset in chunk */
nonnull_msg->raw = curr_msg->raw;
@@ -1506,6 +1508,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ null_chk_proxy = NULL;
/* Set the flag to indicate that the null message
* was packed - if its not at the end its chunk,
@@ -1544,10 +1547,6 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
for(v = 0, null_msg = &oh->mesg[0]; v < oh->nmesgs; v++, null_msg++) {
if(H5O_NULL_ID == null_msg->type->id && curr_msg->chunkno > null_msg->chunkno
&& curr_msg->raw_size <= null_msg->raw_size) {
- H5O_chunk_proxy_t *null_chk_proxy; /* Chunk that null message is in */
- H5O_chunk_proxy_t *curr_chk_proxy; /* Chunk that message is in */
- unsigned null_chk_dirtied = FALSE; /* Flags for unprotecting null chunk */
- unsigned curr_chk_dirtied = FALSE; /* Flags for unprotecting curr chunk */
unsigned old_chunkno; /* Old message information */
uint8_t *old_raw;
@@ -1562,7 +1561,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Copy raw data for non-null message to new chunk */
- HDmemcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ HDmemcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Point non-null message at null message's space */
curr_msg->chunkno = null_msg->chunkno;
@@ -1583,6 +1582,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release current chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_dirtied) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ curr_chk_proxy = NULL;
+ curr_chk_dirtied = FALSE;
/* Check for gap in null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
@@ -1596,6 +1597,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release null chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_dirtied) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ null_chk_proxy = NULL;
+ null_chk_dirtied = FALSE;
} /* end if */
else {
unsigned new_null_msg; /* Message index for new null message */
@@ -1620,8 +1623,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
} /* end if */
else {
/* Adjust null message's size & offset */
- null_msg->raw += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
- null_msg->raw_size -= curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
+ null_msg->raw += curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
+ null_msg->raw_size -= curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
/* Mark null message dirty */
null_msg->dirty = TRUE;
@@ -1643,6 +1646,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release null message's chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_dirtied) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ null_chk_proxy = NULL;
+ null_chk_dirtied = FALSE;
/* Initialize new null message to take over non-null message's location */
oh->mesg[new_null_msg].type = H5O_MSG_NULL;
@@ -1667,6 +1672,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release new null message's chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_dirtied) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ curr_chk_proxy = NULL;
+ curr_chk_dirtied = FALSE;
} /* end else */
/* Indicate that we packed messages */
@@ -1697,6 +1704,11 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
ret_value = (htri_t)did_packing;
done:
+ if(null_chk_proxy && H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_dirtied) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect null object header chunk")
+ if(curr_chk_proxy && H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_dirtied) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect current object header chunk")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_move_msgs_forward() */
@@ -1757,7 +1769,7 @@ H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
if((curr_msg->raw + curr_msg->raw_size) == (curr_msg2->raw - H5O_SIZEOF_MSGHDR_OH(oh))) {
/* Extend first null message length to cover second null message */
adj_raw = 0;
- adj_raw_size = H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size;
+ adj_raw_size = (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size;
/* Message has been merged */
merged_msg = TRUE;
@@ -1765,8 +1777,8 @@ H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Check for second message before first message */
else if((curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh)) == (curr_msg2->raw + curr_msg2->raw_size)) {
/* Adjust first message address and extend length to cover second message */
- adj_raw = -((ssize_t)(H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size));
- adj_raw_size = H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size;
+ adj_raw = -((ssize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size));
+ adj_raw_size = (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size;
/* Message has been merged */
merged_msg = TRUE;
@@ -1877,7 +1889,7 @@ H5O_remove_empty_chunks(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
* its not the "base" chunk), delete that chunk from object header
*/
if(H5O_NULL_ID == null_msg->type->id && null_msg->chunkno > 0 &&
- (H5O_SIZEOF_MSGHDR_OH(oh) + null_msg->raw_size)
+ ((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + null_msg->raw_size)
== (oh->chunk[null_msg->chunkno].size - H5O_SIZEOF_CHKHDR_OH(oh))) {
H5O_mesg_t *curr_msg; /* Pointer to current message to operate on */
unsigned null_msg_no; /* Message # for null message */
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index f4cac40..323bec9 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -246,15 +246,15 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* Version */
HDassert(sdim->version > 0);
HDassert(sdim->type != H5S_NULL || sdim->version >= H5O_SDSPACE_VERSION_2);
- *p++ = sdim->version;
+ *p++ = (uint8_t)sdim->version;
/* Rank */
- *p++ = sdim->rank;
+ *p++ = (uint8_t)sdim->rank;
/* Flags */
if(sdim->max)
flags |= H5S_VALID_MAX;
- *p++ = flags;
+ *p++ = (uint8_t)flags;
/* Dataspace type */
if(sdim->version > H5O_SDSPACE_VERSION_1)
@@ -319,7 +319,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest)
done:
if(NULL == ret_value)
- if(dest && NULL != _dest)
+ if(dest && NULL == _dest)
dest = H5FL_FREE(H5S_extent_t, dest);
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index a4fe5a3..628512f 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -327,7 +327,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->u.hyp.diminfo[curr_dim].count = tdiminfo[i].count;
iter->u.hyp.diminfo[curr_dim].block = tdiminfo[i].block * acc;
iter->u.hyp.size[curr_dim] = mem_size[i] * acc;
- iter->u.hyp.sel_off[curr_dim] = space->select.offset[i] * acc;
+ iter->u.hyp.sel_off[curr_dim] = space->select.offset[i] * (hssize_t)acc;
/* Reset the "last dim flattened" flag to avoid flattened any further dimensions */
last_dim_flattened = 0;
@@ -2662,10 +2662,10 @@ H5S_hyper_bounds_helper(const H5S_hyper_span_info_t *spans, const hssize_t *offs
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Check if the current span extends the bounding box */
- if((curr->low + offset[rank]) < start[rank])
- start[rank] = curr->low + offset[rank];
- if((curr->high + offset[rank]) > end[rank])
- end[rank] = curr->high + offset[rank];
+ if((curr->low + (hsize_t)offset[rank]) < start[rank])
+ start[rank] = curr->low + (hsize_t)offset[rank];
+ if((curr->high + (hsize_t)offset[rank]) > end[rank])
+ end[rank] = curr->high + (hsize_t)offset[rank];
/* Recurse if this node has down spans */
if(curr->down != NULL) {
@@ -2739,10 +2739,10 @@ H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Compute the smallest location in this dimension */
- start[i] = diminfo[i].start + space->select.offset[i];
+ start[i] = diminfo[i].start + (hsize_t)space->select.offset[i];
/* Compute the largest location in this dimension */
- end[i] = diminfo[i].start + diminfo[i].stride * (diminfo[i].count - 1) + (diminfo[i].block - 1) + space->select.offset[i];
+ end[i] = diminfo[i].start + diminfo[i].stride * (diminfo[i].count - 1) + (diminfo[i].block - 1) + (hsize_t)space->select.offset[i];
} /* end for */
} /* end if */
else {
@@ -2812,7 +2812,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Add the hyperslab's offset in this dimension to the total linear offset */
- *offset += hyp_offset * accum;
+ *offset += (hsize_t)(hyp_offset * (hssize_t)accum);
/* Increase the accumulator */
accum *= dim_size[i];
@@ -2845,7 +2845,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Add the hyperslab's offset in this dimension to the total linear offset */
- *offset += hyp_offset * dim_accum[i];
+ *offset += (hsize_t)(hyp_offset * (hssize_t)dim_accum[i]);
/* Advance to first span in "down" dimension */
if(span->down) {
@@ -4436,8 +4436,8 @@ H5S_hyper_adjust_helper_s(H5S_hyper_span_info_t *spans, const hssize_t *offset)
while(span != NULL) {
/* Adjust span offset */
HDassert((hssize_t)span->low >= *offset);
- span->low -= *offset;
- span->high -= *offset;
+ span->low = (hsize_t)((hssize_t)span->low - *offset);
+ span->high = (hsize_t)((hssize_t)span->high - *offset);
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
@@ -4474,32 +4474,32 @@ herr_t
H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
{
unsigned u; /* Local index variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_s);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_s)
- assert(space);
- assert(offset);
+ HDassert(space);
+ HDassert(offset);
/* Subtract the offset from the "regular" coordinates, if they exist */
if(space->select.sel_info.hslab->diminfo_valid) {
- for(u=0; u<space->extent.rank; u++) {
- assert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]);
- space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u];
+ for(u = 0; u < space->extent.rank; u++) {
+ HDassert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]);
+ space->select.sel_info.hslab->opt_diminfo[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start - offset[u]);
} /* end for */
} /* end if */
/* Subtract the offset from the span tree coordinates, if they exist */
if(space->select.sel_info.hslab->span_lst) {
- if(H5S_hyper_adjust_helper_s(space->select.sel_info.hslab->span_lst,offset)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment");
+ if(H5S_hyper_adjust_helper_s(space->select.sel_info.hslab->span_lst, offset) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment")
/* Reset the scratch pointers for the next routine which needs them */
H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst, NULL);
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_adjust_s() */
@@ -7552,17 +7552,17 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
hsize_t slab[H5O_LAYOUT_NDIMS]; /* Cumulative size of each dimension in bytes */
- hsize_t acc; /* Accumulator for computing cumulative sizes */
- hsize_t loc_off; /* Element offset in the dataspace */
- hsize_t last_span_end=0; /* The offset of the end of the last span */
+ hsize_t acc; /* Accumulator for computing cumulative sizes */
+ hsize_t loc_off; /* Element offset in the dataspace */
+ hsize_t last_span_end = 0; /* The offset of the end of the last span */
hsize_t *abs_arr; /* Absolute hyperslab span position */
const hssize_t *off_arr; /* Offset within the dataspace extent */
- size_t span_size=0; /* Number of bytes in current span to actually process */
- size_t io_left; /* Number of elements left to process */
+ size_t span_size = 0; /* Number of bytes in current span to actually process */
+ size_t io_left; /* Number of elements left to process */
size_t io_bytes_left; /* Number of bytes left to process */
- size_t io_used; /* Number of elements processed */
- size_t curr_seq=0; /* Number of sequence/offsets stored in the arrays */
- size_t elem_size; /* Size of each element iterating over */
+ size_t io_used; /* Number of elements processed */
+ size_t curr_seq = 0; /* Number of sequence/offsets stored in the arrays */
+ size_t elem_size; /* Size of each element iterating over */
unsigned ndims; /* Number of dimensions of dataset */
unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
int curr_dim; /* Current dimension being operated on */
@@ -7606,7 +7606,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
/* Set the offset of the first element iterated on */
for(u = 0, loc_off = 0; u < ndims; u++)
/* Compute the sequential element offset */
- loc_off += (abs_arr[u] + off_arr[u]) * slab[u];
+ loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
/* Range check against number of elements left in selection */
HDassert(io_bytes_left <= (iter->elmt_left * elem_size));
@@ -7738,7 +7738,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
/* Reset the buffer offset */
for(u = 0, loc_off = 0; u < ndims; u++)
- loc_off += (abs_arr[u] + off_arr[u]) * slab[u];
+ loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
} /* end else */
else
/* We had better be done with I/O or bad things are going to happen... */
@@ -7772,25 +7772,18 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
/* Store the I/O information for the span */
/* Check if this is appending onto previous sequence */
- if(curr_seq>0 && last_span_end==loc_off)
- len[curr_seq-1]+=span_size;
+ if(curr_seq > 0 && last_span_end == loc_off)
+ len[curr_seq - 1] += span_size;
else {
- off[curr_seq]=loc_off;
- len[curr_seq]=span_size;
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
/* Increment the number of sequences in arrays */
curr_seq++;
} /* end else */
/* Set the location of the last span's end */
- last_span_end=loc_off+span_size;
-
- /* If the sequence & offset arrays are full, do what? */
- if(curr_seq>=maxseq) {
- /* Break out now, we are finished with sequences */
- break;
-
- } /* end else */
+ last_span_end = loc_off + span_size;
/* end COMMON */
/* Break out now, we are finished with I/O */
@@ -7798,31 +7791,31 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
} /* end if */
else {
/* Decrement I/O left to perform */
- io_bytes_left-=span_size;
+ io_bytes_left -= span_size;
/* COMMON */
/* Store the I/O information for the span */
/* Check if this is appending onto previous sequence */
- if(curr_seq>0 && last_span_end==loc_off)
+ if(curr_seq > 0 && last_span_end == loc_off)
len[curr_seq-1]+=span_size;
else {
- off[curr_seq]=loc_off;
- len[curr_seq]=span_size;
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
/* Increment the number of sequences in arrays */
curr_seq++;
} /* end else */
/* Set the location of the last span's end */
- last_span_end=loc_off+span_size;
+ last_span_end = loc_off + span_size;
+/* end COMMON */
/* If the sequence & offset arrays are full, do what? */
- if(curr_seq>=maxseq) {
+ if(curr_seq >= maxseq) {
/* Break out now, we are finished with sequences */
break;
} /* end else */
-/* end COMMON */
} /* end else */
/* Move to next span in fastest changing dimension */
@@ -7925,7 +7918,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
/* Reset the buffer offset */
for(u = 0, loc_off = 0; u < ndims; u++)
- loc_off += (abs_arr[u] + off_arr[u]) * slab[u];
+ loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
} /* end while */
/* Decrement number of elements left in iterator */
@@ -7973,7 +7966,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
+H5S_hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
hsize_t *off, size_t *len)
{
@@ -8011,20 +8004,20 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
size_t start_io_left; /* The initial number of elements left in I/O operation */
size_t elem_size; /* Size of each element iterating over */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_opt);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_opt)
/* Check args */
- assert(space);
- assert(iter);
- assert(maxseq>0);
- assert(maxelem>0);
- assert(nseq);
- assert(nelem);
- assert(off);
- assert(len);
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
/* Set the local copy of the diminfo pointer */
- tdiminfo=iter->u.hyp.diminfo;
+ tdiminfo = iter->u.hyp.diminfo;
/* Check if this is a "flattened" regular hyperslab selection */
if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
@@ -8079,11 +8072,11 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Compute the initial buffer offset */
for(u = 0, loc = 0; u < ndims; u++)
- loc += (iter->u.hyp.off[u] + sel_off[u]) * slab[u];
+ loc += ((hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u])) * slab[u];
/* Add a new sequence */
- off[curr_seq]=loc;
- H5_ASSIGN_OVERFLOW(len[curr_seq],actual_elem*elem_size,hsize_t,size_t);
+ off[curr_seq] = loc;
+ H5_ASSIGN_OVERFLOW(len[curr_seq], actual_elem * elem_size, hsize_t, size_t);
/* Increment sequence count */
curr_seq++;
@@ -8092,10 +8085,10 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
io_left -= actual_elem;
/* Advance the hyperslab iterator */
- H5S_hyper_iter_next(iter,actual_elem);
+ H5S_hyper_iter_next(iter, actual_elem);
/* Decrement the number of elements left in selection */
- iter->elmt_left-=actual_elem;
+ iter->elmt_left -= actual_elem;
} /* end if */
/* Now that we've cleared the "remainder" of the previous fastest dimension
@@ -8103,16 +8096,16 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
* algorithm to compute the offsets and run through as many as possible,
* until the buffer fills up.
*/
- if(io_left>0 && curr_seq<maxseq) { /* Just in case the "remainder" above filled the buffer */
+ if(io_left > 0 && curr_seq < maxseq) { /* Just in case the "remainder" above filled the buffer */
/* Keep the number of elements we started with */
- nelmts=io_left;
+ nelmts = io_left;
/* Compute the arrays to perform I/O on */
/* Copy the location of the point to get */
/* (Add in the selection offset) */
for(u = 0; u < ndims; u++)
- offset[u] = iter->u.hyp.off[u] + sel_off[u];
+ offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
/* Compute the current "counts" for this location */
for(u = 0; u < ndims; u++) {
@@ -8137,18 +8130,18 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
actual_bytes=actual_elem*elem_size;
/* Set local copies of information for the fastest changing dimension */
- fast_dim_start=tdiminfo[fast_dim].start;
- fast_dim_stride=tdiminfo[fast_dim].stride;
- fast_dim_block=tdiminfo[fast_dim].block;
- H5_ASSIGN_OVERFLOW(fast_dim_buf_off,slab[fast_dim]*fast_dim_stride,hsize_t,size_t);
- fast_dim_offset=fast_dim_start+sel_off[fast_dim];
+ fast_dim_start = tdiminfo[fast_dim].start;
+ fast_dim_stride = tdiminfo[fast_dim].stride;
+ fast_dim_block = tdiminfo[fast_dim].block;
+ H5_ASSIGN_OVERFLOW(fast_dim_buf_off, slab[fast_dim] * fast_dim_stride, hsize_t, size_t);
+ fast_dim_offset = (hsize_t)((hssize_t)fast_dim_start + sel_off[fast_dim]);
/* Compute the number of blocks which would fit into the buffer */
- H5_CHECK_OVERFLOW(io_left/fast_dim_block,hsize_t,size_t);
- tot_blk_count=(size_t)(io_left/fast_dim_block);
+ H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
+ tot_blk_count = (size_t)(io_left / fast_dim_block);
/* Don't go over the maximum number of sequences allowed */
- tot_blk_count=MIN(tot_blk_count,(maxseq-curr_seq));
+ tot_blk_count = MIN(tot_blk_count, (maxseq - curr_seq));
/* Compute the amount to wrap at the end of each row */
for(u = 0; u < ndims; u++)
@@ -8159,9 +8152,9 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
skip[u] = (tdiminfo[u].stride - tdiminfo[u].block) * slab[u];
/* Check if there is a partial row left (with full blocks) */
- if(tmp_count[fast_dim]>0) {
+ if(tmp_count[fast_dim] > 0) {
/* Get number of blocks in fastest dimension */
- H5_ASSIGN_OVERFLOW(fast_dim_count,tdiminfo[fast_dim].count-tmp_count[fast_dim],hsize_t,size_t);
+ H5_ASSIGN_OVERFLOW(fast_dim_count, tdiminfo[fast_dim].count - tmp_count[fast_dim], hsize_t, size_t);
/* Make certain this entire row will fit into buffer */
fast_dim_count=MIN(fast_dim_count,tot_blk_count);
@@ -8205,29 +8198,29 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Increment the offset and count for the other dimensions */
temp_dim = (int)fast_dim - 1;
- while(temp_dim>=0) {
+ while(temp_dim >= 0) {
/* Move to the next row in the curent dimension */
offset[temp_dim]++;
tmp_block[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim]<tdiminfo[temp_dim].block)
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
break;
else {
/* Move to the next block in the current dimension */
- offset[temp_dim]+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block);
+ offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
loc += skip[temp_dim];
- tmp_block[temp_dim]=0;
+ tmp_block[temp_dim] = 0;
tmp_count[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
break;
else {
- offset[temp_dim]=tdiminfo[temp_dim].start+sel_off[temp_dim];
+ offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
loc += wrap[temp_dim];
- tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- tmp_block[temp_dim]=0;
+ tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
+ tmp_block[temp_dim] = 0;
} /* end else */
} /* end else */
@@ -8237,13 +8230,13 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
} /* end if */
else {
/* Update the offset in the fastest dimension */
- offset[fast_dim]+=(fast_dim_stride*act_blk_count);
+ offset[fast_dim] += (fast_dim_stride * act_blk_count);
} /* end else */
} /* end if */
/* Compute the number of entire rows to read in */
- H5_CHECK_OVERFLOW( tot_blk_count/tdiminfo[fast_dim].count ,hsize_t,size_t);
- curr_rows=total_rows=(size_t)(tot_blk_count/tdiminfo[fast_dim].count);
+ H5_CHECK_OVERFLOW(tot_blk_count / tdiminfo[fast_dim].count, hsize_t, size_t);
+ curr_rows = total_rows = (size_t)(tot_blk_count / tdiminfo[fast_dim].count);
/* Reset copy of number of blocks in fastest dimension */
H5_ASSIGN_OVERFLOW(fast_dim_count,tdiminfo[fast_dim].count,hsize_t,size_t);
@@ -8253,14 +8246,14 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
#define DUFF_GUTS \
/* Store the sequence information */ \
- off[curr_seq]=loc; \
- len[curr_seq]=actual_bytes; \
+ off[curr_seq] = loc; \
+ len[curr_seq] = actual_bytes; \
\
/* Increment sequence count */ \
curr_seq++; \
\
/* Increment information to reflect block just processed */ \
- loc+=fast_dim_buf_off;
+ loc += fast_dim_buf_off;
#ifdef NO_DUFFS_DEVICE
/* Loop over all the blocks in the fastest changing dimension */
@@ -8305,29 +8298,29 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Increment the offset and count for the other dimensions */
temp_dim = (int)fast_dim - 1;
- while(temp_dim>=0) {
+ while(temp_dim >= 0) {
/* Move to the next row in the curent dimension */
offset[temp_dim]++;
tmp_block[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim]<tdiminfo[temp_dim].block)
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
break;
else {
/* Move to the next block in the current dimension */
- offset[temp_dim]+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block);
+ offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
loc += skip[temp_dim];
- tmp_block[temp_dim]=0;
+ tmp_block[temp_dim] = 0;
tmp_count[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
break;
else {
- offset[temp_dim]=tdiminfo[temp_dim].start+sel_off[temp_dim];
+ offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
loc += wrap[temp_dim];
- tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- tmp_block[temp_dim]=0;
+ tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
+ tmp_block[temp_dim] = 0;
} /* end else */
} /* end else */
@@ -8342,8 +8335,8 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Adjust the number of blocks & elements left to transfer */
/* Decrement number of elements left */
- H5_CHECK_OVERFLOW( actual_elem*(total_rows*tdiminfo[fast_dim].count) ,hsize_t,size_t);
- io_left -= (size_t)(actual_elem*(total_rows*tdiminfo[fast_dim].count));
+ H5_CHECK_OVERFLOW(actual_elem * (total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
+ io_left -= (size_t)(actual_elem * (total_rows * tdiminfo[fast_dim].count));
/* Decrement number of blocks left */
H5_CHECK_OVERFLOW( (total_rows*tdiminfo[fast_dim].count) ,hsize_t,size_t);
@@ -8404,7 +8397,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Update the iterator with the location we stopped */
/* (Subtract out the selection offset) */
for(u = 0; u < ndims; u++)
- iter->u.hyp.off[u] = offset[u] - sel_off[u];
+ iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
/* Decrement the number of elements left in selection */
iter->elmt_left -= (nelmts - io_left);
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 762b316..8028123 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -555,7 +555,7 @@ static H5Z_node *
H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
{
H5Z_node *expr;
- void* ret_value;
+ H5Z_node *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5Z_parse_expression)
@@ -566,7 +566,7 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
current = H5Z_get_token(current);
- switch (current->tok_type) {
+ switch(current->tok_type) {
case H5Z_XFORM_PLUS:
new_node = H5Z_new_node(H5Z_XFORM_PLUS);
@@ -612,6 +612,13 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
case H5Z_XFORM_END:
HGOTO_DONE(expr)
+ case H5Z_XFORM_ERROR:
+ case H5Z_XFORM_INTEGER:
+ case H5Z_XFORM_FLOAT:
+ case H5Z_XFORM_SYMBOL:
+ case H5Z_XFORM_MULT:
+ case H5Z_XFORM_DIVIDE:
+ case H5Z_XFORM_LPAREN:
default:
H5Z_xform_destroy_parse_tree(expr);
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
@@ -1101,54 +1108,69 @@ done:
static hid_t
H5Z_xform_find_type(const H5T_t* type)
{
- hid_t ret_value = SUCCEED;
+ H5T_t *tmp; /* Temporary datatype */
+ hid_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5Z_xform_find_type)
HDassert(type);
/* Check for SHORT type */
- if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SHORT, H5I_DATATYPE), FALSE)) == 0)
+ if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_SHORT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_SHORT)
/* Check for INT type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_INT, H5I_DATATYPE), FALSE)) == 0)
- HGOTO_DONE(H5T_NATIVE_INT)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_INT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
+ HGOTO_DONE(H5T_NATIVE_INT)
/* Check for LONG type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LONG, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_LONG, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LONG)
/* Check for LONGLONG type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LLONG, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_LLONG, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LLONG)
/* Check for UCHAR type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UCHAR, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_UCHAR, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_UCHAR)
/* Check for CHAR type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_CHAR, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_CHAR, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_CHAR)
/* Check for SCHAR type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SCHAR, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_SCHAR, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_SCHAR)
/* Check for USHORT type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_USHORT, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_USHORT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_USHORT)
/* Check for UINT type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UINT, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_UINT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_UINT)
/* Check for ULONG type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULONG, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_ULONG, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_ULONG)
/* Check for ULONGLONG type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULLONG, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_ULLONG, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_ULLONG)
/* Check for FLOAT type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_FLOAT, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_FLOAT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_FLOAT)
/* Check for DOUBLE type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_DOUBLE, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_DOUBLE, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_DOUBLE)
#if H5_SIZEOF_LONG_DOUBLE !=0
/* Check for LONGDOUBLE type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LDOUBLE, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_LDOUBLE, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LDOUBLE)
#endif
else
diff --git a/test/dtypes.c b/test/dtypes.c
index 3af2b8a..e42c243 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -25,9 +25,6 @@
#include "h5test.h"
#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
-/* Number of times to run each test */
-#define NTESTS 1
-
/* Number of elements in each test */
#define NTESTELEM 100000
@@ -184,64 +181,64 @@ test_classes(void)
hid_t memb_id; /* Compound member datatype */
H5T_class_t memb_cls;
H5T_class_t tcls;
- unsigned int nmembs, i;
+ int nmembs;
+ unsigned u;
TESTING("H5Tget_class()");
/*-------------------------------------------------------------
* Check class of some atomic types.
*-----------------------------------------------------------*/
- if ((tcls=H5Tget_class(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if (H5T_INTEGER!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5T_INTEGER != tcls) TEST_ERROR
- if ((tcls=H5Tget_class(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR
- if (H5T_FLOAT!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR
+ if(H5T_FLOAT != tcls) TEST_ERROR
/* Create a VL datatype of char. It should be a VL, not a string class. */
- if((vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR
+ if((vlc_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR
/* Make certain that the correct classes can be detected */
- if ((tcls=H5Tget_class(vlc_id)) < 0) TEST_ERROR
- if (H5T_VLEN!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(vlc_id)) < 0) TEST_ERROR
+ if(H5T_VLEN != tcls) TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if (H5T_STRING==tcls) TEST_ERROR
+ if(H5T_STRING == tcls) TEST_ERROR
/* Create a VL string. It should be a string, not a VL class. */
- if((vls_id=H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
+ if((vls_id = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
if(H5Tset_size(vls_id, H5T_VARIABLE) < 0) TEST_ERROR;
/* Make certain that the correct classes can be detected */
- if ((tcls=H5Tget_class(vls_id)) < 0) TEST_ERROR
- if (H5T_STRING!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(vls_id)) < 0) TEST_ERROR
+ if(H5T_STRING != tcls) TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if (H5T_VLEN==tcls) TEST_ERROR
+ if(H5T_VLEN == tcls) TEST_ERROR
/*-------------------------------------------------------------
* Check class for member types of compound type.
*-----------------------------------------------------------*/
/* Create a compound datatype and insert some complex types */
- if ((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR
- if (H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0) TEST_ERROR
- if (H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0) TEST_ERROR
+ if((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0) TEST_ERROR
- nmembs = H5Tget_nmembers(cmpd_id);
+ if((nmembs = H5Tget_nmembers(cmpd_id)) < 0) TEST_ERROR
- for (i=0;i<nmembs;i++)
- {
+ for(u = 0; u < (unsigned)nmembs; u++) {
/* Get member type ID */
- if((memb_id = H5Tget_member_type(cmpd_id, i)) < 0) TEST_ERROR
+ if((memb_id = H5Tget_member_type(cmpd_id, u)) < 0) TEST_ERROR
/* Get member type class */
- if((memb_cls = H5Tget_member_class (cmpd_id, i)) < 0) TEST_ERROR
+ if((memb_cls = H5Tget_member_class (cmpd_id, u)) < 0) TEST_ERROR
/* Verify member class */
- if(H5Tdetect_class (memb_id, memb_cls) < 0) TEST_ERROR
+ if(H5Tdetect_class(memb_id, memb_cls) < 0) TEST_ERROR
/* Close member type ID */
if(H5Tclose(memb_id) < 0) TEST_ERROR
- }
+ } /* end for */
/* Close datatypes */
if(H5Tclose(cmpd_id) < 0) TEST_ERROR
@@ -2315,7 +2312,7 @@ test_compound_13(void)
float y;
};
struct s1 data_out, data_in;
- hid_t fileid, grpid, typeid, array1_tid, spaceid, attid;
+ hid_t fileid, grpid, dtypeid, array1_tid, spaceid, attid;
hid_t fapl_id;
hsize_t dims[1] = {COMPOUND13_ARRAY_SIZE + 1};
char filename[1024];
@@ -2340,24 +2337,24 @@ test_compound_13(void)
if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Create a compound type. */
- if((typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) FAIL_STACK_ERROR
+ if((dtypeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) FAIL_STACK_ERROR
if((array1_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, 1, dims)) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(typeid, "x", HOFFSET(struct s1, x), array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(typeid, "y", HOFFSET(struct s1, y), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(dtypeid, "x", HOFFSET(struct s1, x), array1_tid) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(dtypeid, "y", HOFFSET(struct s1, y), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
/* Create a space. */
if((spaceid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
/* Create an attribute of this compound type. */
- if((attid = H5Acreate2(grpid, COMPOUND13_ATTR_NAME, typeid, spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((attid = H5Acreate2(grpid, COMPOUND13_ATTR_NAME, dtypeid, spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Write some data. */
- if(H5Awrite(attid, typeid, &data_out) < 0) FAIL_STACK_ERROR
+ if(H5Awrite(attid, dtypeid, &data_out) < 0) FAIL_STACK_ERROR
/* Release all resources. */
if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
if(H5Tclose(array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(typeid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(dtypeid) < 0) FAIL_STACK_ERROR
if(H5Sclose(spaceid) < 0) FAIL_STACK_ERROR
if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
@@ -2367,11 +2364,11 @@ test_compound_13(void)
if((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((attid = H5Aopen(grpid, COMPOUND13_ATTR_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((typeid = H5Aget_type(attid)) < 0) FAIL_STACK_ERROR
- if(H5Tget_class(typeid) != H5T_COMPOUND) FAIL_STACK_ERROR
- if(HOFFSET(struct s1, x) != H5Tget_member_offset(typeid, 0)) TEST_ERROR
- if(HOFFSET(struct s1, y) != H5Tget_member_offset(typeid, 1)) TEST_ERROR
- if(H5Aread(attid, typeid, &data_in) < 0) FAIL_STACK_ERROR
+ if((dtypeid = H5Aget_type(attid)) < 0) FAIL_STACK_ERROR
+ if(H5Tget_class(dtypeid) != H5T_COMPOUND) FAIL_STACK_ERROR
+ if(HOFFSET(struct s1, x) != H5Tget_member_offset(dtypeid, 0)) TEST_ERROR
+ if(HOFFSET(struct s1, y) != H5Tget_member_offset(dtypeid, 1)) TEST_ERROR
+ if(H5Aread(attid, dtypeid, &data_in) < 0) FAIL_STACK_ERROR
/* Check the data. */
for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
@@ -2380,7 +2377,7 @@ test_compound_13(void)
/* Release all resources. */
if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(typeid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(dtypeid) < 0) FAIL_STACK_ERROR
if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
@@ -4049,7 +4046,7 @@ test_conv_str_2(void)
char *buf = NULL, s[80];
hid_t c_type = -1;
hid_t f_type = -1;
- const size_t nelmts = NTESTELEM, ntests=NTESTS;
+ const size_t nelmts = NTESTELEM;
size_t i, j, nchars;
int ret_value = 1;
@@ -4068,19 +4065,14 @@ test_conv_str_2(void)
} /* end for */
/* Do the conversions */
- for(i = 0; i < ntests; i++) {
- if(ntests > 1)
- sprintf(s, "Testing random string conversion speed (test %d/%d)", (int)(i + 1), (int)ntests);
- else
- sprintf(s, "Testing random string conversion speed");
- printf("%-70s", s);
- HDfflush(stdout);
- if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
- goto error;
- if(H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
- goto error;
- PASSED();
- } /* end for */
+ sprintf(s, "Testing random string conversion speed");
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ if(H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ PASSED();
ret_value = 0;
@@ -4232,7 +4224,6 @@ static int
test_conv_enum_1(void)
{
const size_t nelmts=NTESTELEM;
- const int ntests=NTESTS;
int i, val, *buf=NULL;
hid_t t1 = -1;
hid_t t2 = -1;
@@ -4257,27 +4248,17 @@ test_conv_enum_1(void)
buf[u] = HDrand() % 26;
/* Conversions */
- for(i = 0; i < ntests; i++) {
- if(ntests > 1)
- sprintf(s, "Testing random enum conversion O(N) (test %d/%d)", i + 1, ntests);
- else
- sprintf(s, "Testing random enum conversion O(N)");
- printf("%-70s", s);
- HDfflush(stdout);
- if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
- } /* end for */
+ sprintf(s, "Testing random enum conversion O(N)");
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
- for(i = 0; i < ntests; i++) {
- if(ntests > 1)
- sprintf(s, "Testing random enum conversion O(N log N) (test %d/%d)", i + 1, ntests);
- else
- sprintf(s, "Testing random enum conversion O(N log N)");
- printf("%-70s", s);
- HDfflush(stdout);
- if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
- }
+ sprintf(s, "Testing random enum conversion O(N log N)");
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
ret_value = 0;
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index dd01d5b..69626c5 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -28,9 +28,6 @@
#include "H5private.h"
#include "h5tools.h"
-/* Name of tool */
-#define PROGRAMNAME "h5dumpgentest"
-
#define FILE1 "tgroup.h5"
#define FILE2 "tdset.h5"
#define FILE3 "tattr.h5"
@@ -482,15 +479,15 @@ static void gent_softlink(void)
#define NY 2
static int gent_softlink2(void)
{
- hid_t fileid1;
- hid_t gid1=0, gid2=0;
- hid_t tid;
- hid_t dset1, dset2;
- hid_t datatype, dataspace;
+ hid_t fileid1 = -1;
+ hid_t gid1 = -1, gid2 = -1;
+ hid_t datatype = -1;
+ hid_t dset1 = -1, dset2 = -1;
+ hid_t dataspace = -1;
hsize_t dimsf[2]; /* dataset dimensions */
- herr_t status=SUCCEED;
int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}};
int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
* FILE
@@ -526,8 +523,8 @@ static int gent_softlink2(void)
/*-----------------------------------------------------------------------
* Named datatype
*------------------------------------------------------------------------*/
- tid = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(fileid1, "dtype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ datatype = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
{
fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1);
@@ -547,16 +544,14 @@ static int gent_softlink2(void)
dataspace = H5Screate_simple(2, dimsf, NULL);
/*
- * Define datatype for the data in the file.
* We will store little endian INT numbers.
*/
- datatype = H5Tcopy(H5T_NATIVE_INT);
/*---------------
* dset1
*/
/* Create a new dataset as sample object */
- dset1 = H5Dcreate2(fileid1, "/dset1", datatype, dataspace,
+ dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (dset1 < 0)
{
@@ -577,7 +572,7 @@ static int gent_softlink2(void)
* dset2
*/
/* Create a new dataset as sample object */
- dset2 = H5Dcreate2(fileid1, "/dset2", datatype, dataspace,
+ dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (dset2 < 0)
{
@@ -700,10 +695,40 @@ out:
H5Sclose(dataspace);
H5Gclose(gid1);
H5Gclose(gid2);
- H5Tclose(datatype);
H5Dclose(dset1);
H5Dclose(dset2);
H5Fclose(fileid1);
+ /*
+ * Close/release resources.
+ */
+ if(dataspace >= 0 && H5Sclose(dataspace) < 0) {
+ fprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(gid1 >= 0 && H5Gclose(gid1) < 0) {
+ fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(gid2 >= 0 && H5Gclose(gid2) < 0) {
+ fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(datatype >= 0 && H5Tclose(datatype) < 0) {
+ fprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(dset1 >= 0 && H5Dclose(dset1) < 0) {
+ fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(dset2 >= 0 && H5Dclose(dset2) < 0) {
+ fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(fileid1 >= 0 && H5Fclose(fileid1) < 0) {
+ fprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
return status;
}
@@ -1357,7 +1382,8 @@ static void gent_loop2(void)
(dset1) (udlink)
*/
-static void gent_many(void)
+static void
+gent_many(void)
{
hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
hid_t array_dt;
@@ -1380,79 +1406,79 @@ static void gent_many(void)
hsize_t dim[4];
herr_t ret;
- fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- create_plist = H5Pcreate(H5P_DATASET_CREATE);
+ create_plist = H5Pcreate(H5P_DATASET_CREATE);
- sdim = 2;
- H5Pset_chunk(create_plist, 1, &sdim);
+ sdim = 2;
+ H5Pset_chunk(create_plist, 1, &sdim);
- group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
- dim[0] = dim[1] = dim[2] = dim[3] = 2;
- array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
- H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt);
- H5Tclose(array_dt);
+ dim[0] = dim[1] = dim[2] = dim[3] = 2;
+ array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
+ H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
- H5Tinsert(type, "b_array", HOFFSET(dset1_t, b), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
+ H5Tinsert(type, "b_array", HOFFSET(dset1_t, b), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
- H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
+ H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt);
+ H5Tclose(array_dt);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
- array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim);
- H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim);
+ H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
- H5Tinsert(type2, "b_array", HOFFSET(dset1_t, b), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
+ H5Tinsert(type2, "b_array", HOFFSET(dset1_t, b), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
- H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
+ H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt);
+ H5Tclose(array_dt);
- /* dset1 */
- sdim = 6;
- maxdim = H5S_UNLIMITED;
- space = H5Screate_simple(1, &sdim, &maxdim);
- dataset = H5Dcreate2(group, "dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+ /* dset1 */
+ sdim = 6;
+ maxdim = H5S_UNLIMITED;
+ space = H5Screate_simple(1, &sdim, &maxdim);
+ dataset = H5Dcreate2(group, "dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- /* add attributes to dset1 */
- dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- sprintf(buf, "abcdefghi");
- H5Awrite(attr, H5T_NATIVE_CHAR, buf);
- H5Sclose(space2);
- H5Aclose(attr);
+ /* add attributes to dset1 */
+ dims[0] = 10;
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "abcdefghi");
+ H5Awrite(attr, H5T_NATIVE_CHAR, buf);
+ H5Sclose(space2);
+ H5Aclose(attr);
- dims[0] = 2; dims[1] = 2;
- space2 = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
- H5Awrite(attr, H5T_NATIVE_INT, data);
- H5Sclose(space2);
- H5Aclose(attr);
+ dims[0] = 2; dims[1] = 2;
+ space2 = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ H5Awrite(attr, H5T_NATIVE_INT, data);
+ H5Sclose(space2);
+ H5Aclose(attr);
- dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- d[i] = 0.1 * i;
- H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
- H5Sclose(space2);
- H5Aclose(attr);
+ dims[0] = 10;
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ d[i] = 0.1 * i;
+ H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
+ H5Sclose(space2);
+ H5Aclose(attr);
for(j=0; j<(int)sdim; j++) {
for(i3 = 0; i3 < 2; i3++) {
@@ -1468,89 +1494,88 @@ static void gent_many(void)
}
}
- H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
- H5Dclose(dataset);
- H5Sclose(space);
+ H5Dclose(dataset);
+ H5Sclose(space);
- H5Tclose(type);
- H5Tclose(type2);
- H5Gclose(group);
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Lcreate_hard(group, "/g1/g1.1/dset1", H5L_SAME_LOC, "link1", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(group, "/g1/g1.1/dset1", H5L_SAME_LOC, "link1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Lcreate_soft("/g1", group, "slink2", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_soft("/g1", group, "slink2", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* dset2 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ /* dset2 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
- dataset = H5Dcreate2(group, "dset2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ dataset = H5Dcreate2(group, "dset2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
dset2[i][j] = j;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
- H5Dclose(dataset);
+ H5Dclose(dataset);
- H5Sclose(space);
- H5Gclose(group);
+ H5Sclose(space);
+ H5Gclose(group);
- group = H5Gopen2(fid, "/g3", H5P_DEFAULT);
- H5Lcreate_hard(group, "/g4/dset2", H5L_SAME_LOC, "link3", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gopen2(fid, "/g3", H5P_DEFAULT);
+ H5Lcreate_hard(group, "/g4/dset2", H5L_SAME_LOC, "link3", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* dset3 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* dset3 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
- dataset = H5Dcreate2(group, "dset3", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ dataset = H5Dcreate2(group, "dset3", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
dset3[i][j] = i;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
-
- H5Dclose(dataset);
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
- H5Sclose(space);
- H5Gclose(group);
+ H5Dclose(dataset);
- group = H5Gopen2(fid, "/g5", H5P_DEFAULT);
- H5Lcreate_soft("/g6/dset3", group, "slink4", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
- H5Pclose(create_plist);
+ H5Sclose(space);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
- group = H5Gcreate2(fid, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gopen2(fid, "/g5", H5P_DEFAULT);
+ H5Lcreate_soft("/g6/dset3", group, "slink4", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ H5Pclose(create_plist);
- /* Create dangling external and UD links */
- H5Lcreate_external("somefile", "somepath", fid, "/g8/elink", H5P_DEFAULT, H5P_DEFAULT);
- H5Lregister(UD_link_class);
- H5Lcreate_ud(fid, "/g8/udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- /* Create links to external and UD links */
- ret= H5Lcreate_soft("/g8/elink", fid, "/g7/slink5", H5P_DEFAULT, H5P_DEFAULT);
- HDassert(ret >= 0);
- ret= H5Lcreate_soft("/g8/udlink", fid, "/g7/slink6", H5P_DEFAULT, H5P_DEFAULT);
- HDassert(ret >= 0);
+ /* Create dangling external and UD links */
+ H5Lcreate_external("somefile", "somepath", fid, "/g8/elink", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid, "/g8/udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
- H5Fclose(fid);
+ /* Create links to external and UD links */
+ ret = H5Lcreate_soft("/g8/elink", fid, "/g7/slink5", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+ ret = H5Lcreate_soft("/g8/udlink", fid, "/g7/slink6", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+ H5Fclose(fid);
}
static hid_t mkstr(int size, H5T_str_t pad) {
@@ -2512,7 +2537,8 @@ static void gent_vldatatypes(void)
assert(ret >= 0);
}
-static void gent_vldatatypes2(void)
+static void
+gent_vldatatypes2(void)
{
hvl_t wdata[SPACE1_DIM1]; /* Information to write */
hvl_t *t1; /* Temporary pointer to VL information */
@@ -2525,16 +2551,16 @@ static void gent_vldatatypes2(void)
herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+1)*sizeof(hvl_t));
- if(wdata[i].p==NULL) {
- printf("Cannot allocate memory for VL data! i=%u\n",i);
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = (hvl_t *)malloc((i + 1) * sizeof(hvl_t));
+ if(wdata[i].p == NULL) {
+ printf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
- wdata[i].len=i+1;
- for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) {
- t1->p=malloc((j+1)*sizeof(unsigned int));
- if(t1->p==NULL) {
+ wdata[i].len = i + 1;
+ for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
+ t1->p = (unsigned *)malloc((j + 1) * sizeof(unsigned));
+ if(t1->p == NULL) {
printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
return;
} /* end if */