summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/lib/h5tools_str.c51
-rw-r--r--tools/src/h5dump/h5dump.c217
2 files changed, 57 insertions, 211 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 5921609..c5759d8 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\" "