diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2014-04-16 15:33:08 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2014-04-16 15:33:08 (GMT) |
commit | 66fb0ea64e2c26f36da922b75ce1fed1fa79d123 (patch) | |
tree | 386e6a19505679a365439a4cf7658bb2c8019fde /src | |
parent | c45423a13de0939385a1cdd2eb969a9c478febc0 (diff) | |
download | hdf5-66fb0ea64e2c26f36da922b75ce1fed1fa79d123.zip hdf5-66fb0ea64e2c26f36da922b75ce1fed1fa79d123.tar.gz hdf5-66fb0ea64e2c26f36da922b75ce1fed1fa79d123.tar.bz2 |
[svn-r25050] Description:
Bring r24995 and r24998 from the trunk to the 1.8 branch:
r24995:
Improve checks for NULL buffer from user during H5Dread/H5Dwrite calls.
r24998:
Check in Neil's changes for correctly handling case where library is
reinitialized through a deprecated routine.
Tested on:
Mac OSX/64 10.9.2 (amazon) w/serial & paralle
(change has baked on trunk for >7 days)
Diffstat (limited to 'src')
-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 |
25 files changed, 347 insertions, 86 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, |