diff options
-rw-r--r-- | src/H5A.c | 148 | ||||
-rw-r--r-- | src/H5D.c | 13 | ||||
-rw-r--r-- | src/H5Dio.c | 9 | ||||
-rw-r--r-- | src/H5FL.c | 3 | ||||
-rw-r--r-- | src/H5O.c | 4 | ||||
-rw-r--r-- | src/H5Oattr.c | 51 | ||||
-rw-r--r-- | src/H5Opkg.h | 2 | ||||
-rw-r--r-- | src/H5Oprivate.h | 2 | ||||
-rw-r--r-- | src/H5Osdspace.c | 112 | ||||
-rw-r--r-- | src/H5S.c | 186 | ||||
-rw-r--r-- | src/H5Sall.c | 8 | ||||
-rw-r--r-- | src/H5Smpio.c | 16 | ||||
-rw-r--r-- | src/H5Snone.c | 4 | ||||
-rw-r--r-- | src/H5Spkg.h | 3 | ||||
-rw-r--r-- | src/H5Sselect.c | 18 |
15 files changed, 225 insertions, 354 deletions
@@ -633,45 +633,48 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) 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); - dst_type_size = H5T_get_size(attr->dt); - - /* Get the maximum buffer size needed and allocate it */ - H5_ASSIGN_OVERFLOW(buf_size,nelmts*MAX(src_type_size,dst_type_size),hsize_t,size_t); - if (NULL==(tconv_buf = H5MM_malloc (buf_size)) || NULL==(bkg_buf = H5MM_calloc(buf_size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Copy the user's data into the buffer for conversion */ - H5_CHECK_OVERFLOW((src_type_size*nelmts),hsize_t,size_t); - HDmemcpy(tconv_buf,buf,(size_t)(src_type_size*nelmts)); - - /* Convert memory buffer into disk buffer */ - /* Set up type conversion function */ - if (NULL == (tpath = H5T_path_find(mem_type, attr->dt, NULL, NULL, dxpl_id))) { - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") - } else if (!H5T_path_noop(tpath)) { - if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL)))<0 || - (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->dt, H5T_COPY_ALL)))<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") - } + /* Check for null dataspace */ + if(nelmts>0) { + /* Get the memory and file datatype sizes */ + src_type_size = H5T_get_size(mem_type); + dst_type_size = H5T_get_size(attr->dt); - /* Perform data type conversion */ - if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed") + /* Get the maximum buffer size needed and allocate it */ + H5_ASSIGN_OVERFLOW(buf_size,nelmts*MAX(src_type_size,dst_type_size),hsize_t,size_t); + if (NULL==(tconv_buf = H5MM_malloc (buf_size)) || NULL==(bkg_buf = H5MM_calloc(buf_size))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - /* Free the previous attribute data buffer, if there is one */ - if(attr->data) - H5MM_xfree(attr->data); + /* Copy the user's data into the buffer for conversion */ + H5_CHECK_OVERFLOW((src_type_size*nelmts),hsize_t,size_t); + HDmemcpy(tconv_buf,buf,(size_t)(src_type_size*nelmts)); - /* Look up the attribute for the object */ - if((idx=H5A_get_index(&(attr->ent),attr->name,dxpl_id))<0) - HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "attribute not found") + /* Convert memory buffer into disk buffer */ + /* Set up type conversion function */ + if (NULL == (tpath = H5T_path_find(mem_type, attr->dt, NULL, NULL, dxpl_id))) { + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") + } else if (!H5T_path_noop(tpath)) { + if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL)))<0 || + (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->dt, H5T_COPY_ALL)))<0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + } - /* Modify the attribute data */ - attr->data=tconv_buf; /* Set the data pointer temporarily */ - if (H5O_modify(&(attr->ent), H5O_ATTR_ID, idx, 0, 1, attr, dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages") + /* Perform data type conversion */ + if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed") + + /* Free the previous attribute data buffer, if there is one */ + if(attr->data) + H5MM_xfree(attr->data); + + /* Look up the attribute for the object */ + if((idx=H5A_get_index(&(attr->ent),attr->name,dxpl_id))<0) + HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "attribute not found") + + /* Modify the attribute data */ + attr->data=tconv_buf; /* Set the data pointer temporarily */ + if (H5O_modify(&(attr->ent), H5O_ATTR_ID, idx, 0, 1, attr, dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages") + } /* end if */ /* Indicate the the attribute doesn't need fill-values */ attr->initialized=TRUE; @@ -779,42 +782,45 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) 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); - dst_type_size = H5T_get_size(mem_type); - - /* Check if the attribute has any data yet, if not, fill with zeroes */ - H5_CHECK_OVERFLOW((dst_type_size*nelmts),hsize_t,size_t); - if(attr->ent_opened && !attr->initialized) { - HDmemset(buf,0,(size_t)(dst_type_size*nelmts)); - } /* end if */ - else { /* Attribute exists and has a value */ - /* Get the maximum buffer size needed and allocate it */ - H5_ASSIGN_OVERFLOW(buf_size,(nelmts*MAX(src_type_size,dst_type_size)),hsize_t,size_t); - if (NULL==(tconv_buf = H5MM_malloc (buf_size)) || NULL==(bkg_buf = H5MM_calloc(buf_size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Copy the attribute data into the buffer for conversion */ - H5_CHECK_OVERFLOW((src_type_size*nelmts),hsize_t,size_t); - HDmemcpy(tconv_buf,attr->data,(size_t)(src_type_size*nelmts)); - - /* Convert memory buffer into disk buffer */ - /* Set up type conversion function */ - if (NULL == (tpath = H5T_path_find(attr->dt, mem_type, NULL, NULL, dxpl_id))) { - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") - } else if (!H5T_path_noop(tpath)) { - if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->dt, H5T_COPY_ALL)))<0 || - (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL)))<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") - } - - /* Perform data type conversion. */ - if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed") - - /* Copy the converted data into the user's buffer */ - HDmemcpy(buf,tconv_buf,(size_t)(dst_type_size*nelmts)); - } /* end else */ + /* Check for null dataspace */ + if(nelmts>0) { + /* Get the memory and file datatype sizes */ + src_type_size = H5T_get_size(attr->dt); + dst_type_size = H5T_get_size(mem_type); + + /* Check if the attribute has any data yet, if not, fill with zeroes */ + H5_CHECK_OVERFLOW((dst_type_size*nelmts),hsize_t,size_t); + if(attr->ent_opened && !attr->initialized) { + HDmemset(buf,0,(size_t)(dst_type_size*nelmts)); + } /* end if */ + else { /* Attribute exists and has a value */ + /* Get the maximum buffer size needed and allocate it */ + H5_ASSIGN_OVERFLOW(buf_size,(nelmts*MAX(src_type_size,dst_type_size)),hsize_t,size_t); + if (NULL==(tconv_buf = H5MM_malloc (buf_size)) || NULL==(bkg_buf = H5MM_calloc(buf_size))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Copy the attribute data into the buffer for conversion */ + H5_CHECK_OVERFLOW((src_type_size*nelmts),hsize_t,size_t); + HDmemcpy(tconv_buf,attr->data,(size_t)(src_type_size*nelmts)); + + /* Convert memory buffer into disk buffer */ + /* Set up type conversion function */ + if (NULL == (tpath = H5T_path_find(attr->dt, mem_type, NULL, NULL, dxpl_id))) { + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") + } else if (!H5T_path_noop(tpath)) { + if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->dt, H5T_COPY_ALL)))<0 || + (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL)))<0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + } + + /* Perform data type conversion. */ + if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed") + + /* Copy the converted data into the user's buffer */ + HDmemcpy(buf,tconv_buf,(size_t)(dst_type_size*nelmts)); + } /* end else */ + } /* end if */ ret_value=SUCCEED; @@ -1313,11 +1313,6 @@ H5D_get_space_status(const H5D_t *dset, H5D_space_status_t *allocation, hid_t dx space=dset->space; assert(space); - if(H5S_NULL == H5S_get_simple_extent_type(space)) { - *allocation = H5D_SPACE_STATUS_NOT_ALLOCATED; - HGOTO_DONE(SUCCEED) - } - /* Get the total number of elements in dataset's dataspace */ if((total_elem=H5S_get_simple_extent_npoints(space))<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get # of dataspace elements") @@ -1966,10 +1961,8 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy dataspace") /* Set the dataset's dataspace to 'all' selection */ - if(H5S_NULL != H5S_get_simple_extent_type(new_dset->space)) { - if(H5S_select_all(new_dset->space,1)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection") - } + if(H5S_select_all(new_dset->space,1)<0) + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection") /* Check if the dataset has a non-default DCPL & get important values, if so */ if(new_dset->dcpl_id!=H5P_DATASET_CREATE_DEFAULT) { @@ -3284,8 +3277,6 @@ H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype") if (NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") - if(H5S_NULL == H5S_get_simple_extent_type(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "null dataspace isn't supported") ret_value=H5S_select_iterate(buf,type_id,space,op,operator_data); diff --git a/src/H5Dio.c b/src/H5Dio.c index c4928e7..9840bf0 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -174,8 +174,6 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") if (NULL == (buf_type=H5I_object_verify(buf_type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") - if(H5S_NULL == H5S_get_simple_extent_type(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "null dataspace isn't valid") /* Fill the selection in the memory buffer */ if(H5D_fill(fill,fill_type,buf,buf_type,space, H5AC_dxpl_id)<0) @@ -660,9 +658,6 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, file_space = dataset->space; if (!mem_space) mem_space = file_space; - if(H5S_NULL == H5S_get_simple_extent_type(mem_space) || - H5S_NULL == H5S_get_simple_extent_type(file_space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "null dataspace isn't supported") if((snelmts = H5S_get_select_npoints(mem_space))<0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection") H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t); @@ -890,9 +885,6 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, file_space = dataset->space; if (!mem_space) mem_space = file_space; - if(H5S_NULL == H5S_get_simple_extent_type(mem_space) || - H5S_NULL == H5S_get_simple_extent_type(file_space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "null dataspace isn't supported") if((snelmts = H5S_get_select_npoints(mem_space))<0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection") H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t); @@ -1083,6 +1075,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, #endif /* Sanity check dataset, then read it */ assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 || + H5S_NULL == H5S_get_simple_extent_type(file_space) || dataset->layout.type==H5D_COMPACT); status = (sconv->read)(dataset->ent.file, &(dataset->layout), &dataset->dcpl_cache, (H5D_storage_t *)&(dataset->efl), H5T_get_size(dataset->type), @@ -1465,7 +1465,7 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) unsigned u; /* Counter for array of free lists */ size_t total_mem; /* Total memory used on list */ - FUNC_ENTER_NOAPI_NOINIT(H5FL_arr_gc_list) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FL_arr_gc_list) /* Walk through the array of free lists */ for(u=0; u<(unsigned)head->maxelem; u++) { @@ -1500,7 +1500,6 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) /* Double check that all the memory on this list is recycled */ assert(head->list_mem==0); -done: FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FL_arr_gc_list() */ @@ -104,8 +104,8 @@ static herr_t H5O_init_interface(void); /* ID to type mapping */ static const H5O_class_t *const message_type_g[] = { H5O_NULL, /*0x0000 Null */ - H5O_SDSPACE, /*0x0001 Extent Dimensionality */ - NULL, /*0x0002 Not assigned */ + H5O_SDSPACE, /*0x0001 Simple Dimensionality */ + NULL, /*0x0002 Data space (fiber bundle?) */ H5O_DTYPE, /*0x0003 Data Type */ H5O_FILL, /*0x0004 Old data storage -- fill value */ H5O_FILL_NEW, /*0x0005 New Data storage -- fill value */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 7ca18cf..2fd4677 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -181,47 +181,18 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED * if (NULL==(attr->ds = H5FL_CALLOC(H5S_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - if((extent=(H5O_SDSPACE->decode)(f,dxpl_id,p,NULL))!=NULL) { - unsigned i; /* Local index variable */ - - if(extent->type != H5S_NO_CLASS) { /* File is new, created by version 1.7 or after */ - /* Compute the number of elements in the extent */ - if(extent->type == H5S_NULL) - extent->nelem = 0; - else { - for(i=0, extent->nelem=1; i<extent->u.simple.rank; i++) - extent->nelem*=extent->u.simple.size[i]; - } - } else { /* File was created by version 1.6 or before, when there was no H5S_NULL */ - /* Set the dataspace type to be simple or scalar as appropriate */ - if(extent->u.simple.rank>0) - extent->type = H5S_SIMPLE; - else - extent->type = H5S_SCALAR; - - /* Compute the number of elements in the extent */ - for(i=0, extent->nelem=1; i<extent->u.simple.rank; i++) - extent->nelem*=extent->u.simple.size[i]; - } - - /* Copy the extent information */ - HDmemcpy(&(attr->ds->extent),extent, sizeof(H5S_extent_t)); - - /* Release temporary extent information */ - H5FL_FREE(H5S_extent_t,extent); - } else { - attr->ds->extent.type = H5S_NULL; - attr->ds->extent.nelem = 0; - } + if((extent=(H5O_SDSPACE->decode)(f,dxpl_id,p,NULL))==NULL) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace"); + + /* Copy the extent information */ + HDmemcpy(&(attr->ds->extent),extent, sizeof(H5S_extent_t)); + + /* Release temporary extent information */ + H5FL_FREE(H5S_extent_t,extent); - if(attr->ds->extent.type == H5S_NULL) { - if(H5S_select_none(attr->ds)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set none selection"); - } else { - /* Default to entire dataspace being selected */ - if(H5S_select_all(attr->ds,0)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); - } + /* Default to entire dataspace being selected */ + if(H5S_select_all(attr->ds,0)<0) + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); if(version < H5O_ATTR_VERSION_NEW) p += H5O_ALIGN(attr->ds_size); diff --git a/src/H5Opkg.h b/src/H5Opkg.h index a4867dd..866e1b7 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -109,7 +109,7 @@ typedef struct H5O_t { H5_DLLVAR const H5O_class_t H5O_NULL[1]; /* - * Extent Data Space Message. + * Simple Data Space Message. */ H5_DLLVAR const H5O_class_t H5O_SDSPACE[1]; diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index a6bd5a3..2686784 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -52,7 +52,7 @@ /* Header message IDs */ #define H5O_NULL_ID 0x0000 /* Null Message. */ -#define H5O_SDSPACE_ID 0x0001 /* Extent Dataspace Message.*/ +#define H5O_SDSPACE_ID 0x0001 /* Simple Dataspace Message. */ /* Complex dataspace is/was planned for message 0x0002 */ #define H5O_DTYPE_ID 0x0003 /* Datatype Message. */ #define H5O_FILL_ID 0x0004 /* Fill Value Message. (Old) */ diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 02b932a..4f2515e 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -35,10 +35,10 @@ static herr_t H5O_sdspace_free (void *_mesg); static herr_t H5O_sdspace_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); -/* This message derives from H5O, for old dataspace before version 1.7 */ +/* This message derives from H5O */ const H5O_class_t H5O_SDSPACE[1] = {{ H5O_SDSPACE_ID, /* message id number */ - "extent_dspace", /* message name for debugging */ + "simple_dspace", /* message name for debugging */ sizeof(H5S_extent_t), /* native message size */ H5O_sdspace_decode, /* decode message */ H5O_sdspace_encode, /* encode message */ @@ -73,7 +73,7 @@ H5FL_ARR_EXTERN(hsize_t); NAME H5O_sdspace_decode PURPOSE - Decode an extent dimensionality message and return a pointer to a memory + Decode a simple dimensionality message and return a pointer to a memory struct with the decoded information USAGE void *H5O_sdspace_decode(f, raw_size, p) @@ -83,14 +83,22 @@ H5FL_ARR_EXTERN(hsize_t); RETURNS Pointer to the new message in native order on success, NULL on failure DESCRIPTION - This function decodes the "raw" disk form of an extent dimensionality + This function decodes the "raw" disk form of a simple dimensionality message into a struct in memory native format. The struct is allocated within this function using malloc() and is returned to the caller. MODIFICATIONS - Raymond Lu - April 8, 2004 - Added the type of dataspace into this header message using a reserved byte. + Robb Matzke, 1998-04-09 + The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes + instead of just four bytes. + + Robb Matzke, 1998-07-20 + Added a version number and reformatted the message for aligment. + + Raymond Lu + April 8, 2004 + Added the type of dataspace into this header message using a reserved + byte. --------------------------------------------------------------------------*/ static void * @@ -110,23 +118,34 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_ /* decode */ if ((sdim = H5FL_CALLOC(H5S_extent_t)) != NULL) { + /* Check version */ version = *p++; if (version!=H5O_SDSPACE_VERSION && version!=H5O_SDSPACE_VERSION_2) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "wrong version number in data space message"); - if(version==H5O_SDSPACE_VERSION_2) - sdim->type = *p++; - else - sdim->type = H5S_NO_CLASS; + + /* Get rank */ sdim->u.simple.rank = *p++; if (sdim->u.simple.rank>H5S_MAX_RANK) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "simple data space dimensionality is too large"); + + /* Get dataspace flags for later */ flags = *p++; + + /* Get the type of the extent */ + if(version>=H5O_SDSPACE_VERSION_2) + sdim->type = *p++; + else { + /* Set the dataspace type to be simple or scalar as appropriate */ + if(sdim->u.simple.rank>0) + sdim->type = H5S_SIMPLE; + else + sdim->type = H5S_SCALAR; + + /* Increment past reserved byte */ + p++; + } /* end else */ - if(version==H5O_SDSPACE_VERSION) { - p += 5; /*reserved*/ - } else if(version==H5O_SDSPACE_VERSION_2) { - p += 4; /*reserved*/ - } + p += 4; /*reserved*/ if (sdim->u.simple.rank > 0) { if (NULL==(sdim->u.simple.size=H5FL_ARR_MALLOC(hsize_t,sdim->u.simple.rank))) @@ -148,6 +167,14 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_ } #endif /* LATER */ } + + /* Compute the number of elements in the extent */ + if(sdim->type == H5S_NULL) + sdim->nelem = 0; + else { + for(i=0, sdim->nelem=1; i<sdim->u.simple.rank; i++) + sdim->nelem*=sdim->u.simple.size[i]; + } } /* Set return value */ @@ -155,7 +182,7 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_ done: if (!ret_value && sdim) { - H5S_release_extent(sdim); + H5S_extent_release(sdim); H5FL_FREE(H5S_extent_t,sdim); } /* end if */ @@ -167,7 +194,7 @@ done: NAME H5O_sdspace_encode PURPOSE - Encode an extent dimensionality message + Encode a simple dimensionality message USAGE herr_t H5O_sdspace_encode(f, raw_size, p, mesg) H5F_t *f; IN: pointer to the HDF5 file struct @@ -181,9 +208,17 @@ done: dimensionality message in the "raw" disk form. MODIFICATIONS - Raymond Lu - April 8, 2004 - Added the type of dataspace into this header message using a reserved byte. + Robb Matzke, 1998-04-09 + The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes + instead of just four bytes. + + Robb Matzke, 1998-07-20 + Added a version number and reformatted the message for aligment. + + Raymond Lu + April 8, 2004 + Added the type of dataspace into this header message using a reserved + byte. --------------------------------------------------------------------------*/ static herr_t @@ -210,10 +245,16 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg) #endif /* encode */ - *p++ = H5O_SDSPACE_VERSION_2; - *p++ = sdim->type; + if(sdim->type!=H5S_NULL) + *p++ = H5O_SDSPACE_VERSION; + else + *p++ = H5O_SDSPACE_VERSION_2; *p++ = sdim->u.simple.rank; *p++ = flags; + if(sdim->type!=H5S_NULL) + *p++ = 0; /*reserved*/ + else + *p++ = sdim->type; *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ @@ -251,7 +292,7 @@ done: RETURNS Pointer to DEST on success, NULL on failure DESCRIPTION - This function copies a native (memory) extent dimensionality message, + This function copies a native (memory) simple dimensionality message, allocating the destination structure if necessary. MODIFICATIONS Raymond Lu @@ -314,11 +355,14 @@ done: RETURNS Size of message on success, zero on failure DESCRIPTION - This function returns the size of the raw extent dimensionality message on + This function returns the size of the raw simple dimensionality message on success. (Not counting the message type or size fields, only the data portion of the message). It doesn't take into account alignment. MODIFICATIONS + Robb Matzke, 1998-04-09 + The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes + instead of just four bytes. --------------------------------------------------------------------------*/ static size_t H5O_sdspace_size(H5F_t *f, const void *mesg) @@ -332,18 +376,16 @@ H5O_sdspace_size(H5F_t *f, const void *mesg) FUNC_ENTER_NOAPI(H5O_sdspace_size, 0); - if(space->type != H5S_NULL) { - /* add in the dimension sizes */ - ret_value += space->u.simple.rank * H5F_SIZEOF_SIZE (f); + /* add in the dimension sizes */ + ret_value += space->u.simple.rank * H5F_SIZEOF_SIZE (f); - /* add in the space for the maximum dimensions, if they are present */ - ret_value += space->u.simple.max ? space->u.simple.rank * H5F_SIZEOF_SIZE (f) : 0; + /* add in the space for the maximum dimensions, if they are present */ + ret_value += space->u.simple.max ? space->u.simple.rank * H5F_SIZEOF_SIZE (f) : 0; #ifdef LATER - /* add in the space for the dimension permutations, if they are present */ - ret_value += space->u.simple.perm ? space->u.simple.rank * 4 : 0; + /* add in the space for the dimension permutations, if they are present */ + ret_value += space->u.simple.perm ? space->u.simple.rank * 4 : 0; #endif - } done: FUNC_LEAVE_NOAPI(ret_value); @@ -373,7 +415,7 @@ H5O_sdspace_reset(void *_mesg) FUNC_ENTER_NOAPI(H5O_sdspace_reset, FAIL); - H5S_release_extent(mesg); + H5S_extent_release(mesg); done: FUNC_LEAVE_NOAPI(ret_value); @@ -414,7 +456,7 @@ done: NAME H5O_sdspace_debug PURPOSE - Prints debugging information for an extent dimensionality message + Prints debugging information for a simple dimensionality message USAGE void *H5O_sdspace_debug(f, mesg, stream, indent, fwidth) H5F_t *f; IN: pointer to the HDF5 file struct @@ -28,7 +28,7 @@ static H5S_t * H5S_create(H5S_class_t type); static herr_t H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max); static htri_t H5S_is_simple(const H5S_t *sdim); -static herr_t H5S_extent_release(H5S_t *ds); +static herr_t H5S_release_simple(H5S_simple_t *simple); /* Interface initialization */ #define PABLO_MASK H5S_mask @@ -53,9 +53,6 @@ static size_t H5S_nconv_g = 0; /*entries used*/ hbool_t H5S_mpi_opt_types_g = TRUE; #endif /* H5_HAVE_PARALLEL */ -/* Declare a free list to manage the H5S_simple_t struct */ -H5FL_DEFINE(H5S_simple_t); - /* Declare a free list to manage the H5S_extent_t struct */ H5FL_DEFINE(H5S_extent_t); @@ -310,23 +307,18 @@ H5S_create(H5S_class_t type) switch(type) { case H5S_SCALAR: ret_value->extent.nelem = 1; - if(H5S_select_all(ret_value,0)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); break; case H5S_SIMPLE: - ret_value->extent.nelem = 0; - if(H5S_select_all(ret_value,0)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); - break; case H5S_NULL: ret_value->extent.nelem = 0; - if(H5S_select_none(ret_value)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set selection to none"); break; default: assert("unknown dataspace (extent) type" && 0); break; } /* end switch */ + + if(H5S_select_all(ret_value,0)<0) + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); } /* end if */ done: @@ -396,17 +388,17 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5S_extent_release(H5S_t *ds) +herr_t +H5S_extent_release(H5S_extent_t *extent) { herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5S_extent_release, FAIL); - assert(ds); + assert(extent); /* release extent */ - switch (ds->extent.type) { + switch (extent->type) { case H5S_NO_CLASS: /*nothing needed */ break; @@ -417,7 +409,7 @@ H5S_extent_release(H5S_t *ds) break; case H5S_SIMPLE: - ret_value=H5S_release_simple(&(ds->extent.u.simple)); + ret_value=H5S_release_simple(&(extent->u.simple)); break; case H5S_COMPLEX: @@ -461,7 +453,7 @@ H5S_close(H5S_t *ds) H5S_select_release(ds); /* Release extent */ - H5S_extent_release(ds); + H5S_extent_release(&ds->extent); /* Release the main structure */ H5FL_FREE(H5S_t,ds); @@ -523,12 +515,10 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_release_simple(H5S_simple_t *simple) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5S_release_simple, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_release_simple); assert(simple); @@ -541,46 +531,7 @@ H5S_release_simple(H5S_simple_t *simple) H5FL_ARR_FREE(hsize_t,simple->perm); #endif /* LATER */ -done: - FUNC_LEAVE_NOAPI(ret_value); -} - - -/*------------------------------------------------------------------------- - * Function: H5S_release_extent - * - * Purpose: Releases all memory associated with an extent data space. - * (but doesn't free the extent space itself) - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Raymond Lu - * Wednesday, March 31, 2004 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5S_release_extent(H5S_extent_t *extent) -{ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5S_release_extent, FAIL); - - assert(extent); - - if(extent->u.simple.size) - H5FL_ARR_FREE(hsize_t,extent->u.simple.size); - if(extent->u.simple.max) - H5FL_ARR_FREE(hsize_t,extent->u.simple.max); -#ifdef LATER - if(extent->u.simple.perm) - H5FL_ARR_FREE(hsize_t,extent->u.simple.perm); -#endif /* LATER */ - -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -1237,73 +1188,17 @@ H5S_read(H5G_entry_t *ent, hid_t dxpl_id) if (H5O_read(ent, H5O_SDSPACE_ID, 0, &(ds->extent), dxpl_id) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to load dataspace info from dataset header"); - if (ds->extent.type == H5S_NO_CLASS) { /* For backward compatibility, if file is created by version 1.6 or before. */ - if(ds->extent.u.simple.rank != 0) { - hsize_t nelem; /* Number of elements in extent */ - unsigned u; /* Local index variable */ + /* Default to entire dataspace being selected */ + if(H5S_select_all(ds,0)<0) + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); - ds->extent.type = H5S_SIMPLE; - - /* Compute the number of elements in the extent */ - for(u=0, nelem=1; u<ds->extent.u.simple.rank; u++) - nelem*=ds->extent.u.simple.size[u]; - ds->extent.nelem = nelem; - } else { - ds->extent.type = H5S_SCALAR; - ds->extent.nelem = 1; - } /* end if */ - - /* Default to entire dataspace being selected */ - if(H5S_select_all(ds,0)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); - - /* Allocate space for the offset and set it to zeros */ - if(ds->extent.u.simple.rank>0) { - if (NULL==(ds->select.offset = H5FL_ARR_CALLOC(hssize_t,ds->extent.u.simple.rank))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - } else - ds->select.offset = NULL; - } else { /* If file is new, created by version 1.7 or after */ - switch(ds->extent.type) { - case H5S_NULL: - ds->extent.nelem = 0; - if(H5S_select_none(ds)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set none selection"); - ds->select.offset = NULL; - break; + /* Allocate space for the offset and set it to zeros */ + if(ds->extent.u.simple.rank>0) { + if (NULL==(ds->select.offset = H5FL_ARR_CALLOC(hssize_t,ds->extent.u.simple.rank))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + } else + ds->select.offset = NULL; - case H5S_SCALAR: - ds->extent.nelem = 1; - /* Default to entire dataspace being selected */ - if(H5S_select_all(ds,0)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); - ds->select.offset = NULL; - break; - - case H5S_SIMPLE: { - hsize_t nelem; /* Number of elements in extent */ - unsigned u; /* Local index variable */ - - /* Compute the number of elements in the extent */ - for(u=0, nelem=1; u<ds->extent.u.simple.rank; u++) - nelem*=ds->extent.u.simple.size[u]; - ds->extent.nelem = nelem; - - /* Default to entire dataspace being selected */ - if(H5S_select_all(ds,0)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); - - /* Allocate space for the offset and set it to zeros */ - if (NULL==(ds->select.offset = H5FL_ARR_CALLOC(hssize_t,ds->extent.u.simple.rank))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - break; } - - default: - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unknown data space type"); - } - } - /* Set the value for successful return */ ret_value=ds; @@ -1409,7 +1304,7 @@ H5Sis_simple(hid_t space_id) unlimited in size. MODIFICATION - A null dataspace cannot be converted from simple space in this function. + A null dataspace cannot be created from simple space with this function. --------------------------------------------------------------------------*/ herr_t @@ -1426,8 +1321,6 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], /* Check args */ if ((space = H5I_object_verify(space_id,H5I_DATASPACE)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); - if(space->extent.type == H5S_NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dataspace"); if (rank > 0 && dims == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified"); if (rank<0 || rank>H5S_MAX_RANK) @@ -1495,26 +1388,9 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, else space->select.offset = NULL; - /* shift out of the previous state to a "simple" dataspace. Not valid for H5S_NULL */ - switch (space->extent.type) { - case H5S_SCALAR: - /* do nothing */ - break; - - case H5S_SIMPLE: - H5S_release_simple(&(space->extent.u.simple)); - break; - - case H5S_COMPLEX: - /* - * eventually this will destroy whatever "complex" dataspace info - * is retained, right now it's an error - */ - /* Fall through to report error */ - - default: - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "unknown data space class"); - } + /* shift out of the previous state to a "simple" dataspace. */ + if(H5S_extent_release(&space->extent)<0) + HGOTO_ERROR (H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent"); if (rank == 0) { /* scalar variable */ space->extent.type = H5S_SCALAR; @@ -1601,15 +1477,17 @@ UNUSED /* Check args */ assert (mem_space && (H5S_SIMPLE==mem_space->extent.type || + H5S_NULL==mem_space->extent.type || H5S_SCALAR==mem_space->extent.type)); assert (file_space && (H5S_SIMPLE==file_space->extent.type || + H5S_NULL==file_space->extent.type || H5S_SCALAR==file_space->extent.type)); /* * We can't do conversion if the source and destination select a * different number of data points. */ - if ((*mem_space->select.get_npoints)(mem_space) != (*file_space->select.get_npoints) (file_space)) + if (H5S_get_select_npoints(mem_space) != H5S_get_select_npoints(file_space)) HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, NULL, "memory and file data spaces are different sizes"); /* @@ -1991,7 +1869,7 @@ H5Sset_extent_none(hid_t space_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); /* Clear the previous extent from the dataspace */ - if(H5S_extent_release(space)<0) + if(H5S_extent_release(&space->extent)<0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, FAIL, "can't release previous dataspace"); space->extent.type=H5S_NO_CLASS; @@ -2029,8 +1907,8 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset) /* Check args */ if (NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); - if (space->extent.u.simple.rank==0 || space->extent.type==H5S_SCALAR - || space->extent.type==H5S_NULL) + if (space->extent.u.simple.rank==0 || (space->extent.type==H5S_SCALAR + || space->extent.type==H5S_NULL)) HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace"); if (offset == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified"); diff --git a/src/H5Sall.c b/src/H5Sall.c index 4509986..5a87e5d 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -710,10 +710,6 @@ H5S_select_all (H5S_t *space, unsigned rel_prev) /* Check args */ assert(space); - /* Not valid for H5S_NULL dataspace */ - if (space->extent.type == H5S_NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid data space"); - /* Remove current selection first */ if(rel_prev) if((*space->select.release)(space)<0) @@ -768,10 +764,6 @@ herr_t H5Sselect_all (hid_t spaceid) if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); - /* Not valid for H5S_NULL dataspace */ - if (space->extent.type == H5S_NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid data space"); - /* Call internal routine to do the work */ if((ret_value=H5S_select_all(space,1))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 9b5a2fa..7c732b1 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -104,17 +104,22 @@ H5S_mpio_all_type( const H5S_t *space, size_t elmt_size, hbool_t *is_derived_type ) { hsize_t total_bytes; + hssize_t snelmts; /*total number of elmts (signed) */ + hsize_t nelmts; /*total number of elmts */ unsigned u; + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_mpio_all_type); + FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_all_type); /* Check args */ assert (space); /* Just treat the entire extent as a block of bytes */ - total_bytes = (hsize_t)elmt_size; - for (u=0; u<space->extent.u.simple.rank; ++u) - total_bytes *= space->extent.u.simple.size[u]; + if((snelmts = H5S_get_simple_extent_npoints(space))<0) + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection") + H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t); + + total_bytes = (hsize_t)elmt_size*nelmts; /* fill in the return values */ *new_type = MPI_BYTE; @@ -122,7 +127,8 @@ H5S_mpio_all_type( const H5S_t *space, size_t elmt_size, *extra_offset = 0; *is_derived_type = 0; - FUNC_LEAVE_NOAPI(SUCCEED); +done: + FUNC_LEAVE_NOAPI(ret_value); } /* H5S_mpio_all_type() */ diff --git a/src/H5Snone.c b/src/H5Snone.c index f91ef2f..e07f5ae 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -665,8 +665,8 @@ herr_t H5S_select_none (H5S_t *space) /* Check args */ assert(space); - /* Remove current selection first. NULL data space either has no selection or selection is none. */ - if((space->extent.type != H5S_NULL) && (*space->select.release)(space)<0) + /* Remove current selection first */ + if((*space->select.release)(space)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab"); /* Set selection type */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 5670f22..8eb2682 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -180,8 +180,7 @@ struct H5S_t { /* Extent functions */ H5_DLL herr_t H5S_close_simple(H5S_simple_t *simple); -H5_DLL herr_t H5S_release_simple(H5S_simple_t *simple); -H5_DLL herr_t H5S_release_extent(H5S_extent_t *extent); +H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent); H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src); /* Operations on selections */ diff --git a/src/H5Sselect.c b/src/H5Sselect.c index e726752..eeea8c7 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -254,9 +254,6 @@ H5Sget_select_npoints(hid_t spaceid) if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); - if (space->extent.type == H5S_NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace"); - ret_value = H5S_get_select_npoints(space); done: @@ -331,9 +328,6 @@ H5Sselect_valid(hid_t spaceid) if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataspace"); - if (space->extent.type == H5S_NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace"); - ret_value = H5S_select_valid(space); done: @@ -914,7 +908,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t iter_init=1; /* Selection iteration info has been initialized */ /* Get the number of elements in selection */ - if((nelmts = (*space->select.get_npoints)(space))<0) + if((nelmts = H5S_get_select_npoints(space))<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); /* Get the rank of the dataspace */ @@ -1333,7 +1327,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf) iter_init=1; /* Selection iteration info has been initialized */ /* Get the number of elements in selection */ - if((nelmts = (*space->select.get_npoints)(space))<0) + if((nelmts = H5S_get_select_npoints(space))<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); /* Compute the number of bytes to process */ @@ -1850,11 +1844,11 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dc /* Get number of bytes in selection */ #ifndef NDEBUG { - hsize_t tmp_maxbytes=(*file_space->select.get_npoints)(file_space)*elmt_size; + hsize_t tmp_maxbytes=H5S_get_select_npoints(file_space)*elmt_size; H5_ASSIGN_OVERFLOW(maxbytes,tmp_maxbytes,hsize_t,size_t); } #else /* NDEBUG */ - maxbytes=(size_t)((*file_space->select.get_npoints)(file_space)*elmt_size); + maxbytes=(size_t)(H5S_get_select_npoints(file_space)*elmt_size); #endif /* NDEBUG */ /* Initialize sequence counts */ @@ -2018,11 +2012,11 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_ca /* Get number of bytes in selection */ #ifndef NDEBUG { - hsize_t tmp_maxbytes=(*file_space->select.get_npoints)(file_space)*elmt_size; + hsize_t tmp_maxbytes=H5S_get_select_npoints(file_space)*elmt_size; H5_ASSIGN_OVERFLOW(maxbytes,tmp_maxbytes,hsize_t,size_t); } #else /* NDEBUG */ - maxbytes=(size_t)((*file_space->select.get_npoints)(file_space)*elmt_size); + maxbytes=(size_t)(H5S_get_select_npoints(file_space)*elmt_size); #endif /* NDEBUG */ /* Initialize sequence counts */ |