summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2003-12-29 17:56:08 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2003-12-29 17:56:08 (GMT)
commit16c51c2061e8c8bacd890ee9543ffcfd552bfb88 (patch)
tree2480c58a8dbd9d0f62a4d117939da83e2f51b2ec /src
parent99e520c8cb3a5e33a5e85ff267fe53e98da1b61e (diff)
downloadhdf5-16c51c2061e8c8bacd890ee9543ffcfd552bfb88.zip
hdf5-16c51c2061e8c8bacd890ee9543ffcfd552bfb88.tar.gz
hdf5-16c51c2061e8c8bacd890ee9543ffcfd552bfb88.tar.bz2
[svn-r7984] Purpose: bug fix
Description: VL datatype fails in certain way(hard to describe) Platforms tested: h5committest
Diffstat (limited to 'src')
-rw-r--r--src/H5FLprivate.h2
-rw-r--r--src/H5Gprivate.h1
-rw-r--r--src/H5HG.c3
-rw-r--r--src/H5I.c9
-rw-r--r--src/H5Iprivate.h1
-rw-r--r--src/H5Tbit.c2
-rw-r--r--src/H5Tconv.c5
-rw-r--r--src/H5Tvlen.c22
8 files changed, 28 insertions, 17 deletions
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index 4f3d938..59e9ac2 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -35,7 +35,7 @@
/* Private headers needed by this file */
/* Macros for turning off free lists in the library */
-/* #define H5_NO_FREE_LISTS */
+#define H5_NO_FREE_LISTS
#ifdef H5_NO_FREE_LISTS
#define H5_NO_REG_FREE_LISTS
#define H5_NO_ARR_FREE_LISTS
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 2bf2c3f..b2bff6c 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -38,6 +38,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Bprivate.h" /* B-trees */
#include "H5Fprivate.h" /* File access */
+#include "H5Gprivate.h" /* Group */
#include "H5RSprivate.h" /* Reference-counted strings */
/*
diff --git a/src/H5HG.c b/src/H5HG.c
index b4b7f17..b6045af 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -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");
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);
obj_start = heap->obj[hobj->idx].begin;
/* Include object header size */
diff --git a/src/H5I.c b/src/H5I.c
index ad2f450..a965ec2 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -117,8 +117,6 @@ H5FL_DEFINE_STATIC(H5I_id_info_t);
/*--------------------- Local function prototypes ---------------------------*/
static herr_t H5I_init_interface(void);
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
static herr_t H5I_debug(H5I_type_t grp);
#endif /* H5I_DEBUG_OUTPUT */
@@ -844,7 +842,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static hid_t
+hid_t
H5I_get_file_id(hid_t obj_id)
{
H5G_entry_t *ent;
@@ -1345,8 +1343,11 @@ H5I_find_id(hid_t id)
/* Check arguments */
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");
+ }
+
grp_ptr = H5I_id_group_list_g[grp];
if (grp_ptr == NULL || grp_ptr->count <= 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid group");
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 79819a5..42369e3 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -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_verify(hid_t id, H5I_type_t id_type);
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_search(H5I_type_t grp, H5I_search_func_t func, void *key);
H5_DLL int H5I_inc_ref(hid_t id);
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index f6e36c7..fae953a 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -183,12 +183,14 @@ H5T_bit_get_d (uint8_t *buf, size_t offset, size_t size)
hsize_t val=0;
size_t i, hs;
hsize_t ret_value; /* Return value */
+ void *pt;
FUNC_ENTER_NOAPI(H5T_bit_get_d, 0);
assert (8*sizeof(val)>=size);
H5T_bit_copy ((uint8_t*)&val, 0, buf, offset, size);
+
switch (((H5T_t*)(H5I_object(H5T_NATIVE_INT_g)))->u.atomic.order) {
case H5T_ORDER_LE:
break;
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index daa37f5..2d043d7 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2455,6 +2455,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
if(nested) {
uint8_t *tmp=bg_ptr;
UINT32DECODE(tmp, bg_seq_len);
+
if(bg_seq_len>0) {
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))) {
@@ -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 */
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");
/* 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)
- 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.*/
H5_CHECK_OVERFLOW(bg_seq_len,hsize_t,hssize_t);
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 1a01458..057a309 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -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));
UINT32DECODE(bg, bg_seq_len);
- /* Get heap information */
- H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr));
- INT32DECODE(bg, bg_hobjid.idx);
-
- /* Free heap object for old data */
- if(bg_hobjid.addr>0) {
- /* Free heap object */
- if(H5HG_remove(f, dxpl_id, &bg_hobjid)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
- } /* end if */
+ if(bg_seq_len > 0) {
+ /* Get heap information */
+ H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr));
+ INT32DECODE(bg, bg_hobjid.idx);
+
+ /* Free heap object for old data */
+ if(bg_hobjid.addr>0) {
+ /* Free heap object */
+ if(H5HG_remove(f, dxpl_id, &bg_hobjid)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
+ } /* end if */
+ } /* end if */
} /* end if */
/* Set the length of the sequence */