[svn-r7984] Purpose: bug fix

Description: VL datatype fails in certain way(hard to describe)


Platforms tested: h5committest
This commit is contained in:
Raymond Lu 2003-12-29 12:56:08 -05:00
parent 99e520c8cb
commit 16c51c2061
8 changed files with 27 additions and 16 deletions

View File

@ -35,7 +35,7 @@
/* Private headers needed by this file */ /* Private headers needed by this file */
/* Macros for turning off free lists in the library */ /* Macros for turning off free lists in the library */
/* #define H5_NO_FREE_LISTS */ #define H5_NO_FREE_LISTS
#ifdef H5_NO_FREE_LISTS #ifdef H5_NO_FREE_LISTS
#define H5_NO_REG_FREE_LISTS #define H5_NO_REG_FREE_LISTS
#define H5_NO_ARR_FREE_LISTS #define H5_NO_ARR_FREE_LISTS

View File

@ -38,6 +38,7 @@
#include "H5private.h" /* Generic Functions */ #include "H5private.h" /* Generic Functions */
#include "H5Bprivate.h" /* B-trees */ #include "H5Bprivate.h" /* B-trees */
#include "H5Fprivate.h" /* File access */ #include "H5Fprivate.h" /* File access */
#include "H5Gprivate.h" /* Group */
#include "H5RSprivate.h" /* Reference-counted strings */ #include "H5RSprivate.h" /* Reference-counted strings */
/* /*

View File

@ -970,6 +970,9 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
assert (hobj->idx>0 && hobj->idx<heap->nalloc); assert (hobj->idx>0 && hobj->idx<heap->nalloc);
if(!(heap->obj[hobj->idx].begin)) {
HDfprintf(stderr,"%s: hobj->idx=%d, heap=%p, heap->obj[hobj->idx].begin=%p\n",FUNC,hobj->idx,heap,heap->obj[hobj->idx].begin);
}
assert (heap->obj[hobj->idx].begin); assert (heap->obj[hobj->idx].begin);
obj_start = heap->obj[hobj->idx].begin; obj_start = heap->obj[hobj->idx].begin;
/* Include object header size */ /* Include object header size */

View File

@ -117,8 +117,6 @@ H5FL_DEFINE_STATIC(H5I_id_info_t);
/*--------------------- Local function prototypes ---------------------------*/ /*--------------------- Local function prototypes ---------------------------*/
static herr_t H5I_init_interface(void); static herr_t H5I_init_interface(void);
static H5I_id_info_t *H5I_find_id(hid_t id); static H5I_id_info_t *H5I_find_id(hid_t id);
static hid_t H5I_get_file_id(hid_t obj_id);
static int H5I_get_ref(hid_t id);
#ifdef H5I_DEBUG_OUTPUT #ifdef H5I_DEBUG_OUTPUT
static herr_t H5I_debug(H5I_type_t grp); static herr_t H5I_debug(H5I_type_t grp);
#endif /* H5I_DEBUG_OUTPUT */ #endif /* H5I_DEBUG_OUTPUT */
@ -844,7 +842,7 @@ done:
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
static hid_t hid_t
H5I_get_file_id(hid_t obj_id) H5I_get_file_id(hid_t obj_id)
{ {
H5G_entry_t *ent; H5G_entry_t *ent;
@ -1345,8 +1343,11 @@ H5I_find_id(hid_t id)
/* Check arguments */ /* Check arguments */
grp = H5I_GRP(id); grp = H5I_GRP(id);
if (grp <= H5I_BADID || grp >= H5I_NGROUPS)
if (grp <= H5I_BADID || grp >= H5I_NGROUPS) {
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid group number"); HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid group number");
}
grp_ptr = H5I_id_group_list_g[grp]; grp_ptr = H5I_id_group_list_g[grp];
if (grp_ptr == NULL || grp_ptr->count <= 0) if (grp_ptr == NULL || grp_ptr->count <= 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid group"); HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid group");

View File

@ -67,6 +67,7 @@ H5_DLL hid_t H5I_register(H5I_type_t grp, void *object);
H5_DLL void *H5I_object(hid_t id); H5_DLL void *H5I_object(hid_t id);
H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type);
H5_DLL H5I_type_t H5I_get_type(hid_t id); H5_DLL H5I_type_t H5I_get_type(hid_t id);
H5_DLL hid_t H5I_get_file_id(hid_t obj_id);
H5_DLL void *H5I_remove(hid_t id); H5_DLL void *H5I_remove(hid_t id);
H5_DLL void *H5I_search(H5I_type_t grp, H5I_search_func_t func, void *key); H5_DLL void *H5I_search(H5I_type_t grp, H5I_search_func_t func, void *key);
H5_DLL int H5I_inc_ref(hid_t id); H5_DLL int H5I_inc_ref(hid_t id);

