diff options
-rw-r--r-- | src/H5A.c | 3 | ||||
-rw-r--r-- | src/H5Adeprec.c | 24 | ||||
-rw-r--r-- | src/H5Apkg.h | 1 | ||||
-rw-r--r-- | src/H5D.c | 24 | ||||
-rw-r--r-- | src/H5Ddeprec.c | 24 | ||||
-rw-r--r-- | src/H5Dint.c | 6 | ||||
-rw-r--r-- | src/H5Dio.c | 79 | ||||
-rw-r--r-- | src/H5Dpkg.h | 2 | ||||
-rw-r--r-- | src/H5E.c | 3 | ||||
-rw-r--r-- | src/H5Edeprec.c | 38 | ||||
-rw-r--r-- | src/H5Epkg.h | 3 | ||||
-rw-r--r-- | src/H5Fpkg.h | 1 | ||||
-rw-r--r-- | src/H5G.c | 23 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 36 | ||||
-rw-r--r-- | src/H5Gpkg.h | 1 | ||||
-rw-r--r-- | src/H5P.c | 36 | ||||
-rw-r--r-- | src/H5Pdeprec.c | 36 | ||||
-rw-r--r-- | src/H5Pint.c | 6 | ||||
-rw-r--r-- | src/H5Ppkg.h | 2 | ||||
-rw-r--r-- | src/H5R.c | 3 | ||||
-rw-r--r-- | src/H5Rdeprec.c | 38 | ||||
-rw-r--r-- | src/H5Rpkg.h | 1 | ||||
-rw-r--r-- | src/H5T.c | 4 | ||||
-rw-r--r-- | src/H5Tdeprec.c | 38 | ||||
-rw-r--r-- | src/H5Tpkg.h | 1 | ||||
-rw-r--r-- | test/dsets.c | 11 | ||||
-rw-r--r-- | test/tmisc.c | 110 | ||||
-rw-r--r-- | test/tselect.c | 12 |
28 files changed, 477 insertions, 89 deletions
@@ -184,6 +184,9 @@ H5A_term_interface(void) if((n = H5I_nmembers(H5I_ATTR))>0) { (void)H5I_clear_type(H5I_ATTR, FALSE, FALSE); } else { + /* Close deprecated interface */ + n += H5A__term_deprec_interface(); + (void)H5I_dec_type_ref(H5I_ATTR); H5_interface_initialize_g = 0; n = 1; diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 7202edf..10ee70b 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -105,6 +105,30 @@ H5A__init_deprec_interface(void) FUNC_LEAVE_NOAPI(H5A_init()) } /* H5A__init_deprec_interface() */ + +/*-------------------------------------------------------------------------- +NAME + H5A__term_deprec_interface -- Terminate interface +USAGE + herr_t H5A__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5A__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5A__term_deprec_interface() */ + #ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 26c8dff..fa26a9a 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -185,6 +185,7 @@ H5_DLLVAR const H5B2_class_t H5A_BT2_CORDER[1]; /* Function prototypes for H5A package scope */ H5_DLL herr_t H5A_init(void); +H5_DLL herr_t H5A__term_deprec_interface(void); H5_DLL hid_t H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id); H5_DLL H5A_t * H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name, @@ -94,6 +94,30 @@ H5D__init_pub_interface(void) } /* H5D__init_pub_interface() */ +/*-------------------------------------------------------------------------- +NAME + H5D__term_pub_interface -- Terminate interface +USAGE + herr_t H5D__term_pub_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5D__term_pub_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5D__term_pub_interface() */ + + /*------------------------------------------------------------------------- * Function: H5Dcreate2 * diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 1999550..04cf032 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -106,6 +106,30 @@ H5D__init_deprec_interface(void) FUNC_LEAVE_NOAPI(H5D_init()) } /* H5D__init_deprec_interface() */ + +/*-------------------------------------------------------------------------- +NAME + H5D__term_deprec_interface -- Terminate interface +USAGE + herr_t H5D__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5D__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5D__term_deprec_interface() */ + #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- diff --git a/src/H5Dint.c b/src/H5Dint.c index 1886340..97c3a1a 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -251,6 +251,12 @@ H5D_term_interface(void) */ H5I_clear_type(H5I_DATASET, TRUE, FALSE); } else { + /* Close public interface */ + n += H5D__term_pub_interface(); + + /* Close deprecated interface */ + n += H5D__term_deprec_interface(); + H5I_dec_type_ref(H5I_DATASET); H5_interface_initialize_g = 0; n = 1; /*H5I*/ diff --git a/src/H5Dio.c b/src/H5Dio.c index 87b8a17..27b5334 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -129,7 +129,6 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5D_t *dset = NULL; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; - char fake_char; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -168,15 +167,6 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, else if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") - if(!buf && (NULL == file_space || H5S_GET_SELECT_NPOINTS(file_space) != 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") - - /* If the buffer is nil, and 0 element is selected, make a fake buffer. - * This is for some MPI package like ChaMPIon on NCSA's tungsten which - * doesn't support this feature. - */ - if(!buf) - buf = &fake_char; /* read raw data */ if(H5D__read(dset, mem_type_id, mem_space, file_space, plist_id, buf/*out*/) < 0) @@ -331,7 +321,6 @@ H5D__pre_write(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, else { /* Normal write */ const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; - char fake_char; if(mem_space_id < 0 || file_space_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") @@ -353,20 +342,10 @@ H5D__pre_write(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file selection+offset not within extent") } /* end if */ - if(!buf && (NULL == file_space || H5S_GET_SELECT_NPOINTS(file_space) != 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") - - /* If the buffer is nil, and 0 element is selected, make a fake buffer. - * This is for some MPI package like ChaMPIon on NCSA's tungsten which - * doesn't support this feature. - */ - if(!buf) - buf = &fake_char; - /* write raw data */ if(H5D__write(dset, mem_type_id, mem_space, file_space, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -416,6 +395,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ + char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -450,6 +430,19 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes") + /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */ + if(NULL == buf) { + /* Check for any elements selected (which is invalid) */ + if(nelmts > 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") + + /* If the buffer is nil, and 0 element is selected, make a fake buffer. + * This is for some MPI package like ChaMPIon on NCSA's tungsten which + * doesn't support this feature. + */ + buf = &fake_char; + } /* end if */ + /* Make sure that both selections have their extents set */ if(!(H5S_has_extent(file_space))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set") @@ -617,6 +610,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ + char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -682,6 +676,33 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if(!mem_space) mem_space = file_space; + if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection") + H5_ASSIGN_OVERFLOW(nelmts, snelmts, hssize_t, hsize_t); + + /* Make certain that the number of elements in each selection is the same */ + if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes") + + /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */ + if(NULL == buf) { + /* Check for any elements selected (which is invalid) */ + if(nelmts > 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") + + /* If the buffer is nil, and 0 element is selected, make a fake buffer. + * This is for some MPI package like ChaMPIon on NCSA's tungsten which + * doesn't support this feature. + */ + buf = &fake_char; + } /* end if */ + + /* Make sure that both selections have their extents set */ + if(!(H5S_has_extent(file_space))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set") + if(!(H5S_has_extent(mem_space))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set") + /* H5S_select_shape_same() has been modified to accept topologically * identical selections with different rank as having the same shape * (if the most rapidly changing coordinates match up), but the I/O @@ -712,20 +733,6 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, buf = adj_buf; } /* end if */ - if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection") - H5_ASSIGN_OVERFLOW(nelmts, snelmts, hssize_t, hsize_t); - - /* Make certain that the number of elements in each selection is the same */ - if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes") - - /* Make sure that both selections have their extents set */ - if(!(H5S_has_extent(file_space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set") - if(!(H5S_has_extent(mem_space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set") - /* Retrieve dataset properties */ /* <none needed currently> */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index c3cee61..5a785a3 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -524,6 +524,8 @@ H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BTREE[1]; /* Package Private Prototypes */ /******************************/ +H5_DLL herr_t H5D__term_pub_interface(void); +H5_DLL herr_t H5D__term_deprec_interface(void); H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id); H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name, @@ -326,6 +326,9 @@ H5E_term_interface(void) } /* end if */ } /* end if */ else { + /* Close deprecated interface */ + n += H5E__term_deprec_interface(); + /* Destroy the error class, message, and stack id groups */ H5I_dec_type_ref(H5I_ERROR_STACK); H5I_dec_type_ref(H5I_ERROR_CLASS); diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 0d3083b..3e9444b 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -34,7 +34,7 @@ #define H5E_PACKAGE /*suppress error about including H5Epkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5E_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5E__init_deprec_interface /***********/ @@ -82,13 +82,12 @@ /*******************/ -#ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- NAME - H5E_init_deprec_interface -- Initialize interface-specific information + H5E__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5E_init_deprec_interface() + herr_t H5E__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -97,13 +96,38 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5E_init_deprec_interface(void) +H5E__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5E_init()) -} /* H5E_init_deprec_interface() */ +} /* H5E__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5E__term_deprec_interface -- Terminate interface +USAGE + herr_t H5E__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5E__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + FUNC_LEAVE_NOAPI(0) +} /* H5E__term_deprec_interface() */ + +#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- * Function: H5Eget_major diff --git a/src/H5Epkg.h b/src/H5Epkg.h index 9a1163a..bfaaf9d 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -132,6 +132,7 @@ H5_DLLVAR H5E_t H5E_stack_g[1]; /******************************/ /* Package Private Prototypes */ /******************************/ +H5_DLL herr_t H5E__term_deprec_interface(void); #ifdef H5_HAVE_THREADSAFE H5_DLL H5E_t *H5E_get_stack(void); #endif /* H5_HAVE_THREADSAFE */ @@ -146,5 +147,5 @@ H5_DLL herr_t H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data); H5_DLL herr_t H5E_pop(H5E_t *err_stack, size_t count); -#endif /* _H5HFpkg_H */ +#endif /* _H5Epkg_H */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 9e01f9f..1f10dbc 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -291,6 +291,7 @@ H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1]; /* General routines */ H5_DLL herr_t H5F_init(void); +H5_DLL herr_t H5F__term_deprec_interface(void); H5_DLL herr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr); H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing); @@ -224,16 +224,19 @@ H5G_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { - if((n = H5I_nmembers(H5I_GROUP))) - H5I_clear_type(H5I_GROUP, FALSE, FALSE); - else { - /* Destroy the group object id group */ - H5I_dec_type_ref(H5I_GROUP); - - /* Mark closed */ - H5_interface_initialize_g = 0; - n = 1; /*H5I*/ - } /* end else */ + if((n = H5I_nmembers(H5I_GROUP))) + H5I_clear_type(H5I_GROUP, FALSE, FALSE); + else { + /* Close deprecated interface */ + n += H5G__term_deprec_interface(); + + /* Destroy the group object id group */ + H5I_dec_type_ref(H5I_GROUP); + + /* Mark closed */ + H5_interface_initialize_g = 0; + n = 1; /*H5I*/ + } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 708b01b..81682e9 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -34,7 +34,7 @@ #define H5G_PACKAGE /*suppress error about including H5Gpkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5G_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5G__init_deprec_interface /***********/ @@ -109,9 +109,9 @@ static H5G_obj_t H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, /*-------------------------------------------------------------------------- NAME - H5G_init_deprec_interface -- Initialize interface-specific information + H5G__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5G_init_deprec_interface() + herr_t H5G__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -120,12 +120,36 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5G_init_deprec_interface(void) +H5G__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5G__init()) -} /* H5G_init_deprec_interface() */ +} /* H5G__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5G__term_deprec_interface -- Terminate interface +USAGE + herr_t H5G__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5G__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5G__term_deprec_interface() */ #ifndef H5_NO_DEPRECATED_SYMBOLS diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index e2180c0..b194adb 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -352,6 +352,7 @@ H5_DLL herr_t H5G__traverse_special(const H5G_loc_t *grp_loc, * Utility functions */ H5_DLL herr_t H5G__init(void); +H5_DLL herr_t H5G__term_deprec_interface(void); H5_DLL const char *H5G__component(const char *name, size_t *size_p); /* @@ -25,7 +25,7 @@ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P_init_pub_interface +#define H5_INTERFACE_INIT_FUNC H5P__init_pub_interface /***********/ @@ -75,9 +75,9 @@ typedef struct { /*-------------------------------------------------------------------------- NAME - H5P_init_pub_interface -- Initialize interface-specific information + H5P__init_pub_interface -- Initialize interface-specific information USAGE - herr_t H5P_init_pub_interface() + herr_t H5P__init_pub_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -86,12 +86,36 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5P_init_pub_interface(void) +H5P__init_pub_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P_init_pub_interface() */ +} /* H5P__init_pub_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5P__term_pub_interface -- Terminate interface +USAGE + herr_t H5P__term_pub_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5P__term_pub_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5P__term_pub_interface() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 5d62d61..e525327 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -34,7 +34,7 @@ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5P__init_deprec_interface /***********/ @@ -84,9 +84,9 @@ /*-------------------------------------------------------------------------- NAME - H5P_init_deprec_interface -- Initialize interface-specific information + H5P__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5P_init_deprec_interface() + herr_t H5P__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -95,12 +95,36 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5P_init_deprec_interface(void) +H5P__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P_init_deprec_interface() */ +} /* H5P__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5P__term_deprec_interface -- Terminate interface +USAGE + herr_t H5P__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5P__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5P__term_deprec_interface() */ #ifndef H5_NO_DEPRECATED_SYMBOLS diff --git a/src/H5Pint.c b/src/H5Pint.c index 19b22c8..2d5f609 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -559,6 +559,12 @@ H5P_term_interface(void) } /* end if */ } /* end if */ } else { + /* Close public interface */ + n += H5P__term_pub_interface(); + + /* Close deprecated interface */ + n += H5P__term_deprec_interface(); + H5I_dec_type_ref(H5I_GENPROP_LST); n++; /*H5I*/ H5I_dec_type_ref(H5I_GENPROP_CLS); diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 7768eec..293420e 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -152,6 +152,8 @@ typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata); /******************************/ /* Private functions, not part of the publicly documented API */ +H5_DLL herr_t H5P__term_pub_interface(void); +H5_DLL herr_t H5P__term_deprec_interface(void); H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, @@ -167,6 +167,9 @@ H5R_term_interface(void) if ((n=H5I_nmembers(H5I_REFERENCE))) { H5I_clear_type(H5I_REFERENCE, FALSE, FALSE); } else { + /* Close deprecated interface */ + n += H5R__term_deprec_interface(); + H5I_dec_type_ref(H5I_REFERENCE); H5_interface_initialize_g = 0; n = 1; /*H5I*/ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 1dd97ee..049792e 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -34,7 +34,7 @@ #define H5R_PACKAGE /*suppress error about including H5Rpkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5R_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5R__init_deprec_interface /***********/ @@ -48,7 +48,6 @@ #include "H5Rpkg.h" /* References */ -#ifndef H5_NO_DEPRECATED_SYMBOLS /****************/ /* Local Macros */ /****************/ @@ -87,9 +86,9 @@ /*-------------------------------------------------------------------------- NAME - H5R_init_deprec_interface -- Initialize interface-specific information + H5R__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5R_init_deprec_interface() + herr_t H5R__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -98,15 +97,40 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5R_init_deprec_interface(void) +H5R__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5R_init()) -} /* H5R_init_deprec_interface() */ +} /* H5R__init_deprec_interface() */ /*-------------------------------------------------------------------------- +NAME + H5R__term_deprec_interface -- Terminate interface +USAGE + herr_t H5R__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5R__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + + FUNC_LEAVE_NOAPI(0) +} /* H5R__term_deprec_interface() */ + +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/*-------------------------------------------------------------------------- NAME H5Rget_obj_type1 PURPOSE diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 82382fb..2ff1c2c 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -55,6 +55,7 @@ /* General functions */ H5_DLL herr_t H5R_init(void); +H5_DLL herr_t H5R__term_deprec_interface(void); H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); @@ -1491,6 +1491,10 @@ H5T_term_interface(void) /* Unlock all datatypes, then free them */ /* note that we are ignoring the return value from H5I_iterate() */ H5I_iterate(H5I_DATATYPE, H5T_unlock_cb, NULL, FALSE); + + /* Close deprecated interface */ + n += H5T__term_deprec_interface(); + H5I_dec_type_ref(H5I_DATATYPE); /* Reset all the datatype IDs */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 32080fe..a8881fb 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -34,7 +34,7 @@ #define H5T_PACKAGE /*suppress error about including H5Tpkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_deprec_interface +#define H5_INTERFACE_INIT_FUNC H5T__init_deprec_interface /***********/ @@ -49,7 +49,6 @@ #include "H5Tpkg.h" /* Datatypes */ -#ifndef H5_NO_DEPRECATED_SYMBOLS /****************/ /* Local Macros */ /****************/ @@ -88,9 +87,9 @@ /*-------------------------------------------------------------------------- NAME - H5T_init_deprec_interface -- Initialize interface-specific information + H5T__init_deprec_interface -- Initialize interface-specific information USAGE - herr_t H5T_init_deprec_interface() + herr_t H5T__init_deprec_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -99,13 +98,38 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5T_init_deprec_interface(void) +H5T__init_deprec_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_deprec_interface() */ +} /* H5T__init_deprec_interface() */ + + +/*-------------------------------------------------------------------------- +NAME + H5T__term_deprec_interface -- Terminate interface +USAGE + herr_t H5T__term_deprec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Terminates interface. (Just resets H5_interface_initialize_g + currently). + +--------------------------------------------------------------------------*/ +herr_t +H5T__term_deprec_interface(void) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Mark closed */ + H5_interface_initialize_g = 0; + FUNC_LEAVE_NOAPI(0) +} /* H5T__term_deprec_interface() */ + +#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- * Function: H5Tcommit1 diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 8323e15..bd37829 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -508,6 +508,7 @@ H5FL_EXTERN(H5T_t); H5FL_EXTERN(H5T_shared_t); /* Common functions */ +H5_DLL herr_t H5T__term_deprec_interface(void); H5_DLL H5T_t *H5T__create(H5T_class_t type, size_t size); H5_DLL herr_t H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id); H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, diff --git a/test/dsets.c b/test/dsets.c index 54b88bc..85949bb 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -6690,8 +6690,17 @@ test_zero_dims(hid_t file) if(H5Pset_chunk(dcpl, 1, &csize) < 0) FAIL_STACK_ERROR if((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Just a no-op */ + /* Various no-op writes */ if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR + if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR + if(H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR + if(H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR + + /* Various no-op reads */ + if(H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR + if(H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR + if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR + if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR if(H5Dclose(d) < 0) FAIL_STACK_ERROR if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR diff --git a/test/tmisc.c b/test/tmisc.c index e28b124..d599199 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -316,6 +316,15 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset /* Definitions for misc. test #30 */ #define MISC30_FILE "tmisc30.h5" +/* Definitions for misc. test #31 */ +#define MISC31_FILE "tmisc31.h5" +#define MISC31_DSETNAME "dset" +#define MISC31_ATTRNAME1 "attr1" +#define MISC31_ATTRNAME2 "attr2" +#define MISC31_GROUPNAME "group" +#define MISC31_PROPNAME "misc31_prop" +#define MISC31_DTYPENAME "dtype" + /**************************************************************** ** ** test_misc1(): test unlinking a dataset from a group and immediately @@ -5239,6 +5248,105 @@ test_misc30(void) VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ + +/**************************************************************** +** +** test_misc31(): Test reentering library through deprecated +* routines that register an id after calling +* H5close(). +** +****************************************************************/ +static void +test_misc31(void) +{ + hid_t file_id; /* File id */ + hid_t space_id; /* Dataspace id */ + hid_t dset_id; /* Dataset id */ + hid_t attr_id; /* Attribute id */ + hid_t group_id; /* Group id */ + hid_t dtype_id; /* Datatype id */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Deprecated routines initialize after H5close()\n")); + +#ifndef H5_NO_DEPRECATED_SYMBOLS + file_id = H5Fcreate(MISC31_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fcreate"); + + /* Test dataset package */ + space_id = H5Screate(H5S_SCALAR); + CHECK(space_id, FAIL, "H5Screate"); + dset_id = H5Dcreate1(file_id, MISC31_DSETNAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dcreate1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dset_id = H5Dopen1(file_id, MISC31_DSETNAME); + CHECK(dset_id, FAIL, "H5Dopen1"); + + /* Test attribute package */ + space_id = H5Screate(H5S_SCALAR); + CHECK(space_id, FAIL, "H5Screate"); + attr_id = H5Acreate1(dset_id, MISC31_ATTRNAME1, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + CHECK(attr_id, FAIL, "H5Acreate1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dset_id = H5Dopen1(file_id, MISC31_DSETNAME); + CHECK(dset_id, FAIL, "H5Dopen1"); + space_id = H5Screate(H5S_SCALAR); + CHECK(space_id, FAIL, "H5Screate"); + attr_id = H5Acreate1(dset_id, MISC31_ATTRNAME2, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + CHECK(attr_id, FAIL, "H5Acreate1"); + + /* Test group package */ + group_id = H5Gcreate1(file_id, MISC31_GROUPNAME, 0); + CHECK(group_id, FAIL, "H5Gcreate1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + group_id = H5Gopen1(file_id, MISC31_GROUPNAME); + CHECK(group_id, FAIL, "H5Gopen1"); + + /* Test property list package */ + ret = H5Pregister1(H5P_OBJECT_CREATE, MISC31_PROPNAME, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK(ret, FAIL, "H5Pregister1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + ret = H5Pregister1(H5P_OBJECT_CREATE, MISC31_PROPNAME, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK(ret, FAIL, "H5Pregister1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + + /* Test datatype package */ + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dtype_id = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype_id, FAIL, "H5Tcopy"); + ret = H5Tcommit1(file_id, MISC31_DTYPENAME, dtype_id); + CHECK(ret, FAIL, "H5Tcommit1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dtype_id = H5Topen1(file_id, MISC31_DTYPENAME); + CHECK(ret, FAIL, "H5Topen1"); + ret = H5Fclose(file_id); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Tclose(dtype_id); + CHECK(ret, FAIL, "H5Tclose"); + +#else /* H5_NO_DEPRECATED_SYMBOLS */ + /* Output message about test being skipped */ + MESSAGE(5, (" ...Skipped")); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ +} /* end test_misc31() */ + + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5284,6 +5392,7 @@ test_misc(void) test_misc28(); /* Test that chunks are cached appropriately */ test_misc29(); /* Test that speculative metadata reads are handled correctly */ test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */ + test_misc31(); /* Test Reentering library through deprecated routines after H5close() */ } /* test_misc() */ @@ -5340,5 +5449,6 @@ cleanup_misc(void) HDremove(MISC28_FILE); HDremove(MISC29_COPY_FILE); HDremove(MISC30_FILE); + HDremove(MISC31_FILE); } diff --git a/test/tselect.c b/test/tselect.c index eff9325..7dfb6d7 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -292,11 +292,15 @@ test_select_hyper(hid_t xfer_plist) ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,wbuf); CHECK(ret, FAIL, "H5Dwrite"); - /* Exercise check for NULL buffer and valid selection */ + /* Exercise checks for NULL buffer and valid selection */ H5E_BEGIN_TRY { ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,NULL); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dwrite"); + H5E_BEGIN_TRY { + ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,NULL); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Dwrite"); /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -326,11 +330,15 @@ test_select_hyper(hid_t xfer_plist) ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,rbuf); CHECK(ret, FAIL, "H5Dread"); - /* Exercise check for NULL buffer and valid selection */ + /* Exercise checks for NULL buffer and valid selection */ H5E_BEGIN_TRY { ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,NULL); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dread"); + H5E_BEGIN_TRY { + ret=H5Dread(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,NULL); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Dread"); /* Check that the values match with a dataset iterator */ tbuf=wbuf+(15*SPACE2_DIM2); |