diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-08 14:55:11 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-08 14:55:11 (GMT) |
commit | feaa5bb9d54017961e325f4bc2c366fc023c2443 (patch) | |
tree | a84153ea1ed3305049e86ddff013c794b414719b | |
parent | c81f060deb2fc82d33ef17a57b3a48718511bdc6 (diff) | |
download | hdf5-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
-rw-r--r-- | doc/html/RM_H5P.html | 69 | ||||
-rw-r--r-- | fortran/src/H5Pf.c | 4 | ||||
-rw-r--r-- | release_docs/RELEASE.txt | 10 | ||||
-rw-r--r-- | src/H5AC.c | 12 | ||||
-rw-r--r-- | src/H5D.c | 294 | ||||
-rw-r--r-- | src/H5Distore.c | 10 | ||||
-rw-r--r-- | src/H5Dprivate.h | 3 | ||||
-rw-r--r-- | src/H5F.c | 58 | ||||
-rw-r--r-- | src/H5FDfphdf5.c | 4 | ||||
-rw-r--r-- | src/H5FDmpio.c | 4 | ||||
-rw-r--r-- | src/H5FPclient.c | 2 | ||||
-rw-r--r-- | src/H5Fistore.c | 10 | ||||
-rw-r--r-- | src/H5Oefl.c | 116 | ||||
-rw-r--r-- | src/H5Opline.c | 28 | ||||
-rw-r--r-- | src/H5Oprivate.h | 8 | ||||
-rw-r--r-- | src/H5P.c | 262 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 40 | ||||
-rw-r--r-- | src/H5Ppkg.h | 1 | ||||
-rw-r--r-- | src/H5Pprivate.h | 5 | ||||
-rw-r--r-- | src/H5Ppublic.h | 32 | ||||
-rw-r--r-- | src/H5Z.c | 28 | ||||
-rw-r--r-- | src/H5private.h | 7 | ||||
-rw-r--r-- | test/dsets.c | 88 | ||||
-rw-r--r-- | test/tgenprop.c | 162 | ||||
-rw-r--r-- | tools/h5repack/h5repack_verify.c | 1 | ||||
-rw-r--r-- | tools/h5repack/testh5repack_main.c | 12 |
26 files changed, 1027 insertions, 243 deletions
diff --git a/doc/html/RM_H5P.html b/doc/html/RM_H5P.html index da6bbb5..d8ae024 100644 --- a/doc/html/RM_H5P.html +++ b/doc/html/RM_H5P.html @@ -4184,6 +4184,7 @@ SUBROUTINE <em>H5P_prp_get_func_t</em> <code>get</code>, <em>H5P_prp_delete_func_t</em> <code>delete</code>, <em>H5P_prp_copy_func_t</em> <code>copy</code>, + <em>H5P_prp_compare_func_t</em> <code>compare</code>, <em>H5P_prp_close_func_t</em> <code>close</code> ) @@ -4290,6 +4291,7 @@ SUBROUTINE routine returns an error value. </p> + <P> The <code>delete</code> routine is called when a property is being deleted from a property list. The <code>H5P_prp_delete_func_t</code> callback function is defined @@ -4323,6 +4325,7 @@ SUBROUTINE error value but the property is still deleted. </P> + <P> The <code>copy</code> routine is called when a new property list with this property is being created through a copy operation. The <code>H5P_prp_copy_func_t</code> collback function is defined @@ -4349,6 +4352,36 @@ SUBROUTINE If the <code>copy</code> routine returns a negative value, the new property value is not copied into the property and the copy routine returns an error value. + </P> + + <P> + The <code>compare</code> routine is called when a property list with + this property is compared to another property list with the same property. + The <code>H5P_prp_compare_func_t</code> callback function is defined + as follows: + <ul><em>typedef int</em> (*<code>H5P_prp_compare_func_t</code>)( + <em>const void *</em><code>value1</code>, + <em>const void *</em><code>value2</code>, + <em>size_t </em><code>size</code>); + </ul> + The parameters to the callback function are defined as follows: + <ul><table> + <tr> + <td><em>const void *</em><code>value1</code></td> + <td>IN: The value of the first property to compare</td></tr> + <tr> + <td><em>const void *</em><code>value2</code></td> + <td>IN: The value of the second property to compare</td></tr> + <tr> + <td><em>size_t </em><code>size</code></td> + <td>IN: The size of the property in bytes</td></tr> + </table></ul> + The <code>compare</code> routine may <EM>not</EM> modify the values. + The <code>compare</code> routine should return a positive value if + <code>value1</code> is greater than <code>value2</code>, a negative value + if <code>value2</code> is greater than <code>value1</code> and zero if + <code>value1</code> and <code>value2</code> are equal. + </P> <P>The <code>close</code> routine is called when a property list with this property is being closed. @@ -4722,6 +4755,7 @@ END SUBROUTINE h5pmodify_filter_f <em>H5P_prp_get_func_t</em> <code>get</code>, <em>H5P_prp_delete_func_t</em> <code>delete</code>, <em>H5P_prp_copy_func_t</em> <code>copy</code>, + <em>H5P_prp_compare_func_t</em> <code>compare</code>, <em>H5P_prp_close_func_t</em> <code>close</code> ) @@ -4749,6 +4783,7 @@ END SUBROUTINE h5pmodify_filter_f <code>get</code> callbacks are never called. </P> + <P> The <code>create</code> routine is called when a new property list with this property is being created. The <code>H5P_prp_create_func_t</code> callback function is defined @@ -4778,6 +4813,7 @@ END SUBROUTINE h5pmodify_filter_f create routine returns an error value. </P> + <P> The <code>set</code> routine is called before a new value is copied into the property. The <code>H5P_prp_set_func_t</code> callback function is defined @@ -4855,6 +4891,7 @@ END SUBROUTINE h5pmodify_filter_f routine returns an error value. </P> + <P> The <code>delete</code> routine is called when a property is being deleted from a property list. The <code>H5P_prp_delete_func_t</code> callback function is defined @@ -4888,6 +4925,7 @@ END SUBROUTINE h5pmodify_filter_f an error value but the property is still deleted. </P> + <P> The <code>copy</code> routine is called when a new property list with this property is being created through a copy operation. The <code>H5P_prp_copy_func_t</code> callback function is defined @@ -4916,6 +4954,36 @@ END SUBROUTINE h5pmodify_filter_f the copy routine returns an error value. </P> + <P> + The <code>compare</code> routine is called when a property list with + this property is compared to another property list with the same property. + The <code>H5P_prp_compare_func_t</code> callback function is defined + as follows: + <ul><em>typedef int</em> (*<code>H5P_prp_compare_func_t</code>)( + <em>const void *</em><code>value1</code>, + <em>const void *</em><code>value2</code>, + <em>size_t </em><code>size</code>); + </ul> + The parameters to the callback function are defined as follows: + <ul><table> + <tr> + <td><em>const void *</em><code>value1</code></td> + <td>IN: The value of the first property to compare</td></tr> + <tr> + <td><em>const void *</em><code>value2</code></td> + <td>IN: The value of the second property to compare</td></tr> + <tr> + <td><em>size_t </em><code>size</code></td> + <td>IN: The size of the property in bytes</td></tr> + </table></ul> + The <code>compare</code> routine may <EM>not</EM> modify the values. + The <code>compare</code> routine should return a positive value if + <code>value1</code> is greater than <code>value2</code>, a negative value + if <code>value2</code> is greater than <code>value1</code> and zero if + <code>value1</code> and <code>value2</code> are equal. + </P> + + <P> The <code>close</code> routine is called when a property list with this property is being closed. The <code>H5P_prp_close_func_t</code> callback function is defined @@ -4948,6 +5016,7 @@ END SUBROUTINE h5pmodify_filter_f If the <code>close</code> routine returns a negative value, the property list close routine returns an error value but the property list is still closed. + </P> <dt><strong>Parameters:</strong> <ul><dl> diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 6918e26..14c8b45 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -2253,7 +2253,7 @@ nh5pregister_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void /* * Call H5Pregister function. */ - if( H5Pregister(c_class, c_name, c_size, value, NULL,NULL,NULL,NULL,NULL,NULL) <0) goto DONE; + if( H5Pregister(c_class, c_name, c_size, value, NULL,NULL,NULL,NULL,NULL,NULL,NULL) <0) goto DONE; ret_value = 0; DONE: @@ -2314,7 +2314,7 @@ nh5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *v /* * Call H5Pinsert function. */ - if( H5Pinsert(c_plist, c_name, c_size, value, NULL,NULL,NULL,NULL,NULL) <0) goto DONE; + if( H5Pinsert(c_plist, c_name, c_size, value, NULL,NULL,NULL,NULL,NULL,NULL) <0) goto DONE; ret_value = 0; DONE: diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c84f330..83badb2 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -41,6 +41,8 @@ New Features Library: -------- + - Added new 'compare' callback parameter to H5Pregister & H5Pinsert + routines. QAK - 2004/01/07 - Data type conversion between integers and floats was added. SLU 2003/11/21 - New function H5Iget_file_id() was added. It returns file ID given @@ -86,10 +88,10 @@ New Features Support for new platforms, languages and compilers. ======================================= - HDF5 Fortran APIs are supported on MAC OSX with IBM XL Fortran - Compiler version 8.1 Beta. Use "--disable-shared --enable-static" - configure flags along with the "--enable-fortran" flag to build - Fortran library. + - HDF5 Fortran APIs are supported on MAC OSX with IBM XL Fortran + Compiler version 8.1 Beta. Use "--disable-shared --enable-static" + configure flags along with the "--enable-fortran" flag to build + Fortran library. EIP - 2004/01/07 Bug Fixes since HDF5-1.6.0 release ================================== @@ -217,11 +217,11 @@ H5AC_init_interface(void) /* Insert 'block before metadata write' property */ block_before_meta_write=1; - if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Insert 'library internal' property */ - if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Set the transfer mode */ @@ -241,11 +241,11 @@ H5AC_init_interface(void) /* Insert 'block before metadata write' property */ block_before_meta_write=0; - if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Insert 'library internal' property */ - if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Set the transfer mode */ @@ -265,11 +265,11 @@ H5AC_init_interface(void) /* Insert 'block before metadata write' property */ block_before_meta_write=0; - if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Insert 'library internal' property */ - if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Set the transfer mode */ @@ -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") /* diff --git a/src/H5Distore.c b/src/H5Distore.c index af66624..90a9c11 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -938,7 +938,7 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res alloc = ent->alloc_size; /* Should the chunk be filtered before writing it to disk? */ - if (ent->pline && ent->pline->nfilters) { + if (ent->pline && ent->pline->nused) { H5P_genplist_t *plist; /* Data xfer property list */ H5Z_cb_t cb_struct; H5Z_EDC_t edc; @@ -1771,7 +1771,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * for the chunk has been defined, then don't load the chunk into the * cache, just write the data to it directly. */ - if (chunk_size>f->shared->rdcc_nbytes && pline.nfilters==0 && + if (chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && chunk_addr!=HADDR_UNDEF) { if ((ret_value=H5F_contig_readvv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file"); @@ -1898,11 +1898,11 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * writing to other elements in the same chunk. Do a direct * write-through of only the elements requested. */ - if ((chunk_size>f->shared->rdcc_nbytes && pline.nfilters==0 && chunk_addr!=HADDR_UNDEF) + if ((chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && chunk_addr!=HADDR_UNDEF) || (IS_H5FD_MPI(f) && (H5F_ACC_RDWR & f->shared->flags))) { #ifdef H5_HAVE_PARALLEL /* Additional sanity check when operating in parallel */ - if (chunk_addr==HADDR_UNDEF || pline.nfilters>0) + if (chunk_addr==HADDR_UNDEF || pline.nused>0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk"); #endif /* H5_HAVE_PARALLEL */ if ((ret_value=H5F_contig_writevv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) @@ -2279,7 +2279,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } /* end else */ /* Check if there are filters which need to be applied to the chunk */ - if (pline.nfilters>0) { + if (pline.nused>0) { unsigned filter_mask=0; size_t buf_size=(size_t)chunk_size; size_t nbytes=(size_t)chunk_size; diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 2923bfb..81075fc 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -52,6 +52,7 @@ #define H5D_CRT_FILL_VALUE_NAME "fill_value" #define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t) #define H5D_CRT_FILL_VALUE_DEF {NULL, 0, NULL} +#define H5D_CRT_FILL_VALUE_CMP H5D_crt_fill_value_cmp /* Definitions for space allocation time */ #define H5D_CRT_ALLOC_TIME_NAME "alloc_time" #define H5D_CRT_ALLOC_TIME_SIZE sizeof(H5D_alloc_time_t) @@ -64,10 +65,12 @@ #define H5D_CRT_EXT_FILE_LIST_NAME "efl" #define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t) #define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL} +#define H5D_CRT_EXT_FILE_LIST_CMP H5D_crt_ext_file_list_cmp /* Definitions for data filter pipeline */ #define H5D_CRT_DATA_PIPELINE_NAME "pline" #define H5D_CRT_DATA_PIPELINE_SIZE sizeof(H5O_pline_t) #define H5D_CRT_DATA_PIPELINE_DEF {0, 0, NULL} +#define H5D_CRT_DATA_PIPELINE_CMP H5D_crt_data_pipeline_cmp /* ======== Data transfer properties ======== */ /* Definitions for maximum temp buffer size property */ @@ -12,14 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/***************************************************************************** - * * - * MODIFICATIONS * - * Robb Matzke, 30 Aug 1997 * - * Added `ERRORS' fields to function prologues. * - * * - ****************************************************************************/ - #define H5F_PACKAGE /*suppress error about including H5Fpkg */ /* Pablo information */ @@ -275,39 +267,39 @@ H5F_init_interface(void) /* Assume that if there are properties in the class, they are the default ones */ if(nprops==0) { /* Register the user block size */ - if(H5P_register(crt_pclass,H5F_CRT_USER_BLOCK_NAME,H5F_CRT_USER_BLOCK_SIZE, &userblock_size,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(crt_pclass,H5F_CRT_USER_BLOCK_NAME,H5F_CRT_USER_BLOCK_SIZE, &userblock_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for symbol table leaf nodes */ - if(H5P_register(crt_pclass,H5F_CRT_SYM_LEAF_NAME,H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(crt_pclass,H5F_CRT_SYM_LEAF_NAME,H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for btree internal nodes */ - if(H5P_register(crt_pclass,H5F_CRT_BTREE_RANK_NAME,H5F_CRT_BTREE_RANK_SIZE, btree_k,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(crt_pclass,H5F_CRT_BTREE_RANK_NAME,H5F_CRT_BTREE_RANK_SIZE, btree_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for an address */ - if(H5P_register(crt_pclass,H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr,NULL,NULL,NULL,NULL,NULL, NULL)<0) + if(H5P_register(crt_pclass,H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for object size */ - if(H5P_register(crt_pclass,H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE,&sizeof_size,NULL,NULL,NULL,NULL,NULL, NULL)<0) + if(H5P_register(crt_pclass,H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE,&sizeof_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the superblock version number */ - if(H5P_register(crt_pclass,H5F_CRT_SUPER_VERS_NAME,H5F_CRT_SUPER_VERS_SIZE, &superblock_ver,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(crt_pclass,H5F_CRT_SUPER_VERS_NAME,H5F_CRT_SUPER_VERS_SIZE, &superblock_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the free-space version number */ - if(H5P_register(crt_pclass,H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE,&freespace_ver,NULL,NULL,NULL,NULL,NULL, NULL)<0) + if(H5P_register(crt_pclass,H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE,&freespace_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the object directory version number */ - if(H5P_register(crt_pclass,H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE,&objectdir_ver,NULL,NULL,NULL,NULL,NULL, NULL)<0) + if(H5P_register(crt_pclass,H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE,&objectdir_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the shared-header version number */ - if(H5P_register(crt_pclass,H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver,NULL,NULL,NULL,NULL, NULL,NULL)<0) + if(H5P_register(crt_pclass,H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") } /* end if */ @@ -361,63 +353,63 @@ end_registration: ; /* Assume that if there are properties in the class, they are the default ones */ if(nprops==0) { /* Register the size of meta data cache(elements) */ - if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_SIZE_NAME,H5F_ACS_META_CACHE_SIZE_SIZE, &mdc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_SIZE_NAME,H5F_ACS_META_CACHE_SIZE_SIZE, &mdc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache (elements) */ - if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the threshold for alignment */ - if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the alignment */ - if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum metadata allocation block size */ - if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the maximum sieve buffer size */ - if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum "small data" allocation block size */ - if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the garbage collection reference */ - if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,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 */ - if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_id,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_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 */ - if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_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 close degree */ - if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the offset of family driver info */ - if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data type of multi driver info */ - if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") } /* end if */ @@ -442,7 +434,7 @@ end_registration: ; /* Assume that if there are properties in the class, they are the default ones */ if(nprops==0) { /* Register property of whether symlinks is local to file */ - if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") } /* end if */ diff --git a/src/H5FDfphdf5.c b/src/H5FDfphdf5.c index 8198165..e2aae8a 100644 --- a/src/H5FDfphdf5.c +++ b/src/H5FDfphdf5.c @@ -554,13 +554,13 @@ H5FD_fphdf5_setup(hid_t dxpl_id, MPI_Datatype btype, /* Set buffer MPI type */ if (H5P_insert(plist, H5FD_FPHDF5_XFER_MEM_MPI_TYPE_NAME, H5FD_FPHDF5_XFER_MEM_MPI_TYPE_SIZE, &btype, - NULL, NULL, NULL, NULL, NULL) < 0) + NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") /* Set file MPI type */ if (H5P_insert(plist, H5FD_FPHDF5_XFER_FILE_MPI_TYPE_NAME, H5FD_FPHDF5_XFER_FILE_MPI_TYPE_SIZE, &ftype, - NULL, NULL, NULL, NULL, NULL) < 0) + NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") done: diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 61d97da..0a62158 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -644,11 +644,11 @@ H5FD_mpio_setup(hid_t dxpl_id, MPI_Datatype btype, MPI_Datatype ftype) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataset transfer list") /* Set buffer MPI type */ - if(H5P_insert(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,H5FD_MPIO_XFER_MEM_MPI_TYPE_SIZE,&btype,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(plist,H5FD_MPIO_XFER_MEM_MPI_TYPE_NAME,H5FD_MPIO_XFER_MEM_MPI_TYPE_SIZE,&btype,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") /* Set file MPI type */ - if(H5P_insert(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,H5FD_MPIO_XFER_FILE_MPI_TYPE_SIZE,&ftype,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(plist,H5FD_MPIO_XFER_FILE_MPI_TYPE_NAME,H5FD_MPIO_XFER_FILE_MPI_TYPE_SIZE,&ftype,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") done: diff --git a/src/H5FPclient.c b/src/H5FPclient.c index cdc22e0..e9f8ffb 100644 --- a/src/H5FPclient.c +++ b/src/H5FPclient.c @@ -969,7 +969,7 @@ H5FP_dump_to_file(H5FD_t *file, hid_t dxpl_id) /* Set the fact that we're dumping metadata to the file */ if (H5P_insert(plist, H5FD_FPHDF5_XFER_DUMPING_METADATA, H5FD_FPHDF5_XFER_DUMPING_SIZE, &dumping, - NULL, NULL, NULL, NULL, NULL) < 0) + NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property"); /* diff --git a/src/H5Fistore.c b/src/H5Fistore.c index af66624..90a9c11 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -938,7 +938,7 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res alloc = ent->alloc_size; /* Should the chunk be filtered before writing it to disk? */ - if (ent->pline && ent->pline->nfilters) { + if (ent->pline && ent->pline->nused) { H5P_genplist_t *plist; /* Data xfer property list */ H5Z_cb_t cb_struct; H5Z_EDC_t edc; @@ -1771,7 +1771,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * for the chunk has been defined, then don't load the chunk into the * cache, just write the data to it directly. */ - if (chunk_size>f->shared->rdcc_nbytes && pline.nfilters==0 && + if (chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && chunk_addr!=HADDR_UNDEF) { if ((ret_value=H5F_contig_readvv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file"); @@ -1898,11 +1898,11 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * writing to other elements in the same chunk. Do a direct * write-through of only the elements requested. */ - if ((chunk_size>f->shared->rdcc_nbytes && pline.nfilters==0 && chunk_addr!=HADDR_UNDEF) + if ((chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && chunk_addr!=HADDR_UNDEF) || (IS_H5FD_MPI(f) && (H5F_ACC_RDWR & f->shared->flags))) { #ifdef H5_HAVE_PARALLEL /* Additional sanity check when operating in parallel */ - if (chunk_addr==HADDR_UNDEF || pline.nfilters>0) + if (chunk_addr==HADDR_UNDEF || pline.nused>0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk"); #endif /* H5_HAVE_PARALLEL */ if ((ret_value=H5F_contig_writevv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) @@ -2279,7 +2279,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } /* end else */ /* Check if there are filters which need to be applied to the chunk */ - if (pline.nfilters>0) { + if (pline.nused>0) { unsigned filter_mask=0; size_t buf_size=(size_t)chunk_size; size_t nbytes=(size_t)chunk_size; diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 4ecd5f8..9155611 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -90,9 +90,10 @@ static void * H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) { H5O_efl_t *mesg = NULL; - int i, version; + int version; const char *s = NULL; const H5HL_t *heap; + size_t u; /* Local index variable */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_efl_decode, NULL); @@ -140,27 +141,27 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s mesg->slot = H5MM_calloc(mesg->nalloc*sizeof(H5O_efl_entry_t)); if (NULL==mesg->slot) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - for (i=0; i<mesg->nused; i++) { + for (u=0; u<mesg->nused; u++) { /* Name */ - H5F_DECODE_LENGTH (f, p, mesg->slot[i].name_offset); + H5F_DECODE_LENGTH (f, p, mesg->slot[u].name_offset); if (NULL == (heap = H5HL_protect(f, dxpl_id, mesg->heap_addr))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value") - s = H5HL_offset_into(f, heap, mesg->slot[i].name_offset); + s = H5HL_offset_into(f, heap, mesg->slot[u].name_offset); assert (s && *s); - mesg->slot[i].name = H5MM_xstrdup (s); - assert(mesg->slot[i].name); + mesg->slot[u].name = H5MM_xstrdup (s); + assert(mesg->slot[u].name); if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") /* File offset */ - H5F_DECODE_LENGTH (f, p, mesg->slot[i].offset); + H5F_DECODE_LENGTH (f, p, mesg->slot[u].offset); /* Size */ - H5F_DECODE_LENGTH (f, p, mesg->slot[i].size); - assert (mesg->slot[i].size>0); + H5F_DECODE_LENGTH (f, p, mesg->slot[u].size); + assert (mesg->slot[u].size>0); } /* Set return value */ @@ -200,7 +201,7 @@ static herr_t H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg) { const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg; - int i; + size_t u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_efl_encode, FAIL); @@ -229,15 +230,15 @@ H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg) H5F_addr_encode(f, &p, mesg->heap_addr); /* Encode file list */ - for (i=0; i<mesg->nused; i++) { + for (u=0; u<mesg->nused; u++) { /* * The name should have been added to the heap when the dataset was * created. */ - assert(mesg->slot[i].name_offset); - H5F_ENCODE_LENGTH (f, p, mesg->slot[i].name_offset); - H5F_ENCODE_LENGTH (f, p, mesg->slot[i].offset); - H5F_ENCODE_LENGTH (f, p, mesg->slot[i].size); + assert(mesg->slot[u].name_offset); + H5F_ENCODE_LENGTH (f, p, mesg->slot[u].name_offset); + H5F_ENCODE_LENGTH (f, p, mesg->slot[u].offset); + H5F_ENCODE_LENGTH (f, p, mesg->slot[u].size); } done: @@ -267,7 +268,7 @@ H5O_efl_copy(const void *_mesg, void *_dest) { const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg; H5O_efl_t *dest = (H5O_efl_t *) _dest; - int i; + size_t u; /* Local index variable */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_efl_copy, NULL); @@ -289,9 +290,9 @@ H5O_efl_copy(const void *_mesg, void *_dest) dest->nalloc = mesg->nalloc; dest->nused = mesg->nused; - for (i = 0; i < mesg->nused; i++) { - dest->slot[i] = mesg->slot[i]; - dest->slot[i].name = H5MM_xstrdup (mesg->slot[i].name); + for (u = 0; u < mesg->nused; u++) { + dest->slot[u] = mesg->slot[u]; + dest->slot[u].name = H5MM_xstrdup (mesg->slot[u].name); } /* Set return value */ @@ -365,7 +366,7 @@ static herr_t H5O_efl_reset(void *_mesg) { H5O_efl_t *mesg = (H5O_efl_t *) _mesg; - int i; + size_t u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_efl_reset, FAIL); @@ -374,8 +375,8 @@ H5O_efl_reset(void *_mesg) assert(mesg); /* reset */ - for (i=0; i<mesg->nused; i++) - mesg->slot[i].name = H5MM_xfree (mesg->slot[i].name); + for (u=0; u<mesg->nused; u++) + mesg->slot[u].name = H5MM_xfree (mesg->slot[u].name); mesg->heap_addr = HADDR_UNDEF; mesg->nused = mesg->nalloc = 0; if(mesg->slot) @@ -406,7 +407,6 @@ done: hsize_t H5O_efl_total_size (H5O_efl_t *efl) { - int i; hsize_t ret_value = 0, tmp; FUNC_ENTER_NOAPI(H5O_efl_total_size, 0); @@ -415,8 +415,10 @@ H5O_efl_total_size (H5O_efl_t *efl) H5O_EFL_UNLIMITED==efl->slot[efl->nused-1].size) { ret_value = H5O_EFL_UNLIMITED; } else { - for (i=0; i<efl->nused; i++, ret_value=tmp) { - tmp = ret_value + efl->slot[i].size; + size_t u; /* Local index variable */ + + for (u=0; u<efl->nused; u++, ret_value=tmp) { + tmp = ret_value + efl->slot[u].size; if (tmp<=ret_value) HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, 0, "total external storage size overflowed"); } @@ -448,7 +450,7 @@ done: static herr_t H5O_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) { - int i, fd=-1; + int fd=-1; size_t to_read; #ifndef NDEBUG hsize_t tempto_read; @@ -456,6 +458,7 @@ H5O_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) hsize_t skip=0; haddr_t cur; ssize_t n; + size_t u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_efl_read, FAIL); @@ -467,31 +470,30 @@ H5O_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) assert (buf || 0==size); /* Find the first efl member from which to read */ - for (i=0, cur=0; i<efl->nused; i++) { - if (H5O_EFL_UNLIMITED==efl->slot[i].size || - addr < cur+efl->slot[i].size) { + for (u=0, cur=0; u<efl->nused; u++) { + if (H5O_EFL_UNLIMITED==efl->slot[u].size || addr < cur+efl->slot[u].size) { skip = addr - cur; break; } - cur += efl->slot[i].size; + cur += efl->slot[u].size; } /* Read the data */ while (size) { - if (i>=efl->nused) + if (u>=efl->nused) HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file"); - if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[i].offset+skip)) + if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[u].offset+skip)) HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed"); - if ((fd=HDopen (efl->slot[i].name, O_RDONLY, 0))<0) + if ((fd=HDopen (efl->slot[u].name, O_RDONLY, 0))<0) HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file"); - if (HDlseek (fd, (off_t)(efl->slot[i].offset+skip), SEEK_SET)<0) + if (HDlseek (fd, (off_t)(efl->slot[u].offset+skip), SEEK_SET)<0) HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file"); #ifndef NDEBUG - tempto_read = MIN(efl->slot[i].size-skip,(hsize_t)size); + tempto_read = MIN(efl->slot[u].size-skip,(hsize_t)size); H5_CHECK_OVERFLOW(tempto_read,hsize_t,size_t); to_read = (size_t)tempto_read; #else /* NDEBUG */ - to_read = MIN((size_t)(efl->slot[i].size-skip), size); + to_read = MIN((size_t)(efl->slot[u].size-skip), size); #endif /* NDEBUG */ if ((n=HDread (fd, buf, to_read))<0) { HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file"); @@ -503,7 +505,7 @@ H5O_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) size -= to_read; buf += to_read; skip = 0; - i++; + u++; } done: @@ -535,13 +537,14 @@ done: static herr_t H5O_efl_write (const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *buf) { - int i, fd=-1; + int fd=-1; size_t to_write; #ifndef NDEBUG hsize_t tempto_write; #endif /* NDEBUG */ haddr_t cur; hsize_t skip=0; + size_t u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_efl_write, FAIL); @@ -553,36 +556,35 @@ H5O_efl_write (const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b assert (buf || 0==size); /* Find the first efl member in which to write */ - for (i=0, cur=0; i<efl->nused; i++) { - if (H5O_EFL_UNLIMITED==efl->slot[i].size || - addr < cur+efl->slot[i].size) { + for (u=0, cur=0; u<efl->nused; u++) { + if (H5O_EFL_UNLIMITED==efl->slot[u].size || addr < cur+efl->slot[u].size) { skip = addr - cur; break; } - cur += efl->slot[i].size; + cur += efl->slot[u].size; } /* Write the data */ while (size) { - if (i>=efl->nused) + if (u>=efl->nused) HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file"); - if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[i].offset+skip)) + if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[u].offset+skip)) HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed"); - if ((fd=HDopen (efl->slot[i].name, O_CREAT|O_RDWR, 0666))<0) { - if (HDaccess (efl->slot[i].name, F_OK)<0) { + if ((fd=HDopen (efl->slot[u].name, O_CREAT|O_RDWR, 0666))<0) { + if (HDaccess (efl->slot[u].name, F_OK)<0) { HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist"); } else { HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file"); } } - if (HDlseek (fd, (off_t)(efl->slot[i].offset+skip), SEEK_SET)<0) + if (HDlseek (fd, (off_t)(efl->slot[u].offset+skip), SEEK_SET)<0) HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file"); #ifndef NDEBUG - tempto_write = MIN(efl->slot[i].size-skip,(hsize_t)size); + tempto_write = MIN(efl->slot[u].size-skip,(hsize_t)size); H5_CHECK_OVERFLOW(tempto_write,hsize_t,size_t); to_write = (size_t)tempto_write; #else /* NDEBUG */ - to_write = MIN((size_t)(efl->slot[i].size-skip), size); + to_write = MIN((size_t)(efl->slot[u].size-skip), size); #endif /* NDEBUG */ if ((size_t)HDwrite (fd, buf, to_write)!=to_write) HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file"); @@ -591,7 +593,7 @@ H5O_efl_write (const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b size -= to_write; buf += to_write; skip = 0; - i++; + u++; } done: @@ -780,7 +782,7 @@ H5O_efl_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * s { const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg; char buf[64]; - int i; + size_t u; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_efl_debug, FAIL); @@ -799,25 +801,25 @@ H5O_efl_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * s "Slots used/allocated:", mesg->nused, mesg->nalloc); - for (i = 0; i < mesg->nused; i++) { - sprintf (buf, "File %d", i); + for (u = 0; u < mesg->nused; u++) { + sprintf (buf, "File %u", (unsigned)u); HDfprintf (stream, "%*s%s:\n", indent, "", buf); HDfprintf(stream, "%*s%-*s \"%s\"\n", indent+3, "", MAX (fwidth-3, 0), "Name:", - mesg->slot[i].name); + mesg->slot[u].name); HDfprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0), "Name offset:", - (unsigned long)(mesg->slot[i].name_offset)); + (unsigned long)(mesg->slot[u].name_offset)); HDfprintf (stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0), "Offset of data in file:", - (unsigned long)(mesg->slot[i].offset)); + (unsigned long)(mesg->slot[u].offset)); HDfprintf (stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0), "Bytes reserved for data:", - (unsigned long)(mesg->slot[i].size)); + (unsigned long)(mesg->slot[u].size)); } done: diff --git a/src/H5Opline.c b/src/H5Opline.c index 972e5e0..5240f72 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -104,15 +104,15 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, version = *p++; if (version!=H5O_PLINE_VERSION) HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "bad version number for filter pipeline message"); - pline->nfilters = *p++; - if (pline->nfilters>H5Z_MAX_NFILTERS) + pline->nused = *p++; + if (pline->nused>H5Z_MAX_NFILTERS) HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter pipeline message has too many filters"); p += 6; /*reserved*/ - pline->nalloc = pline->nfilters; + pline->nalloc = pline->nused; pline->filter = H5MM_calloc(pline->nalloc*sizeof(pline->filter[0])); if (NULL==pline->filter) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - for (i=0; i<pline->nfilters; i++) { + for (i=0; i<pline->nused; i++) { UINT16DECODE(p, pline->filter[i].id); UINT16DECODE(p, name_length); if (name_length % 8) @@ -150,7 +150,7 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, done: if (NULL==ret_value && pline) { if (pline->filter) { - for (i=0; i<pline->nfilters; i++) { + for (i=0; i<pline->nused; i++) { H5MM_xfree(pline->filter[i].name); H5MM_xfree(pline->filter[i].cd_values); } @@ -193,7 +193,7 @@ H5O_pline_encode (H5F_t UNUSED *f, uint8_t *p/*out*/, const void *mesg) assert (mesg); *p++ = H5O_PLINE_VERSION; - *p++ = (uint8_t)(pline->nfilters); + *p++ = (uint8_t)(pline->nused); *p++ = 0; /*reserved 1*/ *p++ = 0; /*reserved 2*/ *p++ = 0; /*reserved 3*/ @@ -201,7 +201,7 @@ H5O_pline_encode (H5F_t UNUSED *f, uint8_t *p/*out*/, const void *mesg) *p++ = 0; /*reserved 5*/ *p++ = 0; /*reserved 6*/ - for (i=0; i<pline->nfilters; i++) { + for (i=0; i<pline->nused; i++) { /* * Get the filter name. If the pipeline message has a name in it then * use that one. Otherwise try to look up the filter and get the name @@ -266,7 +266,7 @@ H5O_pline_copy (const void *_src, void *_dst/*out*/) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); *dst = *src; - dst->nalloc = dst->nfilters; + dst->nalloc = dst->nused; if (dst->nalloc>0) { dst->filter = H5MM_calloc(dst->nalloc * sizeof(dst->filter[0])); if (NULL==dst->filter) @@ -275,7 +275,7 @@ H5O_pline_copy (const void *_src, void *_dst/*out*/) dst->filter = NULL; } - for (i=0; i<src->nfilters; i++) { + for (i=0; i<src->nused; i++) { dst->filter[i] = src->filter[i]; if (src->filter[i].name) { dst->filter[i].name = H5MM_xstrdup(src->filter[i].name); @@ -296,7 +296,7 @@ H5O_pline_copy (const void *_src, void *_dst/*out*/) done: if (!ret_value && dst) { if (dst->filter) { - for (i=0; i<dst->nfilters; i++) { + for (i=0; i<dst->nused; i++) { H5MM_xfree(dst->filter[i].name); H5MM_xfree(dst->filter[i].cd_values); } @@ -342,7 +342,7 @@ H5O_pline_size (H5F_t UNUSED *f, const void *mesg) 1 + /*number of filters */ 6; /*reserved */ - for (i=0; i<pline->nfilters; i++) { + for (i=0; i<pline->nused; i++) { /* Get the name of the filter, same as done with H5O_pline_encode() */ if (NULL==(name=pline->filter[i].name) && (cls=H5Z_find(pline->filter[i].id))) @@ -395,7 +395,7 @@ H5O_pline_reset (void *mesg) assert (pline); - for (i=0; i<pline->nfilters; i++) { + for (i=0; i<pline->nused; i++) { H5MM_xfree(pline->filter[i].name); H5MM_xfree(pline->filter[i].cd_values); } @@ -473,10 +473,10 @@ H5O_pline_debug (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE * fprintf(stream, "%*s%-*s %lu/%lu\n", indent, "", fwidth, "Number of filters:", - (unsigned long)(pline->nfilters), + (unsigned long)(pline->nused), (unsigned long)(pline->nalloc)); - for (i=0; i<pline->nfilters; i++) { + for (i=0; i<pline->nused; i++) { char name[32]; sprintf(name, "Filter at position %lu", (unsigned long)i); fprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 78f8c0e..70362ad 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -105,7 +105,7 @@ typedef struct H5O_fill_new_t { #define H5O_EFL_UNLIMITED H5F_UNLIMITED /*max possible file size */ typedef struct H5O_efl_entry_t { - size_t name_offset; /*offset of name within heap */ + size_t name_offset; /*offset of name within heap */ char *name; /*malloc'd name */ off_t offset; /*offset of data within file */ hsize_t size; /*size allocated within file */ @@ -113,8 +113,8 @@ typedef struct H5O_efl_entry_t { typedef struct H5O_efl_t { haddr_t heap_addr; /*address of name heap */ - int nalloc; /*number of slots allocated */ - int nused; /*number of slots used */ + size_t nalloc; /*number of slots allocated */ + size_t nused; /*number of slots used */ H5O_efl_entry_t *slot; /*array of external file entries */ } H5O_efl_t; @@ -153,8 +153,8 @@ typedef struct H5O_bogus_t { * (Data structure in memory) */ typedef struct H5O_pline_t { - size_t nfilters; /*num filters defined */ size_t nalloc; /*num elements in `filter' array */ + size_t nused; /*num filters defined */ H5Z_filter_info_t *filter; /*array of filters */ } H5O_pline_t; @@ -819,6 +819,7 @@ done: H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback + H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback H5P_prp_close_func_t prp_close; IN: Function pointer to property close callback RETURNS @@ -836,7 +837,8 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, void *value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, - H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close) + H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, + H5P_prp_close_func_t prp_close) { H5P_genprop_t *prop=NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value; /* Return value */ @@ -872,6 +874,11 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, prop->get=prp_get; prop->del=prp_delete; prop->copy=prp_copy; + /* Use custom comparison routine if available, otherwise default to memcmp() */ + if(prp_cmp!=NULL) + prop->cmp=prp_cmp; + else + prop->cmp=&memcmp; prop->close=prp_close; /* Set return value */ @@ -1752,6 +1759,7 @@ done: H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback + H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback H5P_prp_close_func_t prp_close; IN: Function pointer to property close callback RETURNS @@ -1774,11 +1782,12 @@ done: The 'create' callback is called when a new property list with this property is being created. H5P_prp_create_func_t is defined as: typedef herr_t (*H5P_prp_create_func_t)(hid_t prop_id, const char *name, - void **initial_value); + size_t size, void *initial_value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being created. const char *name; IN: The name of the property being modified. - void **initial_value; IN/OUT: The initial value for the property being created. + size_t size; IN: The size of the property value + void *initial_value; IN/OUT: The initial value for the property being created. (The 'default' value passed to H5Pregister) The 'create' routine may modify the value to be set and those changes will be stored as the initial value of the property. If the 'create' routine @@ -1788,10 +1797,11 @@ done: The 'set' callback is called before a new value is copied into the property. H5P_prp_set_func_t is defined as: typedef herr_t (*H5P_prp_set_func_t)(hid_t prop_id, const char *name, - void **value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being modified. const char *name; IN: The name of the property being modified. + size_t size; IN: The size of the property value void *new_value; IN/OUT: The value being set for the property. The 'set' routine may modify the value to be set and those changes will be stored as the value of the property. If the 'set' routine returns a @@ -1801,10 +1811,11 @@ done: The 'get' callback is called before a value is retrieved from the property. H5P_prp_get_func_t is defined as: typedef herr_t (*H5P_prp_get_func_t)(hid_t prop_id, const char *name, - void *value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being queried. const char *name; IN: The name of the property being queried. + size_t size; IN: The size of the property value void *value; IN/OUT: The value being retrieved for the property. The 'get' routine may modify the value to be retrieved and those changes will be returned to the calling function. If the 'get' routine returns a @@ -1814,10 +1825,11 @@ done: The 'delete' callback is called when a property is deleted from a property list. H5P_prp_del_func_t is defined as: typedef herr_t (*H5P_prp_del_func_t)(hid_t prop_id, const char *name, - void *value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list the property is deleted from. const char *name; IN: The name of the property being deleted. + size_t size; IN: The size of the property value void *value; IN/OUT: The value of the property being deleted. The 'delete' routine may modify the value passed in, but the value is not used by the library when the 'delete' routine returns. If the @@ -1826,20 +1838,38 @@ done: The 'copy' callback is called when a property list with this property is copied. H5P_prp_copy_func_t is defined as: - typedef herr_t (*H5P_prp_copy_func_t)(const char *name, void *value); + typedef herr_t (*H5P_prp_copy_func_t)(const char *name, size_t size, + void *value); where the parameters to the callback function are: - const char *name; IN: The name of the property being closed. - void *value; IN: The value of the property being closed. + const char *name; IN: The name of the property being copied. + size_t size; IN: The size of the property value + void *value; IN: The value of the property being copied. The 'copy' routine may modify the value to be copied and those changes will be stored as the value of the property. If the 'copy' routine returns a negative value, the new property value is not copied into the property and the property list copy routine returns an error value. + The 'compare' callback is called when a property list with this + property is compared to another property list. H5P_prp_compare_func_t is + defined as: + typedef int (*H5P_prp_compare_func_t)( void *value1, void *value2, + size_t size); + where the parameters to the callback function are: + const void *value1; IN: The value of the first property being compared. + const void *value2; IN: The value of the second property being compared. + size_t size; IN: The size of the property value + The 'compare' routine may not modify the values to be compared. The + 'compare' routine should return a positive value if VALUE1 is greater than + VALUE2, a negative value if VALUE2 is greater than VALUE1 and zero if VALUE1 + and VALUE2 are equal. + The 'close' callback is called when a property list with this property is being destroyed. H5P_prp_close_func_t is defined as: - typedef herr_t (*H5P_prp_close_func_t)(const char *name, void *value); + typedef herr_t (*H5P_prp_close_func_t)(const char *name, size_t size, + void *value); where the parameters to the callback function are: const char *name; IN: The name of the property being closed. + size_t size; IN: The size of the property value void *value; IN: The value of the property being closed. The 'close' routine may modify the value passed in, but the value is not used by the library when the 'close' routine returns. If the @@ -1869,7 +1899,8 @@ herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, - H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close) + H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, + H5P_prp_close_func_t prp_close) { H5P_genclass_t *new_class; /* New class pointer */ H5P_genprop_t *new_prop=NULL; /* Temporary property pointer */ @@ -1924,7 +1955,7 @@ H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, } /* end if */ /* Create property object from parameters */ - if((new_prop=H5P_create_prop(name,size,H5P_PROP_WITHIN_CLASS,def_value,prp_create,prp_set,prp_get,prp_delete,prp_copy,prp_close))==NULL) + if((new_prop=H5P_create_prop(name,size,H5P_PROP_WITHIN_CLASS,def_value,prp_create,prp_set,prp_get,prp_delete,prp_copy,prp_cmp,prp_close))==NULL) HGOTO_ERROR (H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property"); /* Insert property into property list class */ @@ -1969,6 +2000,7 @@ done: H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback + H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback H5P_prp_close_func_t prp_close; IN: Function pointer to property close callback RETURNS @@ -1991,11 +2023,12 @@ done: The 'create' callback is called when a new property list with this property is being created. H5P_prp_create_func_t is defined as: typedef herr_t (*H5P_prp_create_func_t)(hid_t prop_id, const char *name, - void **initial_value); + size_t size, void *initial_value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being created. const char *name; IN: The name of the property being modified. - void **initial_value; IN/OUT: The initial value for the property being created. + size_t size; IN: The size of the property value + void *initial_value; IN/OUT: The initial value for the property being created. (The 'default' value passed to H5Pregister) The 'create' routine may modify the value to be set and those changes will be stored as the initial value of the property. If the 'create' routine @@ -2005,11 +2038,12 @@ done: The 'set' callback is called before a new value is copied into the property. H5P_prp_set_func_t is defined as: typedef herr_t (*H5P_prp_set_func_t)(hid_t prop_id, const char *name, - void **value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being modified. const char *name; IN: The name of the property being modified. - void **new_value; IN/OUT: The value being set for the property. + size_t size; IN: The size of the property value + void *new_value; IN/OUT: The value being set for the property. The 'set' routine may modify the value to be set and those changes will be stored as the value of the property. If the 'set' routine returns a negative value, the new property value is not copied into the property and @@ -2018,11 +2052,12 @@ done: The 'get' callback is called before a value is retrieved from the property. H5P_prp_get_func_t is defined as: typedef herr_t (*H5P_prp_get_func_t)(hid_t prop_id, const char *name, - void *value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being queried. const char *name; IN: The name of the property being queried. - void **value; IN/OUT: The value being retrieved for the property. + size_t size; IN: The size of the property value + void *value; IN/OUT: The value being retrieved for the property. The 'get' routine may modify the value to be retrieved and those changes will be returned to the calling function. If the 'get' routine returns a negative value, the property value is returned and the property list get @@ -2031,10 +2066,11 @@ done: The 'delete' callback is called when a property is deleted from a property list. H5P_prp_del_func_t is defined as: typedef herr_t (*H5P_prp_del_func_t)(hid_t prop_id, const char *name, - void *value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list the property is deleted from. const char *name; IN: The name of the property being deleted. + size_t size; IN: The size of the property value void *value; IN/OUT: The value of the property being deleted. The 'delete' routine may modify the value passed in, but the value is not used by the library when the 'delete' routine returns. If the @@ -2043,20 +2079,38 @@ done: The 'copy' callback is called when a property list with this property is copied. H5P_prp_copy_func_t is defined as: - typedef herr_t (*H5P_prp_copy_func_t)(const char *name, void *value); + typedef herr_t (*H5P_prp_copy_func_t)(const char *name, size_t size, + void *value); where the parameters to the callback function are: - const char *name; IN: The name of the property being closed. - void *value; IN: The value of the property being closed. + const char *name; IN: The name of the property being copied. + size_t size; IN: The size of the property value + void *value; IN: The value of the property being copied. The 'copy' routine may modify the value to be copied and those changes will be stored as the value of the property. If the 'copy' routine returns a negative value, the new property value is not copied into the property and the property list copy routine returns an error value. + The 'compare' callback is called when a property list with this + property is compared to another property list. H5P_prp_compare_func_t is + defined as: + typedef int (*H5P_prp_compare_func_t)( void *value1, void *value2, + size_t size); + where the parameters to the callback function are: + const void *value1; IN: The value of the first property being compared. + const void *value2; IN: The value of the second property being compared. + size_t size; IN: The size of the property value + The 'compare' routine may not modify the values to be compared. The + 'compare' routine should return a positive value if VALUE1 is greater than + VALUE2, a negative value if VALUE2 is greater than VALUE1 and zero if VALUE1 + and VALUE2 are equal. + The 'close' callback is called when a property list with this property is being destroyed. H5P_prp_close_func_t is defined as: - typedef herr_t (*H5P_prp_close_func_t)(const char *name, void *value); + typedef herr_t (*H5P_prp_close_func_t)(const char *name, size_t size, + void *value); where the parameters to the callback function are: const char *name; IN: The name of the property being closed. + size_t size; IN: The size of the property value void *value; IN: The value of the property being closed. The 'close' routine may modify the value passed in, but the value is not used by the library when the 'close' routine returns. If the @@ -2082,18 +2136,32 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ +#ifdef H5_WANT_H5_V1_6_COMPAT herr_t H5Pregister(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close) +#else /* H5_WANT_H5_V1_6_COMPAT */ +herr_t +H5Pregister(hid_t cls_id, const char *name, size_t size, void *def_value, + H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, + H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, + H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, + H5P_prp_close_func_t prp_close) +#endif /* H5_WANT_H5_V1_6_COMPAT */ { H5P_genclass_t *pclass; /* Property list class to modify */ herr_t ret_value; /* return value */ FUNC_ENTER_API(H5Pregister, FAIL); +#ifdef H5_WANT_H5_V1_6_COMPAT H5TRACE10("e","iszxxxxxxx",cls_id,name,size,def_value,prp_create,prp_set, prp_get,prp_delete,prp_copy,prp_close); +#else /* H5_WANT_H5_V1_6_COMPAT */ + H5TRACE11("e","iszxxxxxxxx",cls_id,name,size,def_value,prp_create,prp_set, + prp_get,prp_delete,prp_copy,prp_cmp,prp_close); +#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Check arguments. */ if (NULL == (pclass = H5I_object_verify(cls_id, H5I_GENPROP_CLS))) @@ -2103,9 +2171,15 @@ H5Pregister(hid_t cls_id, const char *name, size_t size, void *def_value, if (size>0 && def_value==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); +#ifdef H5_WANT_H5_V1_6_COMPAT /* Create the new property list class */ - if ((ret_value=H5P_register(pclass,name,size,def_value,prp_create,prp_set,prp_get,prp_delete,prp_copy,prp_close))<0) + if ((ret_value=H5P_register(pclass,name,size,def_value,prp_create,prp_set,prp_get,prp_delete,prp_copy,NULL,prp_close))<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class"); +#else /* H5_WANT_H5_V1_6_COMPAT */ + /* Create the new property list class */ + if ((ret_value=H5P_register(pclass,name,size,def_value,prp_create,prp_set,prp_get,prp_delete,prp_copy,prp_cmp,prp_close))<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class"); +#endif /* H5_WANT_H5_V1_6_COMPAT */ done: FUNC_LEAVE_API(ret_value); @@ -2126,6 +2200,8 @@ done: H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback + H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback + H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback H5P_prp_close_func_t prp_close; IN: Function pointer to property close callback RETURNS @@ -2147,11 +2223,12 @@ done: The 'set' callback is called before a new value is copied into the property. H5P_prp_set_func_t is defined as: typedef herr_t (*H5P_prp_set_func_t)(hid_t prop_id, const char *name, - void **value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being modified. const char *name; IN: The name of the property being modified. - void **new_value; IN/OUT: The value being set for the property. + size_t size; IN: The size of the property value + void *new_value; IN/OUT: The value being set for the property. The 'set' routine may modify the value to be set and those changes will be stored as the value of the property. If the 'set' routine returns a negative value, the new property value is not copied into the property and @@ -2160,11 +2237,12 @@ done: The 'get' callback is called before a value is retrieved from the property. H5P_prp_get_func_t is defined as: typedef herr_t (*H5P_prp_get_func_t)(hid_t prop_id, const char *name, - void *value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being queried. const char *name; IN: The name of the property being queried. - void **value; IN/OUT: The value being retrieved for the property. + size_t size; IN: The size of the property value + void *value; IN/OUT: The value being retrieved for the property. The 'get' routine may modify the value to be retrieved and those changes will be returned to the calling function. If the 'get' routine returns a negative value, the property value is returned and the property list get @@ -2173,22 +2251,51 @@ done: The 'delete' callback is called when a property is deleted from a property list. H5P_prp_del_func_t is defined as: typedef herr_t (*H5P_prp_del_func_t)(hid_t prop_id, const char *name, - void *value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list the property is deleted from. const char *name; IN: The name of the property being deleted. + size_t size; IN: The size of the property value void *value; IN/OUT: The value of the property being deleted. The 'delete' routine may modify the value passed in, but the value is not used by the library when the 'delete' routine returns. If the 'delete' routine returns a negative value, the property list deletion routine returns an error value but the property is still deleted. + The 'copy' callback is called when a property list with this + property is copied. H5P_prp_copy_func_t is defined as: + typedef herr_t (*H5P_prp_copy_func_t)(const char *name, size_t size, + void *value); + where the parameters to the callback function are: + const char *name; IN: The name of the property being copied. + size_t size; IN: The size of the property value + void *value; IN: The value of the property being copied. + The 'copy' routine may modify the value to be copied and those changes will be + stored as the value of the property. If the 'copy' routine returns a + negative value, the new property value is not copied into the property and + the property list copy routine returns an error value. + + The 'compare' callback is called when a property list with this + property is compared to another property list. H5P_prp_compare_func_t is + defined as: + typedef int (*H5P_prp_compare_func_t)( void *value1, void *value2, + size_t size); + where the parameters to the callback function are: + const void *value1; IN: The value of the first property being compared. + const void *value2; IN: The value of the second property being compared. + size_t size; IN: The size of the property value + The 'compare' routine may not modify the values to be compared. The + 'compare' routine should return a positive value if VALUE1 is greater than + VALUE2, a negative value if VALUE2 is greater than VALUE1 and zero if VALUE1 + and VALUE2 are equal. + The 'close' callback is called when a property list with this property is being destroyed. H5P_prp_close_func_t is defined as: - typedef herr_t (*H5P_prp_close_func_t)(const char *name, + typedef herr_t (*H5P_prp_close_func_t)(const char *name, size_t size, void *value); where the parameters to the callback function are: const char *name; IN: The name of the property being closed. + size_t size; IN: The size of the property value void *value; IN: The value of the property being closed. The 'close' routine may modify the value passed in, but the value is not used by the library when the 'close' routine returns. If the @@ -2222,7 +2329,7 @@ herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, - H5P_prp_close_func_t prp_close) + H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) { H5P_genprop_t *new_prop=NULL; /* Temporary property pointer */ H5TB_NODE *prop_node; /* TBBT node holding property */ @@ -2268,7 +2375,7 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, /* Ok to add to property list */ /* Create property object from parameters */ - if((new_prop=H5P_create_prop(name,size,H5P_PROP_WITHIN_LIST,value,NULL,prp_set,prp_get,prp_delete,prp_copy,prp_close))==NULL) + if((new_prop=H5P_create_prop(name,size,H5P_PROP_WITHIN_LIST,value,NULL,prp_set,prp_get,prp_delete,prp_copy,prp_cmp,prp_close))==NULL) HGOTO_ERROR (H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property"); /* Insert property into property list class */ @@ -2307,6 +2414,8 @@ done: H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback + H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback + H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback H5P_prp_close_func_t prp_close; IN: Function pointer to property close callback RETURNS @@ -2328,11 +2437,12 @@ done: The 'set' callback is called before a new value is copied into the property. H5P_prp_set_func_t is defined as: typedef herr_t (*H5P_prp_set_func_t)(hid_t prop_id, const char *name, - void **value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being modified. const char *name; IN: The name of the property being modified. - void **new_value; IN/OUT: The value being set for the property. + size_t size; IN: The size of the property value + void *new_value; IN/OUT: The value being set for the property. The 'set' routine may modify the value to be set and those changes will be stored as the value of the property. If the 'set' routine returns a negative value, the new property value is not copied into the property and @@ -2341,11 +2451,12 @@ done: The 'get' callback is called before a value is retrieved from the property. H5P_prp_get_func_t is defined as: typedef herr_t (*H5P_prp_get_func_t)(hid_t prop_id, const char *name, - void *value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list being queried. const char *name; IN: The name of the property being queried. - void **value; IN/OUT: The value being retrieved for the property. + size_t size; IN: The size of the property value + void *value; IN/OUT: The value being retrieved for the property. The 'get' routine may modify the value to be retrieved and those changes will be returned to the calling function. If the 'get' routine returns a negative value, the property value is returned and the property list get @@ -2354,21 +2465,51 @@ done: The 'delete' callback is called when a property is deleted from a property list. H5P_prp_del_func_t is defined as: typedef herr_t (*H5P_prp_del_func_t)(hid_t prop_id, const char *name, - void *value); + size_t size, void *value); where the parameters to the callback function are: hid_t prop_id; IN: The ID of the property list the property is deleted from. const char *name; IN: The name of the property being deleted. + size_t size; IN: The size of the property value void *value; IN/OUT: The value of the property being deleted. The 'delete' routine may modify the value passed in, but the value is not used by the library when the 'delete' routine returns. If the 'delete' routine returns a negative value, the property list deletion routine returns an error value but the property is still deleted. + The 'copy' callback is called when a property list with this + property is copied. H5P_prp_copy_func_t is defined as: + typedef herr_t (*H5P_prp_copy_func_t)(const char *name, size_t size, + void *value); + where the parameters to the callback function are: + const char *name; IN: The name of the property being copied. + size_t size; IN: The size of the property value + void *value; IN: The value of the property being copied. + The 'copy' routine may modify the value to be copied and those changes will be + stored as the value of the property. If the 'copy' routine returns a + negative value, the new property value is not copied into the property and + the property list copy routine returns an error value. + + The 'compare' callback is called when a property list with this + property is compared to another property list. H5P_prp_compare_func_t is + defined as: + typedef int (*H5P_prp_compare_func_t)( void *value1, void *value2, + size_t size); + where the parameters to the callback function are: + const void *value1; IN: The value of the first property being compared. + const void *value2; IN: The value of the second property being compared. + size_t size; IN: The size of the property value + The 'compare' routine may not modify the values to be compared. The + 'compare' routine should return a positive value if VALUE1 is greater than + VALUE2, a negative value if VALUE2 is greater than VALUE1 and zero if VALUE1 + and VALUE2 are equal. + The 'close' callback is called when a property list with this property is being destroyed. H5P_prp_close_func_t is defined as: - typedef herr_t (*H5P_prp_close_func_t)(const char *name, void *value); + typedef herr_t (*H5P_prp_close_func_t)(const char *name, size_t size, + void *value); where the parameters to the callback function are: const char *name; IN: The name of the property being closed. + size_t size; IN: The size of the property value void *value; IN: The value of the property being closed. The 'close' routine may modify the value passed in, but the value is not used by the library when the 'close' routine returns. If the @@ -2398,18 +2539,31 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ +#ifdef H5_WANT_H5_V1_6_COMPAT herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close) +#else /* H5_WANT_H5_V1_6_COMPAT */ +herr_t +H5Pinsert(hid_t plist_id, const char *name, size_t size, void *value, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, + H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) +#endif /* H5_WANT_H5_V1_6_COMPAT */ { H5P_genplist_t *plist; /* Property list to modify */ herr_t ret_value; /* return value */ FUNC_ENTER_API(H5Pinsert, FAIL); +#ifdef H5_WANT_H5_V1_6_COMPAT H5TRACE9("e","iszxxxxxx",plist_id,name,size,value,prp_set,prp_get, prp_delete,prp_copy,prp_close); +#else /* H5_WANT_H5_V1_6_COMPAT */ + H5TRACE10("e","iszxxxxxxx",plist_id,name,size,value,prp_set,prp_get, + prp_delete,prp_copy,prp_cmp,prp_close); +#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Check arguments. */ if (NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST))) @@ -2420,8 +2574,13 @@ H5Pinsert(hid_t plist_id, const char *name, size_t size, void *value, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); /* Create the new property list class */ - if ((ret_value=H5P_insert(plist,name,size,value,prp_set,prp_get,prp_delete,prp_copy,prp_close))<0) +#ifdef H5_WANT_H5_V1_6_COMPAT + if ((ret_value=H5P_insert(plist,name,size,value,prp_set,prp_get,prp_delete,prp_copy,NULL,prp_close))<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist"); +#else /* H5_WANT_H5_V1_6_COMPAT */ + if ((ret_value=H5P_insert(plist,name,size,value,prp_set,prp_get,prp_delete,prp_copy,prp_cmp,prp_close))<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist"); +#endif /* H5_WANT_H5_V1_6_COMPAT */ done: FUNC_LEAVE_API(ret_value); @@ -3235,13 +3394,6 @@ H5P_cmp_prop(H5P_genprop_t *prop1, H5P_genprop_t *prop2) if(prop1->size < prop2->size) HGOTO_DONE(-1); if(prop1->size > prop2->size) HGOTO_DONE(1); - /* Check if they both have values allocated (or not allocated) */ - if(prop1->value==NULL && prop2->value!=NULL) HGOTO_DONE(-1); - if(prop1->value!=NULL && prop2->value==NULL) HGOTO_DONE(1); - if(prop1->value!=NULL) - if((cmp_value=HDmemcmp(prop1->value,prop2->value,prop1->size))!=0) - HGOTO_DONE(cmp_value); - /* Check if they both have the same 'create' callback */ if(prop1->create==NULL && prop2->create!=NULL) HGOTO_DONE(-1); if(prop1->create!=NULL && prop2->create==NULL) HGOTO_DONE(1); @@ -3267,11 +3419,25 @@ H5P_cmp_prop(H5P_genprop_t *prop1, H5P_genprop_t *prop2) if(prop1->copy!=NULL && prop2->copy==NULL) HGOTO_DONE(1); if(prop1->copy!=prop2->copy) HGOTO_DONE(-1); + /* Check if they both have the same 'compare' callback */ + if(prop1->cmp==NULL && prop2->cmp!=NULL) HGOTO_DONE(-1); + if(prop1->cmp!=NULL && prop2->cmp==NULL) HGOTO_DONE(1); + if(prop1->cmp!=prop2->cmp) HGOTO_DONE(-1); + /* Check if they both have the same 'close' callback */ if(prop1->close==NULL && prop2->close!=NULL) HGOTO_DONE(-1); if(prop1->close!=NULL && prop2->close==NULL) HGOTO_DONE(1); if(prop1->close!=prop2->close) HGOTO_DONE(-1); + /* Check if they both have values allocated (or not allocated) */ + if(prop1->value==NULL && prop2->value!=NULL) HGOTO_DONE(-1); + if(prop1->value!=NULL && prop2->value==NULL) HGOTO_DONE(1); + if(prop1->value!=NULL) { + /* Call comparison routine */ + if((cmp_value=prop1->cmp(prop1->value,prop2->value,prop1->size))!=0) + HGOTO_DONE(cmp_value); + } /* end if */ + done: FUNC_LEAVE_NOAPI(ret_value); } /* H5P_cmp_prop() */ @@ -4723,7 +4889,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) prop=H5P_find_prop_plist(src_plist,name); /* Create property object from parameters */ - if((new_prop=H5P_create_prop(prop->name,prop->size,H5P_PROP_WITHIN_LIST,prop->value,prop->create,prop->set,prop->get,prop->del,prop->copy,prop->copy))==NULL) + if((new_prop=H5P_create_prop(prop->name,prop->size,H5P_PROP_WITHIN_LIST,prop->value,prop->create,prop->set,prop->get,prop->del,prop->copy,prop->cmp,prop->close))==NULL) HGOTO_ERROR (H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property"); /* Call property creation callback, if it exists */ @@ -4805,7 +4971,7 @@ H5P_copy_prop_pclass(H5P_genclass_t *dst_pclass, H5P_genclass_t *src_pclass, con HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to locate property"); /* Register the property into the destination */ - if(H5P_register(dst_pclass,name,prop->size,prop->value,prop->create,prop->set,prop->get,prop->del,prop->copy,prop->close)<0) + if(H5P_register(dst_pclass,name,prop->size,prop->value,prop->create,prop->set,prop->get,prop->del,prop->copy,prop->cmp,prop->close)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property"); done: diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 8052600..6307a07 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -288,7 +288,7 @@ done: herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) { - int idx; + size_t idx; hsize_t total, tmp; H5O_efl_t efl; H5P_genplist_t *plist; /* Property list pointer */ @@ -426,16 +426,26 @@ done: * *------------------------------------------------------------------------- */ +#ifdef H5_WANT_H5_V1_6_COMPAT herr_t H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/, off_t *offset/*out*/, hsize_t *size/*out*/) +#else /* H5_WANT_H5_V1_6_COMPAT */ +herr_t +H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out*/, + off_t *offset/*out*/, hsize_t *size/*out*/) +#endif /* H5_WANT_H5_V1_6_COMPAT */ { H5O_efl_t efl; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pget_external, FAIL); +#ifdef H5_WANT_H5_V1_6_COMPAT H5TRACE6("e","iIszxxx",plist_id,idx,name_size,name,offset,size); +#else /* H5_WANT_H5_V1_6_COMPAT */ + H5TRACE6("e","iIuzxxx",plist_id,idx,name_size,name,offset,size); +#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) @@ -445,8 +455,13 @@ H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/, if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list"); - if (idx<0 || idx>=efl.nused) +#ifdef H5_WANT_H5_V1_6_COMPAT + if (idx<0 || (size_t)idx>=efl.nused) HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range"); +#else /* H5_WANT_H5_V1_6_COMPAT */ + if (idx>=efl.nused) + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range"); +#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Return values */ if (name_size>0 && name) @@ -661,7 +676,7 @@ H5Pget_nfilters(hid_t plist_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Set return value */ - ret_value=(int)(pline.nfilters); + ret_value=(int)(pline.nused); done: FUNC_LEAVE_API(ret_value); @@ -698,10 +713,17 @@ done: * *------------------------------------------------------------------------- */ +#ifdef H5_WANT_H5_V1_6_COMPAT H5Z_filter_t H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/, size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/) +#else /* H5_WANT_H5_V1_6_COMPAT */ +H5Z_filter_t +H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, + size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, + size_t namelen, char name[]/*out*/) +#endif /* H5_WANT_H5_V1_6_COMPAT */ { H5O_pline_t pline; /* Filter pipeline */ H5Z_filter_info_t *filter; /* Pointer to filter information */ @@ -710,8 +732,13 @@ H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/, H5Z_filter_t ret_value; /* return value */ FUNC_ENTER_API(H5Pget_filter, H5Z_FILTER_ERROR); +#ifdef H5_WANT_H5_V1_6_COMPAT H5TRACE7("Zf","iIsx*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen, name); +#else /* H5_WANT_H5_V1_6_COMPAT */ + H5TRACE7("Zf","iIux*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen, + name); +#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Check args */ if (cd_nelmts || cd_values) { @@ -743,8 +770,13 @@ H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline"); /* Check more args */ - if (idx<0 || (size_t)idx>=pline.nfilters) +#ifdef H5_WANT_H5_V1_6_COMPAT + if (idx<0 || (size_t)idx>=pline.nused) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid"); +#else /* H5_WANT_H5_V1_6_COMPAT */ + if (idx>=pline.nused) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid"); +#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Set pointer to particular filter to query */ filter=&pline.filter[idx]; diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 1b287fb..1c05075 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -74,6 +74,7 @@ typedef struct H5P_genprop_t { H5P_prp_get_func_t get; /* Function to call when a property value is retrieved */ H5P_prp_delete_func_t del; /* Function to call when a property is deleted */ H5P_prp_copy_func_t copy; /* Function to call when a property is copied */ + H5P_prp_compare_func_t cmp; /* Function to call when a property is compared */ H5P_prp_close_func_t close; /* Function to call when a property is closed */ } H5P_genprop_t; diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index bb89ae2..e087624 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -41,7 +41,7 @@ H5_DLL herr_t H5P_set(H5P_genplist_t *plist, const char *name, const void *value H5_DLL herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, - H5P_prp_close_func_t prp_close); + H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); H5_DLL herr_t H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_exist_plist(H5P_genplist_t *plist, const char *name); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); @@ -49,7 +49,8 @@ H5_DLL herr_t H5P_get_nprops_pclass(H5P_genclass_t *pclass, size_t *nprops); H5_DLL herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, - H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); + H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, + H5P_prp_close_func_t prp_close); H5_DLL hid_t H5P_get_driver(H5P_genplist_t *plist); H5_DLL void * H5P_get_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 40573ea..cada129 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -57,6 +57,7 @@ typedef H5P_prp_cb2_t H5P_prp_set_func_t; typedef H5P_prp_cb2_t H5P_prp_get_func_t; typedef H5P_prp_cb2_t H5P_prp_delete_func_t; typedef H5P_prp_cb1_t H5P_prp_copy_func_t; +typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size); typedef H5P_prp_cb1_t H5P_prp_close_func_t; /* Define property list iteration function type */ @@ -116,17 +117,33 @@ H5_DLL hid_t H5Pcreate_class(hid_t parent, const char *name, H5P_cls_close_func_t cls_close, void *close_data); H5_DLL char *H5Pget_class_name(hid_t pclass_id); H5_DLL hid_t H5Pcreate(hid_t cls_id); +#ifdef H5_WANT_H5_V1_6_COMPAT +H5_DLL herr_t H5Pregister(hid_t cls_id, const char *name, size_t size, + void *def_value, H5P_prp_create_func_t prp_create, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_delete_func_t prp_del, + H5P_prp_copy_func_t prp_copy, + H5P_prp_close_func_t prp_close); +H5_DLL herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size, + void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_delete_func_t prp_delete, + H5P_prp_copy_func_t prp_copy, + H5P_prp_close_func_t prp_close); +#else /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pregister(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t prp_copy, + H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); H5_DLL herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, + H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); +#endif /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, void *value); H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name); H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size); @@ -144,6 +161,7 @@ H5_DLL herr_t H5Punregister(hid_t pclass_id, const char *name); H5_DLL herr_t H5Pclose_class(hid_t plist_id); H5_DLL herr_t H5Pclose(hid_t plist_id); H5_DLL hid_t H5Pcopy(hid_t plist_id); + #ifdef H5_WANT_H5_V1_6_COMPAT H5_DLL herr_t H5Pget_version(hid_t plist_id, int *boot/*out*/, int *freelist/*out*/, int *stab/*out*/, @@ -181,9 +199,15 @@ H5_DLL int H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/); H5_DLL herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size); H5_DLL int H5Pget_external_count(hid_t plist_id); +#ifdef H5_WANT_H5_V1_6_COMPAT H5_DLL herr_t H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/, off_t *offset/*out*/, hsize_t *size/*out*/); +#else /* H5_WANT_H5_V1_6_COMPAT */ +H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, + char *name/*out*/, off_t *offset/*out*/, + hsize_t *size/*out*/); +#endif /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info); H5_DLL hid_t H5Pget_driver(hid_t plist_id); @@ -205,11 +229,19 @@ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts, const unsigned int c_values[]); H5_DLL int H5Pget_nfilters(hid_t plist_id); +#ifdef H5_WANT_H5_V1_6_COMPAT H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, int filter, unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/, unsigned cd_values[]/*out*/, size_t namelen, char name[]); +#else /* H5_WANT_H5_V1_6_COMPAT */ +H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, unsigned filter, + unsigned int *flags/*out*/, + size_t *cd_nelmts/*out*/, + unsigned cd_values[]/*out*/, + size_t namelen, char name[]); +#endif /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL H5Z_filter_t H5Pget_filter_by_id(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/, @@ -479,7 +479,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") /* Check if the chunks have filters */ - if(dcpl_pline.nfilters > 0) { + if(dcpl_pline.nused > 0) { unsigned chunk_ndims; /* # of chunk dimensions */ hsize_t chunk_size[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */ H5S_t *space; /* Dataspace describing chunk */ @@ -503,7 +503,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty } /* end if */ /* Iterate over filters */ - for (u=0; u<dcpl_pline.nfilters; u++) { + for (u=0; u<dcpl_pline.nused; u++) { H5Z_class_t *fclass; /* Individual filter information */ /* Get filter information */ @@ -684,12 +684,12 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, assert(0==cd_nelmts || cd_values); /* Locate the filter in the pipeline */ - for(idx=0; idx<pline->nfilters; idx++) + for(idx=0; idx<pline->nused; idx++) if(pline->filter[idx].id==filter) break; /* Check if the filter was not already in the pipeline */ - if(idx>pline->nfilters) + if(idx>pline->nused) HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") /* Change parameters for filter */ @@ -748,11 +748,11 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, * Check filter limit. We do it here for early warnings although we may * decide to relax this restriction in the future. */ - if (pline->nfilters>=H5Z_MAX_NFILTERS) + if (pline->nused>=H5Z_MAX_NFILTERS) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline") /* Allocate additional space in the pipeline if it's full */ - if (pline->nfilters>=pline->nalloc) { + if (pline->nused>=pline->nalloc) { H5O_pline_t x; x.nalloc = MAX(H5Z_MAX_NFILTERS, 2*pline->nalloc); x.filter = H5MM_realloc(pline->filter, x.nalloc*sizeof(x.filter[0])); @@ -763,7 +763,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, } /* Add the new filter to the pipeline */ - idx = pline->nfilters; + idx = pline->nused; pline->filter[idx].id = filter; pline->filter[idx].flags = flags; pline->filter[idx].name = NULL; /*we'll pick it up later*/ @@ -777,7 +777,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, } else { pline->filter[idx].cd_values = NULL; } - pline->nfilters++; + pline->nused++; done: FUNC_LEAVE_NOAPI(ret_value) @@ -907,10 +907,10 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, assert(nbytes && *nbytes>0); assert(buf_size && *buf_size>0); assert(buf && *buf); - assert(!pline || pline->nfilters<H5Z_MAX_NFILTERS); + assert(!pline || pline->nused<H5Z_MAX_NFILTERS); if (pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */ - for (i=pline->nfilters; i>0; --i) { + for (i=pline->nused; i>0; --i) { idx = i-1; if (*filter_mask & ((unsigned)1<<idx)) { @@ -949,7 +949,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, } } } else if (pline) { /* Write */ - for (idx=0; idx<pline->nfilters; idx++) { + for (idx=0; idx<pline->nused; idx++) { if (*filter_mask & ((unsigned)1<<idx)) { failed |= (unsigned)1 << idx; continue; /*filter excluded*/ @@ -1025,12 +1025,12 @@ H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) assert(filter>=0 && filter<=H5Z_FILTER_MAX); /* Locate the filter in the pipeline */ - for(idx=0; idx<pline->nfilters; idx++) + for(idx=0; idx<pline->nused; idx++) if(pline->filter[idx].id==filter) break; /* Check if the filter was not already in the pipeline */ - if(idx>pline->nfilters) + if(idx>pline->nused) HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline") /* Set return value */ @@ -1068,7 +1068,7 @@ H5Z_all_filters_avail(const H5O_pline_t *pline) assert(pline); /* Iterate through all the filters in pipeline */ - for(i=0; i<pline->nfilters; i++) { + for(i=0; i<pline->nused; i++) { /* Look for each filter in the list of registered filters */ for(j=0; j<H5Z_table_used_g; j++) diff --git a/src/H5private.h b/src/H5private.h index 9f22433..2cf58f0 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -982,9 +982,13 @@ extern H5_debug_t H5_debug_g; #define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) RTYPE=R; \ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8) -#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) RTYPE=R; \ +#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) RTYPE=R; \ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9) +#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ + #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9, \ + #A10,A10) #define H5TRACE_RETURN(V) if (RTYPE) { \ H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \ RTYPE=NULL; \ @@ -1002,6 +1006,7 @@ extern H5_debug_t H5_debug_g; #define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/ #define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/ #define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/ +#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/ #define H5TRACE_RETURN(V) /*void*/ #endif diff --git a/test/dsets.c b/test/dsets.c index 7c1f123..fe72215 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -71,6 +71,8 @@ const char *FILENAME[] = { #define DSET_SET_LOCAL_NAME "set_local" #define DSET_SET_LOCAL_NAME_2 "set_local_2" #define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" +#define DSET_COMPARE_DCPL_NAME "compare_dcpl" +#define DSET_COMPARE_DCPL_NAME_2 "compare_dcpl_2" #define USER_BLOCK 1024 #define SIXTY_FOUR_KB 65536 @@ -2989,6 +2991,91 @@ error: /*------------------------------------------------------------------------- + * Function: test_compare_dcpl + * + * Purpose: Verifies that if the same DCPL was used to create two + * datasets, the DCPLs retrieved from each dataset should + * compare equal. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Wednesday, January 7, 2004 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_compare_dcpl(hid_t file) +{ + hid_t dsid=(-1); /* Dataset ID */ + hid_t sid=(-1); /* Dataspace ID */ + hid_t dcpl=(-1); /* Dataspace creation property list ID */ + hid_t dcpl1=(-1),dcpl2=(-1); /* Dataspace creation property list IDs from datasets */ + const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */ + const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */ + + TESTING("comparing dataset creation property lists"); + + /* Create the data space */ + if ((sid = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR + + /* Create dcpl with special filter */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) TEST_ERROR + if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) TEST_ERROR + + /* Set gzip parameter (if available) */ +#ifdef H5_HAVE_FILTER_DEFLATE + if(H5Pset_deflate (dcpl, 9)<0) TEST_ERROR +#endif /* H5_HAVE_FILTER_DEFLATE */ + + /* Create first dataset */ + if ((dsid = H5Dcreate(file, DSET_COMPARE_DCPL_NAME, H5T_NATIVE_INT, sid, dcpl)) <0) TEST_ERROR + + /* Get copy of dataset's dataset creation property list */ + if ((dcpl1=H5Dget_create_plist(dsid))<0) TEST_ERROR + + /* Close dataset */ + if(H5Dclose (dsid)<0) TEST_ERROR + + /* Create second dataset */ + if ((dsid = H5Dcreate(file, DSET_COMPARE_DCPL_NAME_2, H5T_NATIVE_INT, sid, dcpl)) <0) TEST_ERROR + + /* Get copy of dataset's dataset creation property list */ + if ((dcpl2=H5Dget_create_plist(dsid))<0) TEST_ERROR + + /* Close dataset */ + if(H5Dclose (dsid)<0) TEST_ERROR + + /* Close dataspace */ + if(H5Sclose(sid)<0) TEST_ERROR + + /* Compare dataset creation property lists */ + if(H5Pequal(dcpl1,dcpl2)<=0) TEST_ERROR + + /* Close dataset creation property lists */ + if(H5Pclose(dcpl)<0) TEST_ERROR + if(H5Pclose(dcpl1)<0) TEST_ERROR + if(H5Pclose(dcpl2)<0) TEST_ERROR + + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dsid); + H5Sclose(sid); + H5Pclose(dcpl); + H5Pclose(dcpl1); + H5Pclose(dcpl2); + } H5E_END_TRY; + return -1; +} /* end test_compare_dcpl() */ + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the dataset interface (H5D) @@ -3052,6 +3139,7 @@ main(void) nerrors += test_can_apply(file)<0 ?1:0; nerrors += test_set_local(fapl)<0 ?1:0; nerrors += test_can_apply_szip(file)<0 ?1:0; + nerrors += test_compare_dcpl(file)<0 ?1:0; if (H5Fclose(file)<0) goto error; if (nerrors) goto error; diff --git a/test/tgenprop.c b/test/tgenprop.c index e75c9e0..51f1ceb 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /*********************************************************** * * Test program: tgenprop @@ -186,11 +184,19 @@ test_genprop_basic_class_prop(void) VERIFY(ret, 0, "H5Pexist"); /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Try to insert the first property again (should fail) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ VERIFY(ret, FAIL, "H5Pregister"); /* Check the existance of the first property */ @@ -208,11 +214,19 @@ test_genprop_basic_class_prop(void) VERIFY(nprops, 1, "H5Pget_nprops"); /* Insert second property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Try to insert the second property again (should fail) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ VERIFY(ret, FAIL, "H5Pregister"); /* Check the existance of the second property */ @@ -230,7 +244,11 @@ test_genprop_basic_class_prop(void) VERIFY(nprops, 2, "H5Pget_nprops"); /* Insert third property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Check the existance of the third property */ @@ -333,19 +351,35 @@ test_genprop_class_iter(void) CHECK_I(cid1, "H5Pcreate_class"); /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert third property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert third property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Check the number of properties in class */ @@ -429,19 +463,35 @@ test_genprop_class_callback(void) CHECK_I(cid1, "H5Pcreate_class"); /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert third property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert fourth property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Check the number of properties in class */ @@ -530,11 +580,19 @@ test_genprop_basic_list(void) /* Add several properties (w/default values) */ /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Check the number of properties in class */ @@ -632,11 +690,19 @@ test_genprop_basic_list_prop(void) /* Add several properties (several w/default values) */ /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Create a property list from the class */ @@ -651,11 +717,19 @@ test_genprop_basic_list_prop(void) /* Add temporary properties */ /* Insert first temporary property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pinsert"); /* Insert second temporary property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pinsert"); /* Check the number of properties in list */ @@ -790,11 +864,19 @@ test_genprop_list_iter(void) /* Add several properties (several w/default values) */ /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Create a property list from the class */ @@ -809,11 +891,19 @@ test_genprop_list_iter(void) /* Add temporary properties */ /* Insert first temporary property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pinsert"); /* Insert second temporary property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pinsert"); /* Check the number of properties in list */ @@ -872,6 +962,9 @@ typedef struct { char *cop_name; void *cop_value; + /* Compare information */ + int cmp_count; + /* Close information */ int cls_count; char *cls_name; @@ -960,6 +1053,20 @@ test_genprop_prop_cop_cb1(const char *name, size_t size, void *value) /**************************************************************** ** +** test_genprop_prop_cmp_cb1(): Property comparison callback for test_genprop_list_callback +** +****************************************************************/ +static int +test_genprop_prop_cmp_cb1(const void UNUSED *value1, const void UNUSED *value2, size_t UNUSED size) +{ + /* Set the information from the comparison call */ + prop1_cb_info.cmp_count++; + + return(0); +} + +/**************************************************************** +** ** test_genprop_prop_cls_cb1(): Property close callback for test_genprop_list_callback ** ****************************************************************/ @@ -1027,19 +1134,35 @@ test_genprop_list_callback(void) CHECK_I(cid1, "H5Pcreate_class"); /* Insert first property into class (with callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,test_genprop_prop_crt_cb1,test_genprop_prop_set_cb1,test_genprop_prop_get_cb1,NULL,test_genprop_prop_cop_cb1,test_genprop_prop_cls_cb1); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,test_genprop_prop_crt_cb1,test_genprop_prop_set_cb1,test_genprop_prop_get_cb1,NULL,test_genprop_prop_cop_cb1,test_genprop_prop_cmp_cb1,test_genprop_prop_cls_cb1); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with only delete callback) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,test_genprop_prop_del_cb2,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,test_genprop_prop_del_cb2,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert third property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert fourth property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Check the number of properties in class */ @@ -1169,6 +1292,13 @@ test_genprop_list_callback(void) VERIFY(cop_cb_struct.count, 1, "H5Pcopy"); VERIFY(cop_cb_struct.id, lid2, "H5Pcopy"); + /* Compare the two lists */ + ret = H5Pequal(lid1,lid2); + VERIFY(ret, 1, "H5Pequal"); + + /* Verify compare callback information for properties tracked */ + VERIFY(prop1_cb_info.cmp_count, 1, "H5Pequal"); + /* Close first list */ ret = H5Pclose(lid1); CHECK_I(ret, "H5Pclose"); @@ -1240,7 +1370,11 @@ test_genprop_list_addprop(void) CHECK(pid, FAIL, "H5Pcreate"); /* Insert temporary property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pinsert(pid,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pinsert(pid,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pinsert"); /* Check existence of added property */ @@ -1319,7 +1453,11 @@ test_genprop_class_addprop(void) VERIFY(ret, 0, "H5Pexist"); /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Create a derived dataset creation property list */ @@ -1396,11 +1534,19 @@ test_genprop_equal(void) CHECK_I(cid1, "H5Pcreate_class"); /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Insert second property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Create a property list from the class */ @@ -1444,7 +1590,11 @@ test_genprop_path(void) CHECK_I(cid1, "H5Pcreate_class"); /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Get full path for first class */ @@ -1461,7 +1611,11 @@ test_genprop_path(void) CHECK_I(cid2, "H5Pcreate_class"); /* Insert second property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid2,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid2,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Get full path for second class */ @@ -1519,7 +1673,11 @@ test_genprop_refcount(void) CHECK_I(cid1, "H5Pcreate_class"); /* Insert first property into class (with no callbacks) */ +#ifdef H5_WANT_H5_V1_6_COMPAT ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL); +#else /* H5_WANT_H5_V1_6_COMPAT */ + ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +#endif /* H5_WANT_H5_V1_6_COMPAT */ CHECK_I(ret, "H5Pregister"); /* Create a new generic list, derived from the root of the class hierarchy */ diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 6961731..dc33206 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -413,6 +413,7 @@ int h5repack_cmpdcpl(const char *fname1, if (ret==0) { printf("Property lists for <%s> are different\n",travt1->objs[i].name); + goto error; } /*------------------------------------------------------------------------- diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c index 0ab5f1c..1cd3762 100644 --- a/tools/h5repack/testh5repack_main.c +++ b/tools/h5repack/testh5repack_main.c @@ -50,10 +50,8 @@ test_copy(void) TEST_ERROR; if (h5repack_verify(FNAME1OUT,&pack_options)<=0) TEST_ERROR; -#if 0 if (h5repack_cmpdcpl(FNAME1,FNAME1OUT)<=0) TEST_ERROR; -#endif if (h5repack_end (&pack_options)<0) TEST_ERROR; @@ -68,6 +66,8 @@ test_copy(void) TEST_ERROR; if (h5repack_verify(FNAME2OUT,&pack_options)<=0) TEST_ERROR; + if (h5repack_cmpdcpl(FNAME2,FNAME2OUT)<=0) + TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; PASSED(); @@ -81,6 +81,8 @@ test_copy(void) TEST_ERROR; if (h5repack_verify(FNAME3OUT,&pack_options)<=0) TEST_ERROR; + if (h5repack_cmpdcpl(FNAME3,FNAME3OUT)<=0) + TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; PASSED(); @@ -136,6 +138,8 @@ test_filter_deflate(void) TEST_ERROR; if (h5repack_verify(FNAME4OUT,&pack_options)<=0) TEST_ERROR; + if (h5repack_cmpdcpl(FNAME4,FNAME4OUT)<=0) + TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; @@ -569,6 +573,8 @@ test_layout_contiguous(void) TEST_ERROR; if (h5repack_verify(FNAME4OUT,&pack_options)<=0) TEST_ERROR; + if (h5repack_cmpdcpl(FNAME4,FNAME4OUT)<=0) + TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; @@ -587,6 +593,8 @@ test_layout_contiguous(void) TEST_ERROR; if (h5repack_verify(FNAME4OUT,&pack_options)<=0) TEST_ERROR; + if (h5repack_cmpdcpl(FNAME4,FNAME4OUT)<=0) + TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; |