summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-06-11 21:06:29 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-06-11 21:06:29 (GMT)
commit8735902ea3fd111e2a8924b4516b701659259cf4 (patch)
tree6fb0ca23f62d27793dc5aa0a442c43ff7ed0adde /src
parent2a59a4ca3d1a165fd62c3a76e38f194124d00839 (diff)
downloadhdf5-8735902ea3fd111e2a8924b4516b701659259cf4.zip
hdf5-8735902ea3fd111e2a8924b4516b701659259cf4.tar.gz
hdf5-8735902ea3fd111e2a8924b4516b701659259cf4.tar.bz2
[svn-r8663] *** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/H5Odtype.c4
-rw-r--r--src/H5T.c8
-rw-r--r--src/H5Tcommit.c15
3 files changed, 23 insertions, 4 deletions
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 88403ea..c2015c0 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -1111,7 +1111,9 @@ H5O_dtype_get_share(H5F_t UNUSED *f, const void *_mesg,
assert (sh);
if (H5F_addr_defined (dt->ent.header)) {
- assert (H5T_STATE_NAMED==dt->state || H5T_STATE_OPEN==dt->state);
+ if(H5T_STATE_NAMED!=dt->state && H5T_STATE_OPEN!=dt->state && H5T_STATE_TRANSIENT!=dt->state)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "datatype state is not valid");
+
sh->in_gh = FALSE;
sh->u.ent = dt->ent;
} else
diff --git a/src/H5T.c b/src/H5T.c
index 7a50308..91ad28e 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2744,6 +2744,14 @@ H5T_open (H5G_entry_t *loc, const char *name, hid_t dxpl_id)
if ((dt=H5T_open_oid(&ent, dxpl_id)) ==NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found");
+ /* Mark any datatypes as being in memory now */
+ if (H5T_vlen_mark(dt, NULL, H5T_VLEN_MEMORY)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
+
+ /* Unlock data type */
+ if (H5T_lock (dt, FALSE)<0)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to lock transient data type")
+
/* Set return value */
ret_value=dt;
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index f43d8d8..37363b5 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -139,13 +139,17 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id)
if (H5T_STATE_IMMUTABLE==type->state)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "data type is immutable");
+ /* Find the insertion file */
+ if (NULL==(file=H5G_insertion_file(loc, name, dxpl_id)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to find insertion point");
+
/* Check for a "sensible" datatype to store on disk */
if(H5T_is_sensible(type)!=TRUE)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "datatype is not sensible");
- /* Find the insertion file */
- if (NULL==(file=H5G_insertion_file(loc, name, dxpl_id)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to find insertion point");
+ /* Mark datatype as being on disk now */
+ if (H5T_vlen_mark(type, file, H5T_VLEN_DISK)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid VL location");
/*
* Create the object header and open it for write access. Insert the data
@@ -159,6 +163,11 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name data type");
type->state = H5T_STATE_OPEN;
+ /* Mark datatype as being on memory now because this datatype may be still used in
+ * memory after committed to disk. So we need to change its size back. */
+ if (H5T_vlen_mark(type, NULL, H5T_VLEN_MEMORY)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype in memory")
+
done:
if (ret_value<0) {
if ((type->state==H5T_STATE_TRANSIENT || type->state==H5T_STATE_RDONLY) && H5F_addr_defined(type->ent.header)) {