diff options
Diffstat (limited to 'src/H5Ddeprec.c')
-rw-r--r-- | src/H5Ddeprec.c | 105 |
1 files changed, 46 insertions, 59 deletions
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 8bb9e1e..70e0cd8 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -6,7 +6,7 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -29,56 +29,47 @@ /* Module Setup */ /****************/ -#include "H5Dmodule.h" /* This source code file is part of the H5D module */ - +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ - +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Package Typedefs */ /********************/ - /********************/ /* Local Prototypes */ /********************/ - /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: H5Dcreate1 * @@ -109,56 +100,54 @@ *------------------------------------------------------------------------- */ hid_t -H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, - hid_t dcpl_id) +H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ - hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5G_loc_t loc; /* Object location to insert dataset into */ + H5D_t * dset = NULL; /* New dataset's info */ + const H5S_t *space; /* Dataspace for dataset */ + hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, dcpl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) + if (H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") - if(!name) + if (!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") - if(!*name) + if (!*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") - if(H5I_DATATYPE != H5I_get_type(type_id)) + if (H5I_DATATYPE != H5I_get_type(type_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") - if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE))) + if (NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") - if(H5P_DEFAULT == dcpl_id) + if (H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; - else - if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID") + else if (TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID") /* Verify access property list and set up collective metadata if appropriate */ - if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) + if (H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Create the dataset */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id))) + if (NULL == + (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Register the new dataset to get an ID for it */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) + if ((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: if (H5I_INVALID_HID == ret_value) - if(dset && H5D_close(dset) < 0) + if (dset && H5D_close(dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate1() */ - /*------------------------------------------------------------------------- * Function: H5Dopen1 * @@ -179,15 +168,15 @@ done: hid_t H5Dopen1(hid_t loc_id, const char *name) { - H5D_t *dset = NULL; - H5G_loc_t loc; /* Object location of group */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5D_t * dset = NULL; + H5G_loc_t loc; /* Object location of group */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) + if (H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if (!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") @@ -195,22 +184,21 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Open the dataset */ - if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT))) + if (NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Get an atom for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) + if ((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: - if(H5I_INVALID_HID == ret_value) - if(dset && H5D_close(dset) < 0) + if (H5I_INVALID_HID == ret_value) + if (dset && H5D_close(dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen1() */ - /*------------------------------------------------------------------------- * Function: H5Dextend * @@ -230,38 +218,37 @@ done: herr_t H5Dextend(hid_t dset_id, const hsize_t size[]) { - H5D_t *dset; /* Pointer to dataset to modify */ - hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t * dset; /* Pointer to dataset to modify */ + hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") - if(!size) + if (!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Make certain that the dataset dimensions don't decrease */ /* (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) */ - if(H5S_get_simple_extent_dims(dset->shared->space, dset_dims, NULL) < 0) + if (H5S_get_simple_extent_dims(dset->shared->space, dset_dims, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") - for(u = 0; u < dset->shared->ndims; u++) - if(size[u] > dset_dims[u]) + for (u = 0; u < dset->shared->ndims; u++) + if (size[u] > dset_dims[u]) dset_dims[u] = size[u]; /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(dset_id) < 0) + if (H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Increase size */ - if(H5D__set_extent(dset, dset_dims) < 0) + if (H5D__set_extent(dset, dset_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset") done: FUNC_LEAVE_API(ret_value) } /* end H5Dextend() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - |