From a09b4eb6a3d3f7eab8bd44ed64a20d21dc39a3af Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 Oct 2019 12:30:07 -0500 Subject: More whitespace changes --- tools/h5dump/h5dump.c | 216 ++++++++++------------------------------- tools/h5repack/h5repack_copy.c | 14 +-- tools/lib/h5tools_str.c | 48 +-------- 3 files changed, 63 insertions(+), 215 deletions(-) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 7c5b3fa..dec1299 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -219,12 +219,6 @@ static struct long_options l_opts[] = { * Purpose: Shutdown MPI & HDF5 and call exit() * * Return: Does not return - * - * Programmer: Quincey Koziol - * Saturday, 31. January 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -397,17 +391,11 @@ usage(const char *prog) /*------------------------------------------------------------------------- - * Function: table_list_add - * - * Purpose: Add a new set of tables + * Function: table_list_add * - * Return: index of added table on success, -1 on failure - * - * Programmer: Neil Fortner, nfortne2@hdfgroup.org - * Adapted from trav_addr_add in h5trav.c by Quincey Koziol - * - * Date: October 13, 2008 + * Purpose: Add a new set of tables * + * Return: index of added table on success, -1 on failure *------------------------------------------------------------------------- */ ssize_t @@ -434,8 +422,7 @@ table_list_add(hid_t oid, unsigned long file_no) table_list.nused--; return -1; } - if(init_objs(oid, &info, &table_list.tables[idx].group_table, - &table_list.tables[idx].dset_table, &table_list.tables[idx].type_table) < 0) { + if(init_objs(oid, &info, &table_list.tables[idx].group_table, &table_list.tables[idx].dset_table, &table_list.tables[idx].type_table) < 0) { H5Idec_ref(oid); table_list.nused--; return -1; @@ -450,17 +437,11 @@ table_list_add(hid_t oid, unsigned long file_no) /*------------------------------------------------------------------------- - * Function: table_list_visited - * - * Purpose: Check if a table already exists for the specified fileno - * - * Return: The index of the matching table, or -1 if no matches found + * Function: table_list_visited * - * Programmer: Neil Fortner, nfortne2@hdfgroup.org - * Adapted from trav_addr_visited in h5trav.c by Quincey Koziol - * - * Date: October 13, 2008 + * Purpose: Check if a table already exists for the specified fileno * + * Return: The index of the matching table, or -1 if no matches found *------------------------------------------------------------------------- */ ssize_t @@ -480,16 +461,11 @@ table_list_visited(unsigned long file_no) /*------------------------------------------------------------------------- - * Function: table_list_free - * - * Purpose: Frees the table list - * - * Return: void - * - * Programmer: Neil Fortner, nfortne2@hdfgroup.org + * Function: table_list_free * - * Date: October 13, 2008 + * Purpose: Frees the table list * + * Return: void *------------------------------------------------------------------------- */ static void @@ -521,16 +497,10 @@ table_list_free(void) /*------------------------------------------------------------------------- * Function: set_binary_form * - * Purpose: set the binary form of output by translating from a string input - * parameter to a integer return value - * - * Return: integer form of binary output or -1 if none found - * - * Programmer: Pedro Vicente Nunes - * June 28, 2006 - * - * Modifications: + * Purpose: set the binary form of output by translating from a string input + * parameter to a integer return value * + * Return: integer form of binary output or -1 if none found *------------------------------------------------------------------------- */ static int @@ -555,17 +525,11 @@ set_binary_form(const char *form) /*------------------------------------------------------------------------- * Function: set_sort_by * - * Purpose: set the "by" form of sorting by translating from a string input - * parameter to a H5_index_t return value - * current sort values are [creation_order | name] - * - * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found - * - * Programmer: Pedro Vicente Nunes - * October 1, 2007 - * - * Modifications: + * Purpose: set the "by" form of sorting by translating from a string input + * parameter to a H5_index_t return value + * current sort values are [creation_order | name] * + * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found *------------------------------------------------------------------------- */ static H5_index_t @@ -584,16 +548,9 @@ set_sort_by(const char *form) /*------------------------------------------------------------------------- * Function: set_sort_order * - * Purpose: set the order of sorting by translating from a string input - * parameter to a H5_iter_order_t return value - * current order values are [ascending | descending ] - * - * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found - * - * Programmer: Pedro Vicente Nunes - * October 1, 2007 - * - * Modifications: + * Purpose: set the order of sorting by translating from a string input + * parameter to a H5_iter_order_t return value + * current order values are [ascending | descending ] * *------------------------------------------------------------------------- */ @@ -623,10 +580,6 @@ set_sort_order(const char *form) * either commas (,) or white spaces. * * Return: - * - * Programmer: Bill Wendling - * Tuesday, 6. February 2001 - * *------------------------------------------------------------------------- */ static void @@ -681,12 +634,6 @@ parse_hsize_list(const char *h_list, subset_d *d) * * Return: Success: struct subset_t object * Failure: NULL - * - * Programmer: Bill Wendling - * Tuesday, 6. February 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ static struct subset_t * @@ -704,21 +651,24 @@ parse_subset_params(char *dset) while (*brace && *brace != ';') brace++; - if (*brace) brace++; + if (*brace) + brace++; parse_hsize_list(brace, &s->stride); while (*brace && *brace != ';') brace++; - if (*brace) brace++; + if (*brace) + brace++; parse_hsize_list(brace, &s->count); while (*brace && *brace != ';') brace++; - if (*brace) brace++; + if (*brace) + brace++; parse_hsize_list(brace, &s->block); } @@ -734,9 +684,7 @@ parse_subset_params(char *dset) * should be at the start of the list you want to parse. * * Return: Success: SUCCEED - * * Failure: FAIL - * *------------------------------------------------------------------------- */ static int @@ -855,12 +803,6 @@ parse_mask_list(const char *h_list) * to free * * Return: Nothing - * - * Programmer: Bill Wendling - * Tuesday, 20. February 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -903,15 +845,7 @@ free_handler(struct handler_t *hand, int len) * Return: Success: A pointer to an array of handler_t structures. * These contain all the information needed to dump * the necessary object. - * * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: Bill Wendling - * Tuesday, 20. February 2001 - * - * Modifications: - * pvn June, 1, 2006. Add a switch for binary output - * *------------------------------------------------------------------------- */ static struct handler_t * @@ -1314,14 +1248,11 @@ end_collect: char *s3_cred_string = NULL; const char *ccred[3]; unsigned nelems = 0; - if ( FAIL == - parse_tuple(opt_arg, ',', - &s3_cred_string, &nelems, &s3_cred)) - { + if (FAIL == parse_tuple(opt_arg, ',', &s3_cred_string, &nelems, &s3_cred)) { error_msg("unable to parse malformed s3 credentials\n"); usage(h5tools_getprogname()); free_handler(hand, argc); - hand= NULL; + hand = NULL; h5tools_setstatus(EXIT_FAILURE); goto done; } @@ -1329,7 +1260,7 @@ end_collect: error_msg("s3 credentials expects 3 elements\n"); usage(h5tools_getprogname()); free_handler(hand, argc); - hand= NULL; + hand = NULL; h5tools_setstatus(EXIT_FAILURE); goto done; } @@ -1340,7 +1271,7 @@ end_collect: error_msg("Invalid S3 credentials\n"); usage(h5tools_getprogname()); free_handler(hand, argc); - hand= NULL; + hand = NULL; h5tools_setstatus(EXIT_FAILURE); goto done; } @@ -1356,19 +1287,12 @@ end_collect: goto error; #else { - /* read hdfs properties tuple and store values in `hdfs_fa` - */ + /* read hdfs properties tuple and store values in `hdfs_fa` */ unsigned nelems = 0; char *props_src = NULL; char **props = NULL; unsigned long k = 0; - if (FAIL == parse_tuple( - (const char *)opt_arg, - ',', - &props_src, - &nelems, - &props)) - { + if (FAIL == parse_tuple((const char *)opt_arg, ',', &props_src, &nelems, &props)) { error_msg("unable to parse hdfs properties tuple\n"); goto error; } @@ -1384,11 +1308,9 @@ end_collect: * strings... Silent overflow is possible, albeit * unlikely. */ - if (strncmp(props[0], "", 1)) { - HDstrncpy(hdfs_fa.namenode_name, - (const char *)props[0], - HDstrlen(props[0])); - } + if (strncmp(props[0], "", 1)) + HDstrncpy(hdfs_fa.namenode_name, (const char *)props[0], HDstrlen(props[0])); + if (strncmp(props[1], "", 1)) { k = strtoul((const char *)props[1], NULL, 0); if (errno == ERANGE) { @@ -1397,16 +1319,12 @@ end_collect: } hdfs_fa.namenode_port = (int32_t)k; } - if (strncmp(props[2], "", 1)) { - HDstrncpy(hdfs_fa.kerberos_ticket_cache, - (const char *)props[2], - HDstrlen(props[2])); - } - if (strncmp(props[3], "", 1)) { - HDstrncpy(hdfs_fa.user_name, - (const char *)props[3], - HDstrlen(props[3])); - } + if (strncmp(props[2], "", 1)) + HDstrncpy(hdfs_fa.kerberos_ticket_cache, (const char *)props[2], HDstrlen(props[2])); + + if (strncmp(props[3], "", 1)) + HDstrncpy(hdfs_fa.user_name, (const char *)props[3], HDstrlen(props[3])); + if (strncmp(props[4], "", 1)) { k = strtoul((const char *)props[4], NULL, 0); if (errno == ERANGE) { @@ -1456,36 +1374,6 @@ error: * * Return: Success: 0 * Failure: 1 - * - * Programmer: Ruey-Hsia Li - * - * Modifications: - * Albert Cheng - * 30. September 2000 - * Add the -o option--output file for datasets raw data - * - * REMcG - * November 2000 - * Changes to support XML. - * - * Bill Wendling - * Wednesday, 10. January 2001 - * Modified the way command line parameters are interpreted. They go - * through one function call now (get_option). - * - * Bill Wendling - * Tuesday, 20. February 2001 - * Moved command line parsing to separate function. Made various - * "display_*" flags global. - * - * REMcG - * August 2003 - * Major upgrade to XML support. - * - * Pedro Vicente - * September 2007 - * list objects in requested order (creation order or alphabetically) - * *------------------------------------------------------------------------- */ int @@ -1539,8 +1427,7 @@ main(int argc, const char *argv[]) /* Check for conflicting options */ if (doxml) { if (!display_all) { - error_msg("option \"%s\" not available for XML\n", - "to display selected objects"); + error_msg("option \"%s\" not available for XML\n", "to display selected objects"); h5tools_setstatus(EXIT_FAILURE); goto done; } @@ -1591,7 +1478,8 @@ main(int argc, const char *argv[]) #else conf_fa = (void *)&ros3_fa; #endif /* H5_HAVE_ROS3_VFD */ - } else if (!HDstrcmp(driver, "hdfs")) { + } + else if (!HDstrcmp(driver, "hdfs")) { #ifndef H5_HAVE_LIBHDFS error_msg("HDFS VFD is not enabled.\n"); h5tools_setstatus(EXIT_FAILURE); @@ -1608,11 +1496,9 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_FAILURE); goto done; } - if (0 == h5tools_set_configured_fapl( - fapl_id, - driver, /* guaranteed "ros3" or "hdfs" */ - conf_fa)) /* appropriate to driver */ - { + /* driver guaranteed "ros3" or "hdfs" */ + /* conf_fa appropriate to driver */ + if (0 == h5tools_set_configured_fapl(fapl_id, driver, conf_fa)) { error_msg("unable to set fapl\n"); h5tools_setstatus(EXIT_FAILURE); goto done; @@ -1625,7 +1511,7 @@ main(int argc, const char *argv[]) if (fapl_id != H5P_DEFAULT) { fid = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); - } + } else { fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); } @@ -1700,8 +1586,7 @@ main(int argc, const char *argv[]) /* alternative first element, depending on schema or DTD. */ if (useschema) { if (HDstrcmp(xmlnsprefix,"") == 0) { - PRINTSTREAM(rawoutstream, "\n", - xml_dtd_uri); + PRINTSTREAM(rawoutstream, "\n", xml_dtd_uri); } else { /* TO DO: make -url option work in this case (may need new option) */ @@ -1710,7 +1595,8 @@ main(int argc, const char *argv[]) ns = HDstrdup(xmlnsprefix); indx = HDstrrchr(ns,(int)':'); - if (indx) *indx = '\0'; + if (indx) + *indx = '\0'; PRINTSTREAM(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\" " "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index cdee6eb..85b3081 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -51,7 +51,7 @@ * local functions *------------------------------------------------------------------------- */ -static int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], +static int get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr); static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, @@ -337,7 +337,7 @@ done: } /* end copy_objects() */ /*------------------------------------------------------------------------- - * Function: Get_hyperslab + * Function: get_hyperslab * * Purpose: Calulate a hyperslab from a dataset for higher performance. * The size of hyperslab is limitted by H5TOOLS_BUFSIZE. @@ -369,7 +369,7 @@ done: *-----------------------------------------*/ int -Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], +get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) { int ret_value = 0; @@ -490,7 +490,7 @@ Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], done: return ret_value; -} /* end Get_hyperslab() */ +} /* end get_hyperslab() */ /*------------------------------------------------------------------------- * Function: do_copy_objects @@ -538,7 +538,7 @@ done: * in (2) is that, when using the strip mine size, it assures that the "remaining" part * of the dataset that does not fill an entire strip mine is processed. * - * 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()). + * 1. figure out a hyperslab (dimentions) and size (refer to get_hyperslab()). * 2. Calculate the hyperslab selections as the selection is moving forward. * Selection would be same as the hyperslab except for the remaining edge portion * of the dataset. The code take care of the remaining portion if exist. @@ -935,8 +935,8 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, } /* get hyperslab dims and size in byte */ - if (Get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Get_hyperslab failed"); + if (get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "get_hyperslab failed"); hslab_buf = HDmalloc((size_t)hslab_nbytes); if (hslab_buf == NULL) diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 794a3d3..27c2fb3 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -587,48 +587,10 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, /*------------------------------------------------------------------------- * Function: h5tools_str_sprint * - * Purpose: Renders the value pointed to by VP of type TYPE into variable - * length string STR. - * - * Return: A pointer to memory containing the result or NULL on error. - * - * Programmer: Robb Matzke - * Thursday, July 23, 1998 - * - * Modifications: - * Robb Matzke, 1999-04-26 - * Made this function safe from overflow problems by allowing it - * to reallocate the output string. - * - * Robb Matzke, 1999-06-04 - * Added support for object references. The new `container' - * argument is the dataset where the reference came from. - * - * Robb Matzke, 1999-06-07 - * Added support for printing raw data. If info->raw is non-zero - * then data is printed in hexadecimal format. - * - * Robb Matzke, 2003-01-10 - * Binary output format is dd:dd:... instead of 0xdddd... so it - * doesn't look like a hexadecimal integer, and thus users will - * be less likely to complain that HDF5 didn't properly byte - * swap their data during type conversion. - * - * Robb Matzke, LLNL, 2003-06-05 - * If TYPE is a variable length string then the pointer to - * the value to pring (VP) is a pointer to a `char*'. - * - * PVN, 28 March 2006 - * added H5T_NATIVE_LDOUBLE case - * - * Raymond Lu, 2011-09-01 - * CLANG compiler complained about the line (about 800): - * tempint = (tempint >> packed_data_offset) & packed_data_mask; - * The right shift may cause undefined behavior if PACKED_DATA_OFFSET is - * 32-bit or more. For every kind of native integers, I changed the code - * to make it zero if PACKED_DATA_OFFSET is greater than or equal to the - * size of integer. + * Purpose: Renders the value pointed to by VP of type TYPE into variable + * length string STR. * + * Return: A pointer to memory containing the result or NULL on error. *------------------------------------------------------------------------- */ char * @@ -640,8 +602,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai char *name = NULL; unsigned char *ucp_vp = (unsigned char *)vp; char *cp_vp = (char *)vp; - hid_t memb = -1; - hid_t obj = -1; + hid_t memb = H5I_INVALID_HID; + hid_t obj = H5I_INVALID_HID; static char fmt_llong[8], fmt_ullong[8]; H5T_str_t pad; H5T_class_t type_class; -- cgit v0.12