summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-10-03 18:04:43 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-10-03 18:04:43 (GMT)
commit1fee0ce58dd6eaabfaee16a36f46a28d80552bd8 (patch)
tree9a60ad9a5ab1e4ae8a955056b09152ab18d279c1
parent5152a39cb914dddda986e51c7db8b3f0375a7c22 (diff)
parenta09b4eb6a3d3f7eab8bd44ed64a20d21dc39a3af (diff)
downloadhdf5-1fee0ce58dd6eaabfaee16a36f46a28d80552bd8.zip
hdf5-1fee0ce58dd6eaabfaee16a36f46a28d80552bd8.tar.gz
hdf5-1fee0ce58dd6eaabfaee16a36f46a28d80552bd8.tar.bz2
Merge pull request #1982 in HDFFV/hdf5 from ~BYRN/hdf5_adb:hdf5_1_8 to hdf5_1_8
* commit 'a09b4eb6a3d3f7eab8bd44ed64a20d21dc39a3af': More whitespace changes Whitespace cleanup
-rw-r--r--tools/h5dump/h5dump.c216
-rw-r--r--tools/h5ls/h5ls.c316
-rw-r--r--tools/h5repack/h5repack_copy.c14
-rw-r--r--tools/lib/h5tools_str.c48
4 files changed, 220 insertions, 374 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: <none>
- *
- * 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, "<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) */
@@ -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/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index fe58610..b0b42fa 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -241,12 +241,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
@@ -287,7 +287,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 ' ':
@@ -321,17 +322,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 */
@@ -363,12 +363,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
@@ -515,7 +515,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;
@@ -523,12 +524,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
@@ -554,13 +555,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
@@ -637,15 +638,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
@@ -704,12 +705,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
@@ -809,18 +810,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 */
@@ -854,12 +855,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
@@ -971,12 +972,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
@@ -1066,12 +1067,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
@@ -1095,12 +1096,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
@@ -1191,19 +1192,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;
@@ -1233,16 +1234,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
@@ -1285,11 +1286,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
@@ -1298,7 +1299,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;
@@ -1408,22 +1409,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;
@@ -1587,15 +1588,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
@@ -1603,13 +1604,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));
@@ -1647,13 +1648,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
@@ -1678,8 +1679,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;
@@ -1784,7 +1785,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);
}
@@ -1832,20 +1833,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;
@@ -1867,12 +1868,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
@@ -1880,7 +1881,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;
@@ -1916,7 +1917,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.
@@ -2028,11 +2029,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;
@@ -2200,21 +2201,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;
@@ -2275,21 +2275,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
@@ -2348,13 +2348,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)
@@ -2379,11 +2378,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
@@ -2396,18 +2395,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;
@@ -2565,14 +2564,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];
@@ -2580,8 +2580,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);
@@ -2633,7 +2632,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");
}
@@ -2654,8 +2653,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.
@@ -2866,7 +2864,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/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;