summaryrefslogtreecommitdiffstats
path: root/src/H5A.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-05-27 20:26:32 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-05-27 20:26:32 (GMT)
commit6e6760216bd2dc64bba0976cdf1a1fed5a8fa114 (patch)
tree13235c92a1c3d9be4a8dc988788cb2e383e264eb /src/H5A.c
parent66be6f05d417671d1ef202931d769743ad8a83d9 (diff)
downloadhdf5-6e6760216bd2dc64bba0976cdf1a1fed5a8fa114.zip
hdf5-6e6760216bd2dc64bba0976cdf1a1fed5a8fa114.tar.gz
hdf5-6e6760216bd2dc64bba0976cdf1a1fed5a8fa114.tar.bz2
[svn-r8592] Purpose:
Code optimization & bug fix Description: When dimension information is being stored in the storage layout message on disk, it is stored as 32-bit quantities, possibly truncating the dimension information, if a dimension is greater than 32-bits in size. Solution: Fix the storage layout message problem by revising file format to not store dimension information, since it is already available in the dataspace. Also revise the storage layout data structures to be more compartmentalized for the information for contiguous, chunked and compact storage. Platforms tested: FreeBSD 4.9 (sleipnir) w/parallel Solaris 2.7 (arabica) h5committest
Diffstat (limited to 'src/H5A.c')
-rw-r--r--src/H5A.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/H5A.c b/src/H5A.c
index aa786da..6d8ce44 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -272,7 +272,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type,
assert(attr->dt_size>0);
attr->ds_size=H5O_raw_size(H5O_SDSPACE_ID,attr->ent.file,&(space->extent.u.simple));
assert(attr->ds_size>0);
- H5_ASSIGN_OVERFLOW(attr->data_size,H5S_get_simple_extent_npoints(attr->ds)*H5T_get_size(attr->dt),hssize_t,size_t);
+ H5_ASSIGN_OVERFLOW(attr->data_size,H5S_GET_SIMPLE_EXTENT_NPOINTS(attr->ds)*H5T_get_size(attr->dt),hssize_t,size_t);
/* Hold the symbol table entry (and file) open */
if (H5O_open(&(attr->ent)) < 0)
@@ -613,6 +613,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
{
uint8_t *tconv_buf = NULL; /* data type conv buffer */
uint8_t *bkg_buf = NULL; /* temp conversion buffer */
+ hssize_t snelmts; /* elements in attribute */
hsize_t nelmts; /* elements in attribute */
H5T_path_t *tpath = NULL; /* conversion information*/
hid_t src_id = -1, dst_id = -1;/* temporary type atoms */
@@ -629,7 +630,9 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
assert(buf);
/* Create buffer for data to store on disk */
- nelmts=H5S_get_simple_extent_npoints (attr->ds);
+ if((snelmts=H5S_GET_SIMPLE_EXTENT_NPOINTS(attr->ds))<0)
+ HGOTO_ERROR (H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ nelmts=(hsize_t)snelmts;
/* Get the memory and file datatype sizes */
src_type_size = H5T_get_size(mem_type);
@@ -761,6 +764,7 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id)
{
uint8_t *tconv_buf = NULL; /* data type conv buffer*/
uint8_t *bkg_buf = NULL; /* background buffer */
+ hssize_t snelmts; /* elements in attribute */
hsize_t nelmts; /* elements in attribute*/
H5T_path_t *tpath = NULL; /* type conversion info */
hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/
@@ -776,7 +780,9 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id)
assert(buf);
/* Create buffer for data to store on disk */
- nelmts=H5S_get_simple_extent_npoints (attr->ds);
+ if((snelmts=H5S_GET_SIMPLE_EXTENT_NPOINTS(attr->ds))<0)
+ HGOTO_ERROR (H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ nelmts=(hsize_t)snelmts;
/* Get the memory and file datatype sizes */
src_type_size = H5T_get_size(attr->dt);