diff options
Diffstat (limited to 'src/H5L.c')
-rw-r--r-- | src/H5L.c | 1490 |
1 files changed, 700 insertions, 790 deletions
@@ -15,25 +15,25 @@ /* Module Setup */ /****************/ -#define H5L_PACKAGE /*suppress error about including H5Lpkg */ +#define H5L_PACKAGE /*suppress error about including H5Lpkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5L_init_interface +#define H5_INTERFACE_INIT_FUNC H5L_init_interface /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lpkg.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* File objects */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* File objects */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ @@ -41,170 +41,158 @@ #define H5L_MIN_TABLE_SIZE 32 /* Minimum size of the user-defined link type table if it is allocated */ - /******************/ /* Local Typedefs */ /******************/ /* User data for path traversal routine for getting link info by name */ typedef struct { - H5L_info_t *linfo; /* Buffer to return to user */ - hid_t dxpl_id; /* DXPL to use in callback */ + H5L_info_t *linfo; /* Buffer to return to user */ + hid_t dxpl_id; /* DXPL to use in callback */ } H5L_trav_gi_t; /* User data for path traversal routine for getting link info by index */ typedef struct { /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - hid_t dxpl_id; /* DXPL to use in callback */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + hid_t dxpl_id; /* DXPL to use in callback */ /* Out */ - H5L_info_t *linfo; /* Buffer to return to user */ + H5L_info_t *linfo; /* Buffer to return to user */ } H5L_trav_gibi_t; /* User data for path traversal callback to creating a link */ typedef struct { - H5F_t *file; /* Pointer to the file */ - H5P_genplist_t *lc_plist; /* Link creation property list */ - hid_t dxpl_id; /* Dataset transfer property list */ - H5G_name_t *path; /* Path to object being linked */ - H5O_obj_create_t *ocrt_info; /* Pointer to object creation info */ - H5O_link_t *lnk; /* Pointer to link information to insert */ + H5F_t * file; /* Pointer to the file */ + H5P_genplist_t * lc_plist; /* Link creation property list */ + hid_t dxpl_id; /* Dataset transfer property list */ + H5G_name_t * path; /* Path to object being linked */ + H5O_obj_create_t *ocrt_info; /* Pointer to object creation info */ + H5O_link_t * lnk; /* Pointer to link information to insert */ } H5L_trav_cr_t; /* User data for path traversal routine for moving and renaming a link */ typedef struct { - const char *dst_name; /* Destination name for moving object */ - H5T_cset_t cset; /* Char set for new name */ - H5G_loc_t *dst_loc; /* Destination location for moving object */ - unsigned dst_target_flags; /* Target flags for destination object */ - hbool_t copy; /* TRUE if this is a copy operation */ - hid_t lapl_id; /* LAPL to use in callback */ - hid_t dxpl_id; /* DXPL to use in callback */ + const char *dst_name; /* Destination name for moving object */ + H5T_cset_t cset; /* Char set for new name */ + H5G_loc_t * dst_loc; /* Destination location for moving object */ + unsigned dst_target_flags; /* Target flags for destination object */ + hbool_t copy; /* TRUE if this is a copy operation */ + hid_t lapl_id; /* LAPL to use in callback */ + hid_t dxpl_id; /* DXPL to use in callback */ } H5L_trav_mv_t; /* User data for path traversal routine for moving and renaming an object */ typedef struct { - H5F_t *file; /* Pointer to the file */ - H5O_link_t *lnk; /* Pointer to link information to insert */ - hbool_t copy; /* TRUE if this is a copy operation */ - hid_t dxpl_id; /* Dataset transfer property list */ + H5F_t * file; /* Pointer to the file */ + H5O_link_t *lnk; /* Pointer to link information to insert */ + hbool_t copy; /* TRUE if this is a copy operation */ + hid_t dxpl_id; /* Dataset transfer property list */ } H5L_trav_mv2_t; /* User data for path traversal routine for getting link value */ typedef struct { - size_t size; /* Size of user buffer */ - void *buf; /* User buffer */ + size_t size; /* Size of user buffer */ + void * buf; /* User buffer */ } H5L_trav_gv_t; /* User data for path traversal routine for getting link value by index */ typedef struct { /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - hid_t dxpl_id; /* DXPL to use in callback */ - size_t size; /* Size of user buffer */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + hid_t dxpl_id; /* DXPL to use in callback */ + size_t size; /* Size of user buffer */ /* Out */ - void *buf; /* User buffer */ + void *buf; /* User buffer */ } H5L_trav_gvbi_t; /* User data for path traversal routine for removing link */ typedef struct { - hid_t dxpl_id; /* DXPL to use in callback */ + hid_t dxpl_id; /* DXPL to use in callback */ } H5L_trav_rm_t; /* User data for path traversal routine for removing link by index */ typedef struct { /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - hid_t dxpl_id; /* DXPL to use in callback */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + hid_t dxpl_id; /* DXPL to use in callback */ } H5L_trav_rmbi_t; /* User data for path traversal routine for getting name by index */ typedef struct { /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - size_t size; /* Size of name buffer */ - hid_t dxpl_id; /* DXPL to use in callback */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + size_t size; /* Size of name buffer */ + hid_t dxpl_id; /* DXPL to use in callback */ /* Out */ - char *name; /* Buffer to return name to user */ - ssize_t name_len; /* Length of full name */ + char * name; /* Buffer to return name to user */ + ssize_t name_len; /* Length of full name */ } H5L_trav_gnbi_t; /********************/ /* Local Prototypes */ /********************/ -static int H5L_find_class_idx(H5L_type_t id); -static herr_t H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_create_real(const H5G_loc_t *link_loc, const char *link_name, - H5G_name_t *obj_path, H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id); +static int H5L_find_class_idx(H5L_type_t id); +static herr_t H5L_link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L_create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, + H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id); static herr_t H5L_get_val_real(const H5O_link_t *lnk, void *buf, size_t size); -static herr_t H5L_get_val_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_get_val_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_delete_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_exists_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, - hid_t dxpl_id); -static herr_t H5L_get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_get_name_by_idx_cb(H5G_loc_t *grp_loc/*in*/, - const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/); +static herr_t H5L_get_val_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L_get_val_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L_delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L_delete_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L_move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L_move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L_exists_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id); +static herr_t H5L_get_info_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L_get_info_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); +static herr_t H5L_get_name_by_idx_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/); /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ /* Information about user-defined links */ -static size_t H5L_table_alloc_g = 0; -static size_t H5L_table_used_g = 0; -static H5L_class_t *H5L_table_g = NULL; +static size_t H5L_table_alloc_g = 0; +static size_t H5L_table_used_g = 0; +static H5L_class_t *H5L_table_g = NULL; - /*------------------------------------------------------------------------- * Function: H5L_init * @@ -222,7 +210,7 @@ static H5L_class_t *H5L_table_g = NULL; herr_t H5L_init(void) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* FUNC_ENTER() does all the work */ @@ -231,7 +219,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_init() */ - /*------------------------------------------------------------------------- * Function: H5L_init_interface * @@ -247,19 +234,18 @@ done: static herr_t H5L_init_interface(void) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Initialize user-defined link classes */ - if(H5L_register_external() < 0) + if (H5L_register_external() < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_init_interface() */ - /*------------------------------------------------------------------------- * Function: H5L_term_interface * @@ -280,7 +266,7 @@ H5L_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Free the table of link types */ - H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g); + H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g); H5L_table_used_g = H5L_table_alloc_g = 0; /* Mark the interface as uninitialized */ @@ -289,7 +275,6 @@ H5L_term_interface(void) FUNC_LEAVE_NOAPI(n) } /* H5L_term_interface() */ - /*------------------------------------------------------------------------- * Function: H5Lmove * @@ -308,49 +293,46 @@ H5L_term_interface(void) *------------------------------------------------------------------------- */ herr_t -H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, - const char *dst_name, hid_t lcpl_id, hid_t lapl_id) +H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id, + hid_t lapl_id) { - H5G_loc_t src_loc, *src_loc_p; - H5G_loc_t dst_loc, *dst_loc_p; - herr_t ret_value=SUCCEED; /* Return value */ + H5G_loc_t src_loc, *src_loc_p; + H5G_loc_t dst_loc, *dst_loc_p; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, - lapl_id); + H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, lapl_id); /* Check arguments */ - if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) + if (src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") - if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) + if (src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) + if (dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!src_name || !*src_name) + if (!src_name || !*src_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") - if(!dst_name || !*dst_name) + if (!dst_name || !*dst_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") - if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) + if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; - if(src_loc_id == H5L_SAME_LOC) + if (src_loc_id == H5L_SAME_LOC) src_loc_p = dst_loc_p; - else if(dst_loc_id == H5L_SAME_LOC) + else if (dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; /* Move the link */ - if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if (H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) } /* end H5Lmove() */ - /*------------------------------------------------------------------------- * Function: H5Lcopy * @@ -366,49 +348,46 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, - const char *dst_name, hid_t lcpl_id, hid_t lapl_id) +H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id, + hid_t lapl_id) { - H5G_loc_t src_loc, *src_loc_p; - H5G_loc_t dst_loc, *dst_loc_p; - herr_t ret_value=SUCCEED; /* Return value */ + H5G_loc_t src_loc, *src_loc_p; + H5G_loc_t dst_loc, *dst_loc_p; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, - lapl_id); + H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, lapl_id); /* Check arguments */ - if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) + if (src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") - if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) + if (src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) + if (dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!src_name || !*src_name) + if (!src_name || !*src_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") - if(!dst_name || !*dst_name) + if (!dst_name || !*dst_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") - if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) + if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; - if(src_loc_id == H5L_SAME_LOC) + if (src_loc_id == H5L_SAME_LOC) src_loc_p = dst_loc_p; - else if(dst_loc_id == H5L_SAME_LOC) + else if (dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; /* Copy the link */ - if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if (H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) } /* end H5Lcopy() */ - /*------------------------------------------------------------------------- * Function: H5Lcreate_soft * @@ -428,34 +407,33 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lcreate_soft(const char *link_target, - hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) +H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, + hid_t lapl_id) { - H5G_loc_t link_loc; /* Group location for new link */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t link_loc; /* Group location for new link */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*si*sii", link_target, link_loc_id, link_name, lcpl_id, lapl_id); /* Check arguments */ - if(H5G_loc(link_loc_id, &link_loc) < 0) + if (H5G_loc(link_loc_id, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!link_target || !*link_target) + if (!link_target || !*link_target) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no target specified") - if(!link_name || !*link_name) + if (!link_name || !*link_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") - if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) + if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Create the link */ - if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if (H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_soft() */ - /*------------------------------------------------------------------------- * Function: H5Lcreate_hard * @@ -473,51 +451,48 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, - hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) +H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, + hid_t lapl_id) { - H5G_loc_t cur_loc, *cur_loc_p; - H5G_loc_t new_loc, *new_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t cur_loc, *cur_loc_p; + H5G_loc_t new_loc, *new_loc_p; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "i*si*sii", cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, - lapl_id); + H5TRACE6("e", "i*si*sii", cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id); /* Check arguments */ - if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC) + if (cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC") - if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0) + if (cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0) + if (new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!cur_name || !*cur_name) + if (!cur_name || !*cur_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") - if(!new_name || !*new_name) + if (!new_name || !*new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") - if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) + if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Set up current & new location pointers */ cur_loc_p = &cur_loc; new_loc_p = &new_loc; - if(cur_loc_id == H5L_SAME_LOC) + if (cur_loc_id == H5L_SAME_LOC) cur_loc_p = new_loc_p; - else if(new_loc_id == H5L_SAME_LOC) + else if (new_loc_id == H5L_SAME_LOC) new_loc_p = cur_loc_p; - else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) + else if (cur_loc_p->oloc->file != new_loc_p->oloc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") /* Create the link */ - if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, - lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if (H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_hard() */ - /*------------------------------------------------------------------------- * Function: H5Lcreate_ud * @@ -543,33 +518,31 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, - const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) +H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, + size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t link_loc; - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t link_loc; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, - udata_size, lcpl_id, lapl_id); + H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, udata_size, lcpl_id, lapl_id); /* Check arguments */ - if(H5G_loc(link_loc_id, &link_loc) < 0) + if (H5G_loc(link_loc_id, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!link_name || !*link_name) + if (!link_name || !*link_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") - if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) + if (link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") /* Create external link */ - if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if (H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_ud() */ - /*------------------------------------------------------------------------- * Function: H5Ldelete * @@ -590,27 +563,26 @@ done: herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; /* Group's location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Group's location */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*si", loc_id, name, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) + if (H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Unlink */ - if(H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0) + if (H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) } /* end H5Ldelete() */ - /*------------------------------------------------------------------------- * Function: H5Ldelete_by_idx * @@ -631,46 +603,45 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Ldelete_by_idx(hid_t loc_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) +H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + hid_t lapl_id) { - H5G_loc_t loc; /* Group's location */ - H5L_trav_rmbi_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Group's location */ + H5L_trav_rmbi_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) + if (H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!group_name || !*group_name) + if (!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Set up user data for unlink operation */ udata.idx_type = idx_type; - udata.order = order; - udata.n = n; - udata.dxpl_id = H5AC_dxpl_id; + udata.order = order; + udata.n = n; + udata.dxpl_id = H5AC_dxpl_id; /* Traverse the group hierarchy to remove the link */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_delete_by_idx_cb, &udata, lapl_id, H5AC_dxpl_id) < 0) + if (H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, + H5L_delete_by_idx_cb, &udata, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") done: FUNC_LEAVE_API(ret_value) } /* end H5Ldelete_by_idx() */ - /*------------------------------------------------------------------------- * Function: H5Lget_val * @@ -691,35 +662,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, - hid_t lapl_id) +H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Group location for location to query */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Group location for location to query */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*sxzi", loc_id, name, buf, size, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) + if (H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the link value */ - if(H5L_get_val(&loc, name, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0) + if (H5L_get_val(&loc, name, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value for '%s'", name) done: FUNC_LEAVE_API(ret_value) } /* end H5Lget_val() */ - /*------------------------------------------------------------------------- * Function: H5Lget_val_by_idx * @@ -739,51 +707,47 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size, - hid_t lapl_id) +H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + void *buf /*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Group location for location to query */ - H5L_trav_gvbi_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Group location for location to query */ + H5L_trav_gvbi_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, buf, size, - lapl_id); + H5TRACE8("e", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, buf, size, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) + if (H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!group_name || !*group_name) + if (!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Set up user data for retrieving information */ udata.idx_type = idx_type; - udata.order = order; - udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; - udata.buf = buf; - udata.size = size; + udata.order = order; + udata.n = n; + udata.dxpl_id = H5AC_ind_dxpl_id; + udata.buf = buf; + udata.size = size; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if (H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, &udata, + lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") - done: FUNC_LEAVE_API(ret_value) } /* end H5Lget_val_by_idx() */ - /*------------------------------------------------------------------------- * Function: H5Lexists * @@ -800,32 +764,30 @@ done: htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; - htri_t ret_value; + H5G_loc_t loc; + htri_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*si", loc_id, name, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) + if (H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Check for the existence of the link */ - if((ret_value = H5L_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if ((ret_value = H5L_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) } /* end H5Lexists() */ - /*------------------------------------------------------------------------- * Function: H5Lget_info * @@ -841,35 +803,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, - hid_t lapl_id) +H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { - H5G_loc_t loc; - herr_t ret_value = SUCCEED; + H5G_loc_t loc; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) + if (H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) + if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the link information */ - if(H5L_get_info(&loc, name, linfo, lapl_id, H5AC_ind_dxpl_id) < 0) + if (H5L_get_info(&loc, name, linfo, lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) } /* end H5Lget_info() */ - /*------------------------------------------------------------------------- * Function: H5Lget_info_by_idx * @@ -885,50 +844,46 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lget_info_by_idx(hid_t loc_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linfo /*out*/, hid_t lapl_id) +H5Lget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, + hsize_t n, H5L_info_t *linfo /*out*/, hid_t lapl_id) { - H5G_loc_t loc; /* Group location for group to query */ - H5L_trav_gibi_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Group location for group to query */ + H5L_trav_gibi_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, - lapl_id); + H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) + if (H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!group_name || !*group_name) + if (!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Set up user data for callback */ udata.idx_type = idx_type; - udata.order = order; - udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; - udata.linfo = linfo; + udata.order = order; + udata.n = n; + udata.dxpl_id = H5AC_ind_dxpl_id; + udata.linfo = linfo; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if (H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, + lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") - done: FUNC_LEAVE_API(ret_value) } /* end H5Lget_info_by_idx() */ - /*------------------------------------------------------------------------- * Function: H5Lregister * @@ -951,35 +906,34 @@ done: herr_t H5Lregister(const H5L_class_t *cls) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", cls); /* Check args */ - if(cls == NULL) + if (cls == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") /* Check H5L_class_t version number; this is where a function to convert * from an outdated version should be called. */ - if(cls->version != H5L_LINK_CLASS_T_VERS) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number") + if (cls->version != H5L_LINK_CLASS_T_VERS) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number") - if(cls->id < H5L_TYPE_UD_MIN || cls->id > H5L_TYPE_MAX) + if (cls->id < H5L_TYPE_UD_MIN || cls->id > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number") - if(cls->trav_func == NULL) + if (cls->trav_func == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no traversal function specified") /* Do it */ - if(H5L_register(cls) < 0) + if (H5L_register(cls) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register link type") done: FUNC_LEAVE_API(ret_value) } /* end H5Lregister() */ - /*------------------------------------------------------------------------- * Function: H5Lunregister * @@ -998,24 +952,23 @@ done: herr_t H5Lunregister(H5L_type_t id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "Ll", id); /* Check args */ - if(id < 0 || id > H5L_TYPE_MAX) + if (id < 0 || id > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type") /* Do it */ - if(H5L_unregister(id) < 0) + if (H5L_unregister(id) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type") done: FUNC_LEAVE_API(ret_value) } /* end H5Lunregister() */ - /*------------------------------------------------------------------------- * Function: H5Lis_registered * @@ -1034,19 +987,19 @@ done: htri_t H5Lis_registered(H5L_type_t id) { - size_t i; /* Local index variable */ - htri_t ret_value = FALSE; /* Return value */ + size_t i; /* Local index variable */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "Ll", id); /* Check args */ - if(id < 0 || id > H5L_TYPE_MAX) + if (id < 0 || id > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type id number") /* Is the link class already registered? */ - for(i = 0; i < H5L_table_used_g; i++) - if(H5L_table_g[i].id == id) { + for (i = 0; i < H5L_table_used_g; i++) + if (H5L_table_g[i].id == id) { ret_value = TRUE; break; } /* end if */ @@ -1055,7 +1008,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Lis_registered() */ - /*------------------------------------------------------------------------- * Function: H5Lget_name_by_idx * @@ -1074,44 +1026,42 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5Lget_name_by_idx(hid_t loc_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - char *name /*out*/, size_t size, hid_t lapl_id) +H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, + hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - H5L_trav_gnbi_t udata; /* User data for callback */ - ssize_t ret_value; /* Return value */ + H5G_loc_t loc; /* Location of group */ + H5L_trav_gnbi_t udata; /* User data for callback */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size, - lapl_id); + H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) + if (H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!group_name || !*group_name) + if (!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Set up user data for callback */ udata.idx_type = idx_type; - udata.order = order; - udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; - udata.name = name; - udata.size = size; + udata.order = order; + udata.n = n; + udata.dxpl_id = H5AC_ind_dxpl_id; + udata.name = name; + udata.size = size; udata.name_len = -1; /* Traverse the group hierarchy to locate the link to get name of */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if (H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, + lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") /* Set the return value */ @@ -1121,7 +1071,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Lget_name_by_idx() */ - /*------------------------------------------------------------------------- * Function: H5Literate * @@ -1145,50 +1094,50 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, - hsize_t *idx_p, H5L_iterate_t op, void *op_data) +H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, + void *op_data) { - H5I_type_t id_type; /* Type of ID */ - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_lnk; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value; /* Return value */ + H5I_type_t id_type; /* Type of ID */ + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIo*hx*x", grp_id, idx_type, order, idx_p, op, op_data); /* Check arguments */ id_type = H5I_get_type(grp_id); - if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(!op) + if (!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Set up iteration beginning/end info */ - idx = (idx_p == NULL ? 0 : *idx_p); + idx = (idx_p == NULL ? 0 : *idx_p); last_lnk = 0; /* Build link operator info */ - lnk_op.op_type = H5G_LINK_OP_NEW; + lnk_op.op_type = H5G_LINK_OP_NEW; lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if ((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, + H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ - if(idx_p) + if (idx_p) *idx_p = last_lnk; done: FUNC_LEAVE_API(ret_value) } /* end H5Literate() */ - /*------------------------------------------------------------------------- * Function: H5Literate_by_name * @@ -1212,55 +1161,52 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Literate_by_name(hid_t loc_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, - H5L_iterate_t op, void *op_data, hid_t lapl_id) +H5Literate_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, + hsize_t *idx_p, H5L_iterate_t op, void *op_data, hid_t lapl_id) { - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_lnk; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value; /* Return value */ + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, group_name, idx_type, order, idx_p, op, - op_data, lapl_id); + H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, group_name, idx_type, order, idx_p, op, op_data, lapl_id); /* Check arguments */ - if(!group_name || !*group_name) + if (!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(!op) + if (!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") - if(H5P_DEFAULT == lapl_id) + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Set up iteration beginning/end info */ - idx = (idx_p == NULL ? 0 : *idx_p); + idx = (idx_p == NULL ? 0 : *idx_p); last_lnk = 0; /* Build link operator info */ - lnk_op.op_type = H5G_LINK_OP_NEW; + lnk_op.op_type = H5G_LINK_OP_NEW; lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if ((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, + lapl_id, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ - if(idx_p) + if (idx_p) *idx_p = last_lnk; done: FUNC_LEAVE_API(ret_value) } /* end H5Literate_by_name() */ - /*------------------------------------------------------------------------- * Function: H5Lvisit * @@ -1290,35 +1236,33 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, - H5L_iterate_t op, void *op_data) +H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { - H5I_type_t id_type; /* Type of ID */ - herr_t ret_value; /* Return value */ + H5I_type_t id_type; /* Type of ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "iIiIox*x", grp_id, idx_type, order, op, op_data); /* Check args */ id_type = H5I_get_type(grp_id); - if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(!op) + if (!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if ((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) } /* end H5Lvisit() */ - /*------------------------------------------------------------------------- * Function: H5Lvisit_by_name * @@ -1348,32 +1292,31 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) +H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, + H5L_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIox*xi", loc_id, group_name, idx_type, order, op, op_data, - lapl_id); + H5TRACE7("e", "i*sIiIox*xi", loc_id, group_name, idx_type, order, op, op_data, lapl_id); /* Check args */ - if(!group_name || !*group_name) + if (!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(!op) + if (!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - if(H5P_DEFAULT == lapl_id) + if (H5P_DEFAULT == lapl_id) lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + else if (TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if ((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < + 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1388,7 +1331,6 @@ done: *------------------------------------------------------------------------- */ - /*------------------------------------------------------------------------- * Function: H5L_find_class_idx * @@ -1407,20 +1349,19 @@ done: static int H5L_find_class_idx(H5L_type_t id) { - size_t i; /* Local index variable */ - int ret_value = FAIL; /* Return value */ + size_t i; /* Local index variable */ + int ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR - for(i = 0; i < H5L_table_used_g; i++) - if(H5L_table_g[i].id == id) + for (i = 0; i < H5L_table_used_g; i++) + if (H5L_table_g[i].id == id) HGOTO_DONE((int)i) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_find_class_idx */ - /*------------------------------------------------------------------------- * Function: H5L_find_class * @@ -1438,23 +1379,22 @@ done: const H5L_class_t * H5L_find_class(H5L_type_t id) { - int idx; /* Filter index in global table */ - H5L_class_t *ret_value = NULL; /* Return value */ + int idx; /* Filter index in global table */ + H5L_class_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Get the index in the global table */ - if((idx = H5L_find_class_idx(id)) < 0) + if ((idx = H5L_find_class_idx(id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class") /* Set return value */ - ret_value = H5L_table_g+idx; + ret_value = H5L_table_g + idx; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_find_class */ - /*------------------------------------------------------------------------- * Function: H5L_register * @@ -1473,8 +1413,8 @@ done: herr_t H5L_register(const H5L_class_t *cls) { - size_t i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1482,23 +1422,23 @@ H5L_register(const H5L_class_t *cls) HDassert(cls->id >= 0 && cls->id <= H5L_TYPE_MAX); /* Is the link type already registered? */ - for(i = 0; i < H5L_table_used_g; i++) - if(H5L_table_g[i].id == cls->id) + for (i = 0; i < H5L_table_used_g; i++) + if (H5L_table_g[i].id == cls->id) break; /* Filter not already registered */ - if(i >= H5L_table_used_g) { - if(H5L_table_used_g >= H5L_table_alloc_g) { - size_t n = MAX(H5L_MIN_TABLE_SIZE, (2 * H5L_table_alloc_g)); + if (i >= H5L_table_used_g) { + if (H5L_table_used_g >= H5L_table_alloc_g) { + size_t n = MAX(H5L_MIN_TABLE_SIZE, (2 * H5L_table_alloc_g)); H5L_class_t *table = (H5L_class_t *)H5MM_realloc(H5L_table_g, (n * sizeof(H5L_class_t))); - if(!table) + if (!table) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table") - H5L_table_g = table; + H5L_table_g = table; H5L_table_alloc_g = n; - } /* end if */ + } /* end if */ - /* Initialize */ - i = H5L_table_used_g++; + /* Initialize */ + i = H5L_table_used_g++; } /* end if */ /* Copy link class info into table */ @@ -1508,7 +1448,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_register */ - /*------------------------------------------------------------------------- * Function: H5L_unregister * @@ -1526,20 +1465,20 @@ done: herr_t H5L_unregister(H5L_type_t id) { - size_t i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) HDassert(id >= 0 && id <= H5L_TYPE_MAX); /* Is the filter already registered? */ - for(i = 0; i < H5L_table_used_g; i++) - if(H5L_table_g[i].id == id) + for (i = 0; i < H5L_table_used_g; i++) + if (H5L_table_g[i].id == id) break; /* Fail if filter not found */ - if(i >= H5L_table_used_g) + if (i >= H5L_table_used_g) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered") /* Remove filter from table */ @@ -1551,7 +1490,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_unregister() */ - /*------------------------------------------------------------------------- * Function: H5L_link * @@ -1566,11 +1504,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) +H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id, hid_t lapl_id, + hid_t dxpl_id) { - H5O_link_t lnk; /* Link to insert */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_link_t lnk; /* Link to insert */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1585,18 +1523,18 @@ H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, */ /* Construct link information for eventual insertion */ - lnk.type = H5L_TYPE_HARD; + lnk.type = H5L_TYPE_HARD; lnk.u.hard.addr = obj_loc->oloc->addr; /* Create the link */ - if(H5L_create_real(new_loc, new_name, obj_loc->path, obj_loc->oloc->file, &lnk, NULL, lcpl_id, lapl_id, dxpl_id) < 0) + if (H5L_create_real(new_loc, new_name, obj_loc->path, obj_loc->oloc->file, &lnk, NULL, lcpl_id, lapl_id, + dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_link() */ - /*------------------------------------------------------------------------- * Function: H5L_link_object * @@ -1610,11 +1548,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, - H5O_obj_create_t *ocrt_info, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) +H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t *ocrt_info, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id) { - H5O_link_t lnk; /* Link to insert */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_link_t lnk; /* Link to insert */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1632,14 +1570,13 @@ H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, lnk.type = H5L_TYPE_HARD; /* Create the link */ - if(H5L_create_real(new_loc, new_name, NULL, NULL, &lnk, ocrt_info, lcpl_id, lapl_id, dxpl_id) < 0) + if (H5L_create_real(new_loc, new_name, NULL, NULL, &lnk, ocrt_info, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_link_object() */ - /*------------------------------------------------------------------------- * Function: H5L_link_cb * @@ -1653,33 +1590,35 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATTR_UNUSED *lnk, - H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) +H5L_link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_ATTR_UNUSED *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_cr_t *udata = (H5L_trav_cr_t *)_udata; /* User data passed in */ - H5G_t *grp = NULL; /* H5G_t for this group, opened to pass to user callback */ - hid_t grp_id = FAIL; /* Id for this group (passed to user callback */ - H5G_loc_t temp_loc; /* For UD callback */ - hbool_t temp_loc_init = FALSE; /* Temporary location for UD callback (temp_loc) has been initialized */ - hbool_t obj_created = FALSE; /* Whether an object was created (through a hard link) */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_cr_t *udata = (H5L_trav_cr_t *)_udata; /* User data passed in */ + H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */ + hid_t grp_id = FAIL; /* Id for this group (passed to user callback */ + H5G_loc_t temp_loc; /* For UD callback */ + hbool_t temp_loc_init = FALSE; /* Temporary location for UD callback (temp_loc) has been initialized */ + hbool_t obj_created = FALSE; /* Whether an object was created (through a hard link) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check if the name in this group resolved to a valid location */ /* (which is not what we want) */ - if(obj_loc != NULL) + if (obj_loc != NULL) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name already exists") /* Check for crossing file boundaries with a new hard link */ - if(udata->lnk->type == H5L_TYPE_HARD) { + if (udata->lnk->type == H5L_TYPE_HARD) { /* Check for creating an object */ /* (only for hard links) */ - if(udata->ocrt_info) { - H5G_loc_t new_loc; /* Group location for new object */ + if (udata->ocrt_info) { + H5G_loc_t new_loc; /* Group location for new object */ /* Create new object at this location */ - if(NULL == (udata->ocrt_info->new_obj = H5O_obj_create(grp_loc->oloc->file, udata->ocrt_info->obj_type, udata->ocrt_info->crt_info, &new_loc, udata->dxpl_id))) + if (NULL == (udata->ocrt_info->new_obj = + H5O_obj_create(grp_loc->oloc->file, udata->ocrt_info->obj_type, + udata->ocrt_info->crt_info, &new_loc, udata->dxpl_id))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create object") /* Set address for hard link */ @@ -1693,57 +1632,57 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATTR } /* end if */ else { /* Check that both objects are in same file */ - if(!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) + if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "interfile hard links are not allowed") } /* end else */ - } /* end if */ + } /* end if */ /* Set 'standard' aspects of link */ - udata->lnk->corder = 0; /* Will be re-written during group insertion, if the group is tracking creation order */ - udata->lnk->corder_valid = FALSE; /* Creation order not valid (yet) */ + udata->lnk->corder = + 0; /* Will be re-written during group insertion, if the group is tracking creation order */ + udata->lnk->corder_valid = FALSE; /* Creation order not valid (yet) */ /* Check for non-default link creation properties */ - if(udata->lc_plist) { + if (udata->lc_plist) { /* Get character encoding property */ - if(H5P_get(udata->lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &udata->lnk->cset) < 0) + if (H5P_get(udata->lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &udata->lnk->cset) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding") } /* end if */ else - udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */ + udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */ /* Set the link's name correctly */ /* Casting away const OK -QAK */ udata->lnk->name = (char *)name; /* Insert link into group */ - if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, - udata->ocrt_info ? udata->ocrt_info->obj_type : H5O_TYPE_UNKNOWN, - udata->ocrt_info ? udata->ocrt_info->crt_info : NULL, - udata->dxpl_id) < 0) + if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, + udata->ocrt_info ? udata->ocrt_info->obj_type : H5O_TYPE_UNKNOWN, + udata->ocrt_info ? udata->ocrt_info->crt_info : NULL, udata->dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object") /* Set object's path if it has been passed in and is not set */ - if(udata->path != NULL && udata->path->user_path_r == NULL) - if(H5G_name_set(grp_loc->path, udata->path, name) < 0) + if (udata->path != NULL && udata->path->user_path_r == NULL) + if (H5G_name_set(grp_loc->path, udata->path, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name") /* If link is a user-defined link, trigger its creation callback if it has one */ - if(udata->lnk->type >= H5L_TYPE_UD_MIN) { - const H5L_class_t *link_class; /* User-defined link class */ + if (udata->lnk->type >= H5L_TYPE_UD_MIN) { + const H5L_class_t *link_class; /* User-defined link class */ /* Get the link class for this type of link. */ - if(NULL == (link_class = H5L_find_class(udata->lnk->type))) + if (NULL == (link_class = H5L_find_class(udata->lnk->type))) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get class of UD link") - if(link_class->create_func != NULL) { - H5O_loc_t temp_oloc; - H5G_name_t temp_path; + if (link_class->create_func != NULL) { + H5O_loc_t temp_oloc; + H5G_name_t temp_path; /* Create a temporary location (or else H5G_open will do a shallow * copy and wipe out grp_loc) */ H5G_name_reset(&temp_path); - if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0) + if (H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location") temp_loc.oloc = &temp_oloc; @@ -1751,21 +1690,22 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATTR temp_loc_init = TRUE; /* Set up location for user-defined callback */ - if((grp = H5G_open(&temp_loc, udata->dxpl_id)) == NULL) + if ((grp = H5G_open(&temp_loc, udata->dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if ((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register ID for group") /* Make callback */ - if((link_class->create_func)(name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size, H5P_DEFAULT) < 0) + if ((link_class->create_func)(name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size, + H5P_DEFAULT) < 0) HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link creation callback failed") } /* end if */ - } /* end if */ + } /* end if */ done: /* Check if an object was created */ - if(obj_created) { - H5O_loc_t oloc; /* Object location for created object */ + if (obj_created) { + H5O_loc_t oloc; /* Object location for created object */ /* Set up object location */ HDmemset(&oloc, 0, sizeof(oloc)); @@ -1773,20 +1713,20 @@ done: oloc.addr = udata->lnk->u.hard.addr; /* Decrement refcount on new object's object header in memory */ - if(H5O_dec_rc_by_loc(&oloc, udata->dxpl_id) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + if (H5O_dec_rc_by_loc(&oloc, udata->dxpl_id) < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ /* Close the location given to the user callback if it was created */ - if(grp_id >= 0) { - if(H5I_dec_app_ref(grp_id) < 0) + if (grp_id >= 0) { + if (H5I_dec_app_ref(grp_id) < 0) HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback") } /* end if */ - else if(grp != NULL) { - if(H5G_close(grp) < 0) + else if (grp != NULL) { + if (H5G_close(grp) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback") } /* end if */ - else if(temp_loc_init) + else if (temp_loc_init) H5G_loc_free(&temp_loc); /* Indicate that this callback didn't take ownership of the group * @@ -1796,7 +1736,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_link_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_create_real * @@ -1817,15 +1756,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_create_real(const H5G_loc_t *link_loc, const char *link_name, - H5G_name_t *obj_path, H5F_t *obj_file, H5O_link_t *lnk, - H5O_obj_create_t *ocrt_info, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) +H5L_create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, H5F_t *obj_file, + H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) { - char *norm_link_name = NULL; /* Pointer to normalized link name */ - unsigned target_flags = H5G_TARGET_NORMAL; /* Flags to pass to group traversal function */ - H5P_genplist_t *lc_plist = NULL; /* Link creation property list */ - H5L_trav_cr_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + char * norm_link_name = NULL; /* Pointer to normalized link name */ + unsigned target_flags = H5G_TARGET_NORMAL; /* Flags to pass to group traversal function */ + H5P_genplist_t *lc_plist = NULL; /* Link creation property list */ + H5L_trav_cr_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1836,22 +1774,22 @@ H5L_create_real(const H5G_loc_t *link_loc, const char *link_name, HDassert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX); /* Get normalized link name */ - if((norm_link_name = H5G_normalize(link_name)) == NULL) + if ((norm_link_name = H5G_normalize(link_name)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name") /* Check for flags present in creation property list */ - if(lcpl_id != H5P_DEFAULT) { + if (lcpl_id != H5P_DEFAULT) { unsigned crt_intmd_group; /* Get link creation property list */ - if(NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Get intermediate group creation property */ - if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0) + if (H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups") - if(crt_intmd_group > 0) + if (crt_intmd_group > 0) target_flags |= H5G_CRT_INTMD_GROUP; } /* end if */ @@ -1868,26 +1806,25 @@ H5L_create_real(const H5G_loc_t *link_loc, const char *link_name, * of its fields should be populated except for name, which is set when * inserting it in the callback. */ - udata.file = obj_file; - udata.lc_plist = lc_plist; - udata.dxpl_id = dxpl_id; - udata.path = obj_path; + udata.file = obj_file; + udata.lc_plist = lc_plist; + udata.dxpl_id = dxpl_id; + udata.path = obj_path; udata.ocrt_info = ocrt_info; - udata.lnk = lnk; + udata.lnk = lnk; /* Traverse the destination path & create new link */ - if(H5G_traverse(link_loc, link_name, target_flags, H5L_link_cb, &udata, lapl_id, dxpl_id) < 0) + if (H5G_traverse(link_loc, link_name, target_flags, H5L_link_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert link") done: /* Free the normalized path name */ - if(norm_link_name) + if (norm_link_name) H5MM_xfree(norm_link_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_create_real() */ - /*------------------------------------------------------------------------- * Function: H5L_create_hard * @@ -1901,18 +1838,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id, - hid_t lapl_id, hid_t dxpl_id) +H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_loc, const char *link_name, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) { - char *norm_cur_name = NULL; /* Pointer to normalized current name */ - H5F_t *link_file = NULL; /* Pointer to file to link to */ - H5O_link_t lnk; /* Link to insert */ - H5G_loc_t obj_loc; /* Location of object to link to */ - H5G_name_t path; /* obj_loc's path*/ - H5O_loc_t oloc; /* obj_loc's oloc */ - hbool_t loc_valid = FALSE; - herr_t ret_value = SUCCEED; /* Return value */ + char * norm_cur_name = NULL; /* Pointer to normalized current name */ + H5F_t * link_file = NULL; /* Pointer to file to link to */ + H5O_link_t lnk; /* Link to insert */ + H5G_loc_t obj_loc; /* Location of object to link to */ + H5G_name_t path; /* obj_loc's path*/ + H5O_loc_t oloc; /* obj_loc's oloc */ + hbool_t loc_valid = FALSE; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1923,7 +1859,7 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, HDassert(link_name && *link_name); /* Get normalized copy of the current name */ - if((norm_cur_name = H5G_normalize(cur_name)) == NULL) + if ((norm_cur_name = H5G_normalize(cur_name)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name") /* Set up link data specific to hard links */ @@ -1933,7 +1869,7 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, obj_loc.path = &path; obj_loc.oloc = &oloc; H5G_loc_reset(&obj_loc); - if(H5G_loc_find(cur_loc, norm_cur_name, &obj_loc, lapl_id, dxpl_id) < 0) + if (H5G_loc_find(cur_loc, norm_cur_name, &obj_loc, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found") loc_valid = TRUE; @@ -1945,23 +1881,22 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, /* Create actual link to the object. Pass in NULL for the path, since this * function shouldn't change an object's user path. */ - if(H5L_create_real(link_loc, link_name, NULL, link_file, &lnk, NULL, lcpl_id, lapl_id, dxpl_id) < 0) + if (H5L_create_real(link_loc, link_name, NULL, link_file, &lnk, NULL, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") done: /* Free the object header location */ - if(loc_valid) - if(H5G_loc_free(&obj_loc) < 0) + if (loc_valid) + if (H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free location") /* Free the normalized path name */ - if(norm_cur_name) + if (norm_cur_name) H5MM_xfree(norm_cur_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_create_hard() */ - /*------------------------------------------------------------------------- * Function: H5L_create_soft * @@ -1975,12 +1910,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_create_soft(const char *target_path, const H5G_loc_t *link_loc, - const char *link_name, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) +H5L_create_soft(const char *target_path, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id) { - char *norm_target = NULL; /* Pointer to normalized current name */ - H5O_link_t lnk; /* Link to insert */ - herr_t ret_value = SUCCEED; /* Return value */ + char * norm_target = NULL; /* Pointer to normalized current name */ + H5O_link_t lnk; /* Link to insert */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1990,26 +1925,25 @@ H5L_create_soft(const char *target_path, const H5G_loc_t *link_loc, HDassert(link_name && *link_name); /* Get normalized copy of the link target */ - if((norm_target = H5G_normalize(target_path)) == NULL) + if ((norm_target = H5G_normalize(target_path)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name") /* Set up link data specific to soft links */ - lnk.type = H5L_TYPE_SOFT; + lnk.type = H5L_TYPE_SOFT; lnk.u.soft.name = norm_target; /* Create actual link to the object */ - if(H5L_create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id, lapl_id, dxpl_id) < 0) + if (H5L_create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") done: /* Free the normalized target name */ - if(norm_target) + if (norm_target) H5MM_xfree(norm_target); FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_create_soft() */ - /*------------------------------------------------------------------------- * Function: H5L_create_ud * @@ -2024,12 +1958,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_create_ud(const H5G_loc_t *link_loc, const char *link_name, - const void *ud_data, size_t ud_data_size, H5L_type_t type, hid_t lcpl_id, - hid_t lapl_id, hid_t dxpl_id) +H5L_create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_data, size_t ud_data_size, + H5L_type_t type, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) { - H5O_link_t lnk; /* Link to insert */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_link_t lnk; /* Link to insert */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2043,22 +1976,22 @@ H5L_create_ud(const H5G_loc_t *link_loc, const char *link_name, lnk.u.ud.udata = NULL; /* Make sure that this link class is registered */ - if(H5L_find_class_idx(type) < 0) + if (H5L_find_class_idx(type) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "link class has not been registered with library") /* Fill in UD link-specific information in the link struct*/ - if(ud_data_size > 0) { + if (ud_data_size > 0) { lnk.u.ud.udata = H5MM_malloc((size_t)ud_data_size); - HDmemcpy(lnk.u.ud.udata, ud_data, (size_t) ud_data_size); + HDmemcpy(lnk.u.ud.udata, ud_data, (size_t)ud_data_size); } /* end if */ else lnk.u.ud.udata = NULL; lnk.u.ud.size = ud_data_size; - lnk.type = type; + lnk.type = type; /* Create actual link to the object */ - if(H5L_create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id, lapl_id, dxpl_id) < 0) + if (H5L_create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to register new name for object") done: @@ -2068,7 +2001,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_create_ud() */ - /*------------------------------------------------------------------------- * Function: H5L_get_val_real * @@ -2084,7 +2016,7 @@ done: static herr_t H5L_get_val_real(const H5O_link_t *lnk, void *buf, size_t size) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2092,17 +2024,17 @@ H5L_get_val_real(const H5O_link_t *lnk, void *buf, size_t size) HDassert(lnk); /* Check for soft link */ - if(H5L_TYPE_SOFT == lnk->type) { + if (H5L_TYPE_SOFT == lnk->type) { /* Copy to output buffer */ - if(size > 0 && buf) { + if (size > 0 && buf) { HDstrncpy((char *)buf, lnk->u.soft.name, size); - if(HDstrlen(lnk->u.soft.name) >= size) + if (HDstrlen(lnk->u.soft.name) >= size) ((char *)buf)[size - 1] = '\0'; } /* end if */ - } /* end if */ + } /* end if */ /* Check for user-defined link */ - else if(lnk->type >= H5L_TYPE_UD_MIN) { - const H5L_class_t *link_class; /* User-defined link class */ + else if (lnk->type >= H5L_TYPE_UD_MIN) { + const H5L_class_t *link_class; /* User-defined link class */ /* Get the link class for this type of link. It's okay if the class * isn't registered, though--we just can't give any more information @@ -2110,11 +2042,11 @@ H5L_get_val_real(const H5O_link_t *lnk, void *buf, size_t size) */ link_class = H5L_find_class(lnk->type); - if(link_class != NULL && link_class->query_func != NULL) { - if((link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, buf, size) < 0) + if (link_class != NULL && link_class->query_func != NULL) { + if ((link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query callback returned failure") } /* end if */ - else if(buf && size > 0) + else if (buf && size > 0) ((char *)buf)[0] = '\0'; } /* end if */ else @@ -2124,7 +2056,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_get_val_real() */ - /*------------------------------------------------------------------------- * Function: H5L_get_val_cb * @@ -2138,20 +2069,20 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_get_val_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) +H5L_get_val_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_gv_t *udata = (H5L_trav_gv_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_gv_t *udata = (H5L_trav_gv_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check if the name in this group resolved to a valid link */ - if(lnk == NULL) + if (lnk == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name) /* Retrieve the value for the link */ - if(H5L_get_val_real(lnk, udata->buf, udata->size) < 0) + if (H5L_get_val_real(lnk, udata->buf, udata->size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value") done: @@ -2162,7 +2093,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_get_val_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_get_val * @@ -2183,11 +2113,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_val(H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size, - hid_t lapl_id, hid_t dxpl_id) +H5L_get_val(H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t size, hid_t lapl_id, hid_t dxpl_id) { - H5L_trav_gv_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_gv_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2197,17 +2126,17 @@ H5L_get_val(H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size, /* Set up user data for retrieving information */ udata.size = size; - udata.buf = buf; + udata.buf = buf; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_cb, &udata, lapl_id, dxpl_id) < 0) + if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_cb, &udata, lapl_id, + dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5L_get_val() */ - /*------------------------------------------------------------------------- * Function: H5L_get_val_by_idx_cb * @@ -2222,34 +2151,34 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_get_val_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/) +H5L_get_val_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */ - H5O_link_t fnd_lnk; /* Link within group */ - hbool_t lnk_copied = FALSE; /* Whether the link was copied */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */ + H5O_link_t fnd_lnk; /* Link within group */ + hbool_t lnk_copied = FALSE; /* Whether the link was copied */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check if the name of the group resolved to a valid object */ - if(obj_loc == NULL) + if (obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group doesn't exist") /* Query link */ - if(H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, - udata->n, &fnd_lnk, udata->dxpl_id) < 0) + if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk, + udata->dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "link not found") lnk_copied = TRUE; /* Retrieve the value for the link */ - if(H5L_get_val_real(&fnd_lnk, udata->buf, udata->size) < 0) + if (H5L_get_val_real(&fnd_lnk, udata->buf, udata->size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value") done: /* Reset the link information, if we have a copy */ - if(lnk_copied) + if (lnk_copied) H5O_msg_reset(H5O_LINK_ID, &fnd_lnk); /* Indicate that this callback didn't take ownership of the group * @@ -2259,7 +2188,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_get_val_by_idx_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_delete_cb * @@ -2274,30 +2202,31 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) +H5L_delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, + H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_rm_t *udata = (H5L_trav_rm_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; + H5L_trav_rm_t *udata = (H5L_trav_rm_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT /* Check if the group resolved to a valid link */ - if(grp_loc == NULL) + if (grp_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group doesn't exist") /* Check if the name in this group resolved to a valid link */ - if(name == NULL) + if (name == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") /* Check for non-existent (NULL) link. * Note that this can also occur when attempting to remove '.' */ - if(lnk == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "callback link pointer is NULL (specified link may be '.' or not exist)") + if (lnk == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, + "callback link pointer is NULL (specified link may be '.' or not exist)") /* Remove the link from the group */ - if(H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name, udata->dxpl_id) < 0) + if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name, udata->dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to remove link from group") done: @@ -2308,7 +2237,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_delete_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_delete * @@ -2324,9 +2252,9 @@ done: herr_t H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { - H5L_trav_rm_t udata; /* User data for callback */ - char *norm_name = NULL; /* Pointer to normalized name */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_rm_t udata; /* User data for callback */ + char * norm_name = NULL; /* Pointer to normalized name */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2335,23 +2263,23 @@ H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) HDassert(name && *name); /* Get normalized copy of the name */ - if((norm_name = H5G_normalize(name)) == NULL) + if ((norm_name = H5G_normalize(name)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize name") /* Set up user data for unlink operation */ udata.dxpl_id = dxpl_id; - if(H5G_traverse(loc, norm_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_delete_cb, &udata, lapl_id, dxpl_id) < 0) + if (H5G_traverse(loc, norm_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, H5L_delete_cb, + &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "can't unlink object") done: /* Free the normalized path name */ - if(norm_name) + if (norm_name) H5MM_xfree(norm_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_delete() */ - /*------------------------------------------------------------------------- * Function: H5L_delete_by_idx_cb * @@ -2365,22 +2293,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_delete_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/) +H5L_delete_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check if the name of the group resolved to a valid object */ - if(obj_loc == NULL) + if (obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group doesn't exist") /* Delete link */ - if(H5G_obj_remove_by_idx(obj_loc->oloc, obj_loc->path->full_path_r, - udata->idx_type, udata->order, udata->n, udata->dxpl_id) < 0) + if (H5G_obj_remove_by_idx(obj_loc->oloc, obj_loc->path->full_path_r, udata->idx_type, udata->order, + udata->n, udata->dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "link not found") done: @@ -2391,7 +2319,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_delete_by_idx_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_move_dest_cb * @@ -2407,27 +2334,26 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, - const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/) +H5L_move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_ATTR_UNUSED *lnk, + H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_mv2_t *udata = (H5L_trav_mv2_t *)_udata; /* User data passed in */ - H5G_t *grp = NULL; /* H5G_t for this group, opened to pass to user callback */ - hid_t grp_id = FAIL; /* ID for this group (passed to user callback */ - H5G_loc_t temp_loc; /* For UD callback */ - hbool_t temp_loc_init = FALSE; - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_mv2_t *udata = (H5L_trav_mv2_t *)_udata; /* User data passed in */ + H5G_t * grp = NULL; /* H5G_t for this group, opened to pass to user callback */ + hid_t grp_id = FAIL; /* ID for this group (passed to user callback */ + H5G_loc_t temp_loc; /* For UD callback */ + hbool_t temp_loc_init = FALSE; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Make sure an object with this name doesn't already exist */ - if(obj_loc != NULL) + if (obj_loc != NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "an object with that name already exists") /* Check for crossing file boundaries with a new hard link */ - if(udata->lnk->type == H5L_TYPE_HARD) { + if (udata->lnk->type == H5L_TYPE_HARD) { /* Check that both objects are in same file */ - if(!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) + if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "moving a link across files is not allowed") } /* end if */ @@ -2437,27 +2363,26 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, udata->lnk->name = (char *)name; /* Insert the link into the group */ - if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, - NULL, udata->dxpl_id) < 0) + if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL, udata->dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") /* If the link was a user-defined link, call its move callback if it has one */ - if(udata->lnk->type >= H5L_TYPE_UD_MIN) { - const H5L_class_t *link_class; /* User-defined link class */ + if (udata->lnk->type >= H5L_TYPE_UD_MIN) { + const H5L_class_t *link_class; /* User-defined link class */ /* Get the link class for this type of link. */ - if(NULL == (link_class = H5L_find_class(udata->lnk->type))) + if (NULL == (link_class = H5L_find_class(udata->lnk->type))) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered") - if((!udata->copy && link_class->move_func) || (udata->copy && link_class->copy_func)) { - H5O_loc_t temp_oloc; - H5G_name_t temp_path; + if ((!udata->copy && link_class->move_func) || (udata->copy && link_class->copy_func)) { + H5O_loc_t temp_oloc; + H5G_name_t temp_path; /* Create a temporary location (or else H5G_open will do a shallow * copy and wipe out grp_loc) */ H5G_name_reset(&temp_path); - if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0) + if (H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location") temp_loc.oloc = &temp_oloc; @@ -2465,33 +2390,35 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, temp_loc_init = TRUE; /* Set up location for user-defined callback */ - if((grp = H5G_open(&temp_loc, udata->dxpl_id)) == NULL) + if ((grp = H5G_open(&temp_loc, udata->dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if ((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group ID") - if(udata->copy) { - if((link_class->copy_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size) < 0) + if (udata->copy) { + if ((link_class->copy_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, + udata->lnk->u.ud.size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD copy callback returned error") } /* end if */ else { - if((link_class->move_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size) < 0) + if ((link_class->move_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, + udata->lnk->u.ud.size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD move callback returned error") } /* end else */ - } /* end if */ - } /* end if */ + } /* end if */ + } /* end if */ done: /* Close the location given to the user callback if it was created */ - if(grp_id >= 0) { - if(H5I_dec_app_ref(grp_id) < 0) + if (grp_id >= 0) { + if (H5I_dec_app_ref(grp_id) < 0) HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback") } /* end if */ - else if(grp != NULL) { - if(H5G_close(grp) < 0) + else if (grp != NULL) { + if (H5G_close(grp) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback") } /* end if */ - else if(temp_loc_init) + else if (temp_loc_init) H5G_loc_free(&temp_loc); /* Indicate that this callback didn't take ownership of the group * @@ -2505,7 +2432,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_move_dest_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_move_cb * @@ -2521,59 +2447,59 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, - H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) +H5L_move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, + void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_mv_t *udata = (H5L_trav_mv_t *)_udata; /* User data passed in */ - H5L_trav_mv2_t udata_out; /* User data for H5L_move_dest_cb traversal */ - char * orig_name = NULL; /* The name of the link in this group */ - hbool_t link_copied = FALSE; /* Has udata_out.lnk been allocated? */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_mv_t *udata = (H5L_trav_mv_t *)_udata; /* User data passed in */ + H5L_trav_mv2_t udata_out; /* User data for H5L_move_dest_cb traversal */ + char * orig_name = NULL; /* The name of the link in this group */ + hbool_t link_copied = FALSE; /* Has udata_out.lnk been allocated? */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check if the name in this group resolved to a valid link */ - if(obj_loc == NULL) + if (obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") /* Check for operations on '.' */ - if(lnk == NULL) + if (lnk == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "the name of a link must be supplied to move or copy") /* Set up user data for move_dest_cb */ - if(NULL == (udata_out.lnk = (H5O_link_t *)H5O_msg_copy(H5O_LINK_ID, lnk, NULL))) + if (NULL == (udata_out.lnk = (H5O_link_t *)H5O_msg_copy(H5O_LINK_ID, lnk, NULL))) HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved") /* In this special case, the link's name is going to be replaced at its * destination, so we should free it here. */ udata_out.lnk->name = (char *)H5MM_xfree(udata_out.lnk->name); - link_copied = TRUE; + link_copied = TRUE; udata_out.lnk->cset = udata->cset; - udata_out.file = grp_loc->oloc->file; - udata_out.copy = udata->copy; - udata_out.dxpl_id = udata->dxpl_id; + udata_out.file = grp_loc->oloc->file; + udata_out.copy = udata->copy; + udata_out.dxpl_id = udata->dxpl_id; /* Keep a copy of link's name (it's "owned" by the H5G_traverse() routine) */ orig_name = H5MM_xstrdup(name); /* Insert the link into its new location */ - if(H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, - H5L_move_dest_cb, &udata_out, udata->lapl_id, udata->dxpl_id) < 0) + if (H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L_move_dest_cb, &udata_out, + udata->lapl_id, udata->dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") /* If this is a move and not a copy operation, change the object's name and remove the old link */ - if(!udata->copy) { - H5RS_str_t *dst_name_r; /* Ref-counted version of dest name */ + if (!udata->copy) { + H5RS_str_t *dst_name_r; /* Ref-counted version of dest name */ /* Make certain that the destination name is a full (not relative) path */ - if(*(udata->dst_name) != '/') { + if (*(udata->dst_name) != '/') { HDassert(udata->dst_loc->path->full_path_r); /* Create reference counted string for full dst path */ - if((dst_name_r = H5G_build_fullpath_refstr_str(udata->dst_loc->path->full_path_r, - udata->dst_name)) == NULL) + if ((dst_name_r = H5G_build_fullpath_refstr_str(udata->dst_loc->path->full_path_r, + udata->dst_name)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_PATH, FAIL, "can't build destination path name") } /* end if */ else @@ -2581,14 +2507,14 @@ H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, HDassert(dst_name_r); /* Fix names up */ - if(H5G_name_replace(lnk, H5G_NAME_MOVE, obj_loc->oloc->file, obj_loc->path->full_path_r, - udata->dst_loc->oloc->file, dst_name_r, udata->dxpl_id) < 0) { + if (H5G_name_replace(lnk, H5G_NAME_MOVE, obj_loc->oloc->file, obj_loc->path->full_path_r, + udata->dst_loc->oloc->file, dst_name_r, udata->dxpl_id) < 0) { H5RS_decr(dst_name_r); HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to replace name") } /* end if */ /* Remove the old link */ - if(H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, orig_name, udata->dxpl_id) < 0) { + if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, orig_name, udata->dxpl_id) < 0) { H5RS_decr(dst_name_r); HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to remove old name") } /* end if */ @@ -2598,14 +2524,14 @@ H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, done: /* Cleanup */ - if(orig_name) + if (orig_name) H5MM_xfree(orig_name); /* If udata_out.lnk was copied, free any memory allocated * In this special case, the H5L_move_dest_cb callback resets the name * so H5O_msg_free shouldn't try to free it */ - if(link_copied) + if (link_copied) H5O_msg_free(H5O_LINK_ID, udata_out.lnk); /* Indicate that this callback didn't take ownership of the group * @@ -2615,7 +2541,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_move_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_move * @@ -2637,17 +2562,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_move(H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, - const char *dst_name, hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, - hid_t dxpl_id) +H5L_move(H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, const char *dst_name, + hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id) { - unsigned dst_target_flags = H5G_TARGET_NORMAL; - H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */ - H5P_genplist_t* lc_plist; /* Link creation property list */ - H5P_genplist_t* la_plist; /* Link access property list */ - H5L_trav_mv_t udata; /* User data for traversal */ - hid_t lapl_copy; /* Copy of lapl for this function */ - herr_t ret_value = SUCCEED; /* Return value */ + unsigned dst_target_flags = H5G_TARGET_NORMAL; + H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */ + H5P_genplist_t *lc_plist; /* Link creation property list */ + H5P_genplist_t *la_plist; /* Link access property list */ + H5L_trav_mv_t udata; /* User data for traversal */ + hid_t lapl_copy; /* Copy of lapl for this function */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2658,57 +2582,55 @@ H5L_move(H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, HDassert(dst_name && *dst_name); /* Check for flags present in creation property list */ - if(lcpl_id != H5P_DEFAULT) { + if (lcpl_id != H5P_DEFAULT) { unsigned crt_intmd_group; - if(NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Get intermediate group creation property */ - if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0) + if (H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups") /* Set target flags for source and destination */ - if(crt_intmd_group > 0) + if (crt_intmd_group > 0) dst_target_flags |= H5G_CRT_INTMD_GROUP; /* Get character encoding property */ - if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &char_encoding) < 0) + if (H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &char_encoding) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding") } /* end if */ /* Copy the link access property list because traversing UD links will * decrease the NLINKS property. HDF5 should have NLINKS traversals to * get to the source and NLINKS more to get to the destination. */ - if(lapl_id == H5P_DEFAULT) + if (lapl_id == H5P_DEFAULT) lapl_copy = lapl_id; else { - if(NULL == (la_plist = (H5P_genplist_t *)H5I_object(lapl_id))) + if (NULL == (la_plist = (H5P_genplist_t *)H5I_object(lapl_id))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid access PL") - if((lapl_copy = H5P_copy_plist(la_plist, FALSE)) < 0) + if ((lapl_copy = H5P_copy_plist(la_plist, FALSE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy access properties") } /* end else */ /* Set up user data */ - udata.dst_loc = dst_loc; - udata.dst_name= dst_name; + udata.dst_loc = dst_loc; + udata.dst_name = dst_name; udata.dst_target_flags = dst_target_flags; - udata.cset = char_encoding; - udata.copy = copy_flag; - udata.lapl_id = lapl_copy; - udata.dxpl_id = dxpl_id; + udata.cset = char_encoding; + udata.copy = copy_flag; + udata.lapl_id = lapl_copy; + udata.dxpl_id = dxpl_id; /* Do the move */ - if(H5G_traverse(src_loc, - src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, - H5L_move_cb, &udata, lapl_id, dxpl_id) < 0) + if (H5G_traverse(src_loc, src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_move_cb, + &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to find link") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_move() */ - /*------------------------------------------------------------------------- * Function: H5L_exists_cb * @@ -2722,11 +2644,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/) +H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) { - hbool_t *udata = (hbool_t *)_udata; /* User data passed in */ + hbool_t *udata = (hbool_t *)_udata; /* User data passed in */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2740,7 +2662,6 @@ H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5L_exists_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_exists * @@ -2756,13 +2677,14 @@ H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED static htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { - hbool_t exists = FALSE; /* Whether the link exists in the group */ - htri_t ret_value; /* Return value */ + hbool_t exists = FALSE; /* Whether the link exists in the group */ + htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_exists_cb, &exists, lapl_id, dxpl_id) < 0) + if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_exists_cb, &exists, lapl_id, + dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "path doesn't exist") /* Set return value */ @@ -2772,7 +2694,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5L_exists() */ - /*------------------------------------------------------------------------- * Function: H5L_get_info_cb * @@ -2786,21 +2707,21 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_get_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/) +H5L_get_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_gi_t *udata = (H5L_trav_gi_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_gi_t *udata = (H5L_trav_gi_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check if the name in this group resolved to a valid link */ - if(lnk == NULL) + if (lnk == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") /* Get information from the link */ - if(H5G_link_to_info(lnk, udata->linfo) < 0) + if (H5G_link_to_info(lnk, udata->linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") done: @@ -2811,7 +2732,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_get_info_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_get_info * @@ -2825,26 +2745,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_info(const H5G_loc_t *loc, const char *name, - H5L_info_t *linfo/*out*/, hid_t lapl_id, hid_t dxpl_id) +H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id, hid_t dxpl_id) { H5L_trav_gi_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - udata.linfo = linfo; + udata.linfo = linfo; udata.dxpl_id = dxpl_id; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_cb, &udata, lapl_id, dxpl_id) < 0) + if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_info_cb, &udata, lapl_id, + dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5L_get_info() */ - /*------------------------------------------------------------------------- * Function: H5L_get_info_by_idx_cb * @@ -2859,34 +2778,34 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_get_info_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/) +H5L_get_info_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_gibi_t *udata = (H5L_trav_gibi_t *)_udata; /* User data passed in */ - H5O_link_t fnd_lnk; /* Link within group */ - hbool_t lnk_copied = FALSE; /* Whether the link was copied */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_gibi_t *udata = (H5L_trav_gibi_t *)_udata; /* User data passed in */ + H5O_link_t fnd_lnk; /* Link within group */ + hbool_t lnk_copied = FALSE; /* Whether the link was copied */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check if the name of the group resolved to a valid object */ - if(obj_loc == NULL) + if (obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group doesn't exist") /* Query link */ - if(H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, - udata->n, &fnd_lnk, udata->dxpl_id) < 0) + if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk, + udata->dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "link not found") lnk_copied = TRUE; /* Get information from the link */ - if(H5G_link_to_info(&fnd_lnk, udata->linfo) < 0) + if (H5G_link_to_info(&fnd_lnk, udata->linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") done: /* Reset the link information, if we have a copy */ - if(lnk_copied) + if (lnk_copied) H5O_msg_reset(H5O_LINK_ID, &fnd_lnk); /* Indicate that this callback didn't take ownership of the group * @@ -2896,7 +2815,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_get_info_by_idx_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_get_default_lcpl * @@ -2914,7 +2832,7 @@ done: hid_t H5L_get_default_lcpl(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2924,7 +2842,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5L_get_default_lcpl */ - /*------------------------------------------------------------------------- * Function: H5L_get_name_by_idx_cb * @@ -2939,22 +2856,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_get_name_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, - const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, - H5G_own_loc_t *own_loc/*out*/) +H5L_get_name_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, + H5G_own_loc_t *own_loc /*out*/) { - H5L_trav_gnbi_t *udata = (H5L_trav_gnbi_t *)_udata; /* User data passed in */ - herr_t ret_value = SUCCEED; /* Return value */ + H5L_trav_gnbi_t *udata = (H5L_trav_gnbi_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check if the name of the group resolved to a valid object */ - if(obj_loc == NULL) + if (obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group doesn't exist") /* Query link */ - if((udata->name_len = H5G_obj_get_name_by_idx(obj_loc->oloc, udata->idx_type, udata->order, - udata->n, udata->name, udata->size, udata->dxpl_id)) < 0) + if ((udata->name_len = H5G_obj_get_name_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, + udata->name, udata->size, udata->dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "link not found") done: @@ -2965,7 +2882,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_get_name_by_idx_cb() */ - /*------------------------------------------------------------------------- * Function: H5L_link_copy_file * @@ -2981,17 +2897,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk, - const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, H5O_copy_t *cpy_info) +H5L_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc, + H5O_link_t *dst_lnk, H5O_copy_t *cpy_info) { - H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */ - const H5O_link_t *src_lnk = _src_lnk; /* Source link */ - hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */ - hbool_t expanded_link_open = FALSE; /* Whether the target location has been opened */ - H5G_loc_t tmp_src_loc; /* Group location holding target object */ - H5G_name_t tmp_src_path; /* Path for target object */ - H5O_loc_t tmp_src_oloc; /* Object location for target object */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_link_t tmp_src_lnk; /* Temporary copy of src link, when needed */ + const H5O_link_t *src_lnk = _src_lnk; /* Source link */ + hbool_t dst_lnk_init = FALSE; /* Whether the destination link is initialized */ + hbool_t expanded_link_open = FALSE; /* Whether the target location has been opened */ + H5G_loc_t tmp_src_loc; /* Group location holding target object */ + H5G_name_t tmp_src_path; /* Path for target object */ + H5O_loc_t tmp_src_oloc; /* Object location for target object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3002,68 +2918,64 @@ H5L_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk, HDassert(cpy_info); /* Expand soft or external link, if requested */ - if((H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) - || (H5L_TYPE_EXTERNAL == src_lnk->type - && cpy_info->expand_ext_link)) { - H5G_loc_t lnk_grp_loc; /* Group location holding link */ - H5G_name_t lnk_grp_path; /* Path for link */ - htri_t tar_exists; /* Whether the target object exists */ + if ((H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) || + (H5L_TYPE_EXTERNAL == src_lnk->type && cpy_info->expand_ext_link)) { + H5G_loc_t lnk_grp_loc; /* Group location holding link */ + H5G_name_t lnk_grp_path; /* Path for link */ + htri_t tar_exists; /* Whether the target object exists */ /* Set up group location for link */ H5G_name_reset(&lnk_grp_path); lnk_grp_loc.path = &lnk_grp_path; - lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */ + lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */ /* Check if the target object exists */ - if((tar_exists = H5G_loc_exists(&lnk_grp_loc, src_lnk->name, H5P_DEFAULT, - dxpl_id)) < 0) + if ((tar_exists = H5G_loc_exists(&lnk_grp_loc, src_lnk->name, H5P_DEFAULT, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to check if target object exists") - if(tar_exists) { + if (tar_exists) { /* Make a temporary copy of the link, so that it will not change the * info in the cache when we change it to a hard link */ - if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk)) + if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk)) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy message") /* Set up group location for target object. Let H5G_traverse expand * the link. */ tmp_src_loc.path = &tmp_src_path; tmp_src_loc.oloc = &tmp_src_oloc; - if(H5G_loc_reset(&tmp_src_loc) < 0) + if (H5G_loc_reset(&tmp_src_loc) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to reset location") /* Find the target object */ - if(H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc, - H5P_DEFAULT, dxpl_id) < 0) + if (H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc, H5P_DEFAULT, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to find target object") expanded_link_open = TRUE; /* Convert symbolic link to hard link */ - if(tmp_src_lnk.type == H5L_TYPE_SOFT) - tmp_src_lnk.u.soft.name = - (char *)H5MM_xfree(tmp_src_lnk.u.soft.name); - else if(tmp_src_lnk.u.ud.size > 0) + if (tmp_src_lnk.type == H5L_TYPE_SOFT) + tmp_src_lnk.u.soft.name = (char *)H5MM_xfree(tmp_src_lnk.u.soft.name); + else if (tmp_src_lnk.u.ud.size > 0) tmp_src_lnk.u.ud.udata = H5MM_xfree(tmp_src_lnk.u.ud.udata); - tmp_src_lnk.type = H5L_TYPE_HARD; + tmp_src_lnk.type = H5L_TYPE_HARD; tmp_src_lnk.u.hard.addr = tmp_src_oloc.addr; - src_lnk = &tmp_src_lnk; + src_lnk = &tmp_src_lnk; } /* end if */ - } /* end if */ + } /* end if */ /* Copy src link information to dst link information */ - if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk)) + if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk)) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy message") dst_lnk_init = TRUE; /* Check if object in source group is a hard link & copy it */ - if(H5L_TYPE_HARD == src_lnk->type) { - H5O_loc_t new_dst_oloc; /* Copied object location in destination */ + if (H5L_TYPE_HARD == src_lnk->type) { + H5O_loc_t new_dst_oloc; /* Copied object location in destination */ /* Set up copied object location to fill in */ H5O_loc_reset(&new_dst_oloc); new_dst_oloc.file = dst_file; - if(!expanded_link_open) { + if (!expanded_link_open) { /* Build temporary object location for source */ H5O_loc_reset(&tmp_src_oloc); tmp_src_oloc.file = src_oloc->file; @@ -3074,8 +2986,7 @@ H5L_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk, /* Copy the shared object from source to destination */ /* Don't care about obj_type or udata because those are only important * for old style groups */ - if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, - TRUE, NULL, NULL) < 0) + if (H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, TRUE, NULL, NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") /* Copy new destination object's information for eventual insertion */ @@ -3084,18 +2995,17 @@ H5L_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk, done: /* Check if we used a temporary src link */ - if(src_lnk != _src_lnk) { + if (src_lnk != _src_lnk) { HDassert(src_lnk == &tmp_src_lnk); H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk); } /* end if */ - if(ret_value < 0) - if(dst_lnk_init) + if (ret_value < 0) + if (dst_lnk_init) H5O_msg_reset(H5O_LINK_ID, dst_lnk); /* Check if we need to free the temp source oloc */ - if(expanded_link_open) - if(H5G_loc_free(&tmp_src_loc) < 0) + if (expanded_link_open) + if (H5G_loc_free(&tmp_src_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object") FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_link_copy_file() */ - |