summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5CX.c6
-rw-r--r--src/H5FD.c17
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5Fint.c2
-rw-r--r--src/H5MM.c5
-rw-r--r--src/H5Pfapl.c21
-rw-r--r--src/H5VLcallback.c11
-rw-r--r--src/H5VLint.c6
-rw-r--r--src/H5VLprivate.h2
9 files changed, 27 insertions, 45 deletions
diff --git a/src/H5CX.c b/src/H5CX.c
index 244439e..160aa84 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -1034,7 +1034,6 @@ H5CX_restore_state(const H5CX_state_t *api_state)
*
*-------------------------------------------------------------------------
*/
-H5_GCC_DIAG_OFF(cast-qual)
herr_t
H5CX_free_state(H5CX_state_t *api_state)
{
@@ -1072,9 +1071,9 @@ H5CX_free_state(H5CX_state_t *api_state)
/* Release the VOL connector property, if it was set */
if(api_state->vol_connector_prop.connector_id) {
- /* Clean up any VOL connector info, ignoring const-ness of connector info */
+ /* Clean up any VOL connector info */
if(api_state->vol_connector_prop.connector_info)
- if(H5VL_free_connector_info(api_state->vol_connector_prop.connector_id, (void *)api_state->vol_connector_prop.connector_info) < 0)
+ if(H5VL_free_connector_info(api_state->vol_connector_prop.connector_id, api_state->vol_connector_prop.connector_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
/* Decrement connector ID */
if(H5I_dec_ref(api_state->vol_connector_prop.connector_id) < 0)
@@ -1087,7 +1086,6 @@ H5CX_free_state(H5CX_state_t *api_state)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_free_state() */
-H5_GCC_DIAG_ON(cast-qual)
/*-------------------------------------------------------------------------
diff --git a/src/H5FD.c b/src/H5FD.c
index 0cc5654..7788f58 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -202,7 +202,7 @@ H5FD__free_cls(H5FD_class_t *cls)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_free_cls() */
+} /* end H5FD__free_cls() */
/*-------------------------------------------------------------------------
@@ -566,17 +566,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_fapl_close
+ * Function: H5FD_free_driver_info
*
- * Purpose: Closes a driver for a dataset transfer property list
+ * Purpose: Frees a driver's info
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
-H5_GCC_DIAG_OFF(cast-qual)
herr_t
-H5FD_fapl_close(hid_t driver_id, const void *driver_info)
+H5FD_free_driver_info(hid_t driver_id, const void *driver_info)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -592,8 +591,9 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info)
/* Allow driver to free info or do it ourselves */
if(driver_info) {
if(driver->fapl_free) {
- /* Free the const pointer (why we turn off the diagnostic) */
- if((driver->fapl_free)((void *)driver_info) < 0)
+ /* Free the const pointer */
+ /* Cast through uintptr_t to de-const memory */
+ if((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed")
}
else
@@ -603,8 +603,7 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_fapl_close() */
-H5_GCC_DIAG_ON(cast-qual)
+} /* end H5FD_free_driver_info() */
/*-------------------------------------------------------------------------
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index ac08f7f..2e3d3ce 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -115,7 +115,7 @@ H5_DLL hsize_t H5FD_sb_size(H5FD_t *file);
H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf);
H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf);
H5_DLL void *H5FD_fapl_get(H5FD_t *file);
-H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, const void *fapl);
+H5_DLL herr_t H5FD_free_driver_info(hid_t driver_id, const void *driver_info);
H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref);
H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr);
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 74189c1..0000512 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -273,7 +273,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
done:
/* Release the copy of the driver info, if it was set up */
- if(driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0)
+ if(driver_prop_copied && H5FD_free_driver_info(driver_prop.driver_id, driver_prop.driver_info) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5MM.c b/src/H5MM.c
index dae3f81..94bd542 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -577,18 +577,17 @@ H5MM_xfree(void *mem)
*
*-------------------------------------------------------------------------
*/
-H5_GCC_DIAG_OFF(cast-qual)
void *
H5MM_xfree_const(const void *mem)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- H5MM_xfree((void *)mem);
+ /* Cast through uintptr_t to de-const memory */
+ H5MM_xfree((void *)(uintptr_t)mem);
FUNC_LEAVE_NOAPI(NULL)
} /* end H5MM_xfree_const() */
-H5_GCC_DIAG_ON(cast-qual)
/*-------------------------------------------------------------------------
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index f238466..9a04c3e 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -1146,7 +1146,6 @@ done:
*
*-------------------------------------------------------------------------
*/
-H5_GCC_DIAG_OFF(cast-qual)
static herr_t
H5P__file_driver_free(void *value)
{
@@ -1159,22 +1158,11 @@ H5P__file_driver_free(void *value)
/* Copy the driver & info, if there is one */
if(info->driver_id > 0) {
- if(info->driver_info) {
- H5FD_class_t *driver; /* Pointer to driver */
- /* Retrieve the driver for the ID */
- if(NULL == (driver = (H5FD_class_t *)H5I_object(info->driver_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID")
-
- /* Allow driver to free info or do it ourselves */
- if(driver->fapl_free) {
- /* Free the const pointer (why we turn off the diagnostic) */
- if((driver->fapl_free)((void *)info->driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed")
- }
- else
- H5MM_xfree_const(info->driver_info);
- }
+ /* Free the driver info, if it exists */
+ if(info->driver_info)
+ if(H5FD_free_driver_info(info->driver_id, info->driver_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed")
/* Decrement reference count for driver */
if(H5I_dec_ref(info->driver_id) < 0)
@@ -1185,7 +1173,6 @@ H5P__file_driver_free(void *value)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_driver_free() */
-H5_GCC_DIAG_ON(cast-qual)
/*-------------------------------------------------------------------------
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index e4ebb95..5c54b5b 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -525,7 +525,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_free_connector_info(hid_t connector_id, void *info)
+H5VL_free_connector_info(hid_t connector_id, const void *info)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
@@ -543,12 +543,13 @@ H5VL_free_connector_info(hid_t connector_id, void *info)
if(info) {
/* Allow the connector to free info or do it ourselves */
if(cls->info_cls.free) {
- if((cls->info_cls.free)(info) < 0)
+ /* Cast through uintptr_t to de-const memory */
+ if((cls->info_cls.free)((void *)(uintptr_t)info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed")
- } /* end if */
+ }
else
- H5MM_xfree(info);
- } /* end if */
+ H5MM_xfree_const(info);
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5VLint.c b/src/H5VLint.c
index df1f7a4..6572faa 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -670,7 +670,6 @@ done:
*
*-------------------------------------------------------------------------
*/
-H5_GCC_DIAG_OFF(cast-qual)
herr_t
H5VL_conn_free(const H5VL_connector_prop_t *connector_prop)
{
@@ -682,8 +681,8 @@ H5VL_conn_free(const H5VL_connector_prop_t *connector_prop)
/* Free the connector info (if it exists) and decrement the ID */
if(connector_prop->connector_id > 0) {
if(connector_prop->connector_info)
- /* Free the connector info, ignoring the const */
- if(H5VL_free_connector_info(connector_prop->connector_id, (void *)connector_prop->connector_info) < 0)
+ /* Free the connector info */
+ if(H5VL_free_connector_info(connector_prop->connector_id, connector_prop->connector_info) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
/* Decrement reference count for connector ID */
@@ -695,7 +694,6 @@ H5VL_conn_free(const H5VL_connector_prop_t *connector_prop)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_conn_free() */
-H5_GCC_DIAG_ON(cast-qual)
/*-------------------------------------------------------------------------
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 27dd18c..3235357 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -128,7 +128,7 @@ H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_in
const void *src_info);
H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value,
const void *info1, const void *info2);
-H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, void *info);
+H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, const void *info);
/* Attribute functions */
H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);