summaryrefslogtreecommitdiffstats
path: root/src/H5A.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-04-15 19:25:36 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-04-15 19:25:36 (GMT)
commit531f24926c362c5f091ccc511c1c0e55dea391c8 (patch)
treead1ba2a11d79de1846006380c25cd9fa6f210598 /src/H5A.c
parenta3a0794eb34e4b0464fa8fbce4ed2b3c8338825b (diff)
downloadhdf5-531f24926c362c5f091ccc511c1c0e55dea391c8.zip
hdf5-531f24926c362c5f091ccc511c1c0e55dea391c8.tar.gz
hdf5-531f24926c362c5f091ccc511c1c0e55dea391c8.tar.bz2
[svn-r20517] Description:
Bring r20513 from trunk to 1.8 branch: Correct several problems with compound datatypes that don't have any fields added: - Change assertion to error report when a file is encountered which has this situation. - Added check to attribute creation to avoid creating attributes with a datatype like this (datasets and named datatypes already have the check) 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/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) 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, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Diffstat (limited to 'src/H5A.c')
-rw-r--r--src/H5A.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 1c75e46..666a2a8 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -389,14 +389,18 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
/* Check if the dataspace has an extent set (or is NULL) */
if(!(H5S_has_extent(space)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace extent has not been set")
+ HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "dataspace extent has not been set")
+
+ /* Check if the datatype is "sensible" for use in a dataset */
+ if(H5T_is_sensible(type) != TRUE)
+ HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, FAIL, "datatype is not sensible")
/* Build the attribute information */
if(NULL == (attr = H5FL_CALLOC(H5A_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for attribute info")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed for attribute info")
if(NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t)))
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate shared attr structure")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "can't allocate shared attr structure")
/* If the creation property list is H5P_DEFAULT, use the default character encoding */
if(acpl_id == H5P_DEFAULT)