diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Dint.c | 4 | ||||
-rw-r--r-- | src/H5HFcache.c | 2 | ||||
-rw-r--r-- | src/H5HG.c | 2 | ||||
-rw-r--r-- | src/H5HGcache.c | 2 | ||||
-rw-r--r-- | src/H5Oattr.c | 8 | ||||
-rw-r--r-- | src/H5Oattribute.c | 9 | ||||
-rw-r--r-- | src/H5Odtype.c | 11 | ||||
-rw-r--r-- | src/H5T.c | 16 | ||||
-rw-r--r-- | src/H5Tcommit.c | 4 | ||||
-rw-r--r-- | src/H5Tvlen.c | 8 | ||||
-rw-r--r-- | src/H5public.h | 4 | ||||
-rw-r--r-- | src/Makefile.in | 2 |
12 files changed, 58 insertions, 14 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c index 64baadc19..d67d146 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1364,6 +1364,10 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) /* Get the type and space */ if(NULL == (dataset->shared->type = (H5T_t *)H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header") + + if(H5T_set_loc(dataset->shared->type, dataset->oloc.file, H5T_LOC_DISK) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 6d250d1..b5d7cb5 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -1539,7 +1539,7 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, if(hdr->filter_len > 0) { H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */ size_t nbytes; /* Number of bytes used */ - unsigned filter_mask; /* Filter mask for block */ + unsigned filter_mask = 0; /* Filter mask for block */ /* Allocate buffer to perform I/O filtering on */ write_size = dblock->size; @@ -320,6 +320,8 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned * heap_flags_ptr) break; } /* end else */ + HDassert(idx < heap->nused); + /* Check if we need more room to store heap objects */ if(idx>=heap->nalloc) { size_t new_alloc; /* New allocation number */ diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 747c41e..22374ce 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -244,6 +244,8 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1, else heap->nused = 1; + HDassert(max_idx < heap->nused); + /* * Add the new heap to the CWFS list, removing some other entry if * necessary to make room. We remove the right-most entry that has less diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 1e85c69..c474681 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -633,7 +633,7 @@ H5O_attr_pre_copy_file(H5F_t UNUSED *file_src, const void UNUSED *native_src, *------------------------------------------------------------------------- */ static void * -H5O_attr_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t UNUSED *mesg_type, +H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void UNUSED *udata, hid_t dxpl_id) { @@ -647,6 +647,12 @@ H5O_attr_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t UNUSED *mesg_ty HDassert(cpy_info); HDassert(!cpy_info->copy_without_attr); + /* Mark datatype as being on disk now. This step used to be done in a lower level + * by H5O_dtype_decode. But it has been moved up. Not an ideal place, but no better + * place than here. */ + if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, file_src, H5T_LOC_DISK) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") + if ( NULL == (ret_value=H5A_attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy attribute") diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 81c2d3b..253f615 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -536,6 +536,11 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) HDassert(udata.attr); ret_value = udata.attr; } /* end else */ + + /* Mark datatype as being on disk now */ + if(H5T_set_loc(ret_value->shared->dt, loc->file, H5T_LOC_DISK) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") + } /* end else */ done: @@ -641,6 +646,10 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute") if(NULL == (ret_value = H5A_copy(NULL, exist_attr))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute") + } else { + /* Mark datatype as being on disk now */ + if(H5T_set_loc(ret_value->shared->dt, loc->file, H5T_LOC_DISK) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") } /* end if */ } /* end if */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index fe8c627..63b2aaf 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -452,8 +452,9 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p /* Set extra information for object references, so the hobj_ref_t gets swizzled correctly */ if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT) { - /* This type is on disk */ - dt->shared->u.atomic.u.r.loc = H5T_LOC_DISK; + /* Mark location this type as undefined for now. The caller function should + * decide the location. */ + dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; /* This type needs conversion */ dt->shared->force_conv = TRUE; @@ -518,8 +519,10 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p ioflags, "vlen", FAIL) dt->shared->force_conv=TRUE; - /* Mark this type as on disk */ - if(H5T_set_loc(dt, f, H5T_LOC_DISK) < 0) + + /* Mark location this type as undefined for now. The caller function should + * decide the location. */ + if(H5T_set_loc(dt, f, H5T_LOC_BADLOC) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") break; @@ -2120,7 +2120,7 @@ H5Tset_size(hid_t type_id, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") if(size <= 0 && size != H5T_VARIABLE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") - if(size == H5T_VARIABLE && dt->shared->type != H5T_STRING) + if(size == H5T_VARIABLE && !H5T_IS_STRING(dt->shared)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "only strings may be variable length") if(H5T_ENUM == dt->shared->type && dt->shared->u.enumer.nmembs > 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") @@ -2923,6 +2923,10 @@ H5T_decode(const unsigned char *buf) if((ret_value = H5O_msg_decode(f, H5AC_dxpl_id, NULL, H5O_DTYPE_ID, buf)) == NULL) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object") + /* Mark datatype as being in memory now */ + if(H5T_set_loc(ret_value, NULL, H5T_LOC_MEMORY) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + done: /* Release fake file structure */ if(f && H5F_fake_free(f) < 0) @@ -4029,8 +4033,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) case H5T_VLEN: assert(dt1->shared->u.vlen.type>H5T_VLEN_BADTYPE && dt1->shared->u.vlen.type<H5T_VLEN_MAXTYPE); assert(dt2->shared->u.vlen.type>H5T_VLEN_BADTYPE && dt2->shared->u.vlen.type<H5T_VLEN_MAXTYPE); - assert(dt1->shared->u.vlen.loc>H5T_LOC_BADLOC && dt1->shared->u.vlen.loc<H5T_LOC_MAXLOC); - assert(dt2->shared->u.vlen.loc>H5T_LOC_BADLOC && dt2->shared->u.vlen.loc<H5T_LOC_MAXLOC); + assert(dt1->shared->u.vlen.loc>=H5T_LOC_BADLOC && dt1->shared->u.vlen.loc<H5T_LOC_MAXLOC); + assert(dt2->shared->u.vlen.loc>=H5T_LOC_BADLOC && dt2->shared->u.vlen.loc<H5T_LOC_MAXLOC); /* Arbitrarily sort sequence VL datatypes before string VL datatypes */ if (dt1->shared->u.vlen.type==H5T_VLEN_SEQUENCE && @@ -4047,7 +4051,11 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) } else if (dt1->shared->u.vlen.loc==H5T_LOC_DISK && dt2->shared->u.vlen.loc==H5T_LOC_MEMORY) { HGOTO_DONE(1); + } else if (dt1->shared->u.vlen.loc==H5T_LOC_BADLOC && + dt2->shared->u.vlen.loc!=H5T_LOC_BADLOC) { + HGOTO_DONE(1); } + /* Don't allow VL types in different files to compare as equal */ if (dt1->shared->u.vlen.f < dt2->shared->u.vlen.f) HGOTO_DONE(-1); @@ -4969,7 +4977,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) FUNC_ENTER_NOAPI(H5T_set_loc, FAIL); assert(dt); - assert(loc>H5T_LOC_BADLOC && loc<H5T_LOC_MAXLOC); + assert(loc>=H5T_LOC_BADLOC && loc<H5T_LOC_MAXLOC); /* Datatypes can't change in size if the force_conv flag is not set */ if(dt->shared->force_conv) { diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index df35789..f580c15 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -741,6 +741,10 @@ H5T_open(const H5G_loc_t *loc, hid_t dxpl_id) /* Point to shared datatype info */ dt->shared = shared_fo; + /* Mark any datatypes as being in memory now */ + if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + /* Increment ref. count on shared info */ shared_fo->fo_count++; diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 27eb0f6..412012a 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -214,7 +214,7 @@ H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* check parameters */ HDassert(dt); - HDassert(loc > H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); + HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Only change the location if it's different */ if(loc != dt->shared->u.vlen.loc || f != dt->shared->u.vlen.f) { @@ -280,6 +280,12 @@ H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Set file ID (since this VL is on disk) */ dt->shared->u.vlen.f = f; break; + + case H5T_LOC_BADLOC: + /* Allow undefined location. In H5Odtype.c, H5O_dtype_decode sets undefined + * location for VL type and leaves it for the caller to decide. + */ + break; default: HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location") diff --git a/src/H5public.h b/src/H5public.h index 2e53920..4e67cd4 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -71,10 +71,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 43 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 44 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "FA_a2" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.43-FA_a2" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.44-FA_a2" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index eb02316..07cd6b7 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -411,7 +411,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 33 +LT_VERS_REVISION = 34 LT_VERS_AGE = 0 H5detect_CFLAGS = -g |