summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-07-21 19:39:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-07-21 19:39:40 (GMT)
commit0c8e622e1acfe4dbf0d8dd25a514a231c08d388d (patch)
tree19388a211f93c4fd6135cad4ad9d25f41def7ab6 /src/H5T.c
parentf383c2a622990b3164c45ac09dc9e8f2f64fe7dd (diff)
downloadhdf5-0c8e622e1acfe4dbf0d8dd25a514a231c08d388d.zip
hdf5-0c8e622e1acfe4dbf0d8dd25a514a231c08d388d.tar.gz
hdf5-0c8e622e1acfe4dbf0d8dd25a514a231c08d388d.tar.bz2
[svn-r17210] Description:
Bring r17157:17209 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.7 (amazon) in debug mode Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 200d5c1..4dd1984 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -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) {