summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-01-08 14:55:11 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-01-08 14:55:11 (GMT)
commitfeaa5bb9d54017961e325f4bc2c366fc023c2443 (patch)
treea84153ea1ed3305049e86ddff013c794b414719b /src/H5D.c
parentc81f060deb2fc82d33ef17a57b3a48718511bdc6 (diff)
downloadhdf5-feaa5bb9d54017961e325f4bc2c366fc023c2443.zip
hdf5-feaa5bb9d54017961e325f4bc2c366fc023c2443.tar.gz
hdf5-feaa5bb9d54017961e325f4bc2c366fc023c2443.tar.bz2
[svn-r8038] Purpose:
Bug fix Description: When two property lists are compared, the H5Pequal routine was just comparing the raw information for the property values. This causes problems when the raw information contains pointers to other information. Solution: Allow a 'compare' callback to be registered for properties, so that a user application get perform the comparison itself, allowing for "deep" compares of the property value. This was exported to the H5Pregister & H5Pinsert routines in the development branch, but not the release branch. Platforms tested: FreeBSD 4.9 (sleipnir) h5committest
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c294
1 files changed, 259 insertions, 35 deletions
diff --git a/src/H5D.c b/src/H5D.c
index a15f1a4..bdd1b41 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -39,6 +39,9 @@ static int interface_initialize_g = 0;
/* Local functions */
static herr_t H5D_init_interface(void);
static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite, hid_t dxpl_id);
+static int H5D_crt_fill_value_cmp(const void *value1, const void *value2, size_t size);
+static int H5D_crt_ext_file_list_cmp(const void *value1, const void *value2, size_t size);
+static int H5D_crt_data_pipeline_cmp(const void *value1, const void *value2, size_t size);
static H5D_t * H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type);
static H5D_t * H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id,
const H5S_t *space, hid_t dcpl_id, hid_t dxpl_id);
@@ -202,63 +205,63 @@ H5D_init_interface(void)
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register the max. temp buffer size property */
- if(H5P_register(xfer_pclass,H5D_XFER_MAX_TEMP_BUF_NAME,H5D_XFER_MAX_TEMP_BUF_SIZE,&def_max_temp_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_MAX_TEMP_BUF_NAME,H5D_XFER_MAX_TEMP_BUF_SIZE,&def_max_temp_buf,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the type conversion buffer property */
- if(H5P_register(xfer_pclass,H5D_XFER_TCONV_BUF_NAME,H5D_XFER_TCONV_BUF_SIZE,&def_tconv_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_TCONV_BUF_NAME,H5D_XFER_TCONV_BUF_SIZE,&def_tconv_buf,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the background buffer property */
- if(H5P_register(xfer_pclass,H5D_XFER_BKGR_BUF_NAME,H5D_XFER_BKGR_BUF_SIZE,&def_bkgr_buf,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_BKGR_BUF_NAME,H5D_XFER_BKGR_BUF_SIZE,&def_bkgr_buf,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the background buffer type property */
- if(H5P_register(xfer_pclass,H5D_XFER_BKGR_BUF_TYPE_NAME,H5D_XFER_BKGR_BUF_TYPE_SIZE,&def_bkgr_buf_type,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_BKGR_BUF_TYPE_NAME,H5D_XFER_BKGR_BUF_TYPE_SIZE,&def_bkgr_buf_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the B-Tree node splitting ratios property */
- if(H5P_register(xfer_pclass,H5D_XFER_BTREE_SPLIT_RATIO_NAME,H5D_XFER_BTREE_SPLIT_RATIO_SIZE,def_btree_split_ratio,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_BTREE_SPLIT_RATIO_NAME,H5D_XFER_BTREE_SPLIT_RATIO_SIZE,def_btree_split_ratio,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen allocation function property */
- if(H5P_register(xfer_pclass,H5D_XFER_VLEN_ALLOC_NAME,H5D_XFER_VLEN_ALLOC_SIZE,&def_vlen_alloc,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VLEN_ALLOC_NAME,H5D_XFER_VLEN_ALLOC_SIZE,&def_vlen_alloc,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen allocation information property */
- if(H5P_register(xfer_pclass,H5D_XFER_VLEN_ALLOC_INFO_NAME,H5D_XFER_VLEN_ALLOC_INFO_SIZE,&def_vlen_alloc_info,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VLEN_ALLOC_INFO_NAME,H5D_XFER_VLEN_ALLOC_INFO_SIZE,&def_vlen_alloc_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen free function property */
- if(H5P_register(xfer_pclass,H5D_XFER_VLEN_FREE_NAME,H5D_XFER_VLEN_FREE_SIZE,&def_vlen_free,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VLEN_FREE_NAME,H5D_XFER_VLEN_FREE_SIZE,&def_vlen_free,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vlen free information property */
- if(H5P_register(xfer_pclass,H5D_XFER_VLEN_FREE_INFO_NAME,H5D_XFER_VLEN_FREE_INFO_SIZE,&def_vlen_free_info,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VLEN_FREE_INFO_NAME,H5D_XFER_VLEN_FREE_INFO_SIZE,&def_vlen_free_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver ID property */
- if(H5P_register(xfer_pclass,H5D_XFER_VFL_ID_NAME,H5D_XFER_VFL_ID_SIZE,&def_vfl_id,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VFL_ID_NAME,H5D_XFER_VFL_ID_SIZE,&def_vfl_id,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the file driver info property */
- if(H5P_register(xfer_pclass,H5D_XFER_VFL_INFO_NAME,H5D_XFER_VFL_INFO_SIZE,&def_vfl_info,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_VFL_INFO_NAME,H5D_XFER_VFL_INFO_SIZE,&def_vfl_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the vector size property */
- if(H5P_register(xfer_pclass,H5D_XFER_HYPER_VECTOR_SIZE_NAME,H5D_XFER_HYPER_VECTOR_SIZE_SIZE,&def_hyp_vec_size,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_HYPER_VECTOR_SIZE_NAME,H5D_XFER_HYPER_VECTOR_SIZE_SIZE,&def_hyp_vec_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the I/O transfer mode property */
- if(H5P_register(xfer_pclass,H5D_XFER_IO_XFER_MODE_NAME,H5D_XFER_IO_XFER_MODE_SIZE,&def_io_xfer_mode,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_IO_XFER_MODE_NAME,H5D_XFER_IO_XFER_MODE_SIZE,&def_io_xfer_mode,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the EDC property */
- if(H5P_register(xfer_pclass,H5D_XFER_EDC_NAME,H5D_XFER_EDC_SIZE,&enable_edc,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_EDC_NAME,H5D_XFER_EDC_SIZE,&enable_edc,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the filter callback property */
- if(H5P_register(xfer_pclass,H5D_XFER_FILTER_CB_NAME,H5D_XFER_FILTER_CB_SIZE,&filter_cb,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ if(H5P_register(xfer_pclass,H5D_XFER_FILTER_CB_NAME,H5D_XFER_FILTER_CB_SIZE,&filter_cb,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
} /* end if */
@@ -284,35 +287,35 @@ H5D_init_interface(void)
/* Assume that if there are properties in the class, they are the default ones */
if(nprops==0) {
/* Register the storage layout property */
- if(H5P_register(crt_pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register(crt_pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the chunking dimensionality property */
- if(H5P_register(crt_pclass, H5D_CRT_CHUNK_DIM_NAME, H5D_CRT_CHUNK_DIM_SIZE, &chunk_ndims, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register(crt_pclass, H5D_CRT_CHUNK_DIM_NAME, H5D_CRT_CHUNK_DIM_SIZE, &chunk_ndims, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the chunking size property */
- if(H5P_register(crt_pclass, H5D_CRT_CHUNK_SIZE_NAME, H5D_CRT_CHUNK_SIZE_SIZE, chunk_size, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register(crt_pclass, H5D_CRT_CHUNK_SIZE_NAME, H5D_CRT_CHUNK_SIZE_SIZE, chunk_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the fill value property */
- if(H5P_register(crt_pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register(crt_pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the space allocation time property */
- if(H5P_register(crt_pclass, H5D_CRT_ALLOC_TIME_NAME, H5D_CRT_ALLOC_TIME_SIZE, &alloc_time, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register(crt_pclass, H5D_CRT_ALLOC_TIME_NAME, H5D_CRT_ALLOC_TIME_SIZE, &alloc_time, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the fill value writing time property */
- if(H5P_register(crt_pclass, H5D_CRT_FILL_TIME_NAME, H5D_CRT_FILL_TIME_SIZE, &fill_time, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register(crt_pclass, H5D_CRT_FILL_TIME_NAME, H5D_CRT_FILL_TIME_SIZE, &fill_time, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the external file list property */
- if(H5P_register(crt_pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register(crt_pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the data pipeline property */
- if(H5P_register(crt_pclass, H5D_CRT_DATA_PIPELINE_NAME, H5D_CRT_DATA_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if(H5P_register(crt_pclass, H5D_CRT_DATA_PIPELINE_NAME, H5D_CRT_DATA_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5D_CRT_DATA_PIPELINE_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
} /* end if */
@@ -551,6 +554,228 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5D_crt_fill_value_cmp
+ *
+ * Purpose: Callback routine which is called whenever the fill value
+ * property in the dataset creation property list is compared.
+ *
+ * Return: positive if VALUE1 is greater than VALUE2, negative if
+ * VALUE2 is greater than VALUE1 and zero if VALUE1 and
+ * VALUE2 are equal.
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 7, 2004
+ *
+ * Modification:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D_crt_fill_value_cmp(const void *value1, const void *value2, size_t size)
+{
+ const H5O_fill_t *fill1=(const H5O_fill_t *)value1, /* Create local aliases for values */
+ *fill2=(const H5O_fill_t *)value2;
+ int cmp_value; /* Value from comparison */
+ herr_t ret_value=0; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_crt_fill_value_cmp)
+
+ /* Sanity check */
+ assert(fill1);
+ assert(fill2);
+ assert(size==sizeof(H5O_fill_t));
+
+ /* Check the size of fill values */
+ if(fill1->size < fill2->size) HGOTO_DONE(-1);
+ if(fill1->size > fill2->size) HGOTO_DONE(1);
+
+ /* Check the types of the fill values */
+ if(fill1->type==NULL && fill2->type!=NULL) HGOTO_DONE(-1);
+ if(fill1->type!=NULL && fill2->type==NULL) HGOTO_DONE(1);
+ if(fill1->type!=NULL)
+ if((cmp_value=H5T_cmp(fill1->type,fill2->type))!=0)
+ HGOTO_DONE(cmp_value);
+
+ /* Check the fill values in the buffers */
+ if(fill1->buf==NULL && fill2->buf!=NULL) HGOTO_DONE(-1);
+ if(fill1->buf!=NULL && fill2->buf==NULL) HGOTO_DONE(1);
+ if(fill1->buf!=NULL)
+ if((cmp_value=HDmemcmp(fill1->buf,fill2->buf,fill1->size))!=0)
+ HGOTO_DONE(cmp_value);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_crt_fill_value_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_crt_ext_file_list_cmp
+ *
+ * Purpose: Callback routine which is called whenever the external file
+ * list property in the dataset creation property list is
+ * compared.
+ *
+ * Return: positive if VALUE1 is greater than VALUE2, negative if
+ * VALUE2 is greater than VALUE1 and zero if VALUE1 and
+ * VALUE2 are equal.
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 7, 2004
+ *
+ * Modification:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D_crt_ext_file_list_cmp(const void *value1, const void *value2, size_t size)
+{
+ const H5O_efl_t *efl1=(const H5O_efl_t *)value1, /* Create local aliases for values */
+ *efl2=(const H5O_efl_t *)value2;
+ int cmp_value; /* Value from comparison */
+ herr_t ret_value=0; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_crt_ext_file_list_cmp)
+
+ /* Sanity check */
+ assert(efl1);
+ assert(efl2);
+ assert(size==sizeof(H5O_efl_t));
+
+ /* Check the heap address of external file lists */
+ if((cmp_value=H5F_addr_cmp(efl1->heap_addr,efl2->heap_addr))!=0)
+ HGOTO_DONE(cmp_value);
+
+ /* Check the number of allocated efl entries */
+ if(efl1->nalloc < efl2->nalloc) HGOTO_DONE(-1);
+ if(efl1->nalloc > efl2->nalloc) HGOTO_DONE(1);
+
+ /* Check the number of used efl entries */
+ if(efl1->nused < efl2->nused) HGOTO_DONE(-1);
+ if(efl1->nused > efl2->nused) HGOTO_DONE(1);
+
+ /* Check the efl entry information */
+ if(efl1->slot==NULL && efl2->slot!=NULL) HGOTO_DONE(-1);
+ if(efl1->slot!=NULL && efl2->slot==NULL) HGOTO_DONE(1);
+ if(efl1->slot!=NULL && efl1->nused>0) {
+ size_t u; /* Local index variable */
+
+ /* Loop through all entries, comparing them */
+ for(u=0; u<efl1->nused; u++) {
+ /* Check the name offset of the efl entry */
+ if(efl1->slot[u].name_offset < efl2->slot[u].name_offset) HGOTO_DONE(-1);
+ if(efl1->slot[u].name_offset > efl2->slot[u].name_offset) HGOTO_DONE(1);
+
+ /* Check the name of the efl entry */
+ if(efl1->slot[u].name==NULL && efl2->slot[u].name!=NULL) HGOTO_DONE(-1);
+ if(efl1->slot[u].name!=NULL && efl2->slot[u].name==NULL) HGOTO_DONE(1);
+ if(efl1->slot[u].name!=NULL)
+ if((cmp_value=HDstrcmp(efl1->slot[u].name,efl2->slot[u].name))!=0)
+ HGOTO_DONE(cmp_value);
+
+ /* Check the file offset of the efl entry */
+ if(efl1->slot[u].offset < efl2->slot[u].offset) HGOTO_DONE(-1);
+ if(efl1->slot[u].offset > efl2->slot[u].offset) HGOTO_DONE(1);
+
+ /* Check the file size of the efl entry */
+ if(efl1->slot[u].size < efl2->slot[u].size) HGOTO_DONE(-1);
+ if(efl1->slot[u].size > efl2->slot[u].size) HGOTO_DONE(1);
+ } /* end for */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_crt_ext_file_list_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_crt_data_pipeline_cmp
+ *
+ * Purpose: Callback routine which is called whenever the filter pipeline
+ * property in the dataset creation property list is compared.
+ *
+ * Return: positive if VALUE1 is greater than VALUE2, negative if
+ * VALUE2 is greater than VALUE1 and zero if VALUE1 and
+ * VALUE2 are equal.
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 7, 2004
+ *
+ * Modification:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D_crt_data_pipeline_cmp(const void *value1, const void *value2, size_t size)
+{
+ const H5O_pline_t *pline1=(const H5O_pline_t *)value1, /* Create local aliases for values */
+ *pline2=(const H5O_pline_t *)value2;
+ int cmp_value; /* Value from comparison */
+ herr_t ret_value=0; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_crt_data_pipeline_cmp)
+
+ /* Sanity check */
+ assert(pline1);
+ assert(pline2);
+ assert(size==sizeof(H5O_pline_t));
+
+ /* Check the number of allocated pipeline entries */
+ if(pline1->nalloc < pline2->nalloc) HGOTO_DONE(-1);
+ if(pline1->nalloc > pline2->nalloc) HGOTO_DONE(1);
+
+ /* Check the number of used pipeline entries */
+ if(pline1->nused < pline2->nused) HGOTO_DONE(-1);
+ if(pline1->nused > pline2->nused) HGOTO_DONE(1);
+
+ /* Check the filter entry information */
+ if(pline1->filter==NULL && pline2->filter!=NULL) HGOTO_DONE(-1);
+ if(pline1->filter!=NULL && pline2->filter==NULL) HGOTO_DONE(1);
+ if(pline1->filter!=NULL && pline1->nused>0) {
+ size_t u; /* Local index variable */
+
+ /* Loop through all filters, comparing them */
+ for(u=0; u<pline1->nused; u++) {
+ /* Check the ID of the filter */
+ if(pline1->filter[u].id < pline2->filter[u].id) HGOTO_DONE(-1);
+ if(pline1->filter[u].id > pline2->filter[u].id) HGOTO_DONE(1);
+
+ /* Check the flags for the filter */
+ if(pline1->filter[u].flags < pline2->filter[u].flags) HGOTO_DONE(-1);
+ if(pline1->filter[u].flags > pline2->filter[u].flags) HGOTO_DONE(1);
+
+ /* Check the name of the filter */
+ if(pline1->filter[u].name==NULL && pline2->filter[u].name!=NULL) HGOTO_DONE(-1);
+ if(pline1->filter[u].name!=NULL && pline2->filter[u].name==NULL) HGOTO_DONE(1);
+ if(pline1->filter[u].name!=NULL)
+ if((cmp_value=HDstrcmp(pline1->filter[u].name,pline2->filter[u].name))!=0)
+ HGOTO_DONE(cmp_value);
+
+ /* Check the number of parameters for the filter */
+ if(pline1->filter[u].cd_nelmts < pline2->filter[u].cd_nelmts) HGOTO_DONE(-1);
+ if(pline1->filter[u].cd_nelmts > pline2->filter[u].cd_nelmts) HGOTO_DONE(1);
+
+ /* Check the filter parameter information */
+ if(pline1->filter[u].cd_values==NULL && pline2->filter[u].cd_values!=NULL) HGOTO_DONE(-1);
+ if(pline1->filter[u].cd_values!=NULL && pline2->filter[u].cd_values==NULL) HGOTO_DONE(1);
+ if(pline1->filter[u].cd_values!=NULL && pline1->filter[u].cd_nelmts>0) {
+ size_t v; /* Local index variable */
+
+ /* Loop through all parameters, comparing them */
+ for(v=0; v<pline1->filter[u].cd_nelmts; v++) {
+ /* Check each parameter for the filter */
+ if(pline1->filter[u].cd_values[v] < pline2->filter[u].cd_values[v]) HGOTO_DONE(-1);
+ if(pline1->filter[u].cd_values[v] > pline2->filter[u].cd_values[v]) HGOTO_DONE(1);
+ } /* end for */
+ } /* end if */
+ } /* end for */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_crt_data_pipeline_cmp() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D_xfer_create
*
* Purpose: Callback routine which is called whenever any dataset transfer
@@ -1472,8 +1697,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p
if (H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve pipeline filter")
- if (pline.nfilters > 0 &&
- H5O_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_FLAG_CONSTANT, &pline) < 0)
+ if (pline.nused > 0 && H5O_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_FLAG_CONSTANT, &pline) < 0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message")
} /* end if */
@@ -1488,25 +1712,25 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p
/* Update external storage message */
if (efl->nused > 0) {
size_t heap_size = H5HL_ALIGN(1);
- int i;
+ size_t u;
- for (i = 0; i < efl->nused; ++i)
- heap_size += H5HL_ALIGN(HDstrlen(efl->slot[i].name) + 1);
+ for (u = 0; u < efl->nused; ++u)
+ heap_size += H5HL_ALIGN(HDstrlen(efl->slot[u].name) + 1);
if (H5HL_create(file, dxpl_id, heap_size, &efl->heap_addr/*out*/) < 0 ||
H5HL_insert(file, dxpl_id, efl->heap_addr, 1, "") == (size_t)(-1))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create external file list name heap")
- for (i = 0; i < efl->nused; ++i) {
+ for (u = 0; u < efl->nused; ++u) {
size_t offset = H5HL_insert(file, dxpl_id, efl->heap_addr,
- HDstrlen(efl->slot[i].name) + 1, efl->slot[i].name);
+ HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name);
- assert(0 == efl->slot[i].name_offset);
+ assert(0 == efl->slot[u].name_offset);
if (offset == (size_t)(-1))
HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, FAIL, "unable to insert URL into name heap")
- efl->slot[i].name_offset = offset;
+ efl->slot[u].name_offset = offset;
}
if (H5O_append(file, dxpl_id, oh, H5O_EFL_ID, H5O_FLAG_CONSTANT, efl) < 0)
@@ -1687,7 +1911,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve pipeline filter")
if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout")
- if(dcpl_pline.nfilters > 0 && H5D_CHUNKED != dcpl_layout)
+ if(dcpl_pline.nused > 0 && H5D_CHUNKED != dcpl_layout)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout")
if(H5P_get(dc_plist, H5D_CRT_ALLOC_TIME_NAME, &alloc_time) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve space allocation time")
@@ -1720,7 +1944,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
new_dset->alloc_time=alloc_time;
/* If MPI VFD is used, no filter support yet. */
- if(IS_H5FD_MPI(file) && dcpl_pline.nfilters > 0)
+ if(IS_H5FD_MPI(file) && dcpl_pline.nused > 0)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel I/O does not support filters yet")
/* Chunked datasets are non-default, so retrieve their info here */
@@ -2075,7 +2299,7 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set pipeline")
/* If MPI VFD is used, no filter support yet. */
- if(IS_H5FD_MPI(dataset->ent.file) && pline.nfilters > 0)
+ if(IS_H5FD_MPI(dataset->ent.file) && pline.nused > 0)
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel IO does not support filters yet")
/*