diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
commit | f1ba03cea5b82699a984c80bd2deac14fdc8df18 (patch) | |
tree | ebe777c3e0b83f4c4cec9212731da9ebe0a0cfd3 /fortran/src/H5Gf.c | |
parent | 10343c197906415388f2a4c8d292e21d25cf7381 (diff) | |
download | hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.zip hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.gz hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.bz2 |
Source formatted
Diffstat (limited to 'fortran/src/H5Gf.c')
-rw-r--r-- | fortran/src/H5Gf.c | 516 |
1 files changed, 260 insertions, 256 deletions
diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 770752d..1e266e7 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -17,7 +17,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ****** -*/ + */ #include "H5f90.h" #include "H5Eprivate.h" @@ -44,51 +44,52 @@ * H5Gcreate1 can be compiled out of the library * QAK - 2007/08/23 * SOURCE -*/ + */ int_f -h5gcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, - hid_t_f *grp_id, hid_t_f *lcpl_id, hid_t_f *gcpl_id, hid_t_f *gapl_id ) +h5gcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, hid_t_f *grp_id, + hid_t_f *lcpl_id, hid_t_f *gcpl_id, hid_t_f *gapl_id) /******/ { - hid_t c_gcpl_id = -1; /* Group creation property list */ - char *c_name = NULL; + hid_t c_gcpl_id = -1; /* Group creation property list */ + char *c_name = NULL; hid_t c_grp_id; int_f ret_value = -1; /* * Convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) goto DONE; /* * Call H5Gcreate function. */ - if(*size_hint == (size_t_f)OBJECT_NAMELEN_DEFAULT_F ){ - c_grp_id = H5Gcreate2((hid_t)*loc_id, c_name,(hid_t)*lcpl_id,(hid_t)*gcpl_id,(hid_t)*gapl_id);} + if (*size_hint == (size_t_f)OBJECT_NAMELEN_DEFAULT_F) { + c_grp_id = H5Gcreate2((hid_t)*loc_id, c_name, (hid_t)*lcpl_id, (hid_t)*gcpl_id, (hid_t)*gapl_id); + } else { - /* Create the group creation property list */ - if((c_gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) - goto DONE; + /* Create the group creation property list */ + if ((c_gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto DONE; - /* Set the local heap size hint */ - if(H5Pset_local_heap_size_hint(c_gcpl_id, (size_t)*size_hint) < 0) - goto DONE; + /* Set the local heap size hint */ + if (H5Pset_local_heap_size_hint(c_gcpl_id, (size_t)*size_hint) < 0) + goto DONE; - /* Create the group */ - c_grp_id = H5Gcreate2((hid_t)*loc_id, c_name, H5P_DEFAULT, c_gcpl_id, H5P_DEFAULT); + /* Create the group */ + c_grp_id = H5Gcreate2((hid_t)*loc_id, c_name, H5P_DEFAULT, c_gcpl_id, H5P_DEFAULT); } - if(c_grp_id < 0) + if (c_grp_id < 0) goto DONE; /* Everything OK, set values to return */ - *grp_id = (hid_t_f)c_grp_id; + *grp_id = (hid_t_f)c_grp_id; ret_value = 0; DONE: - if(c_gcpl_id > 0) + if (c_gcpl_id > 0) H5Pclose(c_gcpl_id); - if(c_name) + if (c_name) HDfree(c_name); return ret_value; } @@ -112,35 +113,35 @@ DONE: * Wednesday, August 5, 1999 * * SOURCE -*/ + */ int_f h5gopen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *gapl_id, hid_t_f *grp_id) /******/ { - char *c_name = NULL; - hid_t c_grp_id; - int ret_value = -1; - - /* - * Convert FORTRAN name to C name - */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + char *c_name = NULL; + hid_t c_grp_id; + int ret_value = -1; + + /* + * Convert FORTRAN name to C name + */ + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) goto DONE; - /* - * Call H5Gopen function. - */ - if((c_grp_id = H5Gopen2((hid_t)*loc_id, c_name, (hid_t)*gapl_id)) < 0) + /* + * Call H5Gopen function. + */ + if ((c_grp_id = H5Gopen2((hid_t)*loc_id, c_name, (hid_t)*gapl_id)) < 0) goto DONE; /* Everything OK, set values to return */ - *grp_id = (hid_t_f)c_grp_id; + *grp_id = (hid_t_f)c_grp_id; ret_value = 0; DONE: - if(c_name) - HDfree(c_name); - return ret_value; + if (c_name) + HDfree(c_name); + return ret_value; } /****if* H5Gf/h5gget_obj_info_idx_c @@ -164,48 +165,50 @@ DONE: * Elena Pourmal * Wednesday, August 5, 1999 * SOURCE -*/ + */ int_f -h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, - _fcd obj_name, int_f *obj_namelen, int_f *obj_type) +h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name, + int_f *obj_namelen, int_f *obj_type) /******/ { H5O_info2_t oinfo; - hid_t c_loc_id = (hid_t)*loc_id; - char *c_name = NULL; - size_t c_obj_namelen; - char *c_obj_name = NULL; - hsize_t c_idx = (hsize_t)*idx; - hid_t gid = (-1); /* Temporary group ID */ - int ret_value = -1; + hid_t c_loc_id = (hid_t)*loc_id; + char * c_name = NULL; + size_t c_obj_namelen; + char * c_obj_name = NULL; + hsize_t c_idx = (hsize_t)*idx; + hid_t gid = (-1); /* Temporary group ID */ + int ret_value = -1; /* * Convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) goto DONE; /* * Allocate buffer to hold name of the object */ c_obj_namelen = (size_t)*obj_namelen; - if(c_obj_namelen) - if(NULL == (c_obj_name = (char *)HDmalloc(c_obj_namelen + 1))) - goto DONE; + if (c_obj_namelen) + if (NULL == (c_obj_name = (char *)HDmalloc(c_obj_namelen + 1))) + goto DONE; /* Get a temporary group ID for the group to query */ - if((gid = H5Gopen2(c_loc_id, c_name, H5P_DEFAULT)) < 0) + if ((gid = H5Gopen2(c_loc_id, c_name, H5P_DEFAULT)) < 0) goto DONE; /* Query the object's information */ - if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, c_obj_name, c_obj_namelen, H5P_DEFAULT) < 0) + if (H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, c_obj_name, c_obj_namelen, + H5P_DEFAULT) < 0) goto DONE; - if(H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if (H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5O_INFO_BASIC, + H5P_DEFAULT) < 0) goto DONE; -/* XXX: Switch from using H5Gget_objtype_by_idx() means that this routine won't - * work on non-hard links - QAK - */ + /* XXX: Switch from using H5Gget_objtype_by_idx() means that this routine won't + * work on non-hard links - QAK + */ *obj_type = oinfo.type; /* @@ -216,12 +219,12 @@ h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, DONE: /* Close the temporary group, if it was opened */ - if(gid > 0) + if (gid > 0) H5Gclose(gid); - if(c_obj_name) + if (c_obj_name) HDfree(c_obj_name); - if(c_name) + if (c_name) HDfree(c_name); return ret_value; } @@ -243,30 +246,30 @@ DONE: * Elena Pourmal * Wednesday, August 5, 1999 * SOURCE -*/ + */ int_f h5gn_members_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers) /******/ { - char *c_name = NULL; + char * c_name = NULL; H5G_info_t ginfo; - int ret_value = -1; + int ret_value = -1; /* * Convert FORTRAN name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) goto DONE; /* Call H5Gget_info_by_name() for the number of objects in the group */ - if(H5Gget_info_by_name((hid_t)*loc_id, c_name, &ginfo, H5P_DEFAULT) < 0) + if (H5Gget_info_by_name((hid_t)*loc_id, c_name, &ginfo, H5P_DEFAULT) < 0) goto DONE; *nmembers = (int_f)ginfo.nlinks; ret_value = 0; DONE: - if(c_name) + if (c_name) HDfree(c_name); return ret_value; } @@ -284,7 +287,7 @@ DONE: * Elena Pourmal * Wednesday, August 5, 1999 * SOURCE -*/ + */ int_f h5gclose_c(hid_t_f *grp_id) @@ -292,12 +295,11 @@ h5gclose_c(hid_t_f *grp_id) { int ret_value = 0; - if(H5Gclose((hid_t)*grp_id) < 0) + if (H5Gclose((hid_t)*grp_id) < 0) ret_value = -1; return ret_value; } - /****if* H5Gf/h5glink_c * NAME * h5glink_c @@ -317,67 +319,68 @@ h5gclose_c(hid_t_f *grp_id) * Mingshi Chen * Friday, August 6, 1999 * SOURCE -*/ + */ int_f -h5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name, - int_f *current_namelen, _fcd new_name, int_f *new_namelen) +h5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name, int_f *current_namelen, _fcd new_name, + int_f *new_namelen) /******/ { char *c_current_name = NULL, *c_new_name = NULL; - int ret_value = -1; + int ret_value = -1; /* - * Convert Fortran name to C name - */ - if(NULL == (c_current_name = (char *)HD5f2cstring(current_name, (size_t)*current_namelen))) + * Convert Fortran name to C name + */ + if (NULL == (c_current_name = (char *)HD5f2cstring(current_name, (size_t)*current_namelen))) goto DONE; - if(NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)*new_namelen))) + if (NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)*new_namelen))) goto DONE; /* - * Call appropriate link creation function - */ - switch((H5L_type_t)*link_type) { + * Call appropriate link creation function + */ + switch ((H5L_type_t)*link_type) { case H5L_TYPE_HARD: - if(H5Lcreate_hard((hid_t)*loc_id, c_current_name, H5L_SAME_LOC, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + if (H5Lcreate_hard((hid_t)*loc_id, c_current_name, H5L_SAME_LOC, c_new_name, H5P_DEFAULT, + H5P_DEFAULT) < 0) goto DONE; break; case H5L_TYPE_SOFT: - if(H5Lcreate_soft(c_current_name, (hid_t)*loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + if (H5Lcreate_soft(c_current_name, (hid_t)*loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) goto DONE; break; - /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */ + /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */ case H5L_TYPE_EXTERNAL: ret_value = -1; - goto DONE; + goto DONE; break; case H5L_TYPE_MAX: ret_value = -1; - goto DONE; + goto DONE; break; case H5L_TYPE_ERROR: ret_value = -1; - goto DONE; + goto DONE; break; - /* End of the warnings fix */ + /* End of the warnings fix */ - default: /* Unknown/unhandled link type */ + default: /* Unknown/unhandled link type */ goto DONE; } /* end switch */ ret_value = 0; DONE: - if(c_current_name) + if (c_current_name) HDfree(c_current_name); - if(c_new_name) + if (c_new_name) HDfree(c_new_name); - return ret_value ; + return ret_value; } /****if* H5Gf/h5glink2_c @@ -404,65 +407,66 @@ DONE: * HISTORY * * SOURCE -*/ + */ int_f -h5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, - int_f *link_type, hid_t_f *new_loc_id, _fcd new_name, int_f *new_namelen) +h5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, int_f *link_type, hid_t_f *new_loc_id, + _fcd new_name, int_f *new_namelen) /******/ { char *c_cur_name = NULL, *c_new_name = NULL; - int ret_value = -1; + int ret_value = -1; /* * Convert Fortran name to C name */ - if(NULL == (c_cur_name = (char *)HD5f2cstring(cur_name, (size_t)*cur_namelen))) + if (NULL == (c_cur_name = (char *)HD5f2cstring(cur_name, (size_t)*cur_namelen))) goto DONE; - if(NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)*new_namelen))) + if (NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)*new_namelen))) goto DONE; /* - * Call appropriate link creation function - */ - switch((H5L_type_t)*link_type) { + * Call appropriate link creation function + */ + switch ((H5L_type_t)*link_type) { case H5L_TYPE_HARD: - if(H5Lcreate_hard((hid_t)*cur_loc_id, c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + if (H5Lcreate_hard((hid_t)*cur_loc_id, c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, + H5P_DEFAULT) < 0) goto DONE; break; case H5L_TYPE_SOFT: - if(H5Lcreate_soft(c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + if (H5Lcreate_soft(c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) goto DONE; break; - /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */ + /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */ case H5L_TYPE_EXTERNAL: ret_value = -1; - goto DONE; + goto DONE; break; case H5L_TYPE_MAX: ret_value = -1; - goto DONE; + goto DONE; break; case H5L_TYPE_ERROR: ret_value = -1; - goto DONE; + goto DONE; break; - /* End of the warnings fix */ + /* End of the warnings fix */ - default: /* Unknown/unhandled link type */ + default: /* Unknown/unhandled link type */ goto DONE; } /* end switch */ ret_value = 0; DONE: - if(c_cur_name) + if (c_cur_name) HDfree(c_cur_name); - if(c_new_name) + if (c_new_name) HDfree(c_new_name); - return ret_value ; + return ret_value; } /****if* H5Gf/h5gunlink_c @@ -479,30 +483,30 @@ DONE: * Mingshi Chen * Friday, August 6, 1999 * SOURCE -*/ + */ int_f h5gunlink_c(hid_t_f *loc_id, _fcd name, int_f *namelen) /******/ { - char *c_name = NULL; - int ret_value = -1; + char *c_name = NULL; + int ret_value = -1; /* * Convert Fortran name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) goto DONE; /* * Call H5Gunlink function */ - if(H5Ldelete((hid_t)*loc_id, c_name, H5P_DEFAULT) < 0) + if (H5Ldelete((hid_t)*loc_id, c_name, H5P_DEFAULT) < 0) goto DONE; ret_value = 0; DONE: - if(c_name) + if (c_name) HDfree(c_name); return ret_value; } @@ -524,35 +528,35 @@ DONE: * Mingshi Chen * Friday, August 6, 1999 * SOURCE -*/ + */ int_f -h5gmove_c(hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name, int_f*dst_namelen) +h5gmove_c(hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name, int_f *dst_namelen) /******/ { char *c_src_name = NULL, *c_dst_name = NULL; - int ret_value = -1; + int ret_value = -1; /* * Convert Fortran name to C name */ - if(NULL == (c_src_name = (char *)HD5f2cstring(src_name, (size_t)*src_namelen))) + if (NULL == (c_src_name = (char *)HD5f2cstring(src_name, (size_t)*src_namelen))) goto DONE; - if(NULL == (c_dst_name = (char *)HD5f2cstring(dst_name, (size_t)*dst_namelen))) + if (NULL == (c_dst_name = (char *)HD5f2cstring(dst_name, (size_t)*dst_namelen))) goto DONE; /* * Call H5Gmove function */ - if(H5Lmove((hid_t)*loc_id, c_src_name, H5L_SAME_LOC, c_dst_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + if (H5Lmove((hid_t)*loc_id, c_src_name, H5L_SAME_LOC, c_dst_name, H5P_DEFAULT, H5P_DEFAULT) < 0) goto DONE; ret_value = 0; DONE: - if(c_src_name) + if (c_src_name) HDfree(c_src_name); - if(c_dst_name) + if (c_dst_name) HDfree(c_dst_name); return ret_value; } @@ -576,35 +580,36 @@ DONE: * Wednesday, September 25, 2002 * * SOURCE -*/ + */ int_f -h5gmove2_c(hid_t_f *src_loc_id, _fcd src_name, int_f *src_namelen, hid_t_f *dst_loc_id, _fcd dst_name, int_f*dst_namelen) +h5gmove2_c(hid_t_f *src_loc_id, _fcd src_name, int_f *src_namelen, hid_t_f *dst_loc_id, _fcd dst_name, + int_f *dst_namelen) /******/ { char *c_src_name = NULL, *c_dst_name = NULL; - int ret_value = -1; + int ret_value = -1; /* * Convert Fortran name to C name */ - if(NULL == (c_src_name = (char *)HD5f2cstring(src_name, (size_t)*src_namelen))) + if (NULL == (c_src_name = (char *)HD5f2cstring(src_name, (size_t)*src_namelen))) goto DONE; - if(NULL == (c_dst_name = (char *)HD5f2cstring(dst_name, (size_t)*dst_namelen))) + if (NULL == (c_dst_name = (char *)HD5f2cstring(dst_name, (size_t)*dst_namelen))) goto DONE; /* * Call H5Gmove2 function */ - if(H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + if (H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name, H5P_DEFAULT, H5P_DEFAULT) < 0) goto DONE; ret_value = 0; DONE: - if(c_src_name) + if (c_src_name) HDfree(c_src_name); - if(c_dst_name) + if (c_dst_name) HDfree(c_dst_name); return ret_value; } @@ -627,37 +632,37 @@ DONE: * Mingshi Chen * Friday, August 6, 1999 * SOURCE -*/ + */ int_f -h5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, - _fcd value) +h5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _fcd value) /******/ { - char *c_name = NULL; - char *c_value = NULL; - int ret_value = -1; + char *c_name = NULL; + char *c_value = NULL; + int ret_value = -1; /* * Convert Fortran name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) goto DONE; /* * Allocate buffer to hold name of the value */ - if(*size) c_value = (char *)HDmalloc((size_t)*size); - if(c_value == NULL) { - HDfree(c_name); - return ret_value; - } + if (*size) + c_value = (char *)HDmalloc((size_t)*size); + if (c_value == NULL) { + HDfree(c_name); + return ret_value; + } /* * Call H5Lget_val function */ - if(H5Lget_val((hid_t)*loc_id, c_name, c_value, (size_t)*size, H5P_DEFAULT) < 0) - goto DONE; + if (H5Lget_val((hid_t)*loc_id, c_name, c_value, (size_t)*size, H5P_DEFAULT) < 0) + goto DONE; /* * Convert C name to FORTRAN and place it in the given buffer @@ -666,9 +671,9 @@ h5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, ret_value = 0; DONE: - if(c_value) + if (c_value) HDfree(c_value); - if(c_name) + if (c_name) HDfree(c_name); return ret_value; } @@ -692,34 +697,33 @@ DONE: * HISTORY * Elena Pourmal * SOURCE -*/ + */ int_f -h5gset_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, - int_f *commentlen) +h5gset_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, int_f *commentlen) /******/ { char *c_name = NULL, *c_comment = NULL; - int ret_value = -1; + int ret_value = -1; /* * Convert Fortran name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) goto DONE; - if(NULL == (c_comment = (char *)HD5f2cstring(comment, (size_t)*commentlen))) + if (NULL == (c_comment = (char *)HD5f2cstring(comment, (size_t)*commentlen))) goto DONE; /* * Call H5Oset_comment_by_name function */ - if(H5Oset_comment_by_name((hid_t)*loc_id, c_name, c_comment, H5P_DEFAULT) < 0) + if (H5Oset_comment_by_name((hid_t)*loc_id, c_name, c_comment, H5P_DEFAULT) < 0) goto DONE; ret_value = 0; DONE: - if(c_name) + if (c_name) HDfree(c_name); - if(c_comment) + if (c_comment) HDfree(c_comment); return ret_value; } @@ -741,47 +745,46 @@ DONE: * Mingshi Chen * Friday, August 6, 1999 * SOURCE -*/ + */ int_f -h5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, - _fcd comment) +h5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, _fcd comment) /******/ { - char *c_name = NULL, *c_comment = NULL; + char * c_name = NULL, *c_comment = NULL; size_t c_bufsize; - int ret_value = -1; + int ret_value = -1; /* * Convert Fortran name to C name */ - if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) goto DONE; /* * Allocate buffer to hold the comment */ c_bufsize = (size_t)*bufsize; - if(c_bufsize) { - if(NULL == (c_comment = (char *)HDmalloc(c_bufsize + 1))) + if (c_bufsize) { + if (NULL == (c_comment = (char *)HDmalloc(c_bufsize + 1))) goto DONE; } /* end if */ /* * Call H5Oget_comment_by_name function */ - if(H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, c_bufsize, H5P_DEFAULT) < 0) + if (H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, c_bufsize, H5P_DEFAULT) < 0) goto DONE; /* - * Convert C name to FORTRAN and place it in the given buffer - */ + * Convert C name to FORTRAN and place it in the given buffer + */ HD5packFstring(c_comment, _fcdtocp(comment), c_bufsize); ret_value = 0; DONE: - if(c_name) + if (c_name) HDfree(c_name); - if(c_comment) + if (c_comment) HDfree(c_comment); return ret_value; } @@ -805,16 +808,16 @@ DONE: * M. Scot Breitenfeld * February 15, 2008 * SOURCE -*/ + */ int_f h5gcreate_anon_c(hid_t_f *loc_id, hid_t_f *gcpl_id, hid_t_f *gapl_id, hid_t_f *grp_id) /******/ { - int_f ret_value=0; /* Return value */ + int_f ret_value = 0; /* Return value */ - if ((*grp_id = (hid_t_f)H5Gcreate_anon((hid_t)*loc_id,(hid_t)*gcpl_id,(hid_t)*gapl_id)) < 0) - HGOTO_DONE(FAIL); + if ((*grp_id = (hid_t_f)H5Gcreate_anon((hid_t)*loc_id, (hid_t)*gcpl_id, (hid_t)*gapl_id)) < 0) + HGOTO_DONE(FAIL); done: return ret_value; @@ -837,21 +840,20 @@ done: * M. Scot Breitenfeld * February 15, 2008 * SOURCE -*/ + */ int_f -h5gget_create_plist_c(hid_t_f *grp_id, hid_t_f *gcpl_id ) +h5gget_create_plist_c(hid_t_f *grp_id, hid_t_f *gcpl_id) /******/ { - int_f ret_value=0; /* Return value */ + int_f ret_value = 0; /* Return value */ - if ((*gcpl_id = (hid_t_f)H5Gget_create_plist((hid_t)*grp_id)) < 0) - HGOTO_DONE(FAIL); + if ((*gcpl_id = (hid_t_f)H5Gget_create_plist((hid_t)*grp_id)) < 0) + HGOTO_DONE(FAIL); done: return ret_value; } - /****if* H5Gf/h5gget_info_c * NAME * h5gget_info_c @@ -881,34 +883,34 @@ done: * M. Scot Breitenfeld * July 16, 2008 * SOURCE -*/ + */ int_f -h5gget_info_c (hid_t_f *group_id, int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted ) +h5gget_info_c(hid_t_f *group_id, int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted) /******/ { - int_f ret_value = 0; /* Return value */ + int_f ret_value = 0; /* Return value */ H5G_info_t ginfo; - /* - * Call H5Gget_info function. - */ - if(H5Gget_info((hid_t)*group_id,&ginfo) < 0) - HGOTO_DONE(FAIL); + /* + * Call H5Gget_info function. + */ + if (H5Gget_info((hid_t)*group_id, &ginfo) < 0) + HGOTO_DONE(FAIL); /* Unpack the structure */ *storage_type = (int_f)ginfo.storage_type; - *nlinks = (int_f)ginfo.nlinks; - *max_corder = (int_f)ginfo.max_corder; - *mounted = 0; - if(ginfo.mounted) *mounted = 1; + *nlinks = (int_f)ginfo.nlinks; + *max_corder = (int_f)ginfo.max_corder; + *mounted = 0; + if (ginfo.mounted) + *mounted = 1; done: return ret_value; } - /****if* H5Gf/h5gget_info_by_idx_c * NAME * h5gget_info_by_idx_c @@ -945,41 +947,42 @@ done: * M. Scot Breitenfeld * July 16, 2008 * SOURCE -*/ + */ int_f -h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, - int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, - int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted ) +h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *index_type, + int_f *order, hsize_t_f *n, hid_t_f *lapl_id, int_f *storage_type, int_f *nlinks, + int_f *max_corder, int_f *mounted) /******/ { - char *c_group_name = NULL; /* Buffer to hold group name C string */ - int_f ret_value = 0; /* Return value */ - H5G_info_t ginfo; - /* - * Convert FORTRAN name to C name - */ - if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL) - HGOTO_DONE(FAIL); - - /* - * Call H5Gget_info_by_idx function. - */ - if(H5Gget_info_by_idx((hid_t)*loc_id,c_group_name, (H5_index_t)*index_type,(H5_iter_order_t)*order,(hsize_t)*n, - &ginfo, (hid_t)*lapl_id) < 0) - HGOTO_DONE(FAIL); - - /* Unpack the structure */ - - *storage_type = (int_f)ginfo.storage_type; - *nlinks = (int_f)ginfo.nlinks; - *max_corder = (int_f)ginfo.max_corder; - *mounted = 0; - if(ginfo.mounted) *mounted = 1; - - done: - if(c_group_name) - HDfree(c_group_name); - return ret_value; + char * c_group_name = NULL; /* Buffer to hold group name C string */ + int_f ret_value = 0; /* Return value */ + H5G_info_t ginfo; + /* + * Convert FORTRAN name to C name + */ + if ((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Gget_info_by_idx function. + */ + if (H5Gget_info_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, + (hsize_t)*n, &ginfo, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL); + + /* Unpack the structure */ + + *storage_type = (int_f)ginfo.storage_type; + *nlinks = (int_f)ginfo.nlinks; + *max_corder = (int_f)ginfo.max_corder; + *mounted = 0; + if (ginfo.mounted) + *mounted = 1; + +done: + if (c_group_name) + HDfree(c_group_name); + return ret_value; } /****if* H5Gf/h5gget_info_by_name_c @@ -1015,37 +1018,38 @@ h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, * M. Scot Breitenfeld * July 16, 2008 * SOURCE -*/ + */ int_f h5gget_info_by_name_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, hid_t_f *lapl_id, - int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted) + int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted) /******/ { - char *c_group_name = NULL; /* Buffer to hold group name C string */ - int_f ret_value = 0; /* Return value */ - H5G_info_t ginfo; - /* - * Convert FORTRAN name to C name - */ - if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL) - HGOTO_DONE(FAIL); - - /* - * Call H5Gget_info_by_name function. - */ - if(H5Gget_info_by_name((hid_t)*loc_id, c_group_name, &ginfo, (hid_t)*lapl_id) < 0) - HGOTO_DONE(FAIL); - - /* Unpack the structure */ - - *storage_type = (int_f)ginfo.storage_type; - *nlinks = (int_f)ginfo.nlinks; - *max_corder = (int_f)ginfo.max_corder; - *mounted = 0; - if(ginfo.mounted) *mounted = 1; - - done: - if(c_group_name) - HDfree(c_group_name); - return ret_value; + char * c_group_name = NULL; /* Buffer to hold group name C string */ + int_f ret_value = 0; /* Return value */ + H5G_info_t ginfo; + /* + * Convert FORTRAN name to C name + */ + if ((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Gget_info_by_name function. + */ + if (H5Gget_info_by_name((hid_t)*loc_id, c_group_name, &ginfo, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL); + + /* Unpack the structure */ + + *storage_type = (int_f)ginfo.storage_type; + *nlinks = (int_f)ginfo.nlinks; + *max_corder = (int_f)ginfo.max_corder; + *mounted = 0; + if (ginfo.mounted) + *mounted = 1; + +done: + if (c_group_name) + HDfree(c_group_name); + return ret_value; } |