diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-10-03 18:04:33 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-10-03 18:04:33 (GMT) |
commit | b8fb6a236e11e16030960a130cb5cbaa21c1037a (patch) | |
tree | 9d8d0ad0b1a7c463ac874cd7b2cda194dea6ab1b | |
parent | f9eb3361bbed3b3f0f2150d36334d6ae5d970388 (diff) | |
parent | 6ad577053e110e4c28b1d2ac6fb68bf29d3f93b9 (diff) | |
download | hdf5-b8fb6a236e11e16030960a130cb5cbaa21c1037a.zip hdf5-b8fb6a236e11e16030960a130cb5cbaa21c1037a.tar.gz hdf5-b8fb6a236e11e16030960a130cb5cbaa21c1037a.tar.bz2 |
Merge pull request #1979 in HDFFV/hdf5 from ~BYRN/hdf5_adb:hdf5_1_10 to hdf5_1_10
* commit '6ad577053e110e4c28b1d2ac6fb68bf29d3f93b9':
More whitespace changes
Whitespace cleanup
Remove incorrect text
Remove duplicate file names
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 51 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump.c | 217 | ||||
-rw-r--r-- | tools/src/h5ls/h5ls.c | 316 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 3 |
5 files changed, 215 insertions, 374 deletions
@@ -1160,8 +1160,6 @@ ./test/use_disable_mdc_flushes.c ./test/use.h ./test/vfd.c -./test/test_filters_le.h5 -./test/test_filters_be.h5 ./test/gen_filters.c ./test/chunk_info.c ./test/vds.c diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 17e3f18..b597e5a 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -662,51 +662,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 - * - * Vailin Choi; August 2010 - * Modified to handle printing of selected compound fields for h5watch. - * - * 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 * @@ -718,8 +677,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; diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 0579f63..19ed013 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -221,12 +221,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 @@ -401,17 +395,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 @@ -438,8 +426,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; @@ -454,17 +441,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 *------------------------------------------------------------------------- */ H5_ATTR_PURE ssize_t @@ -484,16 +465,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 @@ -525,16 +501,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 @@ -559,17 +529,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 @@ -588,17 +552,11 @@ 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 ] * + * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found *------------------------------------------------------------------------- */ static H5_iter_order_t @@ -627,10 +585,6 @@ set_sort_order(const char *form) * either commas (,) or white spaces. * * Return: <none> - * - * Programmer: Bill Wendling - * Tuesday, 6. February 2001 - * *------------------------------------------------------------------------- */ static void @@ -685,12 +639,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 * @@ -708,21 +656,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); } @@ -738,9 +689,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 @@ -859,12 +808,6 @@ parse_mask_list(const char *h_list) * to free * * Return: Nothing - * - * Programmer: Bill Wendling - * Tuesday, 20. February 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -907,15 +850,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 * @@ -1328,14 +1263,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; } @@ -1343,7 +1275,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; } @@ -1354,7 +1286,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; } @@ -1370,19 +1302,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; } @@ -1398,11 +1323,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) { @@ -1411,16 +1334,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) { @@ -1470,36 +1389,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 @@ -1553,8 +1442,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; } @@ -1605,7 +1493,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); @@ -1622,11 +1511,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; @@ -1639,7 +1526,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); } @@ -1714,8 +1601,7 @@ main(int argc, const char *argv[]) /* alternative first element, depending on schema or DTD. */ if (useschema) { if (HDstrcmp(xmlnsprefix,"") == 0) { - PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", - xml_dtd_uri); + PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", xml_dtd_uri); } else { /* TO DO: make -url option work in this case (may need new option) */ @@ -1724,7 +1610,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/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 20a68e8..3b0001d 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -242,12 +242,12 @@ usage (void) /*------------------------------------------------------------------------- - * Function: print_string + * Function: print_string * - * Purpose: Print a string value by escaping unusual characters. If - * STREAM is null then we only count how large the output would be. + * Purpose: Print a string value by escaping unusual characters. If + * STREAM is null then we only count how large the output would be. * - * Return: Number of characters printed. + * Return: Number of characters printed. *------------------------------------------------------------------------- */ static int @@ -288,7 +288,8 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) nprint += 2; break; case '\t': - if (buffer) h5tools_str_append(buffer, "\\t"); + if (buffer) + h5tools_str_append(buffer, "\\t"); nprint += 2; break; case ' ': @@ -322,17 +323,16 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) /*------------------------------------------------------------------------- - * Function: print_obj_name + * Function: print_obj_name * - * Purpose: Print an object name and another string. + * Purpose: Print an object name and another string. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static int -print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, - const char *s) +print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, const char *s) { static char fullname[NAME_BUF_SIZE]; /* Buffer for file and/or object name */ const char *name = fullname; /* Pointer to buffer for printing */ @@ -364,12 +364,12 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, /*------------------------------------------------------------------------- - * Function: print_native_type + * Function: print_native_type * - * Purpose: Prints the name of a native C data type. + * Purpose: Prints the name of a native C data type. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed. + * Return: Success: TRUE + * Failure: FALSE, nothing printed. *------------------------------------------------------------------------- */ static hbool_t @@ -516,7 +516,8 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind) else { return print_int_type(buffer, type, ind); } - } else { + } + else { return print_int_type(buffer, type, ind); } return TRUE; @@ -524,12 +525,12 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: print_ieee_type + * Function: print_ieee_type * - * Purpose: Print the name of an IEEE floating-point data type. + * Purpose: Print the name of an IEEE floating-point data type. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -555,13 +556,13 @@ print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: print_precision + * Function: print_precision * - * Purpose: Prints information on the next line about precision and - * padding if the precision is less than the total data type - * size. + * Purpose: Prints information on the next line about precision and + * padding if the precision is less than the total data type + * size. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -638,15 +639,15 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: print_int_type + * Function: print_int_type * - * Purpose: Print the name of an integer data type. Common information - * like number of bits, byte order, and sign scheme appear on - * the first line. Additional information might appear in - * parentheses on the following lines. + * Purpose: Print the name of an integer data type. Common information + * like number of bits, byte order, and sign scheme appear on + * the first line. Additional information might appear in + * parentheses on the following lines. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -705,12 +706,12 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: print_float_type + * Function: print_float_type * - * Purpose: Print info about a floating point data type. + * Purpose: Print info about a floating point data type. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -810,18 +811,18 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: print_cmpd_type + * Function: print_cmpd_type * - * Purpose: Print info about a compound data type. + * Purpose: Print info about a compound data type. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind) { - char *name=NULL; /* member name */ + char *name = NULL; /* member name */ size_t size; /* total size of type in bytes */ hid_t subtype; /* member data type */ int nmembs; /* number of members */ @@ -855,12 +856,12 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: print_enum_type + * Function: print_enum_type * - * Purpose: Print info about an enumeration data type. + * Purpose: Print info about an enumeration data type. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -972,12 +973,12 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: print_string_type + * Function: print_string_type * - * Purpose: Print information about a string data type. + * Purpose: Print information about a string data type. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -1067,12 +1068,12 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) /*------------------------------------------------------------------------- - * Function: print_reference_type + * Function: print_reference_type * - * Purpose: Prints information about a reference data type. + * Purpose: Prints information about a reference data type. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -1096,12 +1097,12 @@ print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) /*------------------------------------------------------------------------- - * Function: print_opaque_type + * Function: print_opaque_type * - * Purpose: Prints information about an opaque data type. + * Purpose: Prints information about an opaque data type. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -1192,19 +1193,19 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: print_bitfield_type + * Function: print_bitfield_type * - * Purpose: Print information about a bitfield type. + * Purpose: Print information about a bitfield type. * - * Return: Success: TRUE - * Failure: FALSE, nothing printed + * Return: Success: TRUE + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind) { - H5T_order_t order; /* byte order value */ - const char *order_s=NULL; /* byte order string */ + H5T_order_t order; /* byte order value */ + const char *order_s = NULL; /* byte order string */ if (H5T_BITFIELD != H5Tget_class(type)) return FALSE; @@ -1234,16 +1235,16 @@ print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: print_type + * Function: print_type * - * Purpose: Prints a data type definition. The definition is printed - * without any leading space or trailing line-feed (although - * there might be line-feeds inside the type definition). The - * first line is assumed to have IND characters before it on - * the same line (printed by the caller). - * Prints the OID of shared data types. + * Purpose: Prints a data type definition. The definition is printed + * without any leading space or trailing line-feed (although + * there might be line-feeds inside the type definition). The + * first line is assumed to have IND characters before it on + * the same line (printed by the caller). + * Prints the OID of shared data types. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -1286,11 +1287,11 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) /*------------------------------------------------------------------------- - * Function: dump_dataset_values + * Function: dump_dataset_values * - * Purpose: Prints all values of a dataset. + * Purpose: Prints all values of a dataset. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -1299,7 +1300,7 @@ dump_dataset_values(hid_t dset) char string_prefix[64]; static char fmt_double[16]; static char fmt_float[16]; - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t outputformat; @@ -1409,22 +1410,22 @@ dump_dataset_values(hid_t dset) /*------------------------------------------------------------------------- - * Function: list_attr + * Function: list_attr * - * Purpose: Prints information about attributes. + * Purpose: Prints information about attributes. * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void H5_ATTR_UNUSED *op_data) { - hid_t attr = -1; - hid_t space = -1; - hid_t type = -1; - hid_t p_type = -1; + hid_t attr = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t type = H5I_INVALID_HID; + hid_t p_type = H5I_INVALID_HID; hsize_t size[H5S_MAX_RANK]; hsize_t nelmts = 1; hsize_t temp_need; @@ -1588,15 +1589,15 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain /*------------------------------------------------------------------------- - * Function: dataset_list1 + * Function: dataset_list1 * - * Purpose: List information about a dataset which should appear on the - * same line as the dataset name. This information will precede - * information which is applicable to all objects which will be - * printed by the caller. + * Purpose: List information about a dataset which should appear on the + * same line as the dataset name. This information will precede + * information which is applicable to all objects which will be + * printed by the caller. * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -1604,13 +1605,13 @@ dataset_list1(hid_t dset) { hsize_t cur_size[H5S_MAX_RANK]; /* current dataset dimensions */ hsize_t max_size[H5S_MAX_RANK]; /* maximum dataset dimensions */ - hid_t space; /* data space */ - int ndims; /* dimensionality */ - H5S_class_t space_type; /* type of dataspace */ - int i; - hsize_t curr_pos = 0; /* total data element position */ - h5tools_str_t buffer; /* string into which to render */ - h5tools_context_t ctx; /* print context */ + hid_t space; /* data space */ + int ndims; /* dimensionality */ + H5S_class_t space_type; /* type of dataspace */ + int i; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; HDmemset(&ctx, 0, sizeof(ctx)); @@ -1648,13 +1649,13 @@ dataset_list1(hid_t dset) /*------------------------------------------------------------------------- - * Function: dataset_list2 + * Function: dataset_list2 * - * Purpose: List information about a dataset which should appear after - * information which is general to all objects. + * Purpose: List information about a dataset which should appear after + * information which is general to all objects. * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -1679,8 +1680,8 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) double utilization; /* percent utilization of storage */ H5T_class_t tclass; /* datatype class identifier */ int i; - H5D_layout_t stl; - hsize_t curr_pos = 0; /* total data element position */ + H5D_layout_t stl; + hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; @@ -1813,7 +1814,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) case H5T_NCLASSES: default: h5tools_str_append(&buffer, HSIZE_T_FORMAT" logical byte%s, "HSIZE_T_FORMAT" allocated byte%s", total, 1==total?"":"s", used, 1==used?"":"s"); - if (used>0) { + if (used > 0) { utilization = ((double)total * (double)100.0f) / (double)used; h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization); } @@ -1861,20 +1862,20 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) /*------------------------------------------------------------------------- - * Function: datatype_list2 + * Function: datatype_list2 * - * Purpose: List information about a datatype which should appear after - * information which is general to all objects. + * Purpose: List information about a datatype which should appear after + * information which is general to all objects. * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name) { if (verbose_g > 0) { - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; @@ -1896,12 +1897,12 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name) /*------------------------------------------------------------------------- - * Function: list_obj + * Function: list_obj * - * Purpose: Prints information about an object + * Purpose: Prints information about an object * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -1909,7 +1910,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void { H5O_type_t obj_type = oinfo->type; /* Type of the object */ iter_t *iter = (iter_t*)_iter; - hsize_t curr_pos = 0; /* total data element position */ + hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; @@ -1945,7 +1946,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } /* end if */ else { - hid_t obj = (-1); /* ID of object opened */ + hid_t obj = H5I_INVALID_HID; /* ID of object opened */ /* Open the object. Not all objects can be opened. If this is the case * then return right away. @@ -2057,11 +2058,11 @@ done: static herr_t list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) { - char *buf=NULL; + char *buf = NULL; iter_t *iter = (iter_t*)_iter; - int ret; - hsize_t curr_pos = 0; /* total data element position */ - h5tool_link_info_t lnk_info; + int ret; + hsize_t curr_pos = 0; /* total data element position */ + h5tool_link_info_t lnk_info; h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; @@ -2229,21 +2230,20 @@ done: /*------------------------------------------------------------------------- - * Function: visit_obj + * Function: visit_obj * - * Purpose: Begins iteration on an object + * Purpose: Begins iteration on an object * - * Return: - * Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter) { - int retval = 0; - H5O_info_t oi; /* Information for object */ - hsize_t curr_pos = 0; /* total data element position */ + int retval = 0; + H5O_info_t oi; /* Information for object */ + hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; @@ -2304,21 +2304,21 @@ done: /*------------------------------------------------------------------------- - * Function: get_width + * Function: get_width * - * Purpose: Figure out how wide the screen is. This is highly - * unportable, but the user can always override the width we - * detect by giving a command-line option. These code snippets - * were borrowed from the GNU less(1). + * Purpose: Figure out how wide the screen is. This is highly + * unportable, but the user can always override the width we + * detect by giving a command-line option. These code snippets + * were borrowed from the GNU less(1). * - * Return: Success: Number of columns. - * Failure: Some default number of columms. + * Return: Success: Number of columns. + * Failure: Some default number of columms. *------------------------------------------------------------------------- */ static int get_width(void) { - int width = 80; /*the default */ + int width = 80; /*the default */ char *s; /* Try to get it from the COLUMNS environment variable first since it's @@ -2377,13 +2377,12 @@ get_width(void) } /*------------------------------------------------------------------------- - * Function: is_valid_args + * Function: is_valid_args * - * Purpose: check if command line arguments are valid + * Purpose: check if command line arguments are valid * - * Return: - * Success: TRUE (1) - * Failure: FALSE (0) + * Return: Success: TRUE (1) + * Failure: FALSE (0) *-------------------------------------------------------------------------*/ static hbool_t is_valid_args(void) @@ -2408,11 +2407,11 @@ out: /*------------------------------------------------------------------------- - * Function: leave + * Function: leave * - * Purpose: Close HDF5 and MPI and call exit() + * Purpose: Close HDF5 and MPI and call exit() * - * Return: Does not return + * Return: Does not return *------------------------------------------------------------------------- */ static void @@ -2425,18 +2424,18 @@ leave(int ret) /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Opens a file and lists the specified group + * Purpose: Opens a file and lists the specified group * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 *------------------------------------------------------------------------- */ int main(int argc, const char *argv[]) { - hid_t file = -1; + hid_t file = H5I_INVALID_HID; char *fname = NULL, *oname = NULL, *x; const char *s = NULL; char *rest; @@ -2594,14 +2593,15 @@ main(int argc, const char *argv[]) leave(EXIT_FAILURE); } - } else if (!HDstrncmp(argv[argno], "--s3-cred=", (size_t)10)) { + } + else if (!HDstrncmp(argv[argno], "--s3-cred=", (size_t)10)) { #ifndef H5_HAVE_ROS3_VFD HDfprintf(rawerrorstream, "Error: Read-Only S3 VFD is not enabled\n\n"); usage(); leave(EXIT_FAILURE); #else - unsigned nelems = 0; - char *start = NULL; + unsigned nelems = 0; + char *start = NULL; char *s3cred_src = NULL; char **s3cred = NULL; char const *ccred[3]; @@ -2609,8 +2609,7 @@ main(int argc, const char *argv[]) */ start = strchr(argv[argno], '='); if (start == NULL) { - HDfprintf(rawerrorstream, - "Error: Unable to parse null credentials tuple\n" + HDfprintf(rawerrorstream, "Error: Unable to parse null credentials tuple\n" " For anonymous access, omit \"--s3-cred\" and use only \"--vfd=ros3\"\n\n"); usage(); leave(EXIT_FAILURE); @@ -2662,7 +2661,7 @@ main(int argc, const char *argv[]) } start = argv[argno]+13; /* should never segfault: worst case of */ if (*start != '(') { /* null-termintor after '='. */ - + if (_debug) { HDfprintf(stderr, " no tuple.\n"); } @@ -2683,8 +2682,7 @@ main(int argc, const char *argv[]) leave(EXIT_FAILURE); } if (_debug) { - HDfprintf(stderr, " got hdfs-attrs tuple: `(%s,%s,%s,%s,%s)`\n", - props[0], props[1], props[2], props[3], props[4]); + HDfprintf(stderr, " got hdfs-attrs tuple: `(%s,%s,%s,%s,%s)`\n", props[0], props[1], props[2], props[3], props[4]); } /* Populate fapl configuration structure with given properties. @@ -2895,7 +2893,7 @@ main(int argc, const char *argv[]) while (fname && *fname) { if (fapl_id != H5P_DEFAULT) { file = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); - } + } else { file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername); } diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index df8c7ef..b4e1985 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -138,8 +138,7 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct\n"); PRINTVALSTREAM(rawoutstream, " 1: This is H5F_LIBVER_V18 in H5F_libver_t struct\n"); PRINTVALSTREAM(rawoutstream, " 2: This is H5F_LIBVER_V110 in H5F_libver_t struct\n"); - PRINTVALSTREAM(rawoutstream, " 3: This is H5F_LIBVER_V112 in H5F_libver_t struct\n"); - PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V112 for this release\n"); + PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " FS_STRATEGY is a string indicating the file space strategy used:\n"); PRINTVALSTREAM(rawoutstream, " FSM_AGGR:\n"); |