View File

@ -183,12 +183,14 @@ H5T_bit_get_d (uint8_t *buf, size_t offset, size_t size)
hsize_t val=0; hsize_t val=0;
size_t i, hs; size_t i, hs;
hsize_t ret_value; /* Return value */ hsize_t ret_value; /* Return value */
void *pt;
FUNC_ENTER_NOAPI(H5T_bit_get_d, 0); FUNC_ENTER_NOAPI(H5T_bit_get_d, 0);
assert (8*sizeof(val)>=size); assert (8*sizeof(val)>=size);
H5T_bit_copy ((uint8_t*)&val, 0, buf, offset, size); H5T_bit_copy ((uint8_t*)&val, 0, buf, offset, size);
switch (((H5T_t*)(H5I_object(H5T_NATIVE_INT_g)))->u.atomic.order) { switch (((H5T_t*)(H5I_object(H5T_NATIVE_INT_g)))->u.atomic.order) {
case H5T_ORDER_LE: case H5T_ORDER_LE:
break; break;

View File

@ -2455,6 +2455,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
if(nested) { if(nested) {
uint8_t *tmp=bg_ptr; uint8_t *tmp=bg_ptr;
UINT32DECODE(tmp, bg_seq_len); UINT32DECODE(tmp, bg_seq_len);
if(bg_seq_len>0) { if(bg_seq_len>0) {
H5_CHECK_OVERFLOW( bg_seq_len*MAX(src_base_size,dst_base_size) ,hsize_t,size_t); H5_CHECK_OVERFLOW( bg_seq_len*MAX(src_base_size,dst_base_size) ,hsize_t,size_t);
if(tmp_buf_size<(size_t)(bg_seq_len*MAX(src_base_size, dst_base_size))) { if(tmp_buf_size<(size_t)(bg_seq_len*MAX(src_base_size, dst_base_size))) {
@ -2478,12 +2479,12 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* Convert VL sequence */ /* Convert VL sequence */
H5_CHECK_OVERFLOW(seq_len,hssize_t,hsize_t); H5_CHECK_OVERFLOW(seq_len,hssize_t,hsize_t);
if (H5T_convert(tpath, tsrc_id, tdst_id, (hsize_t)seq_len, 0, bkg_stride, conv_buf, tmp_buf, dxpl_id)<0)
if (H5T_convert(tpath, tsrc_id, tdst_id, (hsize_t)seq_len, 0, 0, conv_buf, tmp_buf, dxpl_id)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed");
/* Write sequence to destination location */ /* Write sequence to destination location */
if((*(dst->u.vlen.write))(dst->u.vlen.f,dxpl_id,d,conv_buf, bg_ptr, (hsize_t)seq_len,(hsize_t)dst_base_size)<0) if((*(dst->u.vlen.write))(dst->u.vlen.f,dxpl_id,d,conv_buf, bg_ptr, (hsize_t)seq_len,(hsize_t)dst_base_size)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data");
/* For nested VL case, free leftover heap objects from the deeper level if the length of new data elements is shorted than the old data elements.*/ /* For nested VL case, free leftover heap objects from the deeper level if the length of new data elements is shorted than the old data elements.*/
H5_CHECK_OVERFLOW(bg_seq_len,hsize_t,hssize_t); H5_CHECK_OVERFLOW(bg_seq_len,hsize_t,hssize_t);

View File

@ -818,16 +818,18 @@ H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, void *_bg, hs
HDmemset(&bg_hobjid,0,sizeof(H5HG_t)); HDmemset(&bg_hobjid,0,sizeof(H5HG_t));
UINT32DECODE(bg, bg_seq_len); UINT32DECODE(bg, bg_seq_len);
/* Get heap information */ if(bg_seq_len > 0) {
H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr)); /* Get heap information */
INT32DECODE(bg, bg_hobjid.idx); H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr));
INT32DECODE(bg, bg_hobjid.idx);
/* Free heap object for old data */ /* Free heap object for old data */
if(bg_hobjid.addr>0) { if(bg_hobjid.addr>0) {
/* Free heap object */ /* Free heap object */
if(H5HG_remove(f, dxpl_id, &bg_hobjid)<0) if(H5HG_remove(f, dxpl_id, &bg_hobjid)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
} /* end if */ } /* end if */
} /* end if */
} /* end if */ } /* end if */
/* Set the length of the sequence */ /* Set the length of the sequence